Skip to content

Commit 202f8f9

Browse files
KevinRansombaronfel
authored andcommitted
Fix nuget and ref assemblies (#8252)
* Fix nuget and ref assemblies * Packaging fixes * tweaks * use substring rather than remove * Removed unused md * -1 means not found
1 parent 4f1dd8c commit 202f8f9

File tree

1 file changed

+39
-13
lines changed

1 file changed

+39
-13
lines changed

src/fsharp/FSharp.DependencyManager/FSharp.DependencyManager.Utilities.fs

+39-13
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ module Utilities =
205205
| None -> ""
206206

207207
let arguments prefix =
208-
sprintf "%s -restore %s %c%s%c /t:FSI-PackageManagement" prefix binLoggingArguments '\"' projectPath '\"'
208+
sprintf "%s -restore %s %c%s%c /t:InteractivePackageManagement" prefix binLoggingArguments '\"' projectPath '\"'
209209

210210
let workingDir = Path.GetDirectoryName projectPath
211211

@@ -230,6 +230,10 @@ namespace lib"
230230
<PropertyGroup>
231231
<TargetFramework>$(TARGETFRAMEWORK)</TargetFramework>
232232
<IsPackable>false</IsPackable>
233+
234+
<!-- Temporary fix some sdks, shipped internally with broken parameterization -->
235+
<FSharpCoreImplicitPackageVersion Condition=""'$(FSharpCoreImplicitPackageVersion)' == '{{FSharpCoreShippedPackageVersion}}'"">4.7.0</FSharpCoreImplicitPackageVersion>
236+
<FSharpCoreImplicitPackageVersion Condition=""'$(FSharpCoreImplicitPackageVersion)' == '{{FSharpCorePreviewPackageVersion}}'"">4.7.1-*</FSharpCoreImplicitPackageVersion>
233237
</PropertyGroup>
234238
<ItemGroup>
235239
<Compile Include='Library.fs' />
@@ -273,15 +277,31 @@ $(PACKAGEREFERENCES)
273277
</ItemGroup>
274278
</Target>
275279
276-
<Target Name='ComputePackageRoots'
277-
BeforeTargets='CoreCompile;FSI-PackageManagement'
280+
<Target Name='ComputePackageRootsForInteractivePackageManagement'
281+
BeforeTargets='CoreCompile'
278282
DependsOnTargets='CollectPackageReferences'>
279283
<ItemGroup>
280-
<FsxResolvedFile Include='@(ResolvedCompileFileDefinitions)'>
281-
<PackageRootProperty>Pkg$([System.String]::Copy('%(ResolvedCompileFileDefinitions.NugetPackageId)').Replace('.','_'))</PackageRootProperty>
282-
<PackageRoot>$([MSBuild]::EnsureTrailingSlash('$(%(FsxResolvedFile.PackageRootProperty))'))</PackageRoot>
283-
<InitializeSourcePath>$(%(FsxResolvedFile.PackageRootProperty))\content\%(ResolvedCompileFileDefinitions.FileName)%(ResolvedCompileFileDefinitions.Extension).fsx</InitializeSourcePath>
284-
</FsxResolvedFile>
284+
<InteractiveResolvedFile Remove='@(InteractiveResolvedFile)' />
285+
<InteractiveResolvedFile Include='@(ResolvedCompileFileDefinitions->ClearMetadata())' KeepDuplicates='false'>
286+
<NormalizedIdentity Condition=""'%(Identity)'!=''"">$([System.String]::Copy('%(Identity)').Replace('\', '/'))</NormalizedIdentity>
287+
<NormalizedPathInPackage Condition=""'%(ResolvedCompileFileDefinitions.PathInPackage)'!=''"">$([System.String]::Copy('%(ResolvedCompileFileDefinitions.PathInPackage)').Replace('\', '/'))</NormalizedPathInPackage>
288+
<PositionPathInPackage Condition=""'%(InteractiveResolvedFile.NormalizedPathInPackage)'!=''"">$([System.String]::Copy('%(InteractiveResolvedFile.NormalizedIdentity)').IndexOf('%(InteractiveResolvedFile.NormalizedPathInPackage)'))</PositionPathInPackage>
289+
<PackageRoot Condition=""'%(InteractiveResolvedFile.NormalizedPathInPackage)'!='' and '%(InteractiveResolvedFile.PositionPathInPackage)'!='-1'"">$([System.String]::Copy('%(InteractiveResolvedFile.NormalizedIdentity)').Substring(0, %(InteractiveResolvedFile.PositionPathInPackage)))</PackageRoot>
290+
<InitializeSourcePath>%(InteractiveResolvedFile.PackageRoot)content\%(ResolvedCompileFileDefinitions.FileName)%(ResolvedCompileFileDefinitions.Extension).fsx</InitializeSourcePath>
291+
<IsNotImplementationReference>$([System.String]::Copy('%(ResolvedCompileFileDefinitions.PathInPackage)').StartsWith('ref/'))</IsNotImplementationReference>
292+
<NuGetPackageId>%(ResolvedCompileFileDefinitions.NuGetPackageId)</NuGetPackageId>
293+
<NuGetPackageVersion>%(ResolvedCompileFileDefinitions.NuGetPackageVersion)</NuGetPackageVersion>
294+
</InteractiveResolvedFile>
295+
<InteractiveResolvedFile Include='@(RuntimeCopyLocalItems->ClearMetadata())' KeepDuplicates='false' >
296+
<NormalizedIdentity Condition=""'%(Identity)'!=''"">$([System.String]::Copy('%(Identity)').Replace('\', '/'))</NormalizedIdentity>
297+
<NormalizedPathInPackage Condition=""'%(RuntimeCopyLocalItems.PathInPackage)'!=''"">$([System.String]::Copy('%(RuntimeCopyLocalItems.PathInPackage)').Replace('\', '/'))</NormalizedPathInPackage>
298+
<PositionPathInPackage Condition=""'%(InteractiveResolvedFile.NormalizedPathInPackage)'!=''"">$([System.String]::Copy('%(InteractiveResolvedFile.NormalizedIdentity)').IndexOf('%(InteractiveResolvedFile.NormalizedPathInPackage)'))</PositionPathInPackage>
299+
<PackageRoot Condition=""'%(InteractiveResolvedFile.NormalizedPathInPackage)'!='' and '%(InteractiveResolvedFile.PositionPathInPackage)'!='-1'"">$([System.String]::Copy('%(InteractiveResolvedFile.NormalizedIdentity)').Substring(0, %(InteractiveResolvedFile.PositionPathInPackage)))</PackageRoot>
300+
<InitializeSourcePath>%(InteractiveResolvedFile.PackageRoot)content\%(RuntimeCopyLocalItems.FileName)%(RuntimeCopyLocalItems.Extension).fsx</InitializeSourcePath>
301+
<IsNotImplementationReference>$([System.String]::Copy('%(RuntimeCopyLocalItems.PathInPackage)').StartsWith('ref/'))</IsNotImplementationReference>
302+
<NuGetPackageId>%(RuntimeCopyLocalItems.NuGetPackageId)</NuGetPackageId>
303+
<NuGetPackageVersion>%(RuntimeCopyLocalItems.NuGetPackageVersion)</NuGetPackageVersion>
304+
</InteractiveResolvedFile>
285305
<NativeIncludeRoots
286306
Include='@(RuntimeTargetsCopyLocalItems)'
287307
Condition=""'%(RuntimeTargetsCopyLocalItems.AssetType)' == 'native'"">
@@ -290,7 +310,7 @@ $(PACKAGEREFERENCES)
290310
</ItemGroup>
291311
</Target>
292312
293-
<Target Name='FSI-PackageManagement' DependsOnTargets='ResolvePackageAssets'>
313+
<Target Name='InteractivePackageManagement' DependsOnTargets='ResolvePackageAssets;ComputePackageRootsForInteractivePackageManagement'>
294314
<ItemGroup>
295315
<ReferenceLines Remove='@(ReferenceLines)' />
296316
<ReferenceLines Include='// Generated from #r ""nuget:Package References""' />
@@ -300,12 +320,18 @@ $(PACKAGEREFERENCES)
300320
<ReferenceLines Include='// MSBuildSDKsPath:($(MSBuildSDKsPath))' />
301321
<ReferenceLines Include='// MSBuildExtensionsPath:($(MSBuildExtensionsPath))' />
302322
<ReferenceLines Include='//' />
303-
<ReferenceLines Include='#r @""%(FsxResolvedFile.HintPath)""' Condition = ""'%(FsxResolvedFile.NugetPackageId)' != '' and '%(FsxResolvedFile.NugetPackageId)' != 'Microsoft.NETCore.App' and '%(FsxResolvedFile.NugetPackageId)' != 'FSharp.Core' and '%(FsxResolvedFile.NugetPackageId)' != 'System.ValueTuple' and Exists('%(FsxResolvedFile.HintPath)')"" KeepDuplicates='false' />
323+
<ReferenceLines Include='// References' />
324+
<ReferenceLines Include='//' />
325+
<ReferenceLines Include='#r @""%(InteractiveResolvedFile.FullPath)""' Condition = ""'%(InteractiveResolvedFile.NugetPackageId)' != '' and '%(InteractiveResolvedFile.NugetPackageId)' != 'Microsoft.NETCore.App' and '%(InteractiveResolvedFile.NugetPackageId)' != 'FSharp.Core' and '%(InteractiveResolvedFile.NugetPackageId)' != 'System.ValueTuple' and '%(InteractiveResolvedFile.IsNotImplementationReference)' != 'true' and Exists('%(InteractiveResolvedFile.FullPath)')"" KeepDuplicates='false' />
326+
<ReferenceLines Include='//' />
327+
<ReferenceLines Include='// Includes' />
328+
<ReferenceLines Include='//' />
329+
<ReferenceLines Include='#I @""%(InteractiveResolvedFile.PackageRoot)""' Condition= ""'%(InteractiveResolvedFile.NugetPackageId)' != '' and '%(InteractiveResolvedFile.NugetPackageId)' != 'Microsoft.NETCore.App' and '%(InteractiveResolvedFile.NugetPackageId)' != 'FSharp.Core' and '%(InteractiveResolvedFile.NugetPackageId)' != 'System.ValueTuple' and $([System.String]::Copy('%(InteractiveResolvedFile.PackageRoot)').EndsWith('/')) and Exists(%(InteractiveResolvedFile.PackageRoot))"" KeepDuplicates='false' />
330+
<ReferenceLines Include='#I @""%(NativeIncludeRoots.Path)""' Condition= ""'%(InteractiveResolvedFile.NugetPackageId)' != '' and '%(InteractiveResolvedFile.NugetPackageId)' != 'Microsoft.NETCore.App' and '%(InteractiveResolvedFile.NugetPackageId)' != 'FSharp.Core' and '%(InteractiveResolvedFile.NugetPackageId)' != 'System.ValueTuple' and '%(NativeIncludeRoots.Path)' != ''"" KeepDuplicates='false' />
304331
<ReferenceLines Include='//' />
305-
<ReferenceLines Include='#I @""%(FsxResolvedFile.PackageRoot)""' Condition= ""'%(FsxResolvedFile.PackageRoot)' != ''"" KeepDuplicates='false' />
306-
<ReferenceLines Include='#I @""%(NativeIncludeRoots.Path)""' Condition= ""'%(NativeIncludeRoots.Path)' != ''"" KeepDuplicates='false' />
332+
<ReferenceLines Include='// Load Sources' />
307333
<ReferenceLines Include='//' />
308-
<ReferenceLines Include='#load @""%(FsxResolvedFile.InitializeSourcePath)""' Condition = ""'%(FsxResolvedFile.InitializeSourcePath)' != '' and '%(FsxResolvedFile.NugetPackageId)' != 'Microsoft.NETCore.App' and '%(FsxResolvedFile.NugetPackageId)' != 'FSharp.Core' and '%(FsxResolvedFile.NugetPackageId)' != 'System.ValueTuple' and Exists('%(FsxResolvedFile.InitializeSourcePath)')"" KeepDuplicates='false' />
334+
<ReferenceLines Include='#load @""%(InteractiveResolvedFile.InitializeSourcePath)""' Condition = ""'%(InteractiveResolvedFile.InitializeSourcePath)' != '' and '%(InteractiveResolvedFile.NugetPackageId)' != 'Microsoft.NETCore.App' and '%(InteractiveResolvedFile.NugetPackageId)' != 'FSharp.Core' and '%(InteractiveResolvedFile.NugetPackageId)' != 'System.ValueTuple' and Exists('%(InteractiveResolvedFile.InitializeSourcePath)')"" KeepDuplicates='false' />
309335
</ItemGroup>
310336
311337
<WriteLinesToFile Lines='@(ReferenceLines)' File='$(MSBuildProjectFullPath).fsx' Overwrite='True' WriteOnlyWhenDifferent='True' />

0 commit comments

Comments
 (0)