diff --git a/azure-pipelines-PR.yml b/azure-pipelines-PR.yml index 1ef01974cb4..6c9d65d9bcc 100644 --- a/azure-pipelines-PR.yml +++ b/azure-pipelines-PR.yml @@ -901,3 +901,13 @@ stages: commit: b321cb41a0bea0dab6b4509f895e6cd4d024e9e5 buildScript: dotnet build Nu.sln --configuration Release displayName: Nu_Build + # Design-time provider packaging oracle. Pin d8aba70 (pre-workaround base of FSharp.Data.GraphQL#583): + # it uses the bare IsFSharpDesignTimeProvider gesture, so the client pack drops the provider without this fix. + # Linux-only: the $PWD local feed and the grep content assertion need bash. (nupkg entry names are stored + # uncompressed in the zip, so grep -aF on the package finds the provider path without extra tools.) + - repo: fsprojects/FSharp.Data.GraphQL + commit: d8aba70757792f2d76a66cb8171086ca4c7c1e8e + buildScript: dotnet pack src/FSharp.Data.GraphQL.Shared/FSharp.Data.GraphQL.Shared.fsproj -c Release -p:TreatWarningsAsErrors=false -o "$PWD/__gqlfeed__" ;; dotnet pack src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj -c Release -p:IsNuGet=true -p:TreatWarningsAsErrors=false --source https://api.nuget.org/v3/index.json --source "$PWD/__gqlfeed__" -o "$PWD/__gqlfeed__" && grep -qaF typeproviders/fsharp41/netstandard2.0/FSharp.Data.GraphQL.Client.DesignTime.dll "$PWD/__gqlfeed__"/FSharp.Data.GraphQL.Client.*.nupkg + displayName: FSharpDataGraphQL_DesignTimeProvider_Packaging + useVmImage: $(LinuxMachineQueueName) + usePool: $(DncEngPublicBuildPool) diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index b7b9889a82f..ef1a11ba5e5 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -1,5 +1,6 @@ ### Fixed +* Restore packaging of an F# design-time type provider that is activated via a `ProjectReference` carrying `IsFSharpDesignTimeProvider="true"`. The provider assembly is again included under `fsharp41` when packing (including `pack --no-build`); `PackageFSharpDesignTimeTools` now resolves the provider via `GetTargetPath`, which works in `dotnet pack`'s `BuildProjectReferences=false` content build without forcing an early `ResolveReferences`. ([Issue #18924](https://github.com/dotnet/fsharp/issues/18924), [PR #19979](https://github.com/dotnet/fsharp/pull/19979)) * Provided types used from multiple files no longer produce spurious FS0001 type mismatches under parallel compilation; provided-type entities are now interned so every file linking a given provided type shares one entity. ([PR #19969](https://github.com/dotnet/fsharp/pull/19969)) * TypeProviders-SDK providers now load under an unoptimized compiler; the `systemRuntimeContainsType` closure field the SDK reflects on (`tcImports`) is captured stably regardless of optimization settings. ([PR #19969](https://github.com/dotnet/fsharp/pull/19969)) * Fixed: Inheriting from an undefined type now reports `FS0039` exactly once instead of three times. Phase 1F and Phase 2A of inherit-clause type-checking now skip re-resolving a syntactic clause whose Phase 1D resolution already failed with `UndefinedName`, eliminating both the duplicate diagnostic and the redundant work. ([Issue #16432](https://github.com/dotnet/fsharp/issues/16432), [PR #19862](https://github.com/dotnet/fsharp/pull/19862)) diff --git a/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets b/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets index dcaf578891a..d47a2757012 100644 --- a/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets +++ b/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets @@ -49,23 +49,11 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and $(MSBuildProjectFullPath) - - + + $(TargetsForTfmSpecificContentInPackage);PackageFSharpDesignTimeTools - - - - - <_FSharpDesignTimeProviderProject Include="@(ProjectReference)" Condition="'%(ProjectReference.IsFSharpDesignTimeProvider)' == 'true'" /> - <_FSharpDesignTimeProviderPackage Include="@(PackageReference)" Condition="'%(PackageReference.IsFSharpDesignTimeProvider)' == 'true'" /> - - - $(TargetsForTfmSpecificContentInPackage);PackageFSharpDesignTimeTools - - - $(RestoreAdditionalProjectSources);$(_FSharpCoreLibraryPacksFolder) @@ -78,7 +66,9 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and - + + fsharp41 tools @@ -87,22 +77,71 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and + + + + + + + + + + + + + + + + + + + + + + + + - <_ResolvedOutputFiles - Include="%(_ResolvedProjectReferencePaths.RootDir)%(_ResolvedProjectReferencePaths.Directory)/**/*" - Exclude="%(_ResolvedProjectReferencePaths.RootDir)%(_ResolvedProjectReferencePaths.Directory)/**/FSharp.Core.dll;%(_ResolvedProjectReferencePaths.RootDir)%(_ResolvedProjectReferencePaths.Directory)/**/System.ValueTuple.dll" - Condition="'%(_ResolvedProjectReferencePaths.IsFSharpDesignTimeProvider)' == 'true'"> - %(_ResolvedProjectReferencePaths.NearestTargetFramework) + + <_ResolvedOutputFiles Condition="'@(_FSharpDesignTimeProviderPath)' != ''" + Include="%(_FSharpDesignTimeProviderPath.RootDir)%(_FSharpDesignTimeProviderPath.Directory)**\*" + Exclude="%(_FSharpDesignTimeProviderPath.RootDir)%(_FSharpDesignTimeProviderPath.Directory)**\*.pdb;%(_FSharpDesignTimeProviderPath.RootDir)%(_FSharpDesignTimeProviderPath.Directory)**\*.deps.json;%(_FSharpDesignTimeProviderPath.RootDir)%(_FSharpDesignTimeProviderPath.Directory)ref\**;%(_FSharpDesignTimeProviderPath.RootDir)%(_FSharpDesignTimeProviderPath.Directory)analyzers\**"> + %(_FSharpDesignTimeProviderPath.NearestTargetFramework) - <_ResolvedOutputFiles - Include="@(BuiltProjectOutputGroupKeyOutput)" - Condition=" '$(IsFSharpDesignTimeProvider)' == 'true' and '%(BuiltProjectOutputGroupKeyOutput->Filename)%(BuiltProjectOutputGroupKeyOutput->Extension)' != 'FSharp.Core.dll' and '%(BuiltProjectOutputGroupKeyOutput->Filename)%(BuiltProjectOutputGroupKeyOutput->Extension)' != 'System.ValueTuple.dll' "> - $(TargetFramework) + + <_ResolvedOutputFiles Condition="'$(IsFSharpDesignTimeProvider)' == 'true'" Include="@(BuiltProjectOutputGroupKeyOutput)"> + $(TargetFramework) - - $(FSharpToolsDirectory)/$(FSharpDesignTimeProtocol)/%(_ResolvedOutputFiles.NearestTargetFramework)/%(_ResolvedOutputFiles.FileName)%(_ResolvedOutputFiles.Extension) + + + $(FSharpToolsDirectory)/$(FSharpDesignTimeProtocol)/%(_ResolvedOutputFiles.DesignTimeFramework)/%(_ResolvedOutputFiles.RecursiveDir)%(_ResolvedOutputFiles.FileName)%(_ResolvedOutputFiles.Extension) diff --git a/tests/EndToEndBuildTests/DesignTimeProviderPackaging/Directory.Build.props b/tests/EndToEndBuildTests/DesignTimeProviderPackaging/Directory.Build.props new file mode 100644 index 00000000000..632e4cb412c --- /dev/null +++ b/tests/EndToEndBuildTests/DesignTimeProviderPackaging/Directory.Build.props @@ -0,0 +1,11 @@ + + + + + + + 1.0.0 + + + diff --git a/tests/EndToEndBuildTests/DesignTimeProviderPackaging/TestDesignTimeProviderPackaging.cmd b/tests/EndToEndBuildTests/DesignTimeProviderPackaging/TestDesignTimeProviderPackaging.cmd index cd3094901f1..56688b60d8f 100644 --- a/tests/EndToEndBuildTests/DesignTimeProviderPackaging/TestDesignTimeProviderPackaging.cmd +++ b/tests/EndToEndBuildTests/DesignTimeProviderPackaging/TestDesignTimeProviderPackaging.cmd @@ -85,7 +85,6 @@ echo [Test 2] PASSED: Provider test passed echo. echo === Test 3: Host with ProjectReference to Provider === echo [Test 3] Packing Host with ProjectReference to Provider... -echo [Test 3] Note: This tests experimental execution-time reference checking echo [Test 3] Command: dotnet pack Host\Host.fsproj -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\host.binlog -p:FSharpTestCompilerVersion=coreclr dotnet pack Host\Host.fsproj -o %~dp0artifacts -c %configuration% -v minimal -bl:%~dp0artifacts\host.binlog -p:FSharpTestCompilerVersion=coreclr if ERRORLEVEL 1 ( @@ -94,9 +93,17 @@ if ERRORLEVEL 1 ( goto :failure ) -rem Note: This test may not work as expected due to MSBuild evaluation phase limitations -rem The current implementation only checks IsFSharpDesignTimeProvider property directly -echo [Test 3] PASSED: Host test completed (implementation limitation noted - may not check references correctly) +rem The provider is activated only through ProjectReference IsFSharpDesignTimeProvider metadata; it must still be +rem packaged under tools/fsharp41/ in the consumer's package. This is the case regressed by #18929 (the provider +rem was silently dropped from the package). +echo [Test 3] Checking that the referenced provider is packaged under tools/fsharp41... +powershell -command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem; $names = ([System.IO.Compression.ZipFile]::OpenRead('%~dp0artifacts\Host.1.0.0.nupkg')).Entries.FullName; if ($names | Where-Object { $_ -like 'tools/fsharp41/*Provider.dll' }) { exit 0 } else { Write-Host ('Contents: ' + ($names -join ', ')); exit 1 } }" +if ERRORLEVEL 1 ( + echo [Test 3] FAILED: Host.1.0.0.nupkg does not contain the design-time provider under tools/fsharp41/ + echo [Test 3] The provider referenced via the ProjectReference gesture was dropped from the package. + goto :failure +) +echo [Test 3] PASSED: Host (ProjectReference gesture) test passed echo. echo === Test 4: Pack with --no-build (No Provider) === diff --git a/tests/EndToEndBuildTests/DesignTimeProviderPackaging/TestDesignTimeProviderPackaging.sh b/tests/EndToEndBuildTests/DesignTimeProviderPackaging/TestDesignTimeProviderPackaging.sh index 9c10fa68ba5..0243d411def 100755 --- a/tests/EndToEndBuildTests/DesignTimeProviderPackaging/TestDesignTimeProviderPackaging.sh +++ b/tests/EndToEndBuildTests/DesignTimeProviderPackaging/TestDesignTimeProviderPackaging.sh @@ -74,7 +74,6 @@ echo "[Test 2] PASSED: Provider test passed" echo echo "=== Test 3: Host with ProjectReference to Provider ===" echo "[Test 3] Packing Host with ProjectReference to Provider..." -echo "[Test 3] Note: This tests experimental execution-time reference checking" echo "[Test 3] Command: dotnet pack Host/Host.fsproj -o artifacts -c $configuration -v minimal -bl:artifacts/host.binlog -p:FSharpTestCompilerVersion=coreclr" if ! dotnet pack Host/Host.fsproj -o artifacts -c $configuration -v minimal -bl:artifacts/host.binlog -p:FSharpTestCompilerVersion=coreclr; then echo "[Test 3] FAILED: Pack command returned error code $?" @@ -82,9 +81,17 @@ if ! dotnet pack Host/Host.fsproj -o artifacts -c $configuration -v minimal -bl: exit 1 fi -# Note: This test may not work as expected due to MSBuild evaluation phase limitations -# The current implementation only checks IsFSharpDesignTimeProvider property directly -echo "[Test 3] PASSED: Host test completed (implementation limitation noted - may not check references correctly)" +# The provider is activated only through ProjectReference IsFSharpDesignTimeProvider metadata; it must still be +# packaged under tools/fsharp41/ in the consumer's package. This is the case regressed by #18929 (the provider +# was silently dropped from the package). +echo "[Test 3] Checking that the referenced provider is packaged under tools/fsharp41..." +if ! unzip -l artifacts/Host.1.0.0.nupkg | grep -q "tools/fsharp41/.*Provider.dll"; then + echo "[Test 3] FAILED: Host.1.0.0.nupkg does not contain the design-time provider under tools/fsharp41/" + echo "[Test 3] The provider referenced via the ProjectReference gesture was dropped from the package." + unzip -l artifacts/Host.1.0.0.nupkg | grep -i "fsharp41" || true + exit 1 +fi +echo "[Test 3] PASSED: Host (ProjectReference gesture) test passed" echo echo "=== Test 4: Pack with --no-build (No Provider) ==="