fsharp/buildtools/buildtools.targets

64 строки
2.5 KiB
XML

<Project>
<PropertyGroup>
<!-- during a regular build `dotnet(.exe)` is expected to be on the path -->
<DotNetExe Condition="'$(OS)' == 'Unix'">dotnet</DotNetExe>
<DotNetExe Condition="'$(OS)' != 'Unix'">dotnet.exe</DotNetExe>
<!-- if already running under dotnet, use that instance -->
<DotNetExe Condition="'$(DOTNET_HOST_PATH)' != ''">$(DOTNET_HOST_PATH)</DotNetExe>
<DotNetExePath>$(DotNetExe)</DotNetExePath>
<!-- this is usually set by Arcade, but non-arcade builds won't have it -->
<DotNetTool Condition="'$(DotNetTool)' == ''">$(DotNetExePath)</DotNetTool>
</PropertyGroup>
<!-- Build FsLex files. -->
<Target Name="CallFsLex"
Inputs="@(FsLex)"
Outputs="@(FsLex->'$(FsLexOutputFolder)%(Filename).fs')"
Condition="'@(FsLex)'!=''"
BeforeTargets="CoreCompile">
<PropertyGroup>
<FsLexPath Condition="'$(FsLexPath)' == ''">$(ArtifactsDir)\Bootstrap\fslex\fslex.dll</FsLexPath>
</PropertyGroup>
<!-- Create the output directory -->
<MakeDir Directories="$(FsLexOutputFolder)"/>
<!-- Run the tool -->
<Exec Command="&quot;$(DotNetTool)&quot; &quot;$(FsLexPath)&quot; -o &quot;$(FsLexOutputFolder)%(FsLex.Filename).fs&quot; %(FsLex.OtherFlags) %(FsLex.Identity)" />
<!-- Make sure it will get cleaned -->
<CreateItem Include="$(FsLexOutputFolder)%(FsLex.Filename).fs">
<Output TaskParameter="Include" ItemName="FsGeneratedSource"/>
<Output TaskParameter="Include" ItemName="FileWrites"/>
</CreateItem>
</Target>
<!-- Build FsYacc files. -->
<Target Name="CallFsYacc"
Inputs="@(FsYacc)"
Outputs="@(FsYacc->'$(FsYaccOutputFolder)%(Filename).fs')"
Condition="'@(FsYacc)'!=''"
BeforeTargets="CoreCompile">
<PropertyGroup>
<FsYaccPath Condition="'$(FsYaccPath)' == ''">$(ArtifactsDir)\Bootstrap\fsyacc\fsyacc.dll</FsYaccPath>
</PropertyGroup>
<!-- Create the output directory -->
<MakeDir Directories="$(FsYaccOutputFolder)" />
<!-- Run the tool -->
<Exec Command="&quot;$(DotNetTool)&quot; &quot;$(FsYaccPath)&quot; -o &quot;$(FsYaccOutputFolder)%(FsYacc.Filename).fs&quot; %(FsYacc.OtherFlags) %(FsYacc.Identity)" />
<!-- Make sure it will get cleaned -->
<CreateItem Include="$(FsYaccOutputFolder)%(FsYacc.Filename).fs">
<Output TaskParameter="Include" ItemName="FsGeneratedSource"/>
<Output TaskParameter="Include" ItemName="FileWrites"/>
</CreateItem>
</Target>
</Project>