Repository navigation
Expand file tree
/
Copy pathValidate.proj
More file actions
96 lines (83 loc) · 5.68 KB
/
Copy pathValidate.proj
File metadata and controls
96 lines (83 loc) · 5.68 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
<Project DefaultTargets="All">
<PropertyGroup>
<RepoRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..'))</RepoRoot>
<Solution>$(RepoRoot)Ramstack.HtmxToolkit.slnx</Solution>
<LibraryProject>$(RepoRoot)src/Ramstack.HtmxToolkit/Ramstack.HtmxToolkit.csproj</LibraryProject>
<AotProjectDirectory>$(RepoRoot)tests/Ramstack.HtmxToolkit.AotValidation</AotProjectDirectory>
<AotProject>$(AotProjectDirectory)/Ramstack.HtmxToolkit.AotValidation.csproj</AotProject>
<AllDependsOn>Test;Aot;JavaScript;Docs</AllDependsOn>
<TestDependsOn>BuildDebug;BuildRelease;TestDebug;TestRelease</TestDependsOn>
<AotDependsOn>BuildRelease</AotDependsOn>
</PropertyGroup>
<Target Name="All" DependsOnTargets="$(AllDependsOn)" />
<Target Name="Test" DependsOnTargets="$(TestDependsOn)" />
<Target Name="BuildDebug">
<Message Importance="high" Text="==> Build (Debug)" />
<Exec WorkingDirectory="$(RepoRoot)" Command="dotnet build "$(Solution)" -c Debug --tl:off" />
</Target>
<Target Name="TestDebug">
<Message Importance="high" Text="==> Test (Debug)" />
<Exec WorkingDirectory="$(RepoRoot)" IgnoreStandardErrorWarningFormat="true"
Command="dotnet test "$(Solution)" -c Debug --no-build --tl:off" />
</Target>
<Target Name="BuildRelease">
<Message Importance="high" Text="==> Build (Release)" />
<Exec WorkingDirectory="$(RepoRoot)" Command="dotnet build "$(Solution)" -c Release --tl:off" />
</Target>
<Target Name="TestRelease">
<Message Importance="high" Text="==> Test (Release)" />
<Exec WorkingDirectory="$(RepoRoot)" IgnoreStandardErrorWarningFormat="true"
Command="dotnet test "$(Solution)" -c Release --no-build --tl:off" />
</Target>
<Target Name="Aot" DependsOnTargets="$(AotDependsOn)">
<PropertyGroup>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</RuntimeIdentifier>
<_AotDirectory>$(AotProjectDirectory)/obj/validation</_AotDirectory>
<_AotFeedDirectory>$(_AotDirectory)/feed</_AotFeedDirectory>
<_AotPackagesDirectory>$(_AotDirectory)/packages</_AotPackagesDirectory>
<_AotPublishDirectory>$(_AotDirectory)/publish/$(RuntimeIdentifier)</_AotPublishDirectory>
<_AotExecutable>$(_AotPublishDirectory)/Ramstack.HtmxToolkit.AotValidation</_AotExecutable>
<_AotExecutable Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(_AotExecutable).exe</_AotExecutable>
</PropertyGroup>
<!-- Keep a separate restore cache so the synthetic package is always fresh without touching the user's global cache. -->
<RemoveDir Directories="$(_AotFeedDirectory);$(_AotPackagesDirectory)/ramstack.htmxtoolkit/0.0.0-aot;$(_AotPublishDirectory)" />
<Message Importance="high" Text="==> Pack (AOT validation)" />
<Exec WorkingDirectory="$(RepoRoot)" Command="dotnet pack "$(LibraryProject)" -c Release --no-build --no-restore --tl:off -p:MinVerVersionOverride=0.0.0-aot -o "$(_AotFeedDirectory)"" />
<Message Importance="high" Text="==> Restore (AOT validation)" />
<Exec WorkingDirectory="$(RepoRoot)" Command="dotnet restore "$(AotProject)" -r $(RuntimeIdentifier) --tl:off --packages "$(_AotPackagesDirectory)" --source "$(_AotFeedDirectory)" --source https://api.nuget.org/v3/index.json" />
<Message Importance="high" Text="==> Publish (AOT validation)" />
<Exec WorkingDirectory="$(RepoRoot)" Command="dotnet publish "$(AotProject)" -c Release -r $(RuntimeIdentifier) --no-restore --warnaserror --tl:off -p:RestorePackagesPath="$(_AotPackagesDirectory)" -o "$(_AotPublishDirectory)"" />
<Message Importance="high" Text="==> Run (AOT validation)" />
<Exec WorkingDirectory="$(RepoRoot)" Command=""$(_AotExecutable)"" />
</Target>
<Target Name="JavaScript">
<Message Importance="high" Text="==> Restore (JavaScript)" />
<Exec WorkingDirectory="$(RepoRoot)" Command="pnpm install --frozen-lockfile" />
<ItemGroup>
<_JavaScriptFiles Include="$(RepoRoot)src/Ramstack.HtmxToolkit/wwwroot/htmx-toolkit.js;$(RepoRoot)src/Ramstack.HtmxToolkit/wwwroot/htmx-toolkit.min.js" />
</ItemGroup>
<GetFileHash Files="@(_JavaScriptFiles)">
<Output TaskParameter="Items" ItemName="_JavaScriptBefore" />
</GetFileHash>
<Message Importance="high" Text="==> Build and verify JavaScript assets" />
<Exec WorkingDirectory="$(RepoRoot)" Command="pnpm build" />
<GetFileHash Files="@(_JavaScriptFiles)">
<Output TaskParameter="Items" ItemName="_JavaScriptAfter" />
</GetFileHash>
<Error Condition="'@(_JavaScriptBefore->'%(FileHash)')' != '@(_JavaScriptAfter->'%(FileHash)')'"
Text="JavaScript assets were out of date. Review and commit the regenerated htmx-toolkit.js and htmx-toolkit.min.js files, then rerun validation." />
</Target>
<Target Name="Docs">
<Message Importance="high" Text="==> Restore (documentation)" />
<Exec WorkingDirectory="$(RepoRoot)" Command="dotnet restore "$(LibraryProject)" --tl:off" />
<Exec WorkingDirectory="$(RepoRoot)" Command="dotnet tool restore" />
<!-- Preserve authored api/index.md; remove metadata for types that no longer exist. -->
<ItemGroup>
<_DocfxGeneratedMetadata Include="$(RepoRoot)docs/api/**/*.yml" />
</ItemGroup>
<Delete Files="@(_DocfxGeneratedMetadata)" />
<RemoveDir Directories="$(RepoRoot)docs/_site" />
<Message Importance="high" Text="==> Build documentation" />
<Exec WorkingDirectory="$(RepoRoot)" Command="dotnet docfx docs/docfx.json --warningsAsErrors" />
</Target>
</Project>