Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSBuild common properties #3843

Merged
merged 23 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fc12818
chore: Common properties
s2quake Jun 20, 2024
439c75c
chore: Set lang version to common properties
s2quake Jun 20, 2024
a3caed6
chore: Remove RootNamespace property.
s2quake Jun 20, 2024
880f0e8
chore: Remove AssemblyName property.
s2quake Jun 20, 2024
79a1ba8
chore: Set the value of the Nullable property for all projects to enable
s2quake Jun 20, 2024
74c356d
chore: Cleanup properties for dotnet packing.
s2quake Jun 20, 2024
5586a71
style: Fix errors and warnings caused by using TargetFramework net6.0
s2quake Jun 20, 2024
95a0af7
chore: Normalize SonarAnalyzer.CSharp-related package reference.
s2quake Jun 20, 2024
3597d8a
chore: Normalize Menees.Analyzers.2017-related package reference.
s2quake Jun 20, 2024
9cb6b2a
chore: Normalize CodeAnalysisRuleSet property.
s2quake Jun 20, 2024
e5a3841
chore: Normalize test-related package reference.
s2quake Jun 20, 2024
a0ea4de
chore: Set targetframework 6.0 except src.
s2quake Jun 21, 2024
41bed1b
chore: Cleanup properties
s2quake Jun 21, 2024
e58751b
chore: Remove mono-related properties.
s2quake Jun 21, 2024
90ffc1e
chore: dotnet build and publish and pack.
s2quake Jun 21, 2024
d8a0b42
chore: CheckForOverflowUnderflow, ProduceReferenceAssembly, Documenta…
s2quake Jun 21, 2024
0b006bc
chore: Remove unused properties.
s2quake Jun 25, 2024
4571a04
chore: Clean csproj files.
s2quake Jun 26, 2024
9180b64
chore: Fix ci scripts.
s2quake Jun 26, 2024
744a59f
chore: Add netcoreapp3.1 targetframework into the src build props.
s2quake Jun 28, 2024
13bc565
chore: Add GetPathOfFileAbove property
s2quake Jul 3, 2024
ed627f7
chore: Change Release.md
s2quake Jul 3, 2024
ad61add
Changelog
s2quake Jul 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 0 additions & 91 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,36 +112,6 @@ commands:
- "tools/*/bin/"
- "tools/*/obj/"

mono_build_base:
steps:
- checkout
- concat_files:
glob: "{src,test,tools}/*/*.csproj"
to: .combined-package-files.txt
- restore_cache:
keys:
- v1-deps-{{ arch }}-{{ checksum ".combined-package-files.txt" }}
- v1-deps-{{ arch }}
- run: |
msbuild \
-t:Restore \
-p:Configuration=ReleaseMono \
-p:TestsTargetFramework=net47
- save_cache:
key: v1-deps-{{ arch }}-{{ checksum ".combined-package-files.txt" }}
paths:
- ~/.nuget/packages
- run: |
msbuild \
-p:Configuration=ReleaseMono \
-p:TestsTargetFramework=net47 \
-p:SkipSonar=true
- persist_to_workspace:
root: .
paths:
- "*/bin/"
- "*/obj/"

netcore_test_base:
parameters:
collect_tests_from:
Expand Down Expand Up @@ -434,13 +404,6 @@ jobs:
- netcore_build_base:
collect_tests_filter: "<<parameters.collect_tests_filter>>"

linux-mono-build:
docker:
- image: mono:6.12
resource_class: xlarge
working_directory: /mnt/ramdisk
steps: [mono_build_base]

linux-netcore-test-netmq:
parameters:
parallelism:
Expand Down Expand Up @@ -503,52 +466,11 @@ jobs:
steps:
- netcore_test_base: { code_coverage: false }

linux-unity-test:
docker:
- image: mono:6.12
environment:
XUNIT_UNITY_RUNNER: 0.5.0
resource_class: xlarge
working_directory: /mnt/ramdisk
parallelism: 4
steps:
- run:
name: Install xsltproc
command: apt update -y && apt install -y xsltproc
- unity_test_base

