File: FSharp.SRGen.targets

package info (click to toggle)
fsharp 4.0.0.4%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 58,824 kB
  • ctags: 1,395
  • sloc: cs: 2,983; ml: 1,098; makefile: 410; sh: 409; xml: 113
file content (73 lines) | stat: -rwxr-xr-x 3,653 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!--
***********************************************************************************************
FSharp.SRGen.targets

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
		  created a backup copy.  Incorrect changes to this file will make it
		  impossible to load or build your projects from the command-line or the IDE.

Copyright (C) Microsoft Corporation. Apache 2.0 License.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask TaskName="FsSrGen" AssemblyFile="FSharp.SRGen.Build.Tasks.dll"/>
  <PropertyGroup>
    <!-- Visual Studio and MSBuild use this dependency to trigger resource generation at the right time -->
    <PrepareForBuildDependsOn>ProcessFsSrGen;$(PrepareForBuildDependsOn)</PrepareForBuildDependsOn>
    <!-- XBuild and MonoDevelop and Xamarin Studio use this dependency to trigger resource generation at the right time -->
    <!-- For some reason these don't recognize 'PrepareForBuildDependsOn' -->
    <BuildDependsOn>ProcessFsSrGen;$(BuildDependsOn)</BuildDependsOn>
  </PropertyGroup>

  <!-- Build FsSrGen files. -->
  <Target
		Name="CallFsSrGen"
		Inputs="@(FsSrGen)"
		Outputs="@(FsSrGen->'$(IntermediateOutputPath)%(Filename).fs');@(FsSrGen->'%(Filename).resx')"
		Condition="'@(FsSrGen)'!=''">
    <!-- Create the output directory in case it doesn't exist yet -->
    <MakeDir Directories="$(IntermediateOutputPath)"/>
    <!-- Run the tool -->
    <!-- Don't put the resx in the IntermediateOutputPath as the Mono targets ends up naming the resource incorrectly (it ignores ManifestResourceName) -->
    <FsSrGen
      InputFile="%(FsSrGen.FullPath)"
      ToolPath="$(FsSrGenToolPath)"
      OutputFsFile="$(IntermediateOutputPath)%(FsSrGen.Filename).fs"
      OutputResxFile="%(FsSrGen.Filename).resx"
      >
    </FsSrGen>
  </Target>

  <!-- Process FsSrGen rules. No 'Inputs' and 'Outputs' means this rule always runs if there is any @FsSrGen, even if up-to-date. -->
  <Target
		Name="ProcessFsSrGen"
                DependsOnTargets="CallFsSrGen"
		Condition="'@(FsSrGen)'!=''">
    <!-- Make the outputs magically part of the project -->
    <CreateItem Include="$(IntermediateOutputPath)%(FsSrGen.Filename).fs">
      <Output TaskParameter="Include" ItemName="CompileBefore"/>
    </CreateItem>
    <CreateItem Include="%(FsSrGen.Filename).resx"
                AdditionalMetadata="ManifestResourceName=%(FsSrGen.Filename)">
      <!-- Note AdditionalMetadata above; we need the name in the manifest to be Foo.resources and not e.g. obj.Debug.Foo.resources -->
      <Output TaskParameter="Include" ItemName="EmbeddedResource"/>
    </CreateItem>
    <!-- Add them to the list of things under the IntermediateOutputPath that should be 'clean'ed -->
    <CreateItem Include="$(IntermediateOutputPath)%(FsSrGen.Filename).fs">
      <Output TaskParameter="Include" ItemName="FileWrites"/>
    </CreateItem>
    <CreateItem Include="%(FsSrGen.Filename).resx">
      <Output TaskParameter="Include" ItemName="FileWrites"/>
    </CreateItem>
    <!-- below, turn off this in VS, so that all90.sln does not take forever to load -->
    <Exec Condition="'$(EnsureThereAreNoUnusedFsSrGenResources)'!='false' And '$(BuildingInsideVisualStudio)'!='true'"
          Command="$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin\FindUnusedResources.exe %(FsSrGen.FullPath) $(FSharpSourcesRoot)" />
  </Target>

  <ItemGroup>
    <AvailableItemName Include="FsSrGen">
      <Visible>false</Visible>
    </AvailableItemName>
  </ItemGroup>
</Project>