diff --git a/.gitignore b/.gitignore index e3bf90979e17..1e9a37ba50d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Azure PowerShell specific src/Publish/ src/Package/ +drop/ obj TestResults diff --git a/src/CLU/NuGet.Config b/src/CLU/NuGet.Config new file mode 100644 index 000000000000..ef41e0c4f9e3 --- /dev/null +++ b/src/CLU/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tools/CLU/BuildDrop.ps1 b/tools/CLU/BuildDrop.ps1 new file mode 100644 index 000000000000..8f65f23ba59c --- /dev/null +++ b/tools/CLU/BuildDrop.ps1 @@ -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 + } + } +} \ No newline at end of file diff --git a/tools/CLU/BuildProfile.ps1 b/tools/CLU/BuildProfile.ps1 index 6ec76f460620..7f986445d242 100644 --- a/tools/CLU/BuildProfile.ps1 +++ b/tools/CLU/BuildProfile.ps1 @@ -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"