macos-unity-test:
macos:
xcode: 15.2.0
environment:
XUNIT_UNITY_RUNNER: 0.5.0
parallelism: 3
steps:
- ulimit: { n: 10240 }
- unity_test_base:
runner_target: StandaloneOSX

windows-unity-test:
executor:
name: win/default
size: xlarge
environment:
XUNIT_UNITY_RUNNER: 0.5.0
parallelism: 4
steps:
- run:
name: Install bzip2 & xsltproc
command: choco install bzip2 xsltproc
- unity_test_base:
runner_target: StandaloneWindows64

workflows:
main:
jobs:
- linux-netcore-build:
collect_tests_filter: "FullyQualifiedName!~Libplanet.Net.Tests & CircleCI!=Skip"
# Temporarily tunred off by excluding of linux-unity-test
#- linux-mono-build
- linux-netcore-test-netmq:
requires: [linux-netcore-build]
- linux-netcore-test-ar-SA:
Expand All @@ -559,15 +481,6 @@ workflows:
requires: [linux-netcore-build]
- windows-netcore-test:
requires: [linux-netcore-build]
# Temporarily tunred off due to error on xunity-unity-runner:
#- linux-unity-test:
# requires: [linux-mono-build]
# Temporarily turned off due to CircleCI's slow worker node assignments of
# macOS and Windows VMs:
#- macos-unity-test:
# requires: [linux-mono-build]
#- windows-unity-test:
# requires: [linux-mono-build]
net:
jobs:
- linux-netcore-build:
Expand All @@ -577,10 +490,6 @@ workflows:
name: linux-netcore-test-netmq-net
requires: [linux-netcore-build-net]
parallelism: 1
# - macos-netcore-test:
# name: macos-netcore-test-net
# requires: [linux-netcore-build-net]
# parallelism: 1
- windows-netcore-test:
name: windows-netcore-test-net
requires: [linux-netcore-build-net]
Expand Down
3 changes: 2 additions & 1 deletion .github/bin/dist-pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ for project in "${projects[@]}"; do
if [[ "$version_suffix" = "" ]]; then
dotnet_args="-p:Version=$version"
else
dotnet_args="-p:VersionPrefix=$version_prefix" \
dotnet_args="-p:VersionPrefix=$version_prefix"
dotnet_args="$dotnet_args --version-suffix=$version_suffix"
dotnet_args="$dotnet_args -p:NoPackageAnalysis=true"
dotnet_args="$dotnet_args -p:_IsPacking=true"
fi
# shellcheck disable=SC2086
dotnet build -c "$configuration" $dotnet_args || \
Expand Down
60 changes: 60 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,66 @@ To be released.

### Dependencies

The entire project is now defined by common properties in the
`Directory.Build.props` file. The Directory.Build.props file is located at
the root and in the src, tools, test path.

The project structure and affected Directory.Build.props locations are shown
below.

```plain
┌ Directory.Build.props
├ src
│ ├ Directory.Build.props
│ ├ Libplanet
│ ├ Libplanet.Action
│ ├ Libplanet.Common
│ ├ Libplanet.Crypto.Secp256k1
│ ├ Libplanet.Crypto
│ ├ Libplanet.Net
│ ├ Libplanet.RocksDBStore
│ ├ Libplanet.Store.Remote
│ ├ Libplanet.Store
│ ├ Libplanet.Stun
│ └ Libplanet.Types
├ test
│ ├ Directory.Build.props
│ ├ Libplanet.Action.Tests
│ ├ Libplanet.Analyzers.Tests
│ ├ Libplanet.Crypto.Secp256k1.Tests
│ ├ Libplanet.Explorer.Cocona.Tests
│ ├ Libplanet.Explorer.Tests
│ ├ Libplanet.Extensions.Cocona.Tests
│ ├ Libplanet.Mocks
│ ├ Libplanet.Net.Tests
│ ├ Libplanet.RocksDBStore.Tests
│ ├ Libplanet.Store.Remote.Tests
│ ├ Libplanet.Stun.Tests
│ └ Libplanet.Tests
└ tools
├ Directory.Build.props
├ Libplanet.Analyzers
├ Libplanet.Benchmarks
├ Libplanet.Explorer.Cocona
├ Libplanet.Explorer.Executable
├ Libplanet.Explorer
├ Libplanet.Extensions.Cocona
└ Libplanet.Tools
```

