Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 9 additions & 9 deletions .devcontainer/unitsnet-modular/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"name": "UnitsNet.Modular playground",
"image": "mcr.microsoft.com/devcontainers/dotnet:10.0-noble",
"postCreateCommand": "dotnet build UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.csproj",
"postCreateCommand": "dotnet build UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.csproj -p:Platform=ProjectReferences",
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csdevkit"
],
"settings": {
"dotnet.defaultSolution": "UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.slnx",
"dotnet.defaultSolution": "UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.slnx",
"csharp.debug.console": "integratedTerminal",
"terminal.integrated.cwd": "${workspaceFolder}/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground"
"terminal.integrated.cwd": "${workspaceFolder}/UnitsNet.Modular/Samples/ModularPlayground"
}
},
"codespaces": {
"openFiles": [
"UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/README.md",
"UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/Program.cs",
"UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/ApplicationUnits.cs",
"UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/GameScore.unitsnet.json",
"UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/Properties/launchSettings.json",
"UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.csproj"
"UnitsNet.Modular/Samples/ModularPlayground/README.md",
"UnitsNet.Modular/Samples/ModularPlayground/Program.cs",
"UnitsNet.Modular/Samples/ModularPlayground/ApplicationUnits.cs",
"UnitsNet.Modular/Samples/ModularPlayground/ParcelCount.unitsnet.json",
"UnitsNet.Modular/Samples/ModularPlayground/Properties/launchSettings.json",
"UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.csproj"
]
}
}
Expand Down
33 changes: 22 additions & 11 deletions .github/workflows/unitsnet-modular-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,33 +78,44 @@ jobs:
dotnet-version: 10.0.x

- name: Restore
run: dotnet restore UnitsNet.Modular.slnx -p:UnitsNetModularSampleUpdateLocalPackagesOnBuild=true
run: dotnet restore UnitsNet.Modular.slnx -p:Platform=ProjectReferences

- name: Build
run: dotnet build UnitsNet.Modular.slnx --configuration Release --no-restore --no-incremental -p:UnitsNetModularSampleUpdateLocalPackagesOnBuild=true
run: dotnet build UnitsNet.Modular.slnx --configuration Release --no-restore --no-incremental -p:Platform=ProjectReferences

- name: Test
run: dotnet test UnitsNet.Modular.slnx --configuration Release --no-build -p:UnitsNetModularSampleUpdateLocalPackagesOnBuild=false
run: dotnet test UnitsNet.Modular.slnx --configuration Release --no-build -p:Platform=ProjectReferences

- name: Native AOT smoke test
run: |
dotnet publish UnitsNet.Modular/Samples/UnitsNet.Modular.Lean.Sample/UnitsNet.Modular.Lean.Sample.csproj \
dotnet publish UnitsNet.Modular/Samples/QuantitySelectionSample/QuantitySelectionSample.csproj \
--configuration Release \
--framework net10.0 \
--runtime linux-x64 \
--self-contained true \
-p:PublishAot=true \
-p:UnitsNetModularSampleUpdateLocalPackagesOnBuild=false \
-p:Platform=ProjectReferences \
--output Artifacts/UnitsNet.Modular.AotSmoke
./Artifacts/UnitsNet.Modular.AotSmoke/UnitsNet.Modular.Lean.Sample
./Artifacts/UnitsNet.Modular.AotSmoke/QuantitySelectionSample

- name: Run getting-started NuGet consumer
shell: pwsh
run: ./UnitsNet.Modular/Samples/UnitsNet.Modular.GettingStarted.Sample/run.ps1

- name: Run custom-definition NuGet consumer
shell: pwsh
run: ./UnitsNet.Modular/Samples/UnitsNet.Modular.NuGet.Sample/run.ps1
run: ./UnitsNet.Modular/Samples/GettingStartedSample/run.ps1

- name: Run custom-definition NuGet consumer with isolated cache
run: >-
dotnet run
--project UnitsNet.Modular/Samples/CustomQuantitySample/CustomQuantitySample.csproj
--configuration Debug
-p:Platform=LocalPackages
-p:RestorePackagesPath=${{ runner.temp }}/unitsnet-modular-custom-packages-${{ github.run_id }}-${{ github.run_attempt }}

- name: Run published-package consumer
run: >-
dotnet run
--project UnitsNet.Modular/Samples/GettingStartedSample/GettingStartedSample.csproj
--configuration Release
-p:Platform=PublishedPackages

