Bump up dependencies (#221)
This commit is contained in:
parent
e512b6da64
commit
7f5e81cf47
17 changed files with 164 additions and 139 deletions
|
@ -1,8 +1,8 @@
|
||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GtkUrl Condition=" '$(GtkUrl)' == '' ">https://github.com/GtkSharp/Dependencies/raw/master/gtk-3.24.20.zip</GtkUrl>
|
<GtkUrl Condition=" '$(GtkUrl)' == '' ">https://github.com/GtkSharp/Dependencies/raw/master/gtk-3.24.24.zip</GtkUrl>
|
||||||
<GtkDir Condition=" '$(GtkDir)' == '' ">$(LOCALAPPDATA)\Gtk\3.24.20</GtkDir>
|
<GtkDir Condition=" '$(GtkDir)' == '' ">$(LOCALAPPDATA)\Gtk\3.24.24</GtkDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Target Name="InstallGtk" BeforeTargets="Build" Condition=" '$(SkipGtkInstall)' != 'True' and '$(OS)' == 'Windows_NT' and !Exists('$(GtkDir)/libgtk-3-0.dll') ">
|
<Target Name="InstallGtk" BeforeTargets="Build" Condition=" '$(SkipGtkInstall)' != 'True' and '$(OS)' == 'Windows_NT' and !Exists('$(GtkDir)/libgtk-3-0.dll') ">
|
||||||
|
|
|
@ -42,7 +42,7 @@ class GLibrary
|
||||||
|
|
||||||
if (ret == IntPtr.Zero)
|
if (ret == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
SetDllDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Gtk", "3.24.20"));
|
SetDllDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Gtk", "3.24.24"));
|
||||||
ret = FuncLoader.LoadLibrary(_libraryDefinitions[library][0]);
|
ret = FuncLoader.LoadLibrary(_libraryDefinitions[library][0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<OutputPath>..\..\BuildOutput\Samples</OutputPath>
|
<OutputPath>..\..\BuildOutput\Samples</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -10,7 +10,9 @@
|
||||||
<EmbeddedResource Include="**\*.glade">
|
<EmbeddedResource Include="**\*.glade">
|
||||||
<LogicalName>%(Filename)%(Extension)</LogicalName>
|
<LogicalName>%(Filename)%(Extension)</LogicalName>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Testpic.png" />
|
<EmbeddedResource Include="Testpic.png">
|
||||||
|
<LogicalName>Testpic</LogicalName>
|
||||||
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Sections\**\*.cs" Visible="false">
|
<EmbeddedResource Include="Sections\**\*.cs" Visible="false">
|
||||||
|
|
|
@ -21,29 +21,9 @@ namespace Samples
|
||||||
|
|
||||||
public (string, Widget) CreateContainer()
|
public (string, Widget) CreateContainer()
|
||||||
{
|
{
|
||||||
Stream GetResourceStream(Assembly assembly, string name)
|
var image = new Pixbuf(typeof(ImageSection).Assembly, "Testpic");
|
||||||
{
|
|
||||||
var resources = assembly.GetManifestResourceNames();
|
|
||||||
var resourceName = resources.SingleOrDefault(str => str == name);
|
|
||||||
|
|
||||||
// try harder:
|
|
||||||
if (resourceName == default) {
|
|
||||||
resourceName = resources.SingleOrDefault(str => str.EndsWith(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resourceName == default)
|
|
||||||
return default;
|
|
||||||
var stream = assembly.GetManifestResourceStream(resourceName);
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
Pixbuf image = default;
|
|
||||||
using (var stream = GetResourceStream(typeof(ImageSection).Assembly, "Testpic.png")) {
|
|
||||||
image = new Pixbuf(stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
var container = new ImageBox(image);
|
var container = new ImageBox(image);
|
||||||
|
|
||||||
|
|
||||||
return ($"{nameof(ImageBox)}:", container);
|
return ($"{nameof(ImageBox)}:", container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
"symbols": {
|
"symbols": {
|
||||||
"targetframework": {
|
"targetframework": {
|
||||||
"type": "parameter",
|
"type": "parameter",
|
||||||
"defaultValue": "netcoreapp2.0",
|
"defaultValue": "net5.0",
|
||||||
"replaces": "netcoreapp2.0"
|
"replaces": "net5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"primaryOutputs": [
|
"primaryOutputs": [
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
"symbols": {
|
"symbols": {
|
||||||
"targetframework": {
|
"targetframework": {
|
||||||
"type": "parameter",
|
"type": "parameter",
|
||||||
"defaultValue": "netcoreapp2.0",
|
"defaultValue": "net5.0",
|
||||||
"replaces": "netcoreapp2.0"
|
"replaces": "net5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"primaryOutputs": [
|
"primaryOutputs": [
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
"symbols": {
|
"symbols": {
|
||||||
"targetframework": {
|
"targetframework": {
|
||||||
"type": "parameter",
|
"type": "parameter",
|
||||||
"defaultValue": "netcoreapp2.0",
|
"defaultValue": "net5.0",
|
||||||
"replaces": "netcoreapp2.0"
|
"replaces": "net5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"primaryOutputs": [
|
"primaryOutputs": [
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<OutputPath>..\..\..\BuildOutput\Tools</OutputPath>
|
<OutputPath>..\..\..\BuildOutput\Tools</OutputPath>
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<OutputPath>..\..\..\BuildOutput\Tools</OutputPath>
|
<OutputPath>..\..\..\BuildOutput\Tools</OutputPath>
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
variables:
|
variables:
|
||||||
versionbase: 3.22.25
|
versionbase: 3.24.24
|
||||||
increment: $[counter(variables['versionbase'], 1)]
|
increment: $[counter(variables['versionbase'], 1)]
|
||||||
version: $(versionbase).$(increment)
|
version: $(versionbase).$(increment)
|
||||||
|
|
||||||
|
@ -16,9 +16,6 @@ steps:
|
||||||
- script: echo "##vso[build.updatebuildnumber]$(version)"
|
- script: echo "##vso[build.updatebuildnumber]$(version)"
|
||||||
displayName: 'Set Build Number'
|
displayName: 'Set Build Number'
|
||||||
|
|
||||||
- script: sudo apt install -y monodevelop
|
|
||||||
displayName: 'Install MonoDevelop'
|
|
||||||
|
|
||||||
- script: ./build.sh --BuildTarget=FullBuild --BuildVersion=$(version)
|
- script: ./build.sh --BuildTarget=FullBuild --BuildVersion=$(version)
|
||||||
displayName: 'CAKE Script'
|
displayName: 'CAKE Script'
|
||||||
|
|
||||||
|
@ -42,10 +39,3 @@ steps:
|
||||||
pathtoPublish: BuildOutput/Samples
|
pathtoPublish: BuildOutput/Samples
|
||||||
artifactName: Samples
|
artifactName: Samples
|
||||||
publishLocation: container
|
publishLocation: container
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
|
||||||
displayName: Publish MonoDevelop Addin
|
|
||||||
inputs:
|
|
||||||
pathtoPublish: BuildOutput/Addins/MonoDevelop/MonoDevelop.GtkSharp.Addin_$(version).mpack
|
|
||||||
artifactName: MonoDevelop Addin
|
|
||||||
publishLocation: container
|
|
43
build.cake
43
build.cake
|
@ -1,12 +1,12 @@
|
||||||
#load CakeScripts\GAssembly.cake
|
#load CakeScripts\GAssembly.cake
|
||||||
#load CakeScripts\Settings.cake
|
#load CakeScripts\Settings.cake
|
||||||
#addin "Cake.FileHelpers&version=3.2.0"
|
#addin "Cake.FileHelpers&version=4.0.0"
|
||||||
#addin "Cake.Incubator&version=5.0.1"
|
#addin "Cake.Incubator&version=6.0.0"
|
||||||
|
|
||||||
// VARS
|
// VARS
|
||||||
|
|
||||||
Settings.Cake = Context;
|
Settings.Cake = Context;
|
||||||
Settings.Version = Argument("BuildVersion", "3.22.24.30");
|
Settings.Version = Argument("BuildVersion", "3.24.24.1");
|
||||||
Settings.BuildTarget = Argument("BuildTarget", "Default");
|
Settings.BuildTarget = Argument("BuildTarget", "Default");
|
||||||
Settings.Assembly = Argument("Assembly", "");
|
Settings.Assembly = Argument("Assembly", "");
|
||||||
var configuration = Argument("Configuration", "Release");
|
var configuration = Argument("Configuration", "Release");
|
||||||
|
@ -63,7 +63,10 @@ Task("FullClean")
|
||||||
.IsDependentOn("Clean")
|
.IsDependentOn("Clean")
|
||||||
.Does(() =>
|
.Does(() =>
|
||||||
{
|
{
|
||||||
DeleteDirectory("BuildOutput", true);
|
DeleteDirectory("BuildOutput", new DeleteDirectorySettings {
|
||||||
|
Recursive = true,
|
||||||
|
Force = true
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Task("Build")
|
Task("Build")
|
||||||
|
@ -136,35 +139,6 @@ Task("PackageTemplates")
|
||||||
NuGetPack("Source/Templates/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.nuspec", settings);
|
NuGetPack("Source/Templates/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.nuspec", settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
Task("PackageAddin")
|
|
||||||
.IsDependentOn("PackageTemplates")
|
|
||||||
.Does(() =>
|
|
||||||
{
|
|
||||||
// Copy the current version nuget templates
|
|
||||||
CopyFile(
|
|
||||||
"BuildOutput/NugetPackages/GtkSharp.Template.CSharp." + Settings.Version + ".nupkg",
|
|
||||||
"Source/Addins/MonoDevelop.GtkSharp.Addin/Templates/GtkSharp.Template.CSharp.nupkg"
|
|
||||||
);
|
|
||||||
CopyFile(
|
|
||||||
"BuildOutput/NugetPackages/GtkSharp.Template.FSharp." + Settings.Version + ".nupkg",
|
|
||||||
"Source/Addins/MonoDevelop.GtkSharp.Addin/Templates/GtkSharp.Template.FSharp.nupkg"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Generate version code info
|
|
||||||
var versionline = "[assembly: Mono.Addins.Addin(\"MonoDevelop.GtkSharp.Addin\", Version = \"" + Settings.Version + "\")]";
|
|
||||||
FileWriteText("Source/Addins/MonoDevelop.GtkSharp.Addin/Properties/AddinInfo.Version.cs", versionline);
|
|
||||||
|
|
||||||
// Build MonoDevelop addin
|
|
||||||
var msbuildsettings = new MSBuildSettings
|
|
||||||
{
|
|
||||||
Configuration = configuration,
|
|
||||||
};
|
|
||||||
msbuildsettings = msbuildsettings.WithProperty("Version", Settings.Version);
|
|
||||||
msbuildsettings = msbuildsettings.WithTarget("PackageAddin");
|
|
||||||
|
|
||||||
MSBuild("Source/Addins/MonoDevelop.GtkSharp.Addin/MonoDevelop.GtkSharp.Addin.sln", msbuildsettings);
|
|
||||||
});
|
|
||||||
|
|
||||||
// TASK TARGETS
|
// TASK TARGETS
|
||||||
|
|
||||||
Task("Default")
|
Task("Default")
|
||||||
|
@ -172,8 +146,7 @@ Task("Default")
|
||||||
|
|
||||||
Task("FullBuild")
|
Task("FullBuild")
|
||||||
.IsDependentOn("PackageNuGet")
|
.IsDependentOn("PackageNuGet")
|
||||||
.IsDependentOn("PackageTemplates")
|
.IsDependentOn("PackageTemplates");
|
||||||
.IsDependentOn("PackageAddin");
|
|
||||||
|
|
||||||
// EXECUTION
|
// EXECUTION
|
||||||
|
|
||||||
|
|
180
build.ps1
180
build.ps1
|
@ -5,14 +5,11 @@
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
This is a Powershell script to bootstrap a Cake build.
|
This is a Powershell script to bootstrap a Cake build.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
|
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
|
||||||
and execute your Cake build script with the parameters you provide.
|
and execute your Cake build script with the parameters you provide.
|
||||||
|
|
||||||
.PARAMETER Script
|
.PARAMETER Script
|
||||||
The build script to execute.
|
The build script to execute.
|
||||||
.PARAMETER Target
|
.PARAMETER Target
|
||||||
|
@ -21,40 +18,55 @@ The build script target to run.
|
||||||
The build configuration to use.
|
The build configuration to use.
|
||||||
.PARAMETER Verbosity
|
.PARAMETER Verbosity
|
||||||
Specifies the amount of information to be displayed.
|
Specifies the amount of information to be displayed.
|
||||||
.PARAMETER Experimental
|
.PARAMETER ShowDescription
|
||||||
Tells Cake to use the latest Roslyn release.
|
Shows description about tasks.
|
||||||
.PARAMETER WhatIf
|
.PARAMETER DryRun
|
||||||
Performs a dry run of the build script.
|
Performs a dry run.
|
||||||
No tasks will be executed.
|
|
||||||
.PARAMETER Mono
|
|
||||||
Tells Cake to use the Mono scripting engine.
|
|
||||||
.PARAMETER SkipToolPackageRestore
|
.PARAMETER SkipToolPackageRestore
|
||||||
Skips restoring of packages.
|
Skips restoring of packages.
|
||||||
.PARAMETER ScriptArgs
|
.PARAMETER ScriptArgs
|
||||||
Remaining arguments are added here.
|
Remaining arguments are added here.
|
||||||
|
|
||||||
.LINK
|
.LINK
|
||||||
https://cakebuild.net
|
https://cakebuild.net
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
Param(
|
Param(
|
||||||
[string]$Script = "build.cake",
|
[string]$Script,
|
||||||
[string]$Target = "Default",
|
[string]$Target,
|
||||||
[ValidateSet("Release", "Debug")]
|
[string]$Configuration,
|
||||||
[string]$Configuration = "Release",
|
|
||||||
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
|
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
|
||||||
[string]$Verbosity = "Verbose",
|
[string]$Verbosity,
|
||||||
[switch]$Experimental,
|
[switch]$ShowDescription,
|
||||||
[Alias("DryRun","Noop")]
|
[Alias("WhatIf", "Noop")]
|
||||||
[switch]$WhatIf,
|
[switch]$DryRun,
|
||||||
[switch]$Mono,
|
|
||||||
[switch]$SkipToolPackageRestore,
|
[switch]$SkipToolPackageRestore,
|
||||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||||
[string[]]$ScriptArgs
|
[string[]]$ScriptArgs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# This is an automatic variable in PowerShell Core, but not in Windows PowerShell 5.x
|
||||||
|
if (-not (Test-Path variable:global:IsCoreCLR)) {
|
||||||
|
$IsCoreCLR = $false
|
||||||
|
}
|
||||||
|
|
||||||
|
# Attempt to set highest encryption available for SecurityProtocol.
|
||||||
|
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
|
||||||
|
# will typically produce a message for PowerShell v2 (just an info
|
||||||
|
# message though)
|
||||||
|
try {
|
||||||
|
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
|
||||||
|
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
|
||||||
|
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
|
||||||
|
# installed (.NET 4.5 is an in-place upgrade).
|
||||||
|
# PowerShell Core already has support for TLS 1.2 so we can skip this if running in that.
|
||||||
|
if (-not $IsCoreCLR) {
|
||||||
|
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
|
||||||
|
}
|
||||||
|
|
||||||
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
|
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
|
||||||
function MD5HashFile([string] $filePath)
|
function MD5HashFile([string] $filePath)
|
||||||
{
|
{
|
||||||
|
@ -80,49 +92,52 @@ function MD5HashFile([string] $filePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function GetProxyEnabledWebClient
|
||||||
|
{
|
||||||
|
$wc = New-Object System.Net.WebClient
|
||||||
|
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
|
||||||
|
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
|
||||||
|
$wc.Proxy = $proxy
|
||||||
|
return $wc
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "Preparing to run build script..."
|
Write-Host "Preparing to run build script..."
|
||||||
|
|
||||||
if(!$PSScriptRoot){
|
if(!$PSScriptRoot){
|
||||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$Script){
|
||||||
|
$Script = Join-Path $PSScriptRoot "build.cake"
|
||||||
|
}
|
||||||
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
|
$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"
|
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
|
||||||
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
|
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
|
||||||
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
|
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
|
||||||
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
|
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
|
||||||
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
|
$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?
|
$env:CAKE_PATHS_TOOLS = $TOOLS_DIR
|
||||||
$UseMono = "";
|
$env:CAKE_PATHS_ADDINS = $ADDINS_DIR
|
||||||
if($Mono.IsPresent) {
|
$env:CAKE_PATHS_MODULES = $MODULES_DIR
|
||||||
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
|
# Make sure tools folder exists
|
||||||
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
|
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
|
||||||
Write-Verbose -Message "Creating tools directory..."
|
Write-Verbose -Message "Creating tools directory..."
|
||||||
New-Item -Path $TOOLS_DIR -Type directory | out-null
|
New-Item -Path $TOOLS_DIR -Type Directory | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make sure that packages.config exist.
|
# Make sure that packages.config exist.
|
||||||
if (!(Test-Path $PACKAGES_CONFIG)) {
|
if (!(Test-Path $PACKAGES_CONFIG)) {
|
||||||
Write-Verbose -Message "Downloading packages.config..."
|
Write-Verbose -Message "Downloading packages.config..."
|
||||||
try { (New-Object System.Net.WebClient).DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
|
try {
|
||||||
|
$wc = GetProxyEnabledWebClient
|
||||||
|
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG)
|
||||||
|
} catch {
|
||||||
Throw "Could not download packages.config."
|
Throw "Could not download packages.config."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,14 +157,26 @@ if (!(Test-Path $NUGET_EXE)) {
|
||||||
if (!(Test-Path $NUGET_EXE)) {
|
if (!(Test-Path $NUGET_EXE)) {
|
||||||
Write-Verbose -Message "Downloading NuGet.exe..."
|
Write-Verbose -Message "Downloading NuGet.exe..."
|
||||||
try {
|
try {
|
||||||
(New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
|
$wc = GetProxyEnabledWebClient
|
||||||
|
$wc.DownloadFile($NUGET_URL, $NUGET_EXE)
|
||||||
} catch {
|
} catch {
|
||||||
Throw "Could not download NuGet.exe."
|
Throw "Could not download NuGet.exe."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# These are automatic variables in PowerShell Core, but not in Windows PowerShell 5.x
|
||||||
|
if (-not (Test-Path variable:global:ismacos)) {
|
||||||
|
$IsLinux = $false
|
||||||
|
$IsMacOS = $false
|
||||||
|
}
|
||||||
|
|
||||||
# Save nuget.exe path to environment to be available to child processed
|
# Save nuget.exe path to environment to be available to child processed
|
||||||
$ENV:NUGET_EXE = $NUGET_EXE
|
$env:NUGET_EXE = $NUGET_EXE
|
||||||
|
$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
|
||||||
|
"mono `"$NUGET_EXE`""
|
||||||
|
} else {
|
||||||
|
"`"$NUGET_EXE`""
|
||||||
|
}
|
||||||
|
|
||||||
# Restore tools from NuGet?
|
# Restore tools from NuGet?
|
||||||
if(-Not $SkipToolPackageRestore.IsPresent) {
|
if(-Not $SkipToolPackageRestore.IsPresent) {
|
||||||
|
@ -157,24 +184,61 @@ if(-Not $SkipToolPackageRestore.IsPresent) {
|
||||||
Set-Location $TOOLS_DIR
|
Set-Location $TOOLS_DIR
|
||||||
|
|
||||||
# Check for changes in packages.config and remove installed tools if true.
|
# Check for changes in packages.config and remove installed tools if true.
|
||||||
[string] $md5Hash = MD5HashFile($PACKAGES_CONFIG)
|
[string] $md5Hash = MD5HashFile $PACKAGES_CONFIG
|
||||||
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
|
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
|
||||||
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
|
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
|
||||||
Write-Verbose -Message "Missing or changed package.config hash..."
|
Write-Verbose -Message "Missing or changed package.config hash..."
|
||||||
Remove-Item * -Recurse -Exclude packages.config,nuget.exe
|
Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
|
||||||
|
Remove-Item -Recurse -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Verbose -Message "Restoring tools from NuGet..."
|
Write-Verbose -Message "Restoring tools from NuGet..."
|
||||||
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
|
|
||||||
|
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
|
||||||
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
Throw "An error occured while restoring NuGet tools."
|
Throw "An error occurred while restoring NuGet tools."
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
|
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
|
||||||
}
|
}
|
||||||
Write-Verbose -Message ($NuGetOutput | out-string)
|
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 "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Throw "An error occurred 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 "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Throw "An error occurred while restoring NuGet modules."
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Verbose -Message ($NuGetOutput | Out-String)
|
||||||
|
|
||||||
Pop-Location
|
Pop-Location
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +247,23 @@ if (!(Test-Path $CAKE_EXE)) {
|
||||||
Throw "Could not find Cake.exe at $CAKE_EXE"
|
Throw "Could not find Cake.exe at $CAKE_EXE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
|
||||||
|
"mono `"$CAKE_EXE`""
|
||||||
|
} else {
|
||||||
|
"`"$CAKE_EXE`""
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build an array (not a string) of Cake arguments to be joined later
|
||||||
|
$cakeArguments = @()
|
||||||
|
if ($Script) { $cakeArguments += "`"$Script`"" }
|
||||||
|
if ($Target) { $cakeArguments += "--target=`"$Target`"" }
|
||||||
|
if ($Configuration) { $cakeArguments += "--configuration=$Configuration" }
|
||||||
|
if ($Verbosity) { $cakeArguments += "--verbosity=$Verbosity" }
|
||||||
|
if ($ShowDescription) { $cakeArguments += "--showdescription" }
|
||||||
|
if ($DryRun) { $cakeArguments += "--dryrun" }
|
||||||
|
$cakeArguments += $ScriptArgs
|
||||||
|
|
||||||
# Start Cake
|
# Start Cake
|
||||||
Write-Host "Running build script..."
|
Write-Host "Running build script..."
|
||||||
Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
|
Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")"
|
||||||
exit $LASTEXITCODE
|
exit $LASTEXITCODE
|
6
build.sh
6
build.sh
|
@ -56,7 +56,7 @@ if [ ! -f "$TOOLS_DIR/packages.config" ]; then
|
||||||
echo "Downloading packages.config..."
|
echo "Downloading packages.config..."
|
||||||
curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages
|
curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "An error occured while downloading packages.config."
|
echo "An error occurred while downloading packages.config."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -66,7 +66,7 @@ if [ ! -f "$NUGET_EXE" ]; then
|
||||||
echo "Downloading NuGet..."
|
echo "Downloading NuGet..."
|
||||||
curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
|
curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "An error occured while downloading nuget.exe."
|
echo "An error occurred while downloading nuget.exe."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -97,5 +97,5 @@ fi
|
||||||
if $SHOW_VERSION; then
|
if $SHOW_VERSION; then
|
||||||
exec mono "$CAKE_EXE" -version
|
exec mono "$CAKE_EXE" -version
|
||||||
else
|
else
|
||||||
exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
|
exec mono "$CAKE_EXE" $SCRIPT --verbosity=$VERBOSITY --configuration=$CONFIGURATION --target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
|
||||||
fi
|
fi
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Cake" version="0.37.0" />
|
<package id="Cake" version="1.1.0" />
|
||||||
</packages>
|
</packages>
|
||||||
|
|
Loading…
Reference in a new issue