diff --git a/DotnetCliVersion.txt b/DotnetCliVersion.txt index 798deedf..3996bec9 100644 --- a/DotnetCliVersion.txt +++ b/DotnetCliVersion.txt @@ -1 +1 @@ -5.0.102 \ No newline at end of file +5.0.201 \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index e8ca7951..60bc1df8 100644 --- a/build.ps1 +++ b/build.ps1 @@ -4,9 +4,9 @@ Param( [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 ########################################################################### @@ -23,13 +23,14 @@ $DotNetCliVersion = Get-Content DotnetCliVersion.txt $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1 $env:DOTNET_CLI_TELEMETRY_OPTOUT = 1 -$env:NUGET_XMLDOC_MODE = "skip" +$env:DOTNET_MULTILEVEL_LOOKUP = 0 ########################################################################### # EXECUTION ########################################################################### function ExecSafe([scriptblock] $cmd) { + $LASTEXITCODE = 0 & $cmd 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)" - 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 { Write-Output $_.Exception.Message diff --git a/build.sh b/build.sh index c9d2c433..5565e1ef 100755 --- a/build.sh +++ b/build.sh @@ -1,16 +1,6 @@ #!/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 +bash --version 2>&1 | head -n 1 set -eo pipefail 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" -TEMP_DIRECTORY="$SCRIPT_DIR//.tmp" +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_GLOBAL_FILE="$SCRIPT_DIR/global.json" +DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh" DOTNET_CHANNEL="Current" export DOTNET_CLI_TELEMETRY_OPTOUT=1 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -export NUGET_XMLDOC_MODE="skip" +export DOTNET_MULTILEVEL_LOOKUP=0 ########################################################################### # EXECUTION @@ -74,22 +64,7 @@ elif [[ ! (-x "$DOTNET_EXE" && (-z ${DOTNET_VERSION+x} || $($DOTNET_EXE --versio 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)" -"$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 -- "$@" diff --git a/build/Build.cs b/build/Build.cs index f5f3e5cd..f0592e7d 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -100,7 +100,7 @@ namespace LibHacBuild gitRepository = (GitRepository)new GitRepositoryAttribute().GetValue(null, null); gitVersion = GitVersionTasks.GitVersion(s => s - .SetFramework("netcoreapp3.1") + .SetFramework("net5.0") .DisableProcessLogOutput()) .Result; } diff --git a/build/CodeGen/Stage1/ResultCodegen.cs b/build/CodeGen/Stage1/ResultCodegen.cs index 5b0368d2..e3f6007c 100644 --- a/build/CodeGen/Stage1/ResultCodegen.cs +++ b/build/CodeGen/Stage1/ResultCodegen.cs @@ -50,7 +50,7 @@ namespace LibHacBuild.CodeGen.Stage1 ModuleInfo[] modules = ReadCsv("result_modules.csv"); NamespaceInfo[] nsInfos = ReadCsv("result_namespaces.csv"); ResultInfo[] results = ReadCsv("results.csv"); - + Dictionary moduleDict = modules.ToDictionary(m => m.Id); // Make sure modules have a default namespace @@ -413,14 +413,17 @@ namespace LibHacBuild.CodeGen.Stage1 private static T[] ReadCsv(string name) { - using (var csv = new CsvReader(new StreamReader(GetResource(name)), CultureInfo.InvariantCulture)) + var configuration = new CsvConfiguration(CultureInfo.InvariantCulture) { - csv.Configuration.AllowComments = true; - csv.Configuration.DetectColumnCountChanges = true; + AllowComments = true, + DetectColumnCountChanges = true + }; - csv.Configuration.RegisterClassMap(); - csv.Configuration.RegisterClassMap(); - csv.Configuration.RegisterClassMap(); + using (var csv = new CsvReader(new StreamReader(GetResource(name)), configuration)) + { + csv.Context.RegisterClassMap(); + csv.Context.RegisterClassMap(); + csv.Context.RegisterClassMap(); return csv.GetRecords().ToArray(); } @@ -640,11 +643,11 @@ namespace LibHacBuild.CodeGen.Stage1 { Map(m => m.Id); 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)) - field = row.GetField("Name"); + field = row.Row.GetField("Name"); return field; }); @@ -657,11 +660,11 @@ namespace LibHacBuild.CodeGen.Stage1 { Map(m => m.Name).Name("Namespace"); 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)) - field = row.GetField("Namespace"); + field = row.Row.GetField("Namespace"); return field; }); @@ -678,18 +681,18 @@ namespace LibHacBuild.CodeGen.Stage1 Map(m => m.Summary); 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)) - field = row.GetField("DescriptionStart"); + field = row.Row.GetField("DescriptionStart"); 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; foreach (char c in field) diff --git a/build/CodeGen/_buildCodeGen.csproj b/build/CodeGen/_buildCodeGen.csproj index 71fc1ee2..9fa184c4 100644 --- a/build/CodeGen/_buildCodeGen.csproj +++ b/build/CodeGen/_buildCodeGen.csproj @@ -17,7 +17,7 @@ - + diff --git a/build/_build.csproj b/build/_build.csproj index b9371a5e..8350463c 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -10,11 +10,11 @@ - - - - - + + + + + diff --git a/tests/LibHac.Tests/LibHac.Tests.csproj b/tests/LibHac.Tests/LibHac.Tests.csproj index bc0e1136..0c35d458 100644 --- a/tests/LibHac.Tests/LibHac.Tests.csproj +++ b/tests/LibHac.Tests/LibHac.Tests.csproj @@ -8,7 +8,7 @@ - +