Skip to content

Commit c4e41e5

Browse files
committed
Merge pull request Azure#237 from Azure/clu
Clu
2 parents e7d5d78 + a4bfb81 commit c4e41e5

File tree

4 files changed

+77
-1
lines changed

4 files changed

+77
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Azure PowerShell specific
22
src/Publish/
33
src/Package/
4+
drop/
45

56
obj
67
TestResults

src/CLU/NuGet.Config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="local" value="../../tools/LocalFeed" />
5+
</packageSources>
6+
</configuration>

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)