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: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ decision engine. See README.md for the package layout and measured numbers.

## Commands

mise installs the SDK pinned in `global.json` (plus the .NET 10 runtime every project targets). Run everything
through it:
mise installs the SDK pinned in `global.json`; the libraries target net10.0 and net11.0, the CLI, the tests and the
examples net11.0. Run everything through it:

```bash
mise run build # build the solution
Expand Down
6 changes: 5 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -27,6 +27,10 @@
<!-- src/ projects: packable, XML docs -->
<PropertyGroup Condition="$(MSBuildProjectDirectory.Replace('\','/').Contains('/src/'))">
<IsPackable>true</IsPackable>
<!-- a library targets the oldest supported .NET as well as the current one; TargetFramework (from above) is
cleared, or MSBuild builds that single one. A dotnet tool is an executable and sets net11.0 alone. -->
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
<TargetFramework></TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors>Nullean and contributors</Authors>
<Copyright>Nullean</Copyright>
Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<!-- Build script dependencies -->
<!-- Nullean.Make.Fs needs FSharp.Core 11.0.101 or later; only build/scripts uses it -->
<PackageVersion Include="FSharp.Core" Version="11.0.101" />
<PackageVersion Include="Nullean.Make.Fs" Version="0.28.0" />
<PackageVersion Include="Nullean.Make.Fs" Version="0.30.0" />
<!-- build/scripts opens Proc.Fs directly, so it references it rather than relying on Nullean.Make.Fs -->
<PackageVersion Include="Proc.Fs" Version="0.21.0" />
<PackageVersion Include="Proc.Fs" Version="0.22.1" />
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions build/scripts/Paths.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ open System.IO

let ToolName = "Layar"
let Repository = "nullean/layar"
/// The framework the public API diff reads from the previous release and from this build: the oldest the libraries
/// target, which every release ships
let MainTFM = "net10.0"
let SignKey = ""

Expand Down Expand Up @@ -39,6 +41,12 @@ let Root =

let RootRelative path = Path.GetRelativePath(Root.FullName, path)

/// The build output the API diff reads: a library's MainTFM folder, or the one folder of a project that targets a single
/// framework (a dotnet tool, net11.0 alone)
let ApiDiffOutput (projectDirectory: string) =
let library = $".artifacts/bin/{projectDirectory}/release_{MainTFM}"
if Directory.Exists library then library else $".artifacts/bin/{projectDirectory}/release"

let Output = DirectoryInfo(Path.Combine(Root.FullName, "build", "output"))

let ToolProject = DirectoryInfo(Path.Combine(Root.FullName, "src", ToolName))
6 changes: 3 additions & 3 deletions build/scripts/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ let main argv =
for project in projectsToClean () do
sh $"dotnet clean {project} -c Release -v q" }
| Build -> command {
composes [Clean]
executes (shell { sh $"dotnet build -c Release" }) }
composes [Clean] }
|> executes { sh $"dotnet build -c Release" }
| Test -> target [Build] { sh $"dotnet run --project tests/Laya.Tests/Laya.Tests.csproj -c Release" }
| Pack -> command { requires [Build]; composes [Generatepackages; Validatepackages; Generateapichanges] }
| Ci -> command { requires [Test]; composes [Generatepackages; Validatepackages; Generateapichanges] }
Expand All @@ -73,7 +73,7 @@ let main argv =
let report = Path.Combine(output, $"breaking-changes-{id}.md")
let projectDirectory, assembly = Paths.packageInfo id
// quoted: an unquoted | would pipe
sh $"dotnet assembly-differ diff 'previous-nuget|{id}|{version}|{Paths.MainTFM}' 'directory|.artifacts/bin/{projectDirectory}/release' -a --target {assembly} -f github-comment --output {report}" }
sh $"dotnet assembly-differ diff 'previous-nuget|{id}|{version}|{Paths.MainTFM}' 'directory|{Paths.ApiDiffOutput projectDirectory}' -a --target {assembly} -f github-comment --output {report}" }
| Docs -> target [] {
Documentation.build ()
Documentation.serve port.Value }
Expand Down
2 changes: 1 addition & 1 deletion examples/layar-aot-smoketest/layar-aot-smoketest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<RootNamespace>layar_aot_smoketest</RootNamespace>
<PublishAot>true</PublishAot>
<TrimmerSingleWarn>false</TrimmerSingleWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<RootNamespace>layar_torchsharp_aot_smoketest</RootNamespace>
<PublishAot>true</PublishAot>
<TrimmerSingleWarn>false</TrimmerSingleWarn>
Expand Down
3 changes: 1 addition & 2 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ DOTNET_CLI_TELEMETRY_OPTOUT = "1"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE = "1"

[tools]
# "10": every project targets net10.0, so the tests and the build run on the .NET 10 runtime
dotnet = ["""{{ read_file(path='global.json') | split(pat='"version"') | nth(n=1) | split(pat='"') | nth(n=1) }}""", "10"]
dotnet = ["""{{ read_file(path='global.json') | split(pat='"version"') | nth(n=1) | split(pat='"') | nth(n=1) }}"""]
gh = "latest"
zizmor = "1"

Expand Down
4 changes: 4 additions & 0 deletions src/Laya.Cli/Laya.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- a dotnet tool, not a library: net11.0 alone, so the TargetFrameworks src/ libraries get from
Directory.Build.props is cleared -->
<TargetFrameworks></TargetFrameworks>
<TargetFramework>net11.0</TargetFramework>
<RootNamespace>Laya.Cli</RootNamespace>
<!-- Not "layar": AssemblyName defaults PackageId too, and "layar" collides case-insensitively
with Layar.Core's PackageId "Layar" ("Ambiguous project name 'layar'"). PackAsTool +
Expand Down
2 changes: 2 additions & 0 deletions src/Layar.Core/Lang/ScriptDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public static FrozenDictionary<string, double> ScriptProfile(ReadOnlySpan<char>
}

if (total == 0)
#pragma warning disable IDE0301 // net11.0 suggests [], which net10.0 cannot build a FrozenDictionary from
return FrozenDictionary<string, double>.Empty;
#pragma warning restore IDE0301

var profile = new Dictionary<string, double>();
if (latin > 0)
Expand Down
Loading