Repository navigation
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
122 lines (106 loc) · 6.97 KB
/
Copy pathDirectory.Build.props
File metadata and controls
122 lines (106 loc) · 6.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<Project>
<PropertyGroup>
<!-- net11.0 is the repo default now (test project, samples, demos, anything
that doesn't say otherwise). The old Harmony blocker is gone: I'm
building SageFs.Harmony 2.4.2-sagefs.1 (Directory.Packages.props) from
my LibHarmony fork's patched MonoMod (ci-pipeline.fsx's "restore
harmony fork" stage), and its detours actually work on CoreCLR 11 —
proved it by running WebAppHotReloadVerificationTests on net11 with
zero skips before touching this file.
The tool I actually ship (SageFs, SageFs.Core, SageFs.Host) doesn't
just move to net11 though — it multi-targets $(SageFsTargetFrameworks).
A dotnet tool nupkg built that way carries one tools/<tfm>/any payload
per TFM, and `dotnet tool install` grabs whichever one matches your
SDK. So a .NET 10 user still gets a net10.0 build, a .NET 11 user gets
net11.0, and issue #131 (a net11-only package that .NET 10 users
couldn't install) can't happen again. If a project needs to
multi-target like this, clear the default with
`<TargetFramework></TargetFramework>` and set
`<TargetFrameworks>$(SageFsTargetFrameworks)</TargetFrameworks>`. -->
<TargetFramework>net11.0</TargetFramework>
<SageFsTargetFrameworks>net10.0;net11.0</SageFsTargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!-- F# nullness analysis: surfaces nullability warnings at compile time
(requires the newer FCS/SDK — the whole point of keeping those current).
NoWarn NU1608/NU1902 for the pre-1.0/known-audited transitive pins. -->
<CheckNulls>true</CheckNulls>
<NoWarn>$(NoWarn);NU1608;NU1902</NoWarn>
<Version>0.6.1016</Version>
<!-- Reproducible/tamper-evident restore: commit packages.lock.json per
project and fail restore if it drifts from Directory.Packages.props
without a regenerate. RestoreLockedMode is scoped to CI so local
`dotnet restore` after a version bump still regenerates the file
instead of hard-failing. -->
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<RestoreLockedMode Condition="'$(CI)' == 'true' or '$(GITHUB_ACTIONS)' == 'true'">true</RestoreLockedMode>
</PropertyGroup>
<!-- Build identity that does not move with HEAD (see Directory.Build.targets, SageFsContentRevision). The
SDK's own revision stamp and SourceLink both embed the HEAD commit, which made every commit rebuild
every project. -->
<PropertyGroup>
<EnableSourceLink>false</EnableSourceLink>
<EnableSourceControlManagerQueries>false</EnableSourceControlManagerQueries>
</PropertyGroup>
<!-- The path to SageFs.Core.dll for a sample that wants the holder API
(Holder / HolderRegistry / RegisteredHolder), so a sample can demonstrate
registered live state without hand-writing a HintPath to a build output.
Resolved HERE, in the repo's own props, rather than in each sample: a
per-sample HintPath into SageFs.Core/bin is a build-order dependency on a
path that may not exist yet, and the local gate proved it — in a clean
checkout the ConsoleTicker failed with FS0039 `HolderRegistry is not
defined`, because SageFs.Core had not been built into that Configuration.
A path that does not exist yet simply leaves the property empty, and the
sample's Reference is conditioned on it being non-empty, so this is safe
on a machine where Core has never been built.
This is a stepping stone, not the answer. The answer is SageFs injecting
the reference at build time for a RUN APP, via
`-p:CustomAfterMicrosoftCommonTargets=<generated>.targets` — verified to
build a project with no Reference at all. `-p:ReferencePath=` does NOT
work for that: it only tells MSBuild where to look for references that
already exist, so it can never add one.
The default is set FIRST, because `Configuration` is not yet defined when
a .props file is evaluated — it arrives later from the SDK. Without this
default the `Exists(...)` below tests the literal path
`bin//net10.0/...`, which never exists, the property silently stays
empty, and the sample fails with FS0039 rather than a clear diagnostic.
THE PROPERTY IS NOT CONDITIONED ON THE FILE EXISTING. It used to be, and
that made the whole mechanism a no-op on a clean checkout — which is the
ONLY place that matters:
<PropertyGroup Condition="Exists('…/SageFs.Core.dll')">
<SageFsCoreAssembly>…</SageFsCoreAssembly>
</PropertyGroup>
With that condition, a clean checkout has no `SageFs.Core.dll`, so the
property is empty, so the sample's `<Reference Condition="…!=''">` is
skipped, and so the `BuildSageFsCoreFirst` target that would BUILD Core
is skipped by the very same condition. Nothing builds Core and nothing
references it, and the sample fails with
error FS0039: The value, namespace, type or module
'RegisteredHolder' is not defined
Reproduced in ~6s from a clean checkout, and it took the release gate
down. It was invisible locally for the obvious reason: a local checkout
always has a stale `SageFs.Core.dll` on disk, so the condition was true
and the stale assembly satisfied the reference.
So the property states the PATH unconditionally and lets the build decide
whether the file is there. The ordering target then builds Core when it
is missing, and a missing HintPath after that is a real error rather than
a silently-skipped reference.
THE FRAMEWORK IN THAT PATH IS THE CONSUMER'S OWN, not a fixed one. It was
net10.0 for everybody, so a raw `dotnet build` of a net11.0 sample copied
Core's net10.0 build into its net11.0 output, and the session's bin then
held a SageFs.Core.dll that is a different compilation of the same source
from the one the daemon runs. The daemon under a net11 dotnet runs Core's
net11.0 build, so `HostCoreAdoption.decide`, which compares SHA-256 first
and the clock second, saw "same version, different bytes" and let the clock
decide. Measured on the 0.6.924 gate: the sample held the net10.0 build
(4442221b…) while the daemon ran the net11.0 build (51f28066…), so the
integration tier refused the session when the copy happened to be written
first and passed when it happened to be written second. The gate was a coin
flip on build order. `$(TargetFramework)` is set earlier in this file, so
every consumer gets the build that matches what it runs. -->
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
</PropertyGroup>
<PropertyGroup>
<SageFsCoreAssembly>$(MSBuildThisFileDirectory)SageFs.Core/bin/$(Configuration)/$(TargetFramework)/SageFs.Core.dll</SageFsCoreAssembly>
</PropertyGroup>
</Project>