mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Add build script (#20)
This commit is contained in:
parent
3d50085e22
commit
bb14125542
352 changed files with 493 additions and 13 deletions
2
.gitattributes
vendored
2
.gitattributes
vendored
|
@ -2,6 +2,8 @@
|
||||||
# Set default behavior to automatically normalize line endings.
|
# Set default behavior to automatically normalize line endings.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
* text=auto
|
* text=auto
|
||||||
|
*.sh text eol=lf
|
||||||
|
*.cs text eol=crlf
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Set default behavior for command prompt diff.
|
# Set default behavior for command prompt diff.
|
||||||
|
|
0
.nuke
Normal file
0
.nuke
Normal file
1
DotnetCliVersion.txt
Normal file
1
DotnetCliVersion.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
2.1.500
|
16
LibHac.sln
16
LibHac.sln
|
@ -3,17 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.27703.2026
|
VisualStudioVersion = 15.0.27703.2026
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibHac", "LibHac\LibHac.csproj", "{FFCA6C31-D9D4-4ED8-A06D-0CC6B94422B8}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibHac", "src\LibHac\LibHac.csproj", "{FFCA6C31-D9D4-4ED8-A06D-0CC6B94422B8}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "hactoolnet", "hactoolnet\hactoolnet.csproj", "{B1633A64-125F-40A3-9E15-654B4DE5FD98}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "hactoolnet", "src\hactoolnet\hactoolnet.csproj", "{B1633A64-125F-40A3-9E15-654B4DE5FD98}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibHac.Nand", "LibHac.Nand\LibHac.Nand.csproj", "{AB503D24-F702-4E6E-B615-A9C7BDA218D1}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibHac.Nand", "src\LibHac.Nand\LibHac.Nand.csproj", "{AB503D24-F702-4E6E-B615-A9C7BDA218D1}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NandReader", "NandReader\NandReader.csproj", "{9889C467-284F-4061-B4DB-EC94051C29C0}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NandReader", "src\NandReader\NandReader.csproj", "{9889C467-284F-4061-B4DB-EC94051C29C0}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NandReaderGui", "NandReaderGui\NandReaderGui.csproj", "{3CBD38B0-6575-4768-8E94-A8AF2D2C9F43}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NandReaderGui", "src\NandReaderGui\NandReaderGui.csproj", "{3CBD38B0-6575-4768-8E94-A8AF2D2C9F43}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibHac.Tests", "LibHac.Tests\LibHac.Tests.csproj", "{679C89BD-5FDF-4CC2-9129-ABABD759035B}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibHac.Tests", "tests\LibHac.Tests\LibHac.Tests.csproj", "{679C89BD-5FDF-4CC2-9129-ABABD759035B}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{C7150117-90B8-4083-8141-BBC35C9F44F6}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -43,6 +45,8 @@ Global
|
||||||
{679C89BD-5FDF-4CC2-9129-ABABD759035B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{679C89BD-5FDF-4CC2-9129-ABABD759035B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{679C89BD-5FDF-4CC2-9129-ABABD759035B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{679C89BD-5FDF-4CC2-9129-ABABD759035B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{679C89BD-5FDF-4CC2-9129-ABABD759035B}.Release|Any CPU.Build.0 = Release|Any CPU
|
{679C89BD-5FDF-4CC2-9129-ABABD759035B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C7150117-90B8-4083-8141-BBC35C9F44F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C7150117-90B8-4083-8141-BBC35C9F44F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
5
appveyor.yml
Normal file
5
appveyor.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
version: 0.1.3-{build}
|
||||||
|
image: Visual Studio 2017
|
||||||
|
build_script:
|
||||||
|
- ps: .\build.ps1
|
||||||
|
test: off
|
1
build.bat
Normal file
1
build.bat
Normal file
|
@ -0,0 +1 @@
|
||||||
|
powershell -ExecutionPolicy Bypass -NoProfile -File .\build.ps1 -configuration Release
|
77
build.ps1
Normal file
77
build.ps1
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
#[switch]$CustomParam,
|
||||||
|
[Parameter(Position = 0, Mandatory = $false, ValueFromRemainingArguments = $true)]
|
||||||
|
[string[]]$BuildArguments
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Output "Windows PowerShell $($Host.Version)"
|
||||||
|
|
||||||
|
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { exit 1 }
|
||||||
|
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
# CONFIGURATION
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
|
||||||
|
$TempDirectory = "$PSScriptRoot\\.tmp"
|
||||||
|
|
||||||
|
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
|
||||||
|
$DotNetInstallUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1"
|
||||||
|
$DotNetChannel = "Current"
|
||||||
|
$DotNetCliVersion = Get-Content DotnetCliVersion.txt
|
||||||
|
|
||||||
|
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
|
||||||
|
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
|
||||||
|
$env:NUGET_XMLDOC_MODE = "skip"
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
# EXECUTION
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
function ExecSafe([scriptblock] $cmd) {
|
||||||
|
& $cmd
|
||||||
|
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$json = "{`"sdk`":{`"version`":`"$DotNetCliVersion`"}}"
|
||||||
|
Out-File -FilePath $DotNetGlobalFile -Encoding utf8 -InputObject $json
|
||||||
|
|
||||||
|
# If global.json exists, load expected version
|
||||||
|
if (Test-Path $DotNetGlobalFile) {
|
||||||
|
$DotNetVersion = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json).sdk.version
|
||||||
|
}
|
||||||
|
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
|
||||||
|
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
|
||||||
|
(!(Test-Path variable:DotNetVersion) -or $(& cmd /c 'dotnet --version 2>&1') -eq $DotNetVersion)) {
|
||||||
|
$env:DOTNET_EXE = (Get-Command "dotnet").Path
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$DotNetDirectory = "$TempDirectory\dotnet-win"
|
||||||
|
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
|
||||||
|
|
||||||
|
# Download install script
|
||||||
|
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
|
||||||
|
mkdir -force $TempDirectory > $null
|
||||||
|
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
|
||||||
|
|
||||||
|
# Install by channel or version
|
||||||
|
if (!(Test-Path variable:DotNetVersion)) {
|
||||||
|
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
|
||||||
|
|
||||||
|
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile -- $BuildArguments }
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
if (Test-Path $DotNetGlobalFile) {
|
||||||
|
Remove-Item $DotNetGlobalFile
|
||||||
|
}
|
||||||
|
}
|
75
build.sh
Normal file
75
build.sh
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo $(bash --version 2>&1 | head -n 1)
|
||||||
|
|
||||||
|
#CUSTOMPARAM=0
|
||||||
|
BUILD_ARGUMENTS=()
|
||||||
|
for i in "$@"; do
|
||||||
|
case $(echo $1 | awk '{print tolower($0)}') in
|
||||||
|
# -custom-param) CUSTOMPARAM=1;;
|
||||||
|
*) BUILD_ARGUMENTS+=("$1") ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
# CONFIGURATION
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
|
||||||
|
TEMP_DIRECTORY="$SCRIPT_DIR//.tmp"
|
||||||
|
|
||||||
|
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
|
||||||
|
DOTNET_INSTALL_URL="https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh"
|
||||||
|
DOTNET_CHANNEL="Current"
|
||||||
|
|
||||||
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||||
|
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||||
|
export NUGET_XMLDOC_MODE="skip"
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
# EXECUTION
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
function FirstJsonValue {
|
||||||
|
perl -nle 'print $1 if m{"'$1'": "([^"\-]+)",?}' <<< ${@:2}
|
||||||
|
}
|
||||||
|
trap "rm -f $DOTNET_GLOBAL_FILE" INT TERM EXIT
|
||||||
|
|
||||||
|
dotnetCliVersion=$(cat DotnetCliVersion.txt)
|
||||||
|
|
||||||
|
json="{\"sdk\":{\"version\":\"$dotnetCliVersion\"}}"
|
||||||
|
echo "$json" > $DOTNET_GLOBAL_FILE
|
||||||
|
|
||||||
|
# If global.json exists, load expected version
|
||||||
|
if [ -f "$DOTNET_GLOBAL_FILE" ]; then
|
||||||
|
DOTNET_VERSION=$dotnetCliVersion
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
|
||||||
|
if [[ -x "$(command -v dotnet)" && (-z ${DOTNET_VERSION+x} || $(dotnet --version) == "$DOTNET_VERSION") ]]; then
|
||||||
|
export DOTNET_EXE="$(command -v dotnet)"
|
||||||
|
else
|
||||||
|
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
|
||||||
|
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
|
||||||
|
|
||||||
|
# Download install script
|
||||||
|
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
|
||||||
|
mkdir -p "$TEMP_DIRECTORY"
|
||||||
|
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
|
||||||
|
chmod +x "$DOTNET_INSTALL_FILE"
|
||||||
|
|
||||||
|
# Install by channel or version
|
||||||
|
if [ -z ${DOTNET_VERSION+x} ]; then
|
||||||
|
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
|
||||||
|
else
|
||||||
|
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
|
||||||
|
|
||||||
|
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" -- ${BUILD_ARGUMENTS[@]}
|
268
build/Build.cs
Normal file
268
build/Build.cs
Normal file
|
@ -0,0 +1,268 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using ICSharpCode.SharpZipLib.Zip;
|
||||||
|
using ILRepacking;
|
||||||
|
using Nuke.Common;
|
||||||
|
using Nuke.Common.Git;
|
||||||
|
using Nuke.Common.ProjectModel;
|
||||||
|
using Nuke.Common.Tools.DotNet;
|
||||||
|
using static Nuke.Common.IO.FileSystemTasks;
|
||||||
|
using static Nuke.Common.IO.PathConstruction;
|
||||||
|
using static Nuke.Common.Tools.DotNet.DotNetTasks;
|
||||||
|
|
||||||
|
class Build : NukeBuild
|
||||||
|
{
|
||||||
|
public static int Main() => Execute<Build>(x => x.Results);
|
||||||
|
|
||||||
|
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
|
||||||
|
readonly string Configuration = IsLocalBuild ? "Debug" : "Release";
|
||||||
|
|
||||||
|
[Solution("LibHac.sln")] readonly Solution Solution;
|
||||||
|
[GitRepository] readonly GitRepository GitRepository;
|
||||||
|
|
||||||
|
AbsolutePath SourceDirectory => RootDirectory / "src";
|
||||||
|
AbsolutePath TestsDirectory => RootDirectory / "tests";
|
||||||
|
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
|
||||||
|
AbsolutePath TempDirectory => RootDirectory / ".tmp";
|
||||||
|
AbsolutePath CliCoreDir => TempDirectory / "hactoolnet_netcoreapp2.1";
|
||||||
|
AbsolutePath CliFrameworkDir => TempDirectory / "hactoolnet_net46";
|
||||||
|
AbsolutePath CliFrameworkZip => ArtifactsDirectory / "hactoolnet.zip";
|
||||||
|
AbsolutePath CliCoreZip => ArtifactsDirectory / "hactoolnet_netcore.zip";
|
||||||
|
|
||||||
|
AbsolutePath CliMergedExe => ArtifactsDirectory / "hactoolnet.exe";
|
||||||
|
|
||||||
|
Project LibHacProject => Solution.GetProject("LibHac").NotNull();
|
||||||
|
Project LibHacTestProject => Solution.GetProject("LibHac.Tests").NotNull();
|
||||||
|
Project HactoolnetProject => Solution.GetProject("hactoolnet").NotNull();
|
||||||
|
|
||||||
|
Target Clean => _ => _
|
||||||
|
.Executes(() =>
|
||||||
|
{
|
||||||
|
DeleteDirectories(GlobDirectories(SourceDirectory, "**/bin", "**/obj"));
|
||||||
|
DeleteDirectories(GlobDirectories(TestsDirectory, "**/bin", "**/obj"));
|
||||||
|
EnsureCleanDirectory(ArtifactsDirectory);
|
||||||
|
EnsureCleanDirectory(CliCoreDir);
|
||||||
|
EnsureCleanDirectory(CliFrameworkDir);
|
||||||
|
});
|
||||||
|
|
||||||
|
Target Restore => _ => _
|
||||||
|
.DependsOn(Clean)
|
||||||
|
.Executes(() =>
|
||||||
|
{
|
||||||
|
var settings = new DotNetRestoreSettings()
|
||||||
|
.SetProjectFile(Solution);
|
||||||
|
|
||||||
|
if (EnvironmentInfo.IsUnix) settings = settings.RemoveRuntimes("net46");
|
||||||
|
|
||||||
|
DotNetRestore(s => settings);
|
||||||
|
});
|
||||||
|
|
||||||
|
Target Compile => _ => _
|
||||||
|
.DependsOn(Restore)
|
||||||
|
.Executes(() =>
|
||||||
|
{
|
||||||
|
var buildSettings = new DotNetBuildSettings()
|
||||||
|
.SetProjectFile(Solution)
|
||||||
|
.EnableNoRestore()
|
||||||
|
.SetConfiguration(Configuration);
|
||||||
|
|
||||||
|
if (EnvironmentInfo.IsUnix) buildSettings = buildSettings.SetFramework("netcoreapp2.1");
|
||||||
|
|
||||||
|
DotNetBuild(s => buildSettings);
|
||||||
|
|
||||||
|
var publishSettings = new DotNetPublishSettings()
|
||||||
|
.EnableNoRestore()
|
||||||
|
.SetConfiguration(Configuration);
|
||||||
|
|
||||||
|
DotNetPublish(s => publishSettings
|
||||||
|
.SetProject(HactoolnetProject)
|
||||||
|
.SetFramework("netcoreapp2.1")
|
||||||
|
.SetOutput(CliCoreDir));
|
||||||
|
|
||||||
|
if (EnvironmentInfo.IsWin)
|
||||||
|
{
|
||||||
|
DotNetPublish(s => publishSettings
|
||||||
|
.SetProject(HactoolnetProject)
|
||||||
|
.SetFramework("net46")
|
||||||
|
.SetOutput(CliFrameworkDir));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hack around OS newline differences
|
||||||
|
if (EnvironmentInfo.IsUnix)
|
||||||
|
{
|
||||||
|
foreach (string filename in Directory.EnumerateFiles(CliCoreDir, "*.json"))
|
||||||
|
{
|
||||||
|
ReplaceLineEndings(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Target Pack => _ => _
|
||||||
|
.DependsOn(Compile)
|
||||||
|
.Executes(() =>
|
||||||
|
{
|
||||||
|
var settings = new DotNetPackSettings()
|
||||||
|
.SetProject(LibHacProject)
|
||||||
|
.EnableNoBuild()
|
||||||
|
.SetConfiguration(Configuration)
|
||||||
|
.EnableIncludeSymbols()
|
||||||
|
.SetOutputDirectory(ArtifactsDirectory);
|
||||||
|
|
||||||
|
if (EnvironmentInfo.IsUnix)
|
||||||
|
settings = settings.SetProperties(
|
||||||
|
new Dictionary<string, object> { ["TargetFrameworks"] = "netcoreapp2.1" });
|
||||||
|
|
||||||
|
DotNetPack(s => settings);
|
||||||
|
|
||||||
|
if (Host != HostType.AppVeyor) return;
|
||||||
|
|
||||||
|
foreach (string filename in Directory.EnumerateFiles(ArtifactsDirectory, "*.nupkg"))
|
||||||
|
{
|
||||||
|
PushArtifact(filename);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Target Merge => _ => _
|
||||||
|
.DependsOn(Compile)
|
||||||
|
.OnlyWhen(() => EnvironmentInfo.IsWin)
|
||||||
|
.Executes(() =>
|
||||||
|
{
|
||||||
|
string[] libraries = Directory.GetFiles(CliFrameworkDir, "*.dll");
|
||||||
|
var cliList = new List<string> { CliFrameworkDir / "hactoolnet.exe" };
|
||||||
|
cliList.AddRange(libraries);
|
||||||
|
|
||||||
|
var cliOptions = new RepackOptions
|
||||||
|
{
|
||||||
|
OutputFile = CliMergedExe,
|
||||||
|
InputAssemblies = cliList.ToArray(),
|
||||||
|
SearchDirectories = new[] { "." }
|
||||||
|
};
|
||||||
|
|
||||||
|
new ILRepack(cliOptions).Repack();
|
||||||
|
|
||||||
|
if (Host == HostType.AppVeyor)
|
||||||
|
{
|
||||||
|
PushArtifact(CliMergedExe);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Target Test => _ => _
|
||||||
|
.DependsOn(Compile)
|
||||||
|
.Executes(() =>
|
||||||
|
{
|
||||||
|
var settings = new DotNetTestSettings()
|
||||||
|
.SetProjectFile(LibHacTestProject)
|
||||||
|
.EnableNoBuild()
|
||||||
|
.SetConfiguration(Configuration);
|
||||||
|
|
||||||
|
if (EnvironmentInfo.IsUnix) settings = settings.SetFramework("netcoreapp2.1");
|
||||||
|
|
||||||
|
DotNetTest(s => settings);
|
||||||
|
});
|
||||||
|
|
||||||
|
Target Zip => _ => _
|
||||||
|
.DependsOn(Pack)
|
||||||
|
.Executes(() =>
|
||||||
|
{
|
||||||
|
string[] namesFx = Directory.EnumerateFiles(CliFrameworkDir, "*.exe")
|
||||||
|
.Concat(Directory.EnumerateFiles(CliFrameworkDir, "*.dll"))
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
string[] namesCore = Directory.EnumerateFiles(CliCoreDir, "*.json")
|
||||||
|
.Concat(Directory.EnumerateFiles(CliCoreDir, "*.dll"))
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
if (EnvironmentInfo.IsWin)
|
||||||
|
{
|
||||||
|
ZipFiles(CliFrameworkZip, namesFx);
|
||||||
|
Console.WriteLine($"Created {CliFrameworkZip}");
|
||||||
|
}
|
||||||
|
|
||||||
|
ZipFiles(CliCoreZip, namesCore);
|
||||||
|
Console.WriteLine($"Created {CliCoreZip}");
|
||||||
|
|
||||||
|
if (Host == HostType.AppVeyor)
|
||||||
|
{
|
||||||
|
PushArtifact(CliFrameworkZip);
|
||||||
|
PushArtifact(CliCoreZip);
|
||||||
|
PushArtifact(CliMergedExe);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Target Results => _ => _
|
||||||
|
.DependsOn(Test, Zip, Merge)
|
||||||
|
.Executes(() =>
|
||||||
|
{
|
||||||
|
Console.WriteLine("SHA-1:");
|
||||||
|
using (SHA1 sha = SHA1.Create())
|
||||||
|
{
|
||||||
|
foreach (string filename in Directory.EnumerateFiles(ArtifactsDirectory))
|
||||||
|
{
|
||||||
|
using (var stream = new FileStream(filename, FileMode.Open))
|
||||||
|
{
|
||||||
|
string hash = BitConverter.ToString(sha.ComputeHash(stream)).Replace("-", "");
|
||||||
|
Console.WriteLine($"{hash} - {Path.GetFileName(filename)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
public static void ZipFiles(string outFile, string[] files)
|
||||||
|
{
|
||||||
|
using (var s = new ZipOutputStream(File.Create(outFile)))
|
||||||
|
{
|
||||||
|
s.SetLevel(9);
|
||||||
|
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
var entry = new ZipEntry(Path.GetFileName(file));
|
||||||
|
entry.DateTime = DateTime.UnixEpoch;
|
||||||
|
|
||||||
|
using (FileStream fs = File.OpenRead(file))
|
||||||
|
{
|
||||||
|
entry.Size = fs.Length;
|
||||||
|
s.PutNextEntry(entry);
|
||||||
|
fs.CopyTo(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PushArtifact(string path)
|
||||||
|
{
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Unable to add artifact {path}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var psi = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "appveyor",
|
||||||
|
Arguments = $"PushArtifact \"{path}\"",
|
||||||
|
UseShellExecute = false,
|
||||||
|
RedirectStandardOutput = true,
|
||||||
|
RedirectStandardError = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var proc = new Process
|
||||||
|
{
|
||||||
|
StartInfo = psi
|
||||||
|
};
|
||||||
|
|
||||||
|
proc.Start();
|
||||||
|
|
||||||
|
proc.WaitForExit();
|
||||||
|
|
||||||
|
Console.WriteLine($"Added AppVeyor artifact {path}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReplaceLineEndings(string filename)
|
||||||
|
{
|
||||||
|
string text = File.ReadAllText(filename);
|
||||||
|
File.WriteAllText(filename, text.Replace("\n", "\r\n"));
|
||||||
|
}
|
||||||
|
}
|
24
build/_build.csproj
Normal file
24
build/_build.csproj
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
<RootNamespace></RootNamespace>
|
||||||
|
<IsPackable>False</IsPackable>
|
||||||
|
<NoWarn>CS0649;CS0169</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Nuke.Common" Version="0.12.0" />
|
||||||
|
<PackageReference Include="SharpZipLib" Version="1.0.0" />
|
||||||
|
<PackageReference Include="ILRepack.Lib" Version="2.0.16" NoWarn="NU1701" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<NukeMetadata Include="**\*.json" Exclude="bin\**;obj\**" />
|
||||||
|
<NukeExternalFiles Include="**\*.*.ext" Exclude="bin\**;obj\**" />
|
||||||
|
<None Remove="*.csproj.DotSettings;*.ref.*.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
23
build/_build.csproj.DotSettings
Normal file
23
build/_build.csproj.DotSettings
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/ImplicitNullability/EnableFields/@EntryValue">False</s:Boolean>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Implicit</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_PRIVATE_MODIFIER/@EntryValue">Implicit</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/METHOD_OR_OPERATOR_BODY/@EntryValue">ExpressionBody</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">0</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
|
||||||
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">False</s:Boolean>
|
||||||
|
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/MAX_ATTRIBUTE_LENGTH_FOR_SAME_LINE/@EntryValue">120</s:Int64>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">IF_OWNER_IS_SINGLE_LINE</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
|
||||||
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue