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
4 changes: 4 additions & 0 deletions .github/workflows/bump_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .nuke/parameters.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "build.schema.json",
"Solution": "TedToolkit.sln"
"Solution": "TedToolkit.slnx"
}
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Version>2025.11.21.0</Version>
<Version>2025.11.24.0</Version>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
Expand All @@ -22,7 +22,7 @@
</PropertyGroup>
<PropertyGroup Condition="$(NeedTestsPackage)">
<IsPackable>false</IsPackable>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup Condition="$(NeedTestsPackage)">
<PackageReference Include="TUnit" />
Expand All @@ -49,7 +49,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
</ItemGroup>
<PropertyGroup Condition="$(NeedAlmostAllFrameWorks)">
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0;net472;net48;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0;net10.0;net472;net48;netstandard2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup Condition="$(NeedAlmostAllFrameWorks) and !$(MSBuildProjectName.EndsWith('Sources'))">
<PackageReference Include="PolySharp">
Expand Down
12 changes: 6 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<PackageVersion Include="PeterO.Numbers" Version="1.8.2" />
<PackageVersion Include="PolySharp" Version="1.15.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageVersion Include="Nuke.Common" Version="9.0.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
<PackageVersion Include="Nuke.Common" Version="10.0.0" />
<PackageVersion Include="Octokit" Version="14.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="3.0.0" />
<PackageVersion Include="System.CodeDom" Version="8.0.0" />
<PackageVersion Include="System.Drawing.Common" Version="9.0.9" />
<PackageVersion Include="TUnit" Version="1.0.78" />
<PackageVersion Include="System.Drawing.Common" Version="10.0.0" />
<PackageVersion Include="TUnit" Version="1.2.11" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.2" />
<PackageVersion Include="Seq.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Seq.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="UnitsNet" Version="5.75.0" />
<PackageVersion Include="WPF-UI" Version="4.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.2" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.9" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="10.0.0" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
<PackageVersion Include="Grasshopper" Version="7.0.20314.3001" Condition="'$(TargetFramework)' == 'net48'" />
<PackageVersion Include="Grasshopper" Version="8.0.23304.9001" Condition="'$(TargetFramework)' != 'net48'" />
Expand Down
300 changes: 0 additions & 300 deletions TedToolkit.sln

This file was deleted.

2 changes: 0 additions & 2 deletions TedToolkit.sln.DotSettings

This file was deleted.

