Skip to content

[WIP] .PP Template Support - #2231

Closed
gimpf wants to merge 2 commits into
fsprojects:masterfrom
gimpf:pp-template-support
Closed

gimpf wants to merge 2 commits into
fsprojects:masterfrom
gimpf:pp-template-support

Conversation

@gimpf

@gimpf gimpf commented Apr 11, 2017

Copy link
Copy Markdown

PP Templates are very primitive; they allow substitute $TAGS$ with the value of the project property (sometimes stuff like RootNamespace etc.).

Tests, again, are still missing, but would you consider integrating that functionality?

Markus Grüneis added 2 commits April 11, 2017 15:40
See https://msdn.microsoft.com/en-us/library/dd393574.aspx:
> In MSBuild, element and attribute names are case-sensitive. However, property,
> item, and metadata names are not.

This is needed to make regular .pp templates work correctly.
@forki

forki commented Apr 11, 2017

Copy link
Copy Markdown
Member

what is PP template?

@enricosada

Copy link
Copy Markdown
Contributor

@forki no clue about that

@gimpf

gimpf commented Apr 11, 2017

Copy link
Copy Markdown
Author

@forki @enricosada See https://docs.microsoft.com/en-us/nuget/create-packages/source-and-config-file-transformations

PP is short for "Project Property".

@baronfel

Copy link
Copy Markdown
Contributor

One thing that's missing here, and the part that complicates the template feature somewhat, is that nuget files can have content both per-language and per-framework. Here's the relevant portion from the documentation(check the package folder structure section): https://docs.microsoft.com/en-us/nuget/schema/nuspec#including-content-files

Here's the relevant paragraphs:

The package project should structure content using the following pattern:
/contentFiles/{codeLanguage}/{TxM}/{any?}

  • codeLanguages may be cs, vb, fs, any, or the lowercase equivalent of a given $(ProjectLanguage)
  • TxM is any legal target framework moniker that NuGet supports (see Target frameworks).
  • Any folder structure may be appended to the end of this syntax.
    For example:

Language- and framework-agnostic:
/contentFiles/any/any/config.xml
net45 content for all languages
/contentFiles/any/net45/config.xml
C#-specific content for net45 and up
/contentFiles/cs/net45/sample.cs
Empty folders can use . to opt out of providing content for certain combinations of language and TxM, for example:
contentFiles/vb/any/code.vb
/contentFiles/cs/any/.

What this means is that during install we need to inspect the package layout and filter the list of content to include conditionally by target framework, possibly by wrapping in Choose nodes like we have to with package references.

@cloudRoutine

Copy link
Copy Markdown
Member

@baronfel and I have talked about this before, this currently a bugged feature in Paket where content files in /any/ are adding the /any/ directory to the projects they install into, which should not be happening. You can see this happening with FSharp.Compiler.Service.

@cloudRoutine cloudRoutine left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@gimpf this is a feature that's been on our TODO list for a while, but we just haven't gotten around to it. Is this properly taking into account the language sub directories */cs/*,*/fs/*,etc. ?

open System
open System.Collections.Generic

type CiString(value) =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

needs a doccom explaining what this is for

fun f -> f.Name.EndsWith ".tt"
fun f -> f.Name.EndsWith ".ttinclude"
fun f -> f.Name.EndsWith ".install.xdt"
fun f -> f.Name.EndsWith ".uninstall.xdt" ]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

couldn't this be achieved with an active pattern for EndsWith and a pattern match on fileinfo.Name?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

also it'd be good to emit a warning when a "blacklisted" file has been encountered

@matthid

matthid commented Jun 15, 2017

Copy link
Copy Markdown
Member

Closing due to inactivity, because we refactored a lot in the mean time (so it might be better to start from scratch) and because I think needs to go into InstallModel.

@matthid matthid closed this Jun 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants