Skip to content

Commit

Permalink
Only AOT when explicitly stated
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyShaw committed Jul 8, 2024
1 parent 9d85c94 commit a8b226e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pipeline "Build" {
stage "Build" { run "dotnet build -c Release --tl" }
stage "UnitTests" { run "dotnet test -c Release --tl" }
stage "Pack" { run "dotnet pack --no-restore -c Release --tl" }
stage "Publish" { run "dotnet publish --no-restore -r linux-x64 -c Release" }
stage "PublishAOT" { run "dotnet publish src/Fantomas/Fantomas.fsproj -r linux-x64 -c Release -p:DoPublishAot=yes --tl" }
stage "Docs" {
whenNot { platformOSX }
envVars
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas/Fantomas.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<IsPackable>true</IsPackable>
<RootNamespace>Fantomas</RootNamespace>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
<PublishAot>true</PublishAot>
<PublishAot Condition=" '$(DoPublishAot)' != ''">true</PublishAot>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Fantomas.Client\Fantomas.Client.fsproj" />
Expand Down

3 comments on commit a8b226e

@baronfel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want --no-restore to work, then you'll need to update the Fantomas project file with the complete list of RuntimeIdentifiers that you want to publish AOT for. When you restore with a list of RIDs, Restore can take that knowledge and include all of the RID-specific packages you would need to target each of those platforms. As it is, if you specific RIDs on the CLI and they aren't known to the the Restore, then the CLI will do an implicit Restore for you to ensure NuGet has all of the RID-specific dependencies.

Therefore, for this PR I would suggest adding the explicit RuntimeIdentifiers you would like to support, even if a 'normal' build doesn't use them.

@TobyShaw
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing --no-restore flag to dotnet pack makes sense to save duplicated work with dotnet build. Here we're running 1 publish command and 1 AOT restore command, so it seems like you might as well combine the two?
Unless you're suggesting that the AOT restore can share work with the non-AOT restore? I won't claim to be a NuGet expert here.

@baronfel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you specify the RIDs the 'normal' restore should pull in the required assets for the AOT Publish operation as well. There's no distinction as to the 'purpose' of the Restore from the SDK's perspective.

Please sign in to comment.