87 changes: 87 additions & 0 deletions TedToolkit.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<Solution>
<Folder Name="/build/">
<File Path=".gitignore" />
<File Path="Directory.Build.props" />
<File Path="Directory.Packages.props" />
<File Path="README.md" />
<Project Path="build/NukeBuilder.csproj">
<Build Project="false" />
</Project>
</Folder>
<Folder Name="/src/">
<Project Path="src/libraries/TedToolkit.RoslynHelper/TedToolkit.RoslynHelper.csproj" />
</Folder>
<Folder Name="/src/Assertions/">
<Project Path="src/libraries/TedToolkit.Assertions.FluentValidation/TedToolkit.Assertions.FluentValidation.csproj" />
<Project Path="src/libraries/TedToolkit.Assertions.Logging/TedToolkit.Assertions.Logging.csproj" />
<Project Path="src/libraries/TedToolkit.Assertions/TedToolkit.Assertions.csproj" />
<Project Path="tests/TedToolkit.Assertions.Tests/TedToolkit.Assertions.Tests.csproj" />
</Folder>
<Folder Name="/src/CppInteropGen/">
<Project Path="src/analyzers/TedToolkit.CppInteropGen.SourceGenerator/TedToolkit.CppInteropGen.SourceGenerator.csproj" />
<Project Path="src/libraries/TedToolkit.CppInteropGen/TedToolkit.CppInteropGen.csproj">
<BuildDependency Project="src/analyzers/TedToolkit.CppInteropGen.SourceGenerator/TedToolkit.CppInteropGen.SourceGenerator.csproj" />
</Project>
</Folder>
<Folder Name="/src/Fluent/">
<Project Path="src/analyzers/TedToolkit.Fluent.SourceGenerator/TedToolkit.Fluent.SourceGenerator.csproj" />
<Project Path="src/libraries/TedToolkit.Fluent/TedToolkit.Fluent.csproj">
<BuildDependency Project="src/analyzers/TedToolkit.Fluent.SourceGenerator/TedToolkit.Fluent.SourceGenerator.csproj" />
</Project>
<Project Path="tests/TedToolkit.Fluent.Tests/TedToolkit.Fluent.Tests.csproj" />
</Folder>
<Folder Name="/src/Grasshopper/">
<Project Path="src/analyzers/TedToolkit.Grasshopper.SourceGenerator/TedToolkit.Grasshopper.SourceGenerator.csproj" />
<Project Path="src/libraries/TedToolkit.Grasshopper.Sources/TedToolkit.Grasshopper.Sources.csproj">
<Build Solution="Debug|*" Project="false" />
</Project>
<Project Path="src/libraries/TedToolkit.Grasshopper/TedToolkit.Grasshopper.csproj">
<BuildDependency Project="src/analyzers/TedToolkit.Grasshopper.SourceGenerator/TedToolkit.Grasshopper.SourceGenerator.csproj" />
</Project>
<Project Path="tests/TedToolkit.Grasshopper.Instance/TedToolkit.Grasshopper.Instance.csproj" />
</Folder>
<Folder Name="/src/InterpolatedParser/">
<Project Path="src/analyzers/TedToolkit.InterpolatedParser.SourceGenerator/TedToolkit.InterpolatedParser.SourceGenerator.csproj" />
<Project Path="src/libraries/TedToolkit.InterpolatedParser.Sources/TedToolkit.InterpolatedParser.Sources.csproj">
<Build Solution="Debug|*" Project="false" />
</Project>
<Project Path="src/libraries/TedToolkit.InterpolatedParser/TedToolkit.InterpolatedParser.csproj">
<BuildDependency Project="src/analyzers/TedToolkit.InterpolatedParser.SourceGenerator/TedToolkit.InterpolatedParser.SourceGenerator.csproj" />
</Project>
<Project Path="tests/TedToolkit.InterpolatedParser.Tests/TedToolkit.InterpolatedParser.Tests.csproj" />
</Folder>
<Folder Name="/src/PureConst/">
<Project Path="src/analyzers/TedToolkit.PureConst.Analyzer/TedToolkit.PureConst.Analyzer.csproj" />
<Project Path="src/libraries/TedToolkit.PureConst/TedToolkit.PureConst.csproj">
<BuildDependency Project="src/analyzers/TedToolkit.PureConst.Analyzer/TedToolkit.PureConst.Analyzer.csproj" />
</Project>
<Project Path="tests/TedToolkit.PureConst.Tests/TedToolkit.PureConst.Tests.csproj" />
</Folder>
<Folder Name="/src/QuantExtensions/">
<Project Path="src/analyzers/TedToolkit.QuantExtensions.SourceGenerator/TedToolkit.QuantExtensions.SourceGenerator.csproj" />
<Project Path="src/libraries/TedToolkit.QuantExtensions/TedToolkit.QuantExtensions.csproj">
<BuildDependency Project="src/analyzers/TedToolkit.QuantExtensions.SourceGenerator/TedToolkit.QuantExtensions.SourceGenerator.csproj" />
</Project>
</Folder>
<Folder Name="/src/Quantities/">
<Project Path="src/analyzers/TedToolkit.Quantities.Analyzer/TedToolkit.Quantities.Analyzer.csproj" />
<Project Path="src/applications/TedToolkit.Quantities.Generator/TedToolkit.Quantities.Generator.csproj" />
<Project Path="src/libraries/TedToolkit.Quantities.Data/TedToolkit.Quantities.Data.csproj" />
<Project Path="src/libraries/TedToolkit.Quantities/TedToolkit.Quantities.csproj">
<BuildDependency Project="src/analyzers/TedToolkit.Quantities.Analyzer/TedToolkit.Quantities.Analyzer.csproj" />
<BuildDependency Project="src/libraries/TedToolkit.Quantities.Data/TedToolkit.Quantities.Data.csproj" />
</Project>
</Folder>
<Folder Name="/src/Scopes/">
<Project Path="src/libraries/TedToolkit.Scopes/TedToolkit.Scopes.csproj" />
</Folder>
<Folder Name="/src/ValidResults/">
<Project Path="src/analyzers/TedToolkit.ValidResults.SourceGenerator/TedToolkit.ValidResults.SourceGenerator.csproj" />
<Project Path="src/libraries/TedToolkit.ValidResults/TedToolkit.ValidResults.csproj">
<BuildDependency Project="src/analyzers/TedToolkit.ValidResults.SourceGenerator/TedToolkit.ValidResults.SourceGenerator.csproj" />
</Project>
</Folder>
<Project Path="tests/TedToolkit.Console/TedToolkit.Console.csproj">
<Build Project="false" />
</Project>
</Solution>
5 changes: 3 additions & 2 deletions Tests/TedToolkit.Console/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
global using TedToolkit.Quantities;

