diff --git a/src/CLU/clurun/Program.cs b/src/CLU/clurun/Program.cs index 04cbad3374e2..e07024ddbbfd 100644 --- a/src/CLU/clurun/Program.cs +++ b/src/CLU/clurun/Program.cs @@ -15,7 +15,7 @@ public class Program /// /// The commandline arguments public static void Main(string[] args) - { + { var debugClu = Environment.GetEnvironmentVariable("DebugCLU"); if (!String.IsNullOrEmpty(debugClu)) { diff --git a/src/CLU/clurun/msclu.cfg b/src/CLU/clurun/msclu.cfg index d7a46651c3a5..94356f856413 100644 --- a/src/CLU/clurun/msclu.cfg +++ b/src/CLU/clurun/msclu.cfg @@ -1,3 +1,3 @@ -RepositoryPath: C:\repos\Microsoft.CLU\artifacts\CommandPkgs\win7-x64\Debug +RepositoryPath:TOFILL RuntimePackage: Microsoft.CLU.Commands RuntimeVersion: 0.0.1 \ No newline at end of file diff --git a/tools/CLU/BuildCmdlet.bat b/tools/CLU/BuildCmdlet.bat new file mode 100644 index 000000000000..2476ed167c6e --- /dev/null +++ b/tools/CLU/BuildCmdlet.bat @@ -0,0 +1,17 @@ +echo off +Setlocal EnableDelayedExpansion + +set DebugCLU= +set root=%~dp0..\.. +if not "%1"=="" ( + @powershell -file %~dp0\BuildDrop.ps1 -commandPackagesToBuild %1 --excludeCluRun + %root%\drop\clurun\win7-x64\clurun.exe --install %1 +) else ( + @powershell -file %~dp0\BuildDrop.ps1 -excludeCluRun + %root%\drop\clurun\win7-x64\clurun.exe --install + %root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Profile + %root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Resources + %root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Resources.Cmdlets + %root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Websites + %root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Management.Storage +) \ No newline at end of file diff --git a/tools/CLU/BuildDrop.ps1 b/tools/CLU/BuildDrop.ps1 index 1eb0b34f0d06..2966b1eff815 100644 --- a/tools/CLU/BuildDrop.ps1 +++ b/tools/CLU/BuildDrop.ps1 @@ -9,9 +9,6 @@ if (!($workspaceDirectory)) $env:WORKSPACE = $workspaceDirectory } -$buildProfileScriptPath = "`"$thisScriptDirectory\BuildProfile.ps1`"" # Guard against spaces in the path -$sourcesRoot = "$workspaceDirectory\src\clu" - if (!($dropLocation)) { $dropLocation = "$workspaceDirectory\drop" @@ -24,7 +21,8 @@ if (!(Test-Path -Path $dropLocation -PathType Container)) mkdir "$dropLocation\clurun" } - +$buildProfileScriptPath = "`"$thisScriptDirectory\BuildProfile.ps1`"" # Guard against spaces in the path +$sourcesRoot = "$workspaceDirectory\src\clu" # Grab 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 @@ -39,7 +37,6 @@ foreach($commandPackage in $commandPackages) $commandPackageDir = $commandPackage.Directory $buildOutputDirectory = Join-Path -path $commandPackageDir -ChildPath "bin\Debug\publish" - Invoke-Expression "& $buildProfileScriptPath $commandPackageDir $commandPackageName $buildOutputDirectory $packageVersion $dropLocation\CommandRepo" } diff --git a/tools/CLU/SetupEnv.bat b/tools/CLU/SetupEnv.bat new file mode 100644 index 000000000000..e86c39b8cc48 --- /dev/null +++ b/tools/CLU/SetupEnv.bat @@ -0,0 +1,48 @@ +echo off + +where dotnet.exe +if ERRORLEVEL 1 ( + echo Please install 'dotnet', say from 'https://azureclu.blob.core.windows.net/tools/dotnet-win-x64.latest.zip', unzip, then add its bin folder to the PATH + exit /B +) + +set root=%~dp0..\.. +echo Build all clu source projects +"%ProgramFiles(x86)%\MSBuild\14.0\Bin\msbuild" %root%\build.proj /t:build >NUL + +if ERRORLEVEL 1 ( + echo Build source project failed. To repro, run: msbuild build.proj /t:build +) + +REM build cmdlets packages +@powershell -file %~dp0\BuildDrop.ps1 + +REM cook a msclu.cfg with a correct local repro path. +set mscluCfg=%root%\drop\clurun\win7-x64\msclu.cfg +if not exist %mscluCfg% ( + copy /Y %root%\src\CLU\clurun\msclu.cfg %root%\drop\clurun\win7-x64 +) +echo ^(Get-Content "%mscluCfg%"^) ^| ForEach-Object { $_ -replace "TOFILL", "%root%\drop\CommandRepo" } ^| Set-Content "%mscluCfg%"^ >"%temp%\Rep.ps1" +@powershell -file %temp%\Rep.ps1 + +set DebugCLU= +%root%\drop\clurun\win7-x64\clurun.exe --install +%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Profile +%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Resources +%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Resources.Cmdlets +%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Websites +%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Management.Storage +set DebugCLU=1 +set Path=%Path%;%root%\drop\clurun\win7-x64 + +REM setup osx and linux bits which can be xcopied and run. +REM note, for known nuget bugs, skip --install by copying over cmdlet packages. +xcopy %root%\drop\clurun\win7-x64\pkgs %root%\drop\clurun\osx.10.10-x64\pkgs /S /Q /I /Y +copy /Y %root%\drop\clurun\win7-x64\azure.lx %root%\drop\clurun\osx.10.10-x64 +copy /Y %root%\drop\clurun\win7-x64\msclu.cfg %root%\drop\clurun\osx.10.10-x64 +copy /Y %~dp0\azure.sh %root%\drop\clurun\osx.10.10-x64 + +xcopy %root%\drop\clurun\win7-x64\pkgs %root%\drop\clurun\ubuntu.14.04-x64\pkgs /S /Q /I /Y +copy /Y %root%\drop\clurun\win7-x64\azure.lx %root%\drop\clurun\ubuntu.14.04-x64 +copy /Y %root%\drop\clurun\win7-x64\msclu.cfg %root%\drop\clurun\ubuntu.14.04-x64 +copy /Y %~dp0\azure.sh %root%\drop\clurun\ubuntu.14.04-x64 \ No newline at end of file diff --git a/tools/CLU/azure.sh b/tools/CLU/azure.sh new file mode 100644 index 000000000000..e5149fc2f0e9 --- /dev/null +++ b/tools/CLU/azure.sh @@ -0,0 +1,7 @@ +#!/bin/bash +if [ -z ${CmdletSessionID} ] +then + export CmdletSessionID=$PPID +fi +SCRIPTPATH=$(dirname "$0") +$SCRIPTPATH/clurun -s azure -r $SCRIPTPATH/azure.lx $*