Skip to content

Commit e797326

Browse files
committed
Update version of dotnet.exe used to build. This required minor tweaks to BuildProfile as the behavior for which file end up in the published output has changed (the content directory and nuspec files were no longer included in the published output)
Add a BuildDrop.ps1 file that will do a build and local publish of clurun for osx, linux/ubuntu and win7 along with any command packages in the repo.
1 parent 7ccb995 commit e797326

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

tools/CLU/BuildDrop.ps1

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
param([string]$dropLocation, [string]$packageVersion="0.0.1", [switch] $excludeCommandPackages, [switch] $excludeCluRun)
2+
3+
$thisScriptDirectory = Split-Path $MyInvocation.MyCommand.Path -Parent
4+
5+
$workspaceDirectory = $env:WORKSPACE
6+
if (!($workspaceDirectory))
7+
{
8+
$workspaceDirectory = (Resolve-Path "$thisScriptDirectory\..\..").Path
9+
$env:WORKSPACE = $workspaceDirectory
10+
}
11+
12+
$buildProfileScriptPath = "`"$thisScriptDirectory\BuildProfile.ps1`"" # Guard against spaces in the path
13+
$sourcesRoot = "$workspaceDirectory\src\clu"
14+
15+
if (!($dropLocation))
16+
{
17+
$dropLocation = "$workspaceDirectory\drop"
18+
}
19+
20+
if (!(Test-Path -Path $dropLocation -PathType Container))
21+
{
22+
mkdir "$dropLocation"
23+
mkdir "$dropLocation\CommandRepo"
24+
mkdir "$dropLocation\clurun"
25+
}
26+
27+
28+
29+
if (!($excludeCommandPackages.IsPresent))
30+
{
31+
# Grap all command packages to build.
32+
# We'll assume that all directories that contain a *.nuspec.template file is a command package and that the name of the package is everything leading up to .nuspec.template
33+
$commandPackages = Get-ChildItem -path $sourcesRoot -Filter '*.nuspec.template' -Recurse -File | ForEach-Object { New-Object PSObject -Property @{Directory=$_.DirectoryName; Package=$_.Name.Substring(0, $_.Name.Length - ".nuspec.template".Length)} }
34+
35+
foreach($commandPackage in $commandPackages)
36+
{
37+
$commandPackageName = $commandPackage.Package
38+
$commandPackageDir = $commandPackage.Directory
39+
$buildOutputDirectory = Join-Path -path $commandPackageDir -ChildPath "bin\Debug\publish"
40+
41+
42+
Invoke-Expression "& $buildProfileScriptPath $commandPackageDir $commandPackageName $buildOutputDirectory $packageVersion $dropLocation\CommandRepo"
43+
}
44+
}
45+
46+
if (!($excludeCluRun))
47+
{
48+
foreach ($runtime in @("win7-x64", "osx.10.10-x64", "ubuntu.14.04-x64"))
49+
{
50+
$cluRunOutput = "$dropLocation\clurun\$runtime"
51+
dotnet publish "$sourcesRoot\clurun" --framework dnxcore50 --runtime $runtime --output $cluRunOutput
52+
53+
if (!($runtime.StartsWith("win")))
54+
{
55+
# Fix current x-plat dotnet publish by correctly renaming ConsoleHost to clurun
56+
Move-Item -Path "$cluRunOutput\coreconsole" -Destination "$cluRunOutput\clurun" -Force
57+
58+
# Remove all extra exes that end up in the output directory...
59+
Get-ChildItem -Path "$cluRunOutput" -Filter "*.exe" | Remove-Item
60+
}
61+
else
62+
{
63+
# Remove all extra exes that end up in the output directory...
64+
Get-Childitem -path "$cluRunOutput" -Filter *.exe | Where-Object -Property "Name" -Value "clurun.exe" -NotMatch | Remove-Item
65+
}
66+
}
67+
}

tools/CLU/BuildProfile.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ if ([string]::IsNullOrWhiteSpace($env:WORKSPACE) -or !(Test-Path $env:WORKSPACE)
1717
$packageSource = $packageSource.TrimEnd('\\')
1818
Write-Host "using package id: $packageId, package source: $packageSource, packageVersion: $packageVersion"
1919
dotnet publish $cmdletsDir -f dnxcore50 -r win7-x64 -o $packageSource
20-
$nuSpecTemplate = (Get-ChildItem ([System.IO.Path]::Combine($packageSource, ($packageId + ".nuspec.template"))))
20+
Copy-Item -Path $cmdletsDir\content -Destination $packageSource\content -Recurse -Force
21+
22+
$nuSpecTemplate = (Get-ChildItem ([System.IO.Path]::Combine($cmdletsDir, ($packageId + ".nuspec.template"))))
2123
$nuSpecOutput = [System.IO.Path]::Combine($packageSource, ($packageId + ".nuspec"))
2224
Write-Host "Creating dynamic nuspec package in: $nuSpecOutput"
2325

0 commit comments

Comments
 (0)