Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'develop'
  • Loading branch information
devlead committed Mar 17, 2017
2 parents d075ea3 + 27fba68 commit 3d11281
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 4 deletions.
9 changes: 8 additions & 1 deletion .travis.yml
@@ -1,6 +1,13 @@
language: csharp
script:
- echo "Information(Context.Environment.Runtime.CakeVersion.ToString());" > build.cake
- ./build.sh
- ./build.sh || exit 1
- echo "Testing with modules/addin packages.config"
- mkdir tools/modules
- echo -e "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<packages>\r\n <package id=\"Cake.Paket.Module\" version=\"1.2.2\" />\r\n</packages>" > ./tools/modules/packages.config
- mkdir tools/addins
- echo -e "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<packages>\r\n <package id=\"Cake.MicrosoftTeams\" version=\"0.3.0\" />\r\n</packages>" > ./tools/addins/packages.config
- ./build.sh || exit 1
- ls -D -R
os:
- linux
19 changes: 17 additions & 2 deletions appveyor.yml
Expand Up @@ -7,7 +7,22 @@ build_script:
./build.ps1
'Testing with PowerShell V2'
PowerShell.exe -Version 2.0 -File .\build.ps1
PowerShell.exe -Version 2.0 -File .\build.ps1
New-Item -ItemType Directory ./tools/modules
"<?xml version=""1.0"" encoding=""utf-8""?>`r`n<packages>`r`n <package id=""Cake.Paket.Module"" version=""1.2.2"" />`r`n</packages>" | Out-File -Encoding utf8 -FilePath ./tools/modules/packages.config
New-Item -ItemType Directory ./tools/addins
"<?xml version=""1.0"" encoding=""utf-8""?>`r`n<packages>`r`n <package id=""Cake.MicrosoftTeams"" version=""0.3.0"" />`r`n</packages>" | Out-File -Encoding utf8 -FilePath ./tools/addins/packages.config
'Testing with PowerShell Module & Addin restore'
./build.ps1
artifacts:
- path: '**\*'
name: Resources
39 changes: 39 additions & 0 deletions build.ps1
Expand Up @@ -87,11 +87,15 @@ if(!$PSScriptRoot){
}

$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$ADDINS_DIR = Join-Path $TOOLS_DIR "addins"
$MODULES_DIR = Join-Path $TOOLS_DIR "modules"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"

# Should we use mono?
$UseMono = "";
Expand Down Expand Up @@ -175,6 +179,41 @@ if(-Not $SkipToolPackageRestore.IsPresent) {
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
}
Write-Verbose -Message ($NuGetOutput | out-string)

Pop-Location
}

# Restore addins from NuGet
if (Test-Path $ADDINS_PACKAGES_CONFIG) {
Push-Location
Set-Location $ADDINS_DIR

Write-Verbose -Message "Restoring addins from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""

if ($LASTEXITCODE -ne 0) {
Throw "An error occured while restoring NuGet addins."
}

Write-Verbose -Message ($NuGetOutput | out-string)

Pop-Location
}

# Restore modules from NuGet
if (Test-Path $MODULES_PACKAGES_CONFIG) {
Push-Location
Set-Location $MODULES_DIR

Write-Verbose -Message "Restoring modules from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""

if ($LASTEXITCODE -ne 0) {
Throw "An error occured while restoring NuGet modules."
}

Write-Verbose -Message ($NuGetOutput | out-string)

Pop-Location
}

Expand Down
32 changes: 31 additions & 1 deletion build.sh
Expand Up @@ -9,10 +9,14 @@
# Define directories.
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TOOLS_DIR=$SCRIPT_DIR/tools
ADDINS_DIR=$TOOLS_DIR/addins
MODULES_DIR=$TOOLS_DIR/modules
NUGET_EXE=$TOOLS_DIR/nuget.exe
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe
PACKAGES_CONFIG=$TOOLS_DIR/packages.config
PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum
ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config
MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config

# Define md5sum or md5 depending on Linux/OSX
MD5_EXE=
Expand Down Expand Up @@ -79,14 +83,40 @@ fi

mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet packages."
echo "Could not restore NuGet tools."
exit 1
fi

$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5"

popd >/dev/null

# Restore addins from NuGet.
if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then
pushd "$ADDINS_DIR" >/dev/null

mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet addins."
exit 1
fi

popd >/dev/null
fi

# Restore modules from NuGet.
if [ -f "$MODULES_PACKAGES_CONFIG" ]; then
pushd "$MODULES_DIR" >/dev/null

mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet modules."
exit 1
fi

popd >/dev/null
fi

# Make sure that Cake has been installed.
if [ ! -f "$CAKE_EXE" ]; then
echo "Could not find Cake.exe at '$CAKE_EXE'."
Expand Down

0 comments on commit 3d11281

Please sign in to comment.