|
| 1 | +<!-- |
| 2 | +*********************************************************************************************** |
| 3 | +FSharp.SRGen.targets |
| 4 | +
|
| 5 | +WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have |
| 6 | + created a backup copy. Incorrect changes to this file will make it |
| 7 | + impossible to load or build your projects from the command-line or the IDE. |
| 8 | +
|
| 9 | +Copyright (C) Microsoft Corporation. Apache 2.0 License. |
| 10 | +*********************************************************************************************** |
| 11 | +--> |
| 12 | + |
| 13 | +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 14 | + <UsingTask TaskName="FsSrGen" AssemblyFile="FSharp.SRGen.Build.Tasks.dll"/> |
| 15 | + <PropertyGroup> |
| 16 | + <!-- Visual Studio and MSBuild use this dependency to trigger resource generation at the right time --> |
| 17 | + <PrepareForBuildDependsOn>ProcessFsSrGen;$(PrepareForBuildDependsOn)</PrepareForBuildDependsOn> |
| 18 | + <!-- XBuild and MonoDevelop and Xamarin Studio use this dependency to trigger resource generation at the right time --> |
| 19 | + <!-- For some reason these don't recognize 'PrepareForBuildDependsOn' --> |
| 20 | + <BuildDependsOn>ProcessFsSrGen;$(BuildDependsOn)</BuildDependsOn> |
| 21 | + </PropertyGroup> |
| 22 | + |
| 23 | + <!-- Build FsSrGen files. --> |
| 24 | + <Target |
| 25 | + Name="CallFsSrGen" |
| 26 | + Inputs="@(FsSrGen)" |
| 27 | + Outputs="@(FsSrGen->'$(IntermediateOutputPath)%(Filename).fs');@(FsSrGen->'%(Filename).resx')" |
| 28 | + Condition="'@(FsSrGen)'!=''"> |
| 29 | + <!-- Create the output directory in case it doesn't exist yet --> |
| 30 | + <MakeDir Directories="$(IntermediateOutputPath)"/> |
| 31 | + <!-- Run the tool --> |
| 32 | + <!-- Don't put the resx in the IntermediateOutputPath as the Mono targets ends up naming the resource incorrectly (it ignores ManifestResourceName) --> |
| 33 | + <FsSrGen |
| 34 | + InputFile="%(FsSrGen.FullPath)" |
| 35 | + ToolPath="$(FsSrGenToolPath)" |
| 36 | + OutputFsFile="$(IntermediateOutputPath)%(FsSrGen.Filename).fs" |
| 37 | + OutputResxFile="%(FsSrGen.Filename).resx" |
| 38 | + > |
| 39 | + </FsSrGen> |
| 40 | + </Target> |
| 41 | + |
| 42 | + <!-- Process FsSrGen rules. No 'Inputs' and 'Outputs' means this rule always runs if there is any @FsSrGen, even if up-to-date. --> |
| 43 | + <Target |
| 44 | + Name="ProcessFsSrGen" |
| 45 | + DependsOnTargets="CallFsSrGen" |
| 46 | + Condition="'@(FsSrGen)'!=''"> |
| 47 | + <!-- Make the outputs magically part of the project --> |
| 48 | + <CreateItem Include="$(IntermediateOutputPath)%(FsSrGen.Filename).fs"> |
| 49 | + <Output TaskParameter="Include" ItemName="CompileBefore"/> |
| 50 | + </CreateItem> |
| 51 | + <CreateItem Include="%(FsSrGen.Filename).resx" |
| 52 | + AdditionalMetadata="ManifestResourceName=%(FsSrGen.Filename)"> |
| 53 | + <!-- Note AdditionalMetadata above; we need the name in the manifest to be Foo.resources and not e.g. obj.Debug.Foo.resources --> |
| 54 | + <Output TaskParameter="Include" ItemName="EmbeddedResource"/> |
| 55 | + </CreateItem> |
| 56 | + <!-- Add them to the list of things under the IntermediateOutputPath that should be 'clean'ed --> |
| 57 | + <CreateItem Include="$(IntermediateOutputPath)%(FsSrGen.Filename).fs"> |
| 58 | + <Output TaskParameter="Include" ItemName="FileWrites"/> |
| 59 | + </CreateItem> |
| 60 | + <CreateItem Include="%(FsSrGen.Filename).resx"> |
| 61 | + <Output TaskParameter="Include" ItemName="FileWrites"/> |
| 62 | + </CreateItem> |
| 63 | + <!-- below, turn off this in VS, so that all90.sln does not take forever to load --> |
| 64 | + <Exec Condition="'$(EnsureThereAreNoUnusedFsSrGenResources)'!='false' And '$(BuildingInsideVisualStudio)'!='true'" |
| 65 | + Command="$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin\FindUnusedResources.exe %(FsSrGen.FullPath) $(FSharpSourcesRoot)" /> |
| 66 | + </Target> |
| 67 | + |
| 68 | + <ItemGroup> |
| 69 | + <AvailableItemName Include="FsSrGen"> |
| 70 | + <Visible>false</Visible> |
| 71 | + </AvailableItemName> |
| 72 | + </ItemGroup> |
| 73 | +</Project> |
0 commit comments