mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 06:22:50 +08:00
update cakebuild script for windows and made windows build work
This commit is contained in:
parent
92ce87c61c
commit
9cb00ef159
@ -440,7 +440,8 @@ private void UploadFileToGitHubRelease(FilePath file)
|
|||||||
private void CompleteGitHubRelease()
|
private void CompleteGitHubRelease()
|
||||||
{
|
{
|
||||||
var json = $"{{ \"tag_name\": \"{versioning.NuGetVersion}\", \"target_commitish\": \"master\", \"name\": \"{versioning.NuGetVersion}\", \"body\": \"todo: notes coming\", \"draft\": false, \"prerelease\": false }}";
|
var json = $"{{ \"tag_name\": \"{versioning.NuGetVersion}\", \"target_commitish\": \"master\", \"name\": \"{versioning.NuGetVersion}\", \"body\": \"todo: notes coming\", \"draft\": false, \"prerelease\": false }}";
|
||||||
var content = new System.Net.Http.StringContent(json, System.Text.Encoding.UTF8, "application/json");
|
var request = new System.Net.Http.HttpRequestMessage(new System.Net.Http.HttpMethod("Patch"), $"https://api.github.com/repos/ThreeMammals/Ocelot/releases/{releaseId}");
|
||||||
|
request.Content = new System.Net.Http.StringContent(json, System.Text.Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
using(var client = new System.Net.Http.HttpClient())
|
using(var client = new System.Net.Http.HttpClient())
|
||||||
{
|
{
|
||||||
@ -452,7 +453,7 @@ private void CompleteGitHubRelease()
|
|||||||
|
|
||||||
client.DefaultRequestHeaders.Add("User-Agent", "Ocelot Release");
|
client.DefaultRequestHeaders.Add("User-Agent", "Ocelot Release");
|
||||||
|
|
||||||
var result = client.PatchAsync($"https://api.github.com/repos/ThreeMammals/Ocelot/releases/{releaseId}", content).Result;
|
var result = client.SendAsync(request).Result;
|
||||||
if(result.StatusCode != System.Net.HttpStatusCode.OK)
|
if(result.StatusCode != System.Net.HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
throw new Exception("CompleteGitHubRelease result.StatusCode = " + result.StatusCode);
|
throw new Exception("CompleteGitHubRelease result.StatusCode = " + result.StatusCode);
|
||||||
|
44
build.ps1
44
build.ps1
@ -59,7 +59,10 @@ try {
|
|||||||
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
|
# 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
|
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
|
||||||
# installed (.NET 4.5 is an in-place upgrade).
|
# 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
|
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
|
||||||
|
}
|
||||||
} catch {
|
} 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'
|
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'
|
||||||
}
|
}
|
||||||
@ -118,7 +121,7 @@ $MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
|
|||||||
# 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.
|
||||||
@ -155,7 +158,12 @@ if (!(Test-Path $NUGET_EXE)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# 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) {
|
||||||
@ -163,16 +171,17 @@ 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..."
|
||||||
Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
|
Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
|
||||||
Remove-Item -Recurse
|
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 occurred while restoring NuGet tools."
|
Throw "An error occurred while restoring NuGet tools."
|
||||||
@ -181,7 +190,7 @@ if(-Not $SkipToolPackageRestore.IsPresent) {
|
|||||||
{
|
{
|
||||||
$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
|
Pop-Location
|
||||||
}
|
}
|
||||||
@ -192,13 +201,13 @@ if (Test-Path $ADDINS_PACKAGES_CONFIG) {
|
|||||||
Set-Location $ADDINS_DIR
|
Set-Location $ADDINS_DIR
|
||||||
|
|
||||||
Write-Verbose -Message "Restoring addins from NuGet..."
|
Write-Verbose -Message "Restoring addins from NuGet..."
|
||||||
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
|
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
|
||||||
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
Throw "An error occurred while restoring NuGet addins."
|
Throw "An error occurred while restoring NuGet addins."
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Verbose -Message ($NuGetOutput | out-string)
|
Write-Verbose -Message ($NuGetOutput | Out-String)
|
||||||
|
|
||||||
Pop-Location
|
Pop-Location
|
||||||
}
|
}
|
||||||
@ -209,13 +218,13 @@ if (Test-Path $MODULES_PACKAGES_CONFIG) {
|
|||||||
Set-Location $MODULES_DIR
|
Set-Location $MODULES_DIR
|
||||||
|
|
||||||
Write-Verbose -Message "Restoring modules from NuGet..."
|
Write-Verbose -Message "Restoring modules from NuGet..."
|
||||||
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
|
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
|
||||||
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
Throw "An error occurred while restoring NuGet modules."
|
Throw "An error occurred while restoring NuGet modules."
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Verbose -Message ($NuGetOutput | out-string)
|
Write-Verbose -Message ($NuGetOutput | Out-String)
|
||||||
|
|
||||||
Pop-Location
|
Pop-Location
|
||||||
}
|
}
|
||||||
@ -225,11 +234,16 @@ 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
|
||||||
# Build Cake arguments
|
$cakeArguments = @()
|
||||||
$cakeArguments = @("$Script");
|
if ($Script) { $cakeArguments += "`"$Script`"" }
|
||||||
if ($Target) { $cakeArguments += "-target=$Target" }
|
if ($Target) { $cakeArguments += "-target=`"$Target`"" }
|
||||||
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
|
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
|
||||||
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
|
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
|
||||||
if ($ShowDescription) { $cakeArguments += "-showdescription" }
|
if ($ShowDescription) { $cakeArguments += "-showdescription" }
|
||||||
@ -238,5 +252,5 @@ $cakeArguments += $ScriptArgs
|
|||||||
|
|
||||||
# Start Cake
|
# Start Cake
|
||||||
Write-Host "Running build script..."
|
Write-Host "Running build script..."
|
||||||
&$CAKE_EXE $cakeArguments
|
Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")"
|
||||||
exit $LASTEXITCODE
|
exit $LASTEXITCODE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user