<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="MSBuild.Sdk.Extras">

  <PropertyGroup>
    <TargetFrameworks>net35-client;net40-client;netstandard2.0</TargetFrameworks>
    <RootNamespace>Antlr.ST</RootNamespace>

    <Description>The C# port of StringTemplate 3.</Description>
    <Version>$(ANTLRVersion)</Version>
    <FileVersion>$(ANTLRFileVersion)</FileVersion>
    <InformationalVersion>$(ANTLRInformationalVersion)</InformationalVersion>

    <Title>StringTemplate 3</Title>
    <PackageId>StringTemplate3</PackageId>
    <PackageTags>stringtemplate st3 stringtemplate3 template</PackageTags>

    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
  </PropertyGroup>

  <Target Name="DisableCrazyPackageDeletion" BeforeTargets="Clean">
    <PropertyGroup>
      <GeneratePackageValue>$(GeneratePackageOnBuild)</GeneratePackageValue>
      <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
    </PropertyGroup>
  </Target>
  <Target Name="EnablePackageGeneration" Condition="'$(GeneratePackageValue)' != ''" BeforeTargets="Build">
    <PropertyGroup>
      <GeneratePackageOnBuild>$(GeneratePackageValue)</GeneratePackageOnBuild>
    </PropertyGroup>
  </Target>

  <Choose>
    <When Condition="'$(TargetFramework)' == 'netstandard2.0'">
      <ItemGroup>
        <PackageReference Include="System.Reflection.Emit.ILGeneration" Version="4.3.0" />
        <PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
      </ItemGroup>
    </When>
  </Choose>

  <PropertyGroup>
    <DefineConstants>$(DefineConstants);COMPILE_EXPRESSIONS;CACHE_FUNCTORS</DefineConstants>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Runtime\Antlr3.Runtime\Antlr3.Runtime.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Compile Update="Language\AngleBracketTemplateLexerHelper.cs">
      <DependentUpon>AngleBracketTemplateLexer.g3</DependentUpon>
    </Compile>
    <Compile Update="Language\TemplateLexerHelper.cs">
      <DependentUpon>Template.g3</DependentUpon>
    </Compile>
    <Compile Update="Language\TemplateParserHelper.cs">
      <DependentUpon>Template.g3</DependentUpon>
    </Compile>
    <Compile Update="Language\InterfaceLexerHelper.cs">
      <DependentUpon>Interface.g3</DependentUpon>
    </Compile>
    <Compile Update="Language\InterfaceParserHelper.cs">
      <DependentUpon>Interface.g3</DependentUpon>
    </Compile>
    <Compile Update="Language\GroupLexerHelper.cs">
      <DependentUpon>Group.g3</DependentUpon>
    </Compile>
    <Compile Update="Language\GroupParserHelper.cs">
      <DependentUpon>Group.g3</DependentUpon>
    </Compile>
    <Compile Update="Language\ActionLexerHelper.cs">
      <DependentUpon>Action.g3</DependentUpon>
    </Compile>
    <Compile Update="Language\ActionParserHelper.cs">
      <DependentUpon>Action.g3</DependentUpon>
    </Compile>
    <Compile Update="Language\ActionEvaluatorHelper.cs">
      <DependentUpon>ActionEvaluator.g3</DependentUpon>
    </Compile>
  </ItemGroup>

</Project>