Add build scripts
This commit is contained in:
Родитель
f0dc82c0cf
Коммит
c511e4aee5
|
@ -1,42 +1,212 @@
|
|||
# Autosave files
|
||||
*~
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# build
|
||||
[Oo]bj/
|
||||
[Bb]in/
|
||||
packages/
|
||||
TestResults/
|
||||
|
||||
# globs
|
||||
Makefile.in
|
||||
*.DS_Store
|
||||
*.sln.cache
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.cache
|
||||
*.pidb
|
||||
*.userprefs
|
||||
*.usertasks
|
||||
config.log
|
||||
config.make
|
||||
config.status
|
||||
aclocal.m4
|
||||
install-sh
|
||||
autom4te.cache/
|
||||
*.user
|
||||
*.tar.gz
|
||||
tarballs/
|
||||
test-results/
|
||||
Thumbs.db
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# Mac bundle stuff
|
||||
*.dmg
|
||||
*.app
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# resharper
|
||||
*_Resharper.*
|
||||
*.Resharper
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# dotCover
|
||||
# Visual Studo 2015 cache/options directory
|
||||
.vs/
|
||||
|
||||
# dotnet generated file
|
||||
project.lock.json
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding addin-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
*.droidres
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
*.[Cc]ache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
## Android Auto-generated files
|
||||
Resource.designer.cs
|
||||
|
||||
#Build
|
||||
tools/Cake/
|
||||
tools/Addins/
|
||||
tools/gitlink/
|
||||
tools/GitVersion.CommandLine/
|
||||
tools/nuget.exe
|
||||
tools/packages.config.md5sum
|
||||
artifacts/
|
||||
*.nupkg
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
# configuration for "master" branch
|
||||
-
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
version: 1.0.0.{build}
|
||||
image: Visual Studio 2017 RC
|
||||
environment:
|
||||
ANDROID_HOME: "C:\\android-sdk-windows"
|
||||
NUGET_SOURCE: https://www.nuget.org/api/v2/package
|
||||
NUGET_APIKEY:
|
||||
secure: Kse62H9lWHIwjsqpi2ih1efUnHc5R6VfIzu1Nfr/CXcJSKPkH8EGElCIxvP43/Oh
|
||||
init:
|
||||
- cd \
|
||||
- appveyor DownloadFile http://dl.google.com/android/android-sdk_r24.4.1-windows.zip
|
||||
- 7z x android-sdk_r24.4.1-windows.zip > nul
|
||||
- cd "C:\projects\LottieXamarin"
|
||||
install:
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t tools
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t platform-tools
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t build-tools-24.0.2
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t android-24
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t extra-google-m2repository
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t extra-android-m2repository
|
||||
build_script:
|
||||
- ps: .\build.ps1
|
||||
test:
|
||||
assemblies:
|
||||
- '**/*.Tests.dll'
|
||||
-
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
version: 1.0.0.{build}
|
||||
image: Visual Studio 2017 RC
|
||||
environment:
|
||||
ANDROID_HOME: "C:\\android-sdk-windows"
|
||||
NUGET_SOURCE: https://www.myget.org/F/martijn00/api/v2/package
|
||||
NUGET_APIKEY:
|
||||
secure: 0PNC9eZWAinI1KkE9usbhPAwF1wudL5GJi6lJn9Ylb67M7SE17LIXBoMHuRKJaLE
|
||||
init:
|
||||
- cd \
|
||||
- appveyor DownloadFile http://dl.google.com/android/android-sdk_r24.4.1-windows.zip
|
||||
- 7z x android-sdk_r24.4.1-windows.zip > nul
|
||||
- cd "C:\projects\LottieXamarin"
|
||||
install:
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t tools
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t platform-tools
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t build-tools-24.0.2
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t android-24
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t extra-google-m2repository
|
||||
- echo y | "%ANDROID_HOME%\tools\android.bat" update sdk -u -a -t extra-android-m2repository
|
||||
build_script:
|
||||
- ps: .\build.ps1
|
||||
test:
|
||||
assemblies:
|
||||
- '**/*.Tests.dll'
|
|
@ -0,0 +1,153 @@
|
|||
#tool "nuget:?package=GitVersion.CommandLine"
|
||||
#tool "nuget:?package=gitlink"
|
||||
|
||||
var sln = new FilePath("Lottie.sln");
|
||||
var outputDir = new DirectoryPath("artifacts");
|
||||
var nuspecDir = new DirectoryPath("nuspec");
|
||||
var target = Argument("target", "Default");
|
||||
|
||||
var local = BuildSystem.IsLocalBuild;
|
||||
var isDevelopBranch = StringComparer.OrdinalIgnoreCase.Equals("develop", AppVeyor.Environment.Repository.Branch);
|
||||
var isReleaseBranch = StringComparer.OrdinalIgnoreCase.Equals("master", AppVeyor.Environment.Repository.Branch);
|
||||
var isTagged = AppVeyor.Environment.Repository.Tag.IsTag;
|
||||
|
||||
var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor;
|
||||
var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;
|
||||
var isRepository = StringComparer.OrdinalIgnoreCase.Equals("martijn00/LottieXamarin", AppVeyor.Environment.Repository.Name);
|
||||
|
||||
Task("Clean").Does(() =>
|
||||
{
|
||||
CleanDirectories("./**/bin");
|
||||
CleanDirectories("./**/obj");
|
||||
CleanDirectories(outputDir.FullPath);
|
||||
});
|
||||
|
||||
GitVersion versionInfo = null;
|
||||
Task("Version").Does(() => {
|
||||
GitVersion(new GitVersionSettings {
|
||||
UpdateAssemblyInfo = true,
|
||||
OutputType = GitVersionOutput.BuildServer
|
||||
});
|
||||
|
||||
versionInfo = GitVersion(new GitVersionSettings{ OutputType = GitVersionOutput.Json });
|
||||
Information("VI:\t{0}", versionInfo.FullSemVer);
|
||||
});
|
||||
|
||||
Task("UpdateAppVeyorBuildNumber")
|
||||
.IsDependentOn("Version")
|
||||
.WithCriteria(() => isRunningOnAppVeyor)
|
||||
.Does(() =>
|
||||
{
|
||||
AppVeyor.UpdateBuildVersion(versionInfo.FullBuildMetaData);
|
||||
});
|
||||
|
||||
Task("Restore").Does(() => {
|
||||
NuGetRestore(sln);
|
||||
});
|
||||
|
||||
Task("Build")
|
||||
.IsDependentOn("Clean")
|
||||
.IsDependentOn("UpdateAppVeyorBuildNumber")
|
||||
.IsDependentOn("Restore")
|
||||
.Does(() => {
|
||||
|
||||
DotNetBuild(sln,
|
||||
settings => settings.SetConfiguration("Release")
|
||||
.WithProperty("DebugSymbols", "true")
|
||||
.WithProperty("DebugType", "Full")
|
||||
.WithTarget("Build"));
|
||||
});
|
||||
|
||||
Task("GitLink")
|
||||
.IsDependentOn("Build")
|
||||
//pdbstr.exe and costura are not xplat currently
|
||||
.WithCriteria(() => IsRunningOnWindows())
|
||||
.Does(() =>
|
||||
{
|
||||
GitLink(sln.GetDirectory(),
|
||||
new GitLinkSettings {
|
||||
RepositoryUrl = "https://github.com/martijn00/LottieXamarin",
|
||||
ArgumentCustomization = args => args.Append("-ignore Example.iOS,Example.Forms,Example.Forms.iOS,Example.Forms.Android")
|
||||
});
|
||||
});
|
||||
|
||||
Task("Package")
|
||||
.IsDependentOn("GitLink")
|
||||
.Does(() =>
|
||||
{
|
||||
var nugetSettings = new NuGetPackSettings {
|
||||
Authors = new [] { "Martijn00" },
|
||||
Owners = new [] { "Martijn00" },
|
||||
IconUrl = new Uri("https://raw.githubusercontent.com/martijn00/LottieXamarin/master/icon_lottie.png"),
|
||||
ProjectUrl = new Uri("https://github.com/martijn00/LottieXamarin"),
|
||||
LicenseUrl = new Uri("https://github.com/martijn00/LottieXamarin/blob/master/LICENSE"),
|
||||
Copyright = "Copyright (c) Martijn00",
|
||||
RequireLicenseAcceptance = false,
|
||||
Version = versionInfo.NuGetVersion,
|
||||
Symbols = false,
|
||||
NoPackageAnalysis = true,
|
||||
OutputDirectory = outputDir,
|
||||
Verbosity = NuGetVerbosity.Detailed,
|
||||
BasePath = "./nuspec"
|
||||
};
|
||||
|
||||
EnsureDirectoryExists(outputDir);
|
||||
|
||||
var nuspecs = new List<string> {
|
||||
"Com.Airbnb.Android.Lottie.nuspec",
|
||||
"Com.Airbnb.iOS.Lottie.nuspec",
|
||||
"Com.Airbnb.Xamarin.Forms.Lottie.nuspec"
|
||||
};
|
||||
|
||||
foreach(var nuspec in nuspecs)
|
||||
{
|
||||
NuGetPack(nuspecDir + "/" + nuspec, nugetSettings);
|
||||
}
|
||||
});
|
||||
|
||||
Task("PublishPackages")
|
||||
.IsDependentOn("Package")
|
||||
.WithCriteria(() => !local)
|
||||
.WithCriteria(() => !isPullRequest)
|
||||
.WithCriteria(() => isRepository)
|
||||
.WithCriteria(() => isDevelopBranch || isReleaseBranch)
|
||||
.Does (() =>
|
||||
{
|
||||
if (isReleaseBranch && !isTagged)
|
||||
{
|
||||
Information("Packages will not be published as this release has not been tagged.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Resolve the API key.
|
||||
var apiKey = EnvironmentVariable("NUGET_APIKEY");
|
||||
if (string.IsNullOrEmpty(apiKey))
|
||||
{
|
||||
throw new Exception("The NUGET_APIKEY environment variable is not defined.");
|
||||
}
|
||||
|
||||
var source = EnvironmentVariable("NUGET_SOURCE");
|
||||
if (string.IsNullOrEmpty(source))
|
||||
{
|
||||
throw new Exception("The NUGET_SOURCE environment variable is not defined.");
|
||||
}
|
||||
|
||||
var nugetFiles = GetFiles(outputDir + "/*.nupkg");
|
||||
|
||||
foreach(var nugetFile in nugetFiles)
|
||||
{
|
||||
NuGetPush(nugetFile, new NuGetPushSettings {
|
||||
Source = source,
|
||||
ApiKey = apiKey
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Task("Default")
|
||||
.IsDependentOn("PublishPackages")
|
||||
.Does(() => {
|
||||
|
||||
});
|
||||
|
||||
RunTarget(target);
|
|
@ -0,0 +1,189 @@
|
|||
##########################################################################
|
||||
# This is the Cake bootstrapper script for PowerShell.
|
||||
# This file was downloaded from https://github.com/cake-build/resources
|
||||
# Feel free to change this file to fit your needs.
|
||||
##########################################################################
|
||||
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
This is a Powershell script to bootstrap a Cake build.
|
||||
|
||||
.DESCRIPTION
|
||||
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
|
||||
and execute your Cake build script with the parameters you provide.
|
||||
|
||||
.PARAMETER Script
|
||||
The build script to execute.
|
||||
.PARAMETER Target
|
||||
The build script target to run.
|
||||
.PARAMETER Configuration
|
||||
The build configuration to use.
|
||||
.PARAMETER Verbosity
|
||||
Specifies the amount of information to be displayed.
|
||||
.PARAMETER Experimental
|
||||
Tells Cake to use the latest Roslyn release.
|
||||
.PARAMETER WhatIf
|
||||
Performs a dry run of the build script.
|
||||
No tasks will be executed.
|
||||
.PARAMETER Mono
|
||||
Tells Cake to use the Mono scripting engine.
|
||||
.PARAMETER SkipToolPackageRestore
|
||||
Skips restoring of packages.
|
||||
.PARAMETER ScriptArgs
|
||||
Remaining arguments are added here.
|
||||
|
||||
.LINK
|
||||
http://cakebuild.net
|
||||
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[string]$Script = "build.cake",
|
||||
[string]$Target = "Default",
|
||||
[ValidateSet("Release", "Debug")]
|
||||
[string]$Configuration = "Release",
|
||||
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
|
||||
[string]$Verbosity = "Verbose",
|
||||
[switch]$Experimental,
|
||||
[Alias("DryRun","Noop")]
|
||||
[switch]$WhatIf,
|
||||
[switch]$Mono,
|
||||
[switch]$SkipToolPackageRestore,
|
||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||
[string[]]$ScriptArgs
|
||||
)
|
||||
|
||||
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
|
||||
function MD5HashFile([string] $filePath)
|
||||
{
|
||||
if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
|
||||
{
|
||||
return $null
|
||||
}
|
||||
|
||||
[System.IO.Stream] $file = $null;
|
||||
[System.Security.Cryptography.MD5] $md5 = $null;
|
||||
try
|
||||
{
|
||||
$md5 = [System.Security.Cryptography.MD5]::Create()
|
||||
$file = [System.IO.File]::OpenRead($filePath)
|
||||
return [System.BitConverter]::ToString($md5.ComputeHash($file))
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ($file -ne $null)
|
||||
{
|
||||
$file.Dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Preparing to run build script..."
|
||||
|
||||
if(!$PSScriptRoot){
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
}
|
||||
|
||||
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
|
||||
$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"
|
||||
|
||||
# Should we use mono?
|
||||
$UseMono = "";
|
||||
if($Mono.IsPresent) {
|
||||
Write-Verbose -Message "Using the Mono based scripting engine."
|
||||
$UseMono = "-mono"
|
||||
}
|
||||
|
||||
# Should we use the new Roslyn?
|
||||
$UseExperimental = "";
|
||||
if($Experimental.IsPresent -and !($Mono.IsPresent)) {
|
||||
Write-Verbose -Message "Using experimental version of Roslyn."
|
||||
$UseExperimental = "-experimental"
|
||||
}
|
||||
|
||||
# Is this a dry run?
|
||||
$UseDryRun = "";
|
||||
if($WhatIf.IsPresent) {
|
||||
$UseDryRun = "-dryrun"
|
||||
}
|
||||
|
||||
# Make sure tools folder exists
|
||||
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
|
||||
Write-Verbose -Message "Creating tools directory..."
|
||||
New-Item -Path $TOOLS_DIR -Type directory | out-null
|
||||
}
|
||||
|
||||
# Make sure that packages.config exist.
|
||||
if (!(Test-Path $PACKAGES_CONFIG)) {
|
||||
Write-Verbose -Message "Downloading packages.config..."
|
||||
try { (New-Object System.Net.WebClient).DownloadFile("http://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
|
||||
Throw "Could not download packages.config."
|
||||
}
|
||||
}
|
||||
|
||||
# Try find NuGet.exe in path if not exists
|
||||
if (!(Test-Path $NUGET_EXE)) {
|
||||
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
|
||||
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) }
|
||||
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
|
||||
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
|
||||
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
|
||||
$NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
|
||||
}
|
||||
}
|
||||
|
||||
# Try download NuGet.exe if not exists
|
||||
if (!(Test-Path $NUGET_EXE)) {
|
||||
Write-Verbose -Message "Downloading NuGet.exe..."
|
||||
try {
|
||||
(New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
|
||||
} catch {
|
||||
Throw "Could not download NuGet.exe."
|
||||
}
|
||||
}
|
||||
|
||||
# Save nuget.exe path to environment to be available to child processed
|
||||
$ENV:NUGET_EXE = $NUGET_EXE
|
||||
|
||||
# Restore tools from NuGet?
|
||||
if(-Not $SkipToolPackageRestore.IsPresent) {
|
||||
Push-Location
|
||||
Set-Location $TOOLS_DIR
|
||||
|
||||
# Check for changes in packages.config and remove installed tools if true.
|
||||
[string] $md5Hash = MD5HashFile($PACKAGES_CONFIG)
|
||||
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
|
||||
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
|
||||
Write-Verbose -Message "Missing or changed package.config hash..."
|
||||
Remove-Item * -Recurse -Exclude packages.config,nuget.exe
|
||||
}
|
||||
|
||||
Write-Verbose -Message "Restoring tools from NuGet..."
|
||||
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Throw "An error occured while restoring NuGet tools."
|
||||
}
|
||||
else
|
||||
{
|
||||
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
|
||||
}
|
||||
Write-Verbose -Message ($NuGetOutput | out-string)
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Make sure that Cake has been installed.
|
||||
if (!(Test-Path $CAKE_EXE)) {
|
||||
Throw "Could not find Cake.exe at $CAKE_EXE"
|
||||
}
|
||||
|
||||
# Start Cake
|
||||
Write-Host "Running build script..."
|
||||
Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
|
||||
exit $LASTEXITCODE
|
|
@ -0,0 +1,101 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
##########################################################################
|
||||
# This is the Cake bootstrapper script for Linux and OS X.
|
||||
# This file was downloaded from https://github.com/cake-build/resources
|
||||
# Feel free to change this file to fit your needs.
|
||||
##########################################################################
|
||||
|
||||
# Define directories.
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
TOOLS_DIR=$SCRIPT_DIR/tools
|
||||
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
|
||||
|
||||
# Define md5sum or md5 depending on Linux/OSX
|
||||
MD5_EXE=
|
||||
if [[ "$(uname -s)" == "Darwin" ]]; then
|
||||
MD5_EXE="md5 -r"
|
||||
else
|
||||
MD5_EXE="md5sum"
|
||||
fi
|
||||
|
||||
# Define default arguments.
|
||||
SCRIPT="build.cake"
|
||||
TARGET="Default"
|
||||
CONFIGURATION="Release"
|
||||
VERBOSITY="verbose"
|
||||
DRYRUN=
|
||||
SHOW_VERSION=false
|
||||
SCRIPT_ARGUMENTS=()
|
||||
|
||||
# Parse arguments.
|
||||
for i in "$@"; do
|
||||
case $1 in
|
||||
-s|--script) SCRIPT="$2"; shift ;;
|
||||
-t|--target) TARGET="$2"; shift ;;
|
||||
-c|--configuration) CONFIGURATION="$2"; shift ;;
|
||||
-v|--verbosity) VERBOSITY="$2"; shift ;;
|
||||
-d|--dryrun) DRYRUN="-dryrun" ;;
|
||||
--version) SHOW_VERSION=true ;;
|
||||
--) shift; SCRIPT_ARGUMENTS+=("$@"); break ;;
|
||||
*) SCRIPT_ARGUMENTS+=("$1") ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Make sure the tools folder exist.
|
||||
if [ ! -d "$TOOLS_DIR" ]; then
|
||||
mkdir "$TOOLS_DIR"
|
||||
fi
|
||||
|
||||
# Make sure that packages.config exist.
|
||||
if [ ! -f "$TOOLS_DIR/packages.config" ]; then
|
||||
echo "Downloading packages.config..."
|
||||
curl -Lsfo "$TOOLS_DIR/packages.config" http://cakebuild.net/download/bootstrapper/packages
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "An error occured while downloading packages.config."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Download NuGet if it does not exist.
|
||||
if [ ! -f "$NUGET_EXE" ]; then
|
||||
echo "Downloading NuGet..."
|
||||
curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "An error occured while downloading nuget.exe."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Restore tools from NuGet.
|
||||
pushd "$TOOLS_DIR" >/dev/null
|
||||
if [ ! -f $PACKAGES_CONFIG_MD5 ] || [ "$( cat $PACKAGES_CONFIG_MD5 | sed 's/\r$//' )" != "$( $MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' )" ]; then
|
||||
find . -type d ! -name . | xargs rm -rf
|
||||
fi
|
||||
|
||||
mono "$NUGET_EXE" install -ExcludeVersion
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Could not restore NuGet packages."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' >| $PACKAGES_CONFIG_MD5
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
# Make sure that Cake has been installed.
|
||||
if [ ! -f "$CAKE_EXE" ]; then
|
||||
echo "Could not find Cake.exe at '$CAKE_EXE'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Start Cake
|
||||
if $SHOW_VERSION; then
|
||||
exec mono "$CAKE_EXE" -version
|
||||
else
|
||||
exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
|
||||
fi
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Cake" version="0.17.0" />
|
||||
</packages>
|
Загрузка…
Ссылка в новой задаче