Skip to content

Commit

Permalink
Switch to .NET 8 and update build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollo3zehn committed Feb 20, 2024
1 parent 65c8638 commit e3e2634
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# How to format:
# (1) Add dotnet_diagnostic.XXXX.severity = error
# (2) Run dotnet-format: dotnet format --diagnostics XXXX

[*.cs]
# "run cleanup": https://betterprogramming.pub/enforce-net-code-style-with-editorconfig-d2f0d79091ac
# TODO: build real editorconfig file: https://github.com/dotnet/roslyn/blob/main/.editorconfig
Expand Down
3 changes: 2 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworkVersion>net6.0</TargetFrameworkVersion>
<TargetFrameworkVersion>net8.0</TargetFrameworkVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources>
https://www.myget.org/F/apollo3zehn-dev/api/v3/index.json
</RestoreAdditionalProjectSources>
Expand Down
4 changes: 2 additions & 2 deletions build/print_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

build = sys.argv[1]
is_final_build = sys.argv[2] == "true"
as_pypi_version = sys.argv[3] == "true"
version_type = sys.argv[3]

if is_final_build:
build = None

print(version.get_version(build, as_pypi_version))
print(version.get_version(build, version_type))
1 change: 0 additions & 1 deletion build/release.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import itertools
import subprocess
import sys
import re
Expand Down
6 changes: 3 additions & 3 deletions build/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from typing import Optional


def get_version(build: Optional[str], as_pypi_version: bool = False) -> str:
def get_version(build: Optional[str], version_type: str = "default") -> str:

with open("version.json", "r") as fh:
version_data = json.load(fh)

# version
version = version_data["version"]
suffix = version_data["suffix"]
Expand All @@ -17,7 +17,7 @@ def get_version(build: Optional[str], as_pypi_version: bool = False) -> str:
if build:

# PEP440 does not support SemVer versioning (https://semver.org/#spec-item-9)
if as_pypi_version:
if version_type == "pypi":
version = f"{version}{int(build):03d}"

else:
Expand Down
4 changes: 3 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project>

<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<Import Project="Directory.Build.props.overrides" Condition="exists('Directory.Build.props.overrides')" />

<PropertyGroup>
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
Expand All @@ -10,6 +11,7 @@
</PropertyGroup>

<PropertyGroup Condition="$(VERSION) != ''">
<InformationalVersion>$(VERSION)+$(GITHUB_SHA)</InformationalVersion>
<AssemblyVersion>$(VERSION.Split('.')[0]).0.0.0</AssemblyVersion>
<FileVersion>$(VERSION.Split('.')[0]).$(VERSION.Split('.')[1]).$(VERSION.Split('.')[2].Split('-')[0]).0</FileVersion>
</PropertyGroup>
Expand Down

0 comments on commit e3e2634

Please sign in to comment.