Skip to content

Commit 82afd42

Browse files
committed
Merge pull request #1465 from yugangw-msft/cluscript
Scripts for setup dev environment for clu cmdlet work
2 parents 6bede14 + 4108f1f commit 82afd42

File tree

6 files changed

+76
-7
lines changed

6 files changed

+76
-7
lines changed

src/CLU/clurun/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class Program
1515
/// </summary>
1616
/// <param name="args">The commandline arguments</param>
1717
public static void Main(string[] args)
18-
{
18+
{
1919
var debugClu = Environment.GetEnvironmentVariable("DebugCLU");
2020
if (!String.IsNullOrEmpty(debugClu))
2121
{

src/CLU/clurun/msclu.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
RepositoryPath: C:\repos\Microsoft.CLU\artifacts\CommandPkgs\win7-x64\Debug
1+
RepositoryPath:TOFILL
22
RuntimePackage: Microsoft.CLU.Commands
33
RuntimeVersion: 0.0.1

tools/CLU/BuildCmdlet.bat

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
echo off
2+
Setlocal EnableDelayedExpansion
3+
4+
set DebugCLU=
5+
set root=%~dp0..\..
6+
if not "%1"=="" (
7+
@powershell -file %~dp0\BuildDrop.ps1 -commandPackagesToBuild %1 --excludeCluRun
8+
%root%\drop\clurun\win7-x64\clurun.exe --install %1
9+
) else (
10+
@powershell -file %~dp0\BuildDrop.ps1 -excludeCluRun
11+
%root%\drop\clurun\win7-x64\clurun.exe --install
12+
%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Profile
13+
%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Resources
14+
%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Resources.Cmdlets
15+
%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Websites
16+
%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Management.Storage
17+
)

tools/CLU/BuildDrop.ps1

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ if (!($workspaceDirectory))
99
$env:WORKSPACE = $workspaceDirectory
1010
}
1111

12-
$buildProfileScriptPath = "`"$thisScriptDirectory\BuildProfile.ps1`"" # Guard against spaces in the path
13-
$sourcesRoot = "$workspaceDirectory\src\clu"
14-
1512
if (!($dropLocation))
1613
{
1714
$dropLocation = "$workspaceDirectory\drop"
@@ -24,7 +21,8 @@ if (!(Test-Path -Path $dropLocation -PathType Container))
2421
mkdir "$dropLocation\clurun"
2522
}
2623

27-
24+
$buildProfileScriptPath = "`"$thisScriptDirectory\BuildProfile.ps1`"" # Guard against spaces in the path
25+
$sourcesRoot = "$workspaceDirectory\src\clu"
2826

2927
# Grab all command packages to build.
3028
# 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)
3937
$commandPackageDir = $commandPackage.Directory
4038
$buildOutputDirectory = Join-Path -path $commandPackageDir -ChildPath "bin\Debug\publish"
4139

42-
4340
Invoke-Expression "& $buildProfileScriptPath $commandPackageDir $commandPackageName $buildOutputDirectory $packageVersion $dropLocation\CommandRepo"
4441
}
4542

tools/CLU/SetupEnv.bat

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
echo off
2+
3+
where dotnet.exe
4+
if ERRORLEVEL 1 (
5+
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
6+
exit /B
7+
)
8+
9+
set root=%~dp0..\..
10+
echo Build all clu source projects
11+
"%ProgramFiles(x86)%\MSBuild\14.0\Bin\msbuild" %root%\build.proj /t:build >NUL
12+
13+
if ERRORLEVEL 1 (
14+
echo Build source project failed. To repro, run: msbuild build.proj /t:build
15+
)
16+
17+
REM build cmdlets packages
18+
@powershell -file %~dp0\BuildDrop.ps1
19+
20+
REM cook a msclu.cfg with a correct local repro path.
21+
set mscluCfg=%root%\drop\clurun\win7-x64\msclu.cfg
22+
if not exist %mscluCfg% (
23+
copy /Y %root%\src\CLU\clurun\msclu.cfg %root%\drop\clurun\win7-x64
24+
)
25+
echo ^(Get-Content "%mscluCfg%"^) ^| ForEach-Object { $_ -replace "TOFILL", "%root%\drop\CommandRepo" } ^| Set-Content "%mscluCfg%"^ >"%temp%\Rep.ps1"
26+
@powershell -file %temp%\Rep.ps1
27+
28+
set DebugCLU=
29+
%root%\drop\clurun\win7-x64\clurun.exe --install
30+
%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Profile
31+
%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Resources
32+
%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Resources.Cmdlets
33+
%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Websites
34+
%root%\drop\clurun\win7-x64\clurun.exe --install Microsoft.Azure.Commands.Management.Storage
35+
set DebugCLU=1
36+
set Path=%Path%;%root%\drop\clurun\win7-x64
37+
38+
REM setup osx and linux bits which can be xcopied and run.
39+
REM note, for known nuget bugs, skip --install by copying over cmdlet packages.
40+
xcopy %root%\drop\clurun\win7-x64\pkgs %root%\drop\clurun\osx.10.10-x64\pkgs /S /Q /I /Y
41+
copy /Y %root%\drop\clurun\win7-x64\azure.lx %root%\drop\clurun\osx.10.10-x64
42+
copy /Y %root%\drop\clurun\win7-x64\msclu.cfg %root%\drop\clurun\osx.10.10-x64
43+
copy /Y %~dp0\azure.sh %root%\drop\clurun\osx.10.10-x64
44+
45+
xcopy %root%\drop\clurun\win7-x64\pkgs %root%\drop\clurun\ubuntu.14.04-x64\pkgs /S /Q /I /Y
46+
copy /Y %root%\drop\clurun\win7-x64\azure.lx %root%\drop\clurun\ubuntu.14.04-x64
47+
copy /Y %root%\drop\clurun\win7-x64\msclu.cfg %root%\drop\clurun\ubuntu.14.04-x64
48+
copy /Y %~dp0\azure.sh %root%\drop\clurun\ubuntu.14.04-x64

tools/CLU/azure.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
if [ -z ${CmdletSessionID} ]
3+
then
4+
export CmdletSessionID=$PPID
5+
fi
6+
SCRIPTPATH=$(dirname "$0")
7+
$SCRIPTPATH/clurun -s azure -r $SCRIPTPATH/azure.lx $*

0 commit comments

Comments
 (0)