Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Antlr4 syntax #208

Closed
baruchiro opened this issue Nov 11, 2018 · 6 comments
Closed

Support Antlr4 syntax #208

baruchiro opened this issue Nov 11, 2018 · 6 comments

Comments

@baruchiro
Copy link

Antlr4 use csproj file to generate his files.
Just copy the ItemGroup from old to new.

@hvanbakel
Copy link
Owner

hvanbakel commented Nov 11, 2018 via email

@baruchiro
Copy link
Author

Before:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.props" Condition="Exists('..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.props')" />
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AC708E4D-2737-4D78-AA3D-2E42A48F4F51}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ProjectName</RootNamespace>
    <AssemblyName>ProjectName</AssemblyName>
    <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <SccProjectName>SAK</SccProjectName>
    <SccLocalPath>SAK</SccLocalPath>
    <SccAuxPath>SAK</SccAuxPath>
    <SccProvider>SAK</SccProvider>
    <TargetFrameworkProfile />
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  .
  .
  .
  <ItemGroup>
    <Reference Include="Antlr4.Runtime, Version=4.6.0.0, Culture=neutral, PublicKeyToken=e9931a4108ef2354, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Antlr4.Runtime.4.6.5-rc002\lib\net45\Antlr4.Runtime.dll</HintPath>
      <Private>True</Private>
    </Reference>
    .
    .
    .
    <Reference Include="System" />
    <Reference Include="System.Core" />
  </ItemGroup>
   .
   .
   .
  <ItemGroup>
    <Antlr4 Include="filename1.g4">
      <Generator>MSBuild:Compile</Generator>
      <TargetLanguage>CSharp_v4_5</TargetLanguage>
      <CustomToolNamespace>myFramework</CustomToolNamespace>
    </Antlr4>
    <Antlr4 Include="filename2.g4">
      <Generator>MSBuild:Compile</Generator>
      <TargetLanguage>CSharp_v4_5</TargetLanguage>
      <CustomToolNamespace>myFramework</CustomToolNamespace>
    </Antlr4>
    <None Include="app.config" />
    <None Include="packages.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   .
   .
   .
    <Error Condition="!Exists('..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.props'))" />
    <Error Condition="!Exists('..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.targets'))" />
  </Target>
  <Import Project="..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.targets" Condition="Exists('..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.targets')" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

After migrate:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <ProjectGuid>{AC708E4D-2737-4D78-AA3D-2E42A48F4F51}</ProjectGuid>
    <RootNamespace>ProjectName</RootNamespace>
    <AssemblyName>ProjectName</AssemblyName>
    <TargetFramework>net471</TargetFramework>
    <SccProjectName>SAK</SccProjectName>
    <SccLocalPath>SAK</SccLocalPath>
    <SccAuxPath>SAK</SccAuxPath>
    <SccProvider>SAK</SccProvider>
    <AssemblyTitle>ClassLibrary1</AssemblyTitle>
    <Product>ClassLibrary1</Product>
    <Copyright>Copyright ©  2016</Copyright>
    <OutputPath>...............</OutputPath>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>
  <Import Project="..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.props" Condition="Exists('..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.props')" />
  <Import Project="..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.targets" Condition="Exists('..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.targets')" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.props'))" />
    <Error Condition="!Exists('..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Antlr4.CodeGenerator.4.6.5-rc002\build\Antlr4.CodeGenerator.targets'))" />
  </Target>
  <ItemGroup>
    <PackageReference Include="Antlr4" Version="4.6.5-rc002">
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Antlr4.CodeGenerator" Version="4.6.5-rc002">
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Antlr4.Runtime" Version="4.6.5-rc002" />
    .
    .
    .
  </ItemGroup>
  <ItemGroup>
    <Reference Include="Antlr4.Runtime, Version=4.6.0.0, Culture=neutral, PublicKeyToken=e9931a4108ef2354, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Antlr4.Runtime.4.6.5-rc002\lib\net45\Antlr4.Runtime.dll</HintPath>
      <Private>True</Private>
    </Reference>
     .
     .
     .
  </ItemGroup>
   .
   .
   .
  <ItemGroup>
    <Compile Remove="obj.............................
  </ItemGroup>
</Project>

But this ItemGroup:

  <ItemGroup>
    <Antlr4 Include="filename1.g4">
      <Generator>MSBuild:Compile</Generator>
      <TargetLanguage>CSharp_v4_5</TargetLanguage>
      <CustomToolNamespace>myFramework</CustomToolNamespace>
    </Antlr4>
    <Antlr4 Include="filename2.g4">
      <Generator>MSBuild:Compile</Generator>
      <TargetLanguage>CSharp_v4_5</TargetLanguage>
      <CustomToolNamespace>myFramework</CustomToolNamespace>
    </Antlr4>
    <None Include="app.config" />
    <None Include="packages.config" />
  </ItemGroup>

Should be in csproj after the migration.
Without this lines:

    <None Include="app.config" />
    <None Include="packages.config" />

@baruchiro
Copy link
Author

You can direct me and I will try to fix it myself.

@hvanbakel
Copy link
Owner

hvanbakel commented Nov 12, 2018 via email

hvanbakel added a commit that referenced this issue Nov 13, 2018
[Issue #208] Add Antlr4 tag support
@hvanbakel
Copy link
Owner

Merged, thanks for the PR. Publishing a new version now.

@baruchiro
Copy link
Author

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

No branches or pull requests

2 participants