mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Update build scripts and build dependencies
This commit is contained in:
parent
12fe47c91c
commit
a5d41f5b1f
8 changed files with 43 additions and 76 deletions
|
@ -1 +1 @@
|
||||||
5.0.102
|
5.0.201
|
23
build.ps1
23
build.ps1
|
@ -4,9 +4,9 @@ Param(
|
||||||
[string[]]$BuildArguments
|
[string[]]$BuildArguments
|
||||||
)
|
)
|
||||||
|
|
||||||
Write-Output "Windows PowerShell $($Host.Version)"
|
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
|
||||||
|
|
||||||
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { exit 1 }
|
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
|
||||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -23,13 +23,14 @@ $DotNetCliVersion = Get-Content DotnetCliVersion.txt
|
||||||
|
|
||||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
|
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
|
||||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
|
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
|
||||||
$env:NUGET_XMLDOC_MODE = "skip"
|
$env:DOTNET_MULTILEVEL_LOOKUP = 0
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# EXECUTION
|
# EXECUTION
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
function ExecSafe([scriptblock] $cmd) {
|
function ExecSafe([scriptblock] $cmd) {
|
||||||
|
$LASTEXITCODE = 0
|
||||||
& $cmd
|
& $cmd
|
||||||
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
||||||
}
|
}
|
||||||
|
@ -69,22 +70,10 @@ try {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make sure we have a 3.1 runtime. At the time of writing GitVersion doesn't have a 5.0 build
|
|
||||||
# Remove when a 5.0 build is available
|
|
||||||
if((& $env:DOTNET_EXE --list-runtimes | Out-String) -notlike "*Microsoft.NETCore.App 3.1.*") {
|
|
||||||
|
|
||||||
# Download install script
|
|
||||||
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
|
|
||||||
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
|
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
||||||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
|
|
||||||
|
|
||||||
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel 3.1 -Runtime dotnet -NoPath }
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
|
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
|
||||||
|
|
||||||
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile -- $BuildArguments }
|
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
|
||||||
|
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Output $_.Exception.Message
|
Write-Output $_.Exception.Message
|
||||||
|
|
39
build.sh
39
build.sh
|
@ -1,16 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
echo $(bash --version 2>&1 | head -n 1)
|
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
|
set -eo pipefail
|
||||||
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||||
|
@ -20,15 +10,15 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
|
BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
|
||||||
TEMP_DIRECTORY="$SCRIPT_DIR//.tmp"
|
TEMP_DIRECTORY="$SCRIPT_DIR/.tmp"
|
||||||
|
|
||||||
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
|
DOTNET_GLOBAL_FILE="$SCRIPT_DIR/global.json"
|
||||||
DOTNET_INSTALL_URL="https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh"
|
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
|
||||||
DOTNET_CHANNEL="Current"
|
DOTNET_CHANNEL="Current"
|
||||||
|
|
||||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||||
export NUGET_XMLDOC_MODE="skip"
|
export DOTNET_MULTILEVEL_LOOKUP=0
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# EXECUTION
|
# EXECUTION
|
||||||
|
@ -74,22 +64,7 @@ elif [[ ! (-x "$DOTNET_EXE" && (-z ${DOTNET_VERSION+x} || $($DOTNET_EXE --versio
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure we have a 3.1 runtime. At the time of writing GitVersion doesn't have a 5.0 build
|
|
||||||
# Remove when a 5.0 build is available
|
|
||||||
if [[ $($DOTNET_EXE --list-runtimes) != *"Microsoft.NETCore.App 3.1."* ]]; then
|
|
||||||
|
|
||||||
# Download install script
|
|
||||||
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
|
|
||||||
mkdir -p "$TEMP_DIRECTORY"
|
|
||||||
|
|
||||||
if [ ! -x "$DOTNET_INSTALL_FILE" ]; then
|
|
||||||
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
|
|
||||||
chmod +x "$DOTNET_INSTALL_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel 3.1 --runtime dotnet --no-path
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
|
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
|
||||||
|
|
||||||
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" -- ${BUILD_ARGUMENTS[@]}
|
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
|
||||||
|
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace LibHacBuild
|
||||||
gitRepository = (GitRepository)new GitRepositoryAttribute().GetValue(null, null);
|
gitRepository = (GitRepository)new GitRepositoryAttribute().GetValue(null, null);
|
||||||
|
|
||||||
gitVersion = GitVersionTasks.GitVersion(s => s
|
gitVersion = GitVersionTasks.GitVersion(s => s
|
||||||
.SetFramework("netcoreapp3.1")
|
.SetFramework("net5.0")
|
||||||
.DisableProcessLogOutput())
|
.DisableProcessLogOutput())
|
||||||
.Result;
|
.Result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace LibHacBuild.CodeGen.Stage1
|
||||||
ModuleInfo[] modules = ReadCsv<ModuleInfo>("result_modules.csv");
|
ModuleInfo[] modules = ReadCsv<ModuleInfo>("result_modules.csv");
|
||||||
NamespaceInfo[] nsInfos = ReadCsv<NamespaceInfo>("result_namespaces.csv");
|
NamespaceInfo[] nsInfos = ReadCsv<NamespaceInfo>("result_namespaces.csv");
|
||||||
ResultInfo[] results = ReadCsv<ResultInfo>("results.csv");
|
ResultInfo[] results = ReadCsv<ResultInfo>("results.csv");
|
||||||
|
|
||||||
Dictionary<int, ModuleInfo> moduleDict = modules.ToDictionary(m => m.Id);
|
Dictionary<int, ModuleInfo> moduleDict = modules.ToDictionary(m => m.Id);
|
||||||
|
|
||||||
// Make sure modules have a default namespace
|
// Make sure modules have a default namespace
|
||||||
|
@ -413,14 +413,17 @@ namespace LibHacBuild.CodeGen.Stage1
|
||||||
|
|
||||||
private static T[] ReadCsv<T>(string name)
|
private static T[] ReadCsv<T>(string name)
|
||||||
{
|
{
|
||||||
using (var csv = new CsvReader(new StreamReader(GetResource(name)), CultureInfo.InvariantCulture))
|
var configuration = new CsvConfiguration(CultureInfo.InvariantCulture)
|
||||||
{
|
{
|
||||||
csv.Configuration.AllowComments = true;
|
AllowComments = true,
|
||||||
csv.Configuration.DetectColumnCountChanges = true;
|
DetectColumnCountChanges = true
|
||||||
|
};
|
||||||
|
|
||||||
csv.Configuration.RegisterClassMap<ModuleMap>();
|
using (var csv = new CsvReader(new StreamReader(GetResource(name)), configuration))
|
||||||
csv.Configuration.RegisterClassMap<NamespaceMap>();
|
{
|
||||||
csv.Configuration.RegisterClassMap<ResultMap>();
|
csv.Context.RegisterClassMap<ModuleMap>();
|
||||||
|
csv.Context.RegisterClassMap<NamespaceMap>();
|
||||||
|
csv.Context.RegisterClassMap<ResultMap>();
|
||||||
|
|
||||||
return csv.GetRecords<T>().ToArray();
|
return csv.GetRecords<T>().ToArray();
|
||||||
}
|
}
|
||||||
|
@ -640,11 +643,11 @@ namespace LibHacBuild.CodeGen.Stage1
|
||||||
{
|
{
|
||||||
Map(m => m.Id);
|
Map(m => m.Id);
|
||||||
Map(m => m.Name);
|
Map(m => m.Name);
|
||||||
Map(m => m.Namespace).ConvertUsing(row =>
|
Map(m => m.Namespace).Convert(row =>
|
||||||
{
|
{
|
||||||
string field = row.GetField("Default Namespace");
|
string field = row.Row.GetField("Default Namespace");
|
||||||
if (string.IsNullOrWhiteSpace(field))
|
if (string.IsNullOrWhiteSpace(field))
|
||||||
field = row.GetField("Name");
|
field = row.Row.GetField("Name");
|
||||||
|
|
||||||
return field;
|
return field;
|
||||||
});
|
});
|
||||||
|
@ -657,11 +660,11 @@ namespace LibHacBuild.CodeGen.Stage1
|
||||||
{
|
{
|
||||||
Map(m => m.Name).Name("Namespace");
|
Map(m => m.Name).Name("Namespace");
|
||||||
Map(m => m.Path);
|
Map(m => m.Path);
|
||||||
Map(m => m.ClassName).ConvertUsing(row =>
|
Map(m => m.ClassName).Convert(row =>
|
||||||
{
|
{
|
||||||
string field = row.GetField("Class Name");
|
string field = row.Row.GetField("Class Name");
|
||||||
if (string.IsNullOrWhiteSpace(field))
|
if (string.IsNullOrWhiteSpace(field))
|
||||||
field = row.GetField("Namespace");
|
field = row.Row.GetField("Namespace");
|
||||||
|
|
||||||
return field;
|
return field;
|
||||||
});
|
});
|
||||||
|
@ -678,18 +681,18 @@ namespace LibHacBuild.CodeGen.Stage1
|
||||||
Map(m => m.Summary);
|
Map(m => m.Summary);
|
||||||
|
|
||||||
Map(m => m.DescriptionStart);
|
Map(m => m.DescriptionStart);
|
||||||
Map(m => m.DescriptionEnd).ConvertUsing(row =>
|
Map(m => m.DescriptionEnd).Convert(row =>
|
||||||
{
|
{
|
||||||
string field = row.GetField("DescriptionEnd");
|
string field = row.Row.GetField("DescriptionEnd");
|
||||||
if (string.IsNullOrWhiteSpace(field))
|
if (string.IsNullOrWhiteSpace(field))
|
||||||
field = row.GetField("DescriptionStart");
|
field = row.Row.GetField("DescriptionStart");
|
||||||
|
|
||||||
return int.Parse(field);
|
return int.Parse(field);
|
||||||
});
|
});
|
||||||
|
|
||||||
Map(m => m.Flags).ConvertUsing(row =>
|
Map(m => m.Flags).Convert(row =>
|
||||||
{
|
{
|
||||||
string field = row.GetField("Flags");
|
string field = row.Row.GetField("Flags");
|
||||||
var flags = ResultInfoFlags.None;
|
var flags = ResultInfoFlags.None;
|
||||||
|
|
||||||
foreach (char c in field)
|
foreach (char c in field)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Nuke.Common" Version="5.0.0" />
|
<PackageReference Include="Nuke.Common" Version="5.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageDownload Include="GitVersion.Tool" Version="[5.1.3]" />
|
<PackageDownload Include="GitVersion.Tool" Version="[5.6.6]" />
|
||||||
<PackageReference Include="CsvHelper" Version="16.0.0" />
|
<PackageReference Include="CsvHelper" Version="26.0.1" />
|
||||||
<PackageReference Include="NuGet.CommandLine" Version="5.7.0" />
|
<PackageReference Include="NuGet.CommandLine" Version="5.8.1" />
|
||||||
<PackageReference Include="Nuke.Common" Version="5.0.0" />
|
<PackageReference Include="Nuke.Common" Version="5.0.2" />
|
||||||
<PackageReference Include="SharpZipLib" Version="1.3.0" />
|
<PackageReference Include="SharpZipLib" Version="1.3.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
|
||||||
<PackageReference Include="xunit.core" Version="2.4.1" />
|
<PackageReference Include="xunit.core" Version="2.4.1" />
|
||||||
<PackageReference Include="xunit.analyzers" Version="0.10.0" />
|
<PackageReference Include="xunit.analyzers" Version="0.10.0" />
|
||||||
<PackageReference Include="xunit.assert.source" Version="2.4.1" />
|
<PackageReference Include="xunit.assert.source" Version="2.4.1" />
|
||||||
|
|
Loading…
Reference in a new issue