Repository navigation
[WIP] Move the dependencies over to props during VS Background build #3273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
f5ce16f
979acae
50f8054
0f4dc5f
775f34c
ca47546
dd4a17b
425502a
bba4f2e
595669a
a9f153a
f189eac
f6c4511
4f40b2f
21a10df
2f50af4
52dfa3e
baaf012
3c4ef8f
e35f941
28b3068
d493d43
13ec727
5f17139
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ open Paket.PackageSources | |
| open System | ||
| open Chessie.ErrorHandling | ||
| open System.Reflection | ||
| open Requirements | ||
|
|
||
| /// Finds packages which would be affected by a restore, i.e. not extracted yet or with the wrong version | ||
| let FindPackagesNotExtractedYet(dependenciesFileName) = | ||
|
|
@@ -255,7 +256,7 @@ let createAlternativeNuGetConfig (projectFile:FileInfo) = | |
|
|
||
| saveToFile config alternativeConfigFileInfo |> ignore | ||
|
|
||
| let createPaketPropsFile (cliTools:ResolvedPackage seq) restoreSuccess (fileInfo:FileInfo) = | ||
| let createPaketPropsFile (lockFile:LockFile) (cliTools:ResolvedPackage seq) (packages:((GroupName * PackageName) * PackageInstallSettings * _)seq) (fileInfo:FileInfo) = | ||
| let cliParts = | ||
| if Seq.isEmpty cliTools then | ||
| "" | ||
|
|
@@ -264,22 +265,49 @@ let createPaketPropsFile (cliTools:ResolvedPackage seq) restoreSuccess (fileInfo | |
| |> Seq.map (fun cliTool -> sprintf """ <DotNetCliToolReference Include="%O" Version="%O" />""" cliTool.Name cliTool.Version) | ||
| |> fun xs -> String.Join(Environment.NewLine,xs) | ||
| |> fun s -> " <ItemGroup>" + Environment.NewLine + s + Environment.NewLine + " </ItemGroup>" | ||
|
|
||
|
|
||
|
|
||
| let packagesParts = | ||
| if Seq.isEmpty packages then | ||
| "" | ||
| else | ||
| packages | ||
| |> Seq.map (fun ((groupName,packageName),_,_) -> | ||
| let p = lockFile.Groups.[groupName].Resolution.[packageName] | ||
| let condition = Paket.Requirements.getExplicitRestriction p.Settings.FrameworkRestrictions | ||
| p,condition) | ||
| |> Seq.groupBy snd | ||
| |> Seq.collect (fun (condition,packages) -> | ||
| let condition = condition.ToMSBuildCondition() | ||
| let condition = | ||
| if condition = "" || condition = "true" then "" else | ||
| sprintf " AND (%s)" condition | ||
|
|
||
| let packageReferences = | ||
| packages | ||
| |> Seq.collect (fun (p,_) -> | ||
| [sprintf """ <PackageReference Include="%O">""" p.Name | ||
| sprintf """ <Version>%O</Version>""" p.Version | ||
| //""" <PrivateAssets Condition=" ('%(PaketReferencesFileLinesInfo.AllPrivateAssets)' == 'true') Or ('$(PackAsTool)' == 'true') ">All</PrivateAssets>""" + | ||
| //""" <ExcludeAssets Condition="%(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'exclude'">runtime</ExcludeAssets>""" + | ||
| //""" <Publish Condition=" '$(PackAsTool)' == 'true' ">true</Publish>""" + | ||
| """ </PackageReference>"""]) | ||
|
|
||
| [yield sprintf " <ItemGroup Condition=\"($(DesignTimeBuild) == true)%s\">" condition | ||
| yield! packageReferences | ||
| yield " </ItemGroup>"]) | ||
| |> fun xs -> String.Join(Environment.NewLine,xs) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you know that there is a
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but what would that improve?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, nothing actually. 😁 Just to avoid the lambda. I used to not know about the curried version in the past. |
||
|
|
||
| let content = | ||
| sprintf """<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
| <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <PropertyGroup> | ||
| <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | ||
| %s | ||
| </PropertyGroup> | ||
| %s | ||
| </Project>""" | ||
| (if restoreSuccess then | ||
| "<!-- <RestoreSuccess>False</RestoreSuccess> -->" | ||
| else | ||
| "<RestoreSuccess>False</RestoreSuccess>") | ||
| %s | ||
| </Project>""" | ||
| cliParts | ||
| packagesParts | ||
|
|
||
| saveToFile content fileInfo |> ignore | ||
|
|
||
|
|
@@ -402,14 +430,17 @@ let createProjectReferencesFiles (lockFile:LockFile) (projectFile:ProjectFile) ( | |
| loop 5 | ||
|
|
||
| let cliTools = System.Collections.Generic.List<_>() | ||
| let packages = System.Collections.Generic.List<_>() | ||
| for kv in groups do | ||
| let _,cliToolsInGroup = lockFile.GetOrderedPackageHull(kv.Key,referencesFile) | ||
| let packagesInGroup,cliToolsInGroup = lockFile.GetOrderedPackageHull(kv.Key,referencesFile) | ||
| cliTools.AddRange cliToolsInGroup | ||
| packages.AddRange packagesInGroup | ||
|
|
||
| let paketCLIToolsFileName = FileInfo(Path.Combine(projectFileInfo.Directory.FullName,"obj",projectFileInfo.Name + ".paket.clitools")) | ||
| createPaketCLIToolsFile cliTools paketCLIToolsFileName | ||
|
|
||
| createPaketPropsFile cliTools true (ProjectFile.getPaketPropsFileInfo projectFileInfo) | ||
| let propsFile = ProjectFile.getPaketPropsFileInfo projectFileInfo | ||
| createPaketPropsFile lockFile cliTools packages propsFile | ||
|
|
||
| // Write "cached" file, this way msbuild can check if the references file has changed. | ||
| let paketCachedReferencesFileName = FileInfo(Path.Combine(projectFileInfo.Directory.FullName,"obj",projectFileInfo.Name + ".paket.references.cached")) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Krzysztof-Cieslak @enricosada I'm not sure if this will break the ionide integration. FSAuto was watching the assets file, right? does it watch the props files?