Skip to content

Commit

Permalink
upgrade to .net 9
Browse files Browse the repository at this point in the history
  • Loading branch information
brettfo committed Apr 12, 2024
1 parent be6c658 commit 2648277
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 49 deletions.
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
},
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "7.0"
"version": "9.0",
"additionalVersions": "7.0"
},
"ghcr.io/devcontainers/features/go:1": {
"version": "1.19"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "18"
"version": "20"
}
},
"containerEnv": {
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:
matrix:
value: [{ os: windows-latest, architecture: x64 }, { os: windows-latest, architecture: arm64 }, { os: ubuntu-latest, architecture: x64 }]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-dotnet@v3
- uses: actions/setup-node@v3
- uses: actions/setup-dotnet@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/setup-go@v3
node-version: 20
- uses: actions/setup-go@v5
with:
go-version: 1.19
- name: promote version suffix
Expand All @@ -42,12 +42,12 @@ jobs:
shell: pwsh
run: ./build-and-test.ps1 -configuration Release -architecture ${{ matrix.value.architecture }}
- name: publish artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}
path: ${{ env.artifact_path }}
- name: publish secondary artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: env.secondary_artifact_name != ''
with:
name: ${{ env.secondary_artifact_name }}
Expand All @@ -57,7 +57,7 @@ jobs:
runs-on: ubuntu-latest
needs: create-version-suffix
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: devcontainers/[email protected]
Expand All @@ -75,12 +75,12 @@ jobs:
Write-Output "$name=$updated" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
- name: publish artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}
path: ${{ env.artifact_path }}
- name: publish secondary artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: env.secondary_artifact_name != ''
with:
name: ${{ env.secondary_artifact_name }}
Expand All @@ -90,21 +90,21 @@ jobs:
runs-on: ubuntu-latest
needs: [build, cross_compile]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: create package feed data
run: ./src/create-package-feeds.sh --deb-dir artifacts/deb --deb-feed-path artifacts/deb-feed.tar.gz --win-dir artifacts/win --win-feed-path artifacts/win-feed.tar.gz
run: ./src/create-package-feeds.sh --artifacts-directory artifacts --deb-feed-path artifacts/deb-feed.tar.gz --win-feed-path artifacts/win-feed.tar.gz
- name: publish deb package feed artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: deb-feed
path: artifacts/deb-feed.tar.gz
- name: publish win package feed artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: win-feed
path: artifacts/win-feed.tar.gz
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/artifacts/bin/bcad/Debug/net7.0/bcad.exe",
"program": "${workspaceFolder}/artifacts/bin/bcad/Debug/net9.0/bcad.exe",
"args": [],
"cwd": "${workspaceFolder}/artifacts/bin/bcad/Debug/net7.0",
"cwd": "${workspaceFolder}/artifacts/bin/bcad/Debug/net9.0",
"console": "internalConsole",
"stopAtEntry": false
},
Expand Down
14 changes: 7 additions & 7 deletions build-and-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ try {
Push-Location "$PSScriptRoot/src/javascript-client"
npm i
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
if ($IsLinux -And $architecture -eq "arm64") {
# when cross-compiling for linux arm64, we specifically need the x64 version of icon-gen
npm install --platform=linux --arch=x64 icon-gen
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
npm run compile
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Pop-Location
Expand Down Expand Up @@ -105,18 +110,13 @@ try {
$artifactPath = "$packagesDir/$artifactName"
Set-EnvironmentVariable "artifact_name" $artifactName
Set-EnvironmentVariable "artifact_path" $artifactPath
if ($IsWindows) {
Compress-Archive -Path "$packageOutputDir" -DestinationPath $artifactPath -Force
Set-EnvironmentVariable "secondary_artifact_name" "win"
Set-EnvironmentVariable "secondary_artifact_path" $artifactPath
}
else {
if (-Not $IsWindows) {
$packageVersionPrefix = (Get-Content "$PSScriptRoot/version.txt" | Out-String).Trim()
$packageVersionSuffix = if ("$env:VERSION_SUFFIX" -eq "") { "0" } else { $env:VERSION_SUFFIX }
$packageVersion = "$packageVersionPrefix.$packageVersionSuffix"
$packageArchitecture = if ($architecture -eq "x64") { "amd64" } else { "arm64" }
$packageName = "bcad_${packageVersion}_$packageArchitecture.deb"
Set-EnvironmentVariable "secondary_artifact_name" "deb"
Set-EnvironmentVariable "secondary_artifact_name" "deb-$architecture"
Set-EnvironmentVariable "secondary_artifact_path" "$packagesDir/$packageName"
tar -zcf $artifactPath -C "$packageParentDir/" "$artifactShortName"
./build-package.sh --configuration $configuration --architecture $architecture
Expand Down
21 changes: 9 additions & 12 deletions create-package-feeds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,24 @@

_SCRIPT_DIR="$( cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P )"

DEB_DIR="."
ARTIFACTS_DIRECTORY="."
DEB_FEED_PATH="."
WIN_DIR="."
WIN_FEED_PATH="."

while [ $# -gt 0 ]; do
case "$1" in
--deb-feed-path)
DEB_FEED_PATH=$2
--artifacts-directory)
ARTIFACTS_DIRECTORY=$2
shift
;;
--deb-dir)
DEB_DIR=$2
--deb-feed-path)
DEB_FEED_PATH=$2
shift
;;
--win-feed-path)
WIN_FEED_PATH=$2
shift
;;
--win-dir)
WIN_DIR=$2
shift
;;
*)
echo "Invalid argument: $1"
exit 1
Expand All @@ -44,7 +39,8 @@ echo "package feed location: $destination"
packagesDir="$destination/deb"
poolMainDir="$packagesDir/pool/main"
mkdir -p "$poolMainDir"
cp -r $DEB_DIR/*.deb "$poolMainDir"
cp $ARTIFACTS_DIRECTORY/deb-x64/*.deb "$poolMainDir"
cp $ARTIFACTS_DIRECTORY/deb-arm64/*.deb "$poolMainDir"

# create Packages files
architectures='amd64 arm64'
Expand Down Expand Up @@ -72,7 +68,8 @@ tar -zcf $DEB_FEED_PATH -C "$destination/" deb
# copy in packages
winPackagesDir="$destination/win"
mkdir -p "$winPackagesDir"
cp -r $WIN_DIR/*.zip "$winPackagesDir"
cp $ARTIFACTS_DIRECTORY/bcad-win-x64.zip "$winPackagesDir"
cp $ARTIFACTS_DIRECTORY/bcad-win-arm64.zip "$winPackagesDir"

# copy install script
cp $_SCRIPT_DIR/install.ps1 "$winPackagesDir"
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.100",
"version": "9.0.100-preview.3.24204.13",
"rollForward": "latestMinor"
}
}
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<Import Project="Packages.props" />

<PropertyGroup>
<AppTargetFramework>net9.0</AppTargetFramework>
<AssemblySearchPaths>{HintPathFromItem};{TargetFrameworkDirectory};{RawFileName}</AssemblySearchPaths>
<RepoRoot>$(MSBuildThisFileDirectory)..</RepoRoot>
<_VersionSuffix>$(VERSION_SUFFIX)</_VersionSuffix>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>$(AppTargetFramework)</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>$(AppTargetFramework)</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/IxMilia.BCad.Core.Test/IxMilia.BCad.Core.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>$(AppTargetFramework)</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>$(AppTargetFramework)</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>$(AppTargetFramework)</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/IxMilia.BCad.Lisp.Test/IxMilia.BCad.Lisp.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>$(AppTargetFramework)</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/IxMilia.BCad.Rpc.Test/IxMilia.BCad.Rpc.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>$(AppTargetFramework)</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/IxMilia.BCad.Rpc/IxMilia.BCad.Rpc.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>$(AppTargetFramework)</TargetFramework>
<NoWarn>VSTHRD200;$(NoWarn)</NoWarn><!-- Use "Async" suffix in names of methods that return an awaitable type. -->
</PropertyGroup>

Expand Down
7 changes: 5 additions & 2 deletions src/bcad/bcad.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>$(AppTargetFramework)</TargetFramework>
<ApplicationIcon>$(MSBuildThisFileDirectory)..\javascript-client\out\app.ico</ApplicationIcon>
<NoWarn>$(NoWarn);IL2026</NoWarn> <!-- {0}: Using member '{1}}' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. -->
<NoWarn>$(NoWarn);IL2104</NoWarn> <!-- Assembly '{0}}' produced trim warnings. -->
<NoWarn>$(NoWarn);IL3000</NoWarn> <!-- {0}: 'System.Reflection.Assembly.Location.get' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'. -->
<NoWarn>$(NoWarn);IL3053</NoWarn> <!-- Assembly '{0}' produced AOT analysis warnings. -->
<OutputType Condition="'$(OS)' == 'Windows_NT'">WinExe</OutputType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<PublishAot>true</PublishAot>
<StripSymbols>true</StripSymbols>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 2648277

Please sign in to comment.