Skip to content

Clu #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 10, 2015
Merged

Clu #237

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Azure PowerShell specific
src/Publish/
src/Package/
drop/

obj
TestResults
Expand Down
6 changes: 6 additions & 0 deletions src/CLU/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="local" value="../../tools/LocalFeed" />
</packageSources>
</configuration>
67 changes: 67 additions & 0 deletions tools/CLU/BuildDrop.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
param([string]$dropLocation, [string]$packageVersion="0.0.1", [switch] $excludeCommandPackages, [switch] $excludeCluRun)

$thisScriptDirectory = Split-Path $MyInvocation.MyCommand.Path -Parent

$workspaceDirectory = $env:WORKSPACE
if (!($workspaceDirectory))
{
$workspaceDirectory = (Resolve-Path "$thisScriptDirectory\..\..").Path
$env:WORKSPACE = $workspaceDirectory
}

$buildProfileScriptPath = "`"$thisScriptDirectory\BuildProfile.ps1`"" # Guard against spaces in the path
$sourcesRoot = "$workspaceDirectory\src\clu"

if (!($dropLocation))
{
$dropLocation = "$workspaceDirectory\drop"
}

if (!(Test-Path -Path $dropLocation -PathType Container))
{
mkdir "$dropLocation"
mkdir "$dropLocation\CommandRepo"
mkdir "$dropLocation\clurun"
}



if (!($excludeCommandPackages.IsPresent))
{
# Grap all command packages to build.
# 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
$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)} }

foreach($commandPackage in $commandPackages)
{
$commandPackageName = $commandPackage.Package
$commandPackageDir = $commandPackage.Directory
$buildOutputDirectory = Join-Path -path $commandPackageDir -ChildPath "bin\Debug\publish"


Invoke-Expression "& $buildProfileScriptPath $commandPackageDir $commandPackageName $buildOutputDirectory $packageVersion $dropLocation\CommandRepo"
}
}

if (!($excludeCluRun))
{
foreach ($runtime in @("win7-x64", "osx.10.10-x64", "ubuntu.14.04-x64"))
{
$cluRunOutput = "$dropLocation\clurun\$runtime"
dotnet publish "$sourcesRoot\clurun" --framework dnxcore50 --runtime $runtime --output $cluRunOutput

if (!($runtime.StartsWith("win")))
{
# Fix current x-plat dotnet publish by correctly renaming ConsoleHost to clurun
Move-Item -Path "$cluRunOutput\coreconsole" -Destination "$cluRunOutput\clurun" -Force

# Remove all extra exes that end up in the output directory...
Get-ChildItem -Path "$cluRunOutput" -Filter "*.exe" | Remove-Item
}
else
{
# Remove all extra exes that end up in the output directory...
Get-Childitem -path "$cluRunOutput" -Filter *.exe | Where-Object -Property "Name" -Value "clurun.exe" -NotMatch | Remove-Item
}
}
}
4 changes: 3 additions & 1 deletion tools/CLU/BuildProfile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ if ([string]::IsNullOrWhiteSpace($env:WORKSPACE) -or !(Test-Path $env:WORKSPACE)
$packageSource = $packageSource.TrimEnd('\\')
Write-Host "using package id: $packageId, package source: $packageSource, packageVersion: $packageVersion"
dotnet publish $cmdletsDir -f dnxcore50 -r win7-x64 -o $packageSource
$nuSpecTemplate = (Get-ChildItem ([System.IO.Path]::Combine($packageSource, ($packageId + ".nuspec.template"))))
Copy-Item -Path $cmdletsDir\content -Destination $packageSource\content -Recurse -Force

$nuSpecTemplate = (Get-ChildItem ([System.IO.Path]::Combine($cmdletsDir, ($packageId + ".nuspec.template"))))
$nuSpecOutput = [System.IO.Path]::Combine($packageSource, ($packageId + ".nuspec"))
Write-Host "Creating dynamic nuspec package in: $nuSpecOutput"

Expand Down