The default SDK version for the project has been bumped up to .NET 6.0.
The list of supported SDKs is as follows
- netstandard2.0
- netstandard2.1
- netcoreapp3.1
- net6.0"

> Support for `netstandard2.0` is coming to an end soon, please note that
projects using `netstandard2.0` will be deprecated.

The `VersionPrefix` property has been moved from the
*src/Libplanet/Libplanet.csproj* file to the `Directory.Build.props` file.

### CLI tools

[#3737]: https://github.com/planetarium/libplanet/pull/3737
Expand Down
76 changes: 76 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<Project>

<PropertyGroup>
<TargetFrameworks Condition="'$(_IsPacking)'=='true'">net6.0</TargetFrameworks>
<TargetFramework Condition="'$(_IsPacking)'!='true'">net6.0</TargetFramework>
<LangVersion>10</LangVersion>
<VersionPrefix>5.1.0</VersionPrefix>
<!-- Note: don't be confused by the word "prefix" here. It's merely a
version without suffix like "-dev.123". See the following examples:
Version: 1.2.3-dev.456
VersionPrefix: 1.2.3
VersionSuffix: dev.456
If it's a stable release the version becomes like:
Version: 1.2.3
VersionPrefix: 1.2.3
VersionSuffix: (N/A)
Note that the version suffix is filled through CLI option of dotnet command.
-->
<Nullable>enable</Nullable>
<PackageProjectUrl>https://libplanet.io/</PackageProjectUrl>
<RepositoryUrl>https://github.com/planetarium/libplanet.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Company>Planetarium</Company>
<Authors>Planetarium</Authors>
<PackageLicenseExpression>LGPL-2.1-or-later</PackageLicenseExpression>
<RequireLicenseAcceptance>true</RequireLicenseAcceptance>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Libplanet.ruleset</CodeAnalysisRuleSet>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>

<PackageReleaseNotes>https://github.com/planetarium/libplanet/blob/main/CHANGES.md</PackageReleaseNotes>
<PackageTags>multiplayer online game;game;blockchain</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)CHANGES.md" Pack="true" PackagePath="CHANGES.md" />
<None Include="$(MSBuildThisFileDirectory)LICENSE" Pack="true" PackagePath="LICENSE.txt" />
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="README.md" />
<None Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" PackagePath="icon.png" />
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)Menees.Analyzers.Settings.xml">
<Link>Menees.Analyzers.Settings.xml</Link>
</AdditionalFiles>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Menees.Analyzers.2017" Version="2.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.DotNet.Analyzers.Compatibility" Version="0.2.12-alpha">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers; buildtransitive
</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers
</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(SkipSonar)' != 'true'">
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.12.0.21095">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions Libplanet.Tests.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<Rule Id="MEN009" Action="Warning" />
<Rule Id="MEN010" Action="None" />
<Rule Id="MEN011" Action="None" />
<Rule Id="MEN014" Action="None" />
</Rules>

<Rules AnalyzerId="SonarAnalyzer" RuleNamespace="SonarAnalyzer">
Expand Down
1 change: 1 addition & 0 deletions Libplanet.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<Rule Id="MEN009" Action="Warning" />
<Rule Id="MEN010" Action="None" />
<Rule Id="MEN011" Action="None" />
<Rule Id="MEN014" Action="None" />
</Rules>