- name: Pack
run: dotnet pack UnitsNet.Modular/UnitsNet.Modular/UnitsNet.Modular.csproj --configuration Release --no-build --output Artifacts/UnitsNet.Modular.CI -p:UnitsNetModularPackForPublish=true
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"version": "0.2.0",
"configurations": [
{
"name": "C#: UnitsNet.Modular.Playground",
"name": "C#: ModularPlayground",
"type": "dotnet",
"request": "launch",
"projectPath": "${workspaceFolder}/UnitsNet.Modular/Samples/UnitsNet.Modular.Playground/UnitsNet.Modular.Playground.csproj"
"projectPath": "${workspaceFolder}/UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.csproj"
}
]
}
5 changes: 0 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,4 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)/NullableAttributes.cs" />
</ItemGroup>

</Project>
7 changes: 7 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- Licensed under MIT No Attribution, see LICENSE file at the root. -->
<Project>
<!-- Nullable flow-analysis attributes are built in on modern .NET targets. -->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Compile Include="$(MSBuildThisFileDirectory)NullableAttributes.cs" />
</ItemGroup>
</Project>
21 changes: 21 additions & 0 deletions Directory.Solution.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Licensed under MIT No Attribution, see LICENSE file at the root. -->
<Project>
<!--
This root-level file is imported by both repository solutions. The target is intentionally
inert for the main UnitsNet solution, which does not define the LocalPackages platform.