using TedToolkit.QuantExtensions;
using UnitsNet;
using Length = UnitsNet.Length;
Expand All @@ -8,4 +7,6 @@
[assembly: NumberExtension<int, Angle>]
[assembly: NumberExtension<double, Angle>]

[assembly:Quantities<double>(QuantitySystems.ALL, "AbsorbedDose", "Dimensionless", "DimensionlessRatio")]
[assembly:
Quantities<double>(QuantitySystems.ALL, "Area", "AbsorbedDose", "Dimensionless", "DimensionlessRatio",
Length = LengthUnit.Millimetre)]
28 changes: 22 additions & 6 deletions Tests/TedToolkit.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@
using UnitsNet;
using UnitsNet.Units;

var pi = ERational.FromEDecimal(EDecimal.FromString("3.1415926535897932384626433832795028841971693993751058209749445923"));
var result = pi * ERational.FromInt32(2);
var ctx = EContext.ForPrecision(50) // 精度50位
.WithExponentRange(-1000, 1000) // 指数在 [-1000, 1000]
.WithRounding(ERounding.HalfEven);
Console.WriteLine(result.ToEDecimal(ctx));
// var pi = ERational.FromEDecimal(EDecimal.FromString("3.1415926535897932384626433832795028841971693993751058209749445923"));
// var result = pi * ERational.FromInt32(2);
// var ctx = EContext.ForPrecision(50) // 精度50位
// .WithExponentRange(-1000, 1000) // 指数在 [-1000, 1000]
// .WithRounding(ERounding.HalfEven);
// Console.WriteLine(result.ToEDecimal(ctx));

var rational = ERational.Create(EInteger.FromInt16(1), EInteger.FromInt16(10));
Console.WriteLine(rational);
var powered = Pow(rational, 4);
Console.WriteLine(powered);

return;
var length = (TedToolkit.Quantities.Length)6.0;
Expand All @@ -38,7 +43,18 @@
var b = ratio.DecibelMicrovolts;
return;

static ERational Pow(ERational rational, int exponent)
{
if (exponent == 0) return ERational.One;
var one = rational;
for (var i = 1; i < Math.Abs(exponent); i++)
{
rational *= one;
}

if (exponent < 0) rational = ERational.One / rational;
return rational;
}
// unsafe
// {
// double a = 15;
Expand Down
7 changes: 3 additions & 4 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Build : NukeBuild
.Executes(() =>
{
DotNetTasks.DotNetRun(s => s
.SetProjectFile(Solution.src.Quantities.TedToolkit_Quantities_Generator)
.SetProjectFile(Solution.Directory / "src" / "applications" / "TedToolkit.Quantities.Generator" / "TedToolkit.Quantities.Generator.csproj")
.SetConfiguration(Configuration.Release));
});

Expand All @@ -96,11 +96,10 @@ class Build : NukeBuild
static void TestProject(Project project)
{
DotNetTasks.DotNetTest(s => s
.SetProjectFile(project)
.AddProcessAdditionalArguments($"--project {project.Path}")
.SetConfiguration(Configuration.Release)
.EnableNoRestore()
.EnableNoBuild()
.SetLoggers("trx"));
.EnableNoBuild());
}
});

Expand Down
2 changes: 1 addition & 1 deletion build/NukeBuilder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<NoWarn>CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
Expand Down
6 changes: 2 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"sdk": {
"version": "9.0.0",
"rollForward": "latestMajor",
"allowPrerelease": true
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
2 changes: 1 addition & 1 deletion src/analyzers/TedToolkit.Quantities.Analyzer/UnitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public Unit GetUnit(string key)

var data = collection;
var allUnits = data.Units.Values.ToArray();
var quantityUnits =quantity.Units
var quantityUnits = quantity.Units
.Select(u => data.Units[u]);
if (unitDictionary.TryGetValue(key, out var unitKey))
{
Expand Down
5 changes: 3 additions & 2 deletions src/libraries/TedToolkit.Quantities.Data/Conversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ public readonly record struct Conversion(ERational Multiplier, ERational Offset)
private static ERational Pow(ERational rational, int exponent)
{
if (exponent == 0) return ERational.One;
for (var i = 0; i < Math.Abs(exponent); i++)
var one = rational;
for (var i = 1; i < Math.Abs(exponent); i++)
{
rational *= rational;
rational *= one;
}

if (exponent < 0) rational = ERational.One / rational;
Expand Down