<Rules AnalyzerId="SonarAnalyzer" RuleNamespace="SonarAnalyzer">
Expand Down
12 changes: 6 additions & 6 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ You also need to prepare the next patch release. Switch to the maintenance
branch (e.g., *1.2-maintenance*), and make sure it is up-to-date.

You need to bump the patch version of the `<VersionPrefix>` field
in the *src/Libplanet/Libplanet.csproj* file. For example, if the version you have
in the *Directory.Build.props* file. For example, if the version you have
just released is *1.2.3*, bump it to *1.2.4* (3 + 1 = 4).

Also the changelog section for the next patch release should be prepared; add
Expand Down Expand Up @@ -236,7 +236,7 @@ git reset --hard upstream/main
~~~~

Since this maintenance branch purposes to prepare the next patch release, e.g.,
*1.2.1*, the `<VersionPrefix>` field of the *src/Libplanet/Libplanet.csproj*
*1.2.1*, the `<VersionPrefix>` field of the *Directory.Build.props*
file also needs to be updated:

~~~~ xml
Expand Down Expand Up @@ -279,7 +279,7 @@ git switch main # Or on Git < 2.23: git checkout main
git fetch upstream && git reset --hard upstream/main
~~~~

Then, in a similar manner, update *src/Libplanet/Libplanet.csproj*'s
Then, in a similar manner, update *Directory.Build.props*'s
`<VersionPrefix>` to *1.3.0*, and add an empty section for *1.3.0* with
the release date undecided to the changelog. Make a commit with a simple
message like <q>Version bump</q>.
Expand Down Expand Up @@ -332,7 +332,7 @@ The checklist to prepare the next release:
5. Switch to the *<var>X</var>.<var>Y</var>-maintenance* branch and
make sure it is up-to-date.
6. Bump `<VersionPrefix>`'s patch version on
*src/Libplanet/Libplanet.csproj*.
*Directory.Build.props*.
(For example, if you have just released *1.2.3*, bump it to *1.2.4*.)
7. Add a new section for the next unreleased version to the changelog,
with the sentence <q>To be released</q> (no release date).
Expand All @@ -344,15 +344,15 @@ The checklist to prepare the next release:

1. Create a new branch named *<var>X</var>.<var>Y</var>-maintenance* and
switch to it.
2. Bump `<VersionPrefix>` on *src/Libplanet/Libplanet.csproj* to
2. Bump `<VersionPrefix>` on *Directory.Build.props* to
*<var>X</var>.<var>Y</var>.1*.
3. Add a new section for the next unreleased version
(*<var>X</var>.<var>Y</var>.1*) to the changelog, with the sentence
<q>To be released</q> (no release date).
4. Commit the changes with a message <q>Version bump</q>.
5. `git push upstream X.Y-maintenance`
6. Switch to the *main* branch.
7. Bump `<VersionPrefix>`'s minor version on *src/Libplanet/Libplanet.csproj*.
7. Bump `<VersionPrefix>`'s minor version on *Directory.Build.props*.
(For example, if you have just released *1.2.0*, bump it to *1.3.0*.)
8. Add a new section for the next unreleased minor version to the
changelog, with the sentence <q>To be released</q> (no release date).
Expand Down
4 changes: 1 addition & 3 deletions scripts/determine-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ function getScheduledJobDate() {
async function main() {
const csprojPath = path.join(
path.dirname(__dirname),
"src",
"Libplanet",
"Libplanet.csproj",
"Directory.Build.props",
);
const versionPrefix = await readVersionPrefix(csprojPath);
const scheduledJobDate = getScheduledJobDate();
Expand Down
13 changes: 13 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project>

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

<PropertyGroup>
<TargetFrameworks Condition="'$(_IsPacking)'=='true'">$(TargetFrameworks);netstandard2.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>
<LangVersion>9</LangVersion>
<IsPackable>true</IsPackable>
<IsTestProject>false</IsTestProject>
<Title>$(ProjectName)</Title>
</PropertyGroup>

</Project>
Loading
Loading