A solution restore evaluates package-facing samples in parallel. Bootstrap the shared local
feed once so their per-project restore hooks observe completed package stamps instead of
launching concurrent dotnet pack processes.
-->
<Target Name="PrepareUnitsNetModularLocalPackagesForSolution"
BeforeTargets="_GenerateRestoreGraph;Restore"
Condition="'$(Platform)' == 'LocalPackages'">
<Message Importance="high" Text="Preparing the repository-local UnitsNet.Modular packages..." />
<MSBuild
Projects="$(MSBuildThisFileDirectory)UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Units/SharedUnitsLibrarySample.Units.csproj"
Targets="_PackLocalUnitsNetModularPackages"
BuildInParallel="false"
Properties="Configuration=$(Configuration);Platform=LocalPackages;UnitsNetModularSampleUpdateLocalPackagesOnBuild=true" />
</Target>
</Project>
83 changes: 72 additions & 11 deletions UnitsNet.Modular.slnx
Original file line number Diff line number Diff line change
@@ -1,20 +1,81 @@
<Solution>
<Configurations>
<Platform Name="ProjectReferences" />
<Platform Name="LocalPackages" />
<Platform Name="PublishedPackages" />
</Configurations>
<!-- Core and test projects remain AnyCPU; only samples map dependency-mode platforms. -->
<Project Path="UnitsNet.Modular/UnitsNet.Modular/UnitsNet.Modular.csproj" />
<Project Path="UnitsNet.Modular/UnitsNet.Modular.Generator/UnitsNet.Modular.Generator.csproj" />
<Project Path="UnitsNet.Modular/UnitsNet.Modular.Generator.Tests/UnitsNet.Modular.Generator.Tests.csproj" />
<Project Path="UnitsNet.Modular/UnitsNet.Modular.Tests/UnitsNet.Modular.Tests.csproj" />
<Folder Name="/_Files/">
<File Path="UnitsNet.Modular/ARCHITECTURE.md" />
<File Path="UnitsNet.Modular/Directory.Build.props" />
<File Path="UnitsNet.Modular/Directory.Build.targets" />
<File Path="UnitsNet.Modular/Directory.Packages.props" />
<File Path="UnitsNet.Modular/MIGRATION.md" />
<File Path="UnitsNet.Modular/README.md" />
<File Path="UnitsNet.Modular/THIRD-PARTY-NOTICES.md" />
<File Path="UnitsNet.Modular/UnitsNet.Modular.Versioning.props" />
</Folder>
<Project Path="UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/UnitsNet.Modular.Compatibility.Tests.csproj" />
<Folder Name="/Samples/">
<Project Path="UnitsNet.Modular/Samples/DefinitionPackages/Fictional.Measurements.Definitions/Fictional.Measurements.Definitions.csproj" />
<Project Path="UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units/ConsumerOwned.Units.csproj" />
<Project Path="UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Units.ProjectReferences/ConsumerOwned.Units.ProjectReferences.csproj" />
<Project Path="UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Domain/ConsumerOwned.Domain.csproj" />
<Project Path="UnitsNet.Modular/Samples/ConsumerOwned/ConsumerOwned.Reporting/ConsumerOwned.Reporting.csproj" />
<Project Path="UnitsNet.Modular/Samples/UnitsNet.Modular.AllSi.Sample/UnitsNet.Modular.AllSi.Sample.csproj" />
<Project Path="UnitsNet.Modular/Samples/UnitsNet.Modular.Representative.Sample/UnitsNet.Modular.Representative.Sample.csproj" />
<Project Path="UnitsNet.Modular/Samples/UnitsNet.Modular.Lean.Sample/UnitsNet.Modular.Lean.Sample.csproj" />
<Project Path="UnitsNet.Modular/Samples/UnitsNet.Modular.Custom.Sample/UnitsNet.Modular.Custom.Sample.csproj" />
<Project Path="UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.UnitsNet.Sample/UnitsNet.Modular.Compatibility.UnitsNet.Sample.csproj" />
<Project Path="UnitsNet.Modular/Samples/UnitsNet.Modular.Compatibility.Generated.Sample/UnitsNet.Modular.Compatibility.Generated.Sample.csproj" />
<File Path="UnitsNet.Modular/Samples/README.md" />
<Project Path="UnitsNet.Modular/Samples/GettingStartedSample/GettingStartedSample.csproj">
<Platform Solution="*|ProjectReferences" Project="ProjectReferences" />
<Platform Solution="*|LocalPackages" Project="LocalPackages" />
<Platform Solution="*|PublishedPackages" Project="PublishedPackages" />
</Project>
<Project Path="UnitsNet.Modular/Samples/QuantitySelectionSample/QuantitySelectionSample.csproj">
<Platform Solution="*|ProjectReferences" Project="ProjectReferences" />
<Platform Solution="*|LocalPackages" Project="LocalPackages" />
<Platform Solution="*|PublishedPackages" Project="PublishedPackages" />
</Project>
<Project Path="UnitsNet.Modular/Samples/CustomQuantitySample/CustomQuantitySample.csproj">
<Platform Solution="*|ProjectReferences" Project="ProjectReferences" />
<Platform Solution="*|LocalPackages" Project="LocalPackages" />
<Platform Solution="*|PublishedPackages" Project="PublishedPackages" />
</Project>
<Project Path="UnitsNet.Modular/Samples/ModularPlayground/ModularPlayground.csproj">
<Platform Solution="*|ProjectReferences" Project="ProjectReferences" />
<Platform Solution="*|LocalPackages" Project="LocalPackages" />
<Platform Solution="*|PublishedPackages" Project="PublishedPackages" />
</Project>
</Folder>
<Folder Name="/Samples/Profiles/">
<Project Path="UnitsNet.Modular/Samples/Profiles/AllSiProfileSample/AllSiProfileSample.csproj">
<Platform Solution="*|ProjectReferences" Project="ProjectReferences" />
<Platform Solution="*|LocalPackages" Project="LocalPackages" />
<Platform Solution="*|PublishedPackages" Project="PublishedPackages" />
</Project>
</Folder>
<Folder Name="/Samples/Shared Units Library/">
<Project Path="UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Units/SharedUnitsLibrarySample.Units.csproj">
<Platform Solution="*|ProjectReferences" Project="ProjectReferences" />
<Platform Solution="*|LocalPackages" Project="LocalPackages" />
<Platform Solution="*|PublishedPackages" Project="PublishedPackages" />
</Project>
<Project Path="UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.Domain/SharedUnitsLibrarySample.Domain.csproj">
<Platform Solution="*|ProjectReferences" Project="ProjectReferences" />
<Platform Solution="*|LocalPackages" Project="LocalPackages" />
<Platform Solution="*|PublishedPackages" Project="PublishedPackages" />
</Project>
<Project Path="UnitsNet.Modular/Samples/SharedUnitsLibrarySample/SharedUnitsLibrarySample.App/SharedUnitsLibrarySample.App.csproj">
<Platform Solution="*|ProjectReferences" Project="ProjectReferences" />
<Platform Solution="*|LocalPackages" Project="LocalPackages" />
<Platform Solution="*|PublishedPackages" Project="PublishedPackages" />
</Project>
<Project Path="UnitsNet.Modular/Samples/SharedUnitsLibrarySample/Fictional.Measurements.Definitions/Fictional.Measurements.Definitions.csproj">
<Platform Solution="*|ProjectReferences" Project="ProjectReferences" />
<Platform Solution="*|LocalPackages" Project="LocalPackages" />
<Platform Solution="*|PublishedPackages" Project="PublishedPackages" />
</Project>
<File Path="UnitsNet.Modular/Samples/SharedUnitsLibrarySample/README.md" />
</Folder>
<Folder Name="/Tests/" />
<Folder Name="/Tests/Compatibility fixtures/">
<Project Path="UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Generated/UnitsNet.Modular.Compatibility.GeneratedFixture.csproj" />
<Project Path="UnitsNet.Modular/UnitsNet.Modular.Compatibility.Tests/Fixtures/Legacy/UnitsNet.Modular.Compatibility.LegacyFixture.csproj" />
</Folder>
</Solution>
Loading
Loading