-
Notifications
You must be signed in to change notification settings - Fork 1
/
ROOTNuGetPackageBuilders.psm1
36 lines (31 loc) · 1.31 KB
/
ROOTNuGetPackageBuilders.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Get the directory where this script was invoked.
function Get-ScriptDirectory ()
{
Split-Path $ExecutionContext.SessionState.Module.Path
}
# Build a binary nuget package for this particular version of root.
# This pacakge will download or use the locally installed ROOT, and in MSBUILD
# will correctly setup whatever is required for later use.
#
# Should be run in a location that can deal with creating whatever is needed.
#
function New-ROOTNugetPackage ($rootVersion, $nugetVersion)
{
# Get the directory ready for the various nuget files.
$basedir = "$PWD/$rootVersion"
if (Test-Path $basedir) {
Remove-Item -Recurse $basedir
}
$v = New-Item $basedir -ItemType Directory
# Create the targets file, and copy them over to the new directory
$scriptDirectory = Get-ScriptDirectory
$(Get-Content "$scriptDirectory/ROOT.nuget/FullROOT.nuspec") -replace "5.34.20",$rootVersion -replace "534.20",$nugetVersion > "$basedir/FullROOT.nuspec"
$(Get-Content "$scriptDirectory/ROOT.nuget/ROOT.props") -replace "5.34.20",$rootVersion | set-content "$basedir/ROOT.props"
Copy-Item $scriptDirectory/ROOT.nuget/ROOT.targets $basedir/ROOT.targets
# Run nuget.
#cd $basedir
nuget pack $basedir/FullROOT.nuspec
}
# What we will give to the world
Export-ModuleMember New-ROOTNugetPackage