|
| 1 | +<!-- |
| 2 | + [The "BSD licence"] |
| 3 | + Copyright (c) 2011 Sam Harwell |
| 4 | + All rights reserved. |
| 5 | +
|
| 6 | + Redistribution and use in source and binary forms, with or without |
| 7 | + modification, are permitted provided that the following conditions |
| 8 | + are met: |
| 9 | + 1. Redistributions of source code must retain the above copyright |
| 10 | + notice, this list of conditions and the following disclaimer. |
| 11 | + 2. Redistributions in binary form must reproduce the above copyright |
| 12 | + notice, this list of conditions and the following disclaimer in the |
| 13 | + documentation and/or other materials provided with the distribution. |
| 14 | + 3. The name of the author may not be used to endorse or promote products |
| 15 | + derived from this software without specific prior written permission. |
| 16 | +
|
| 17 | + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 18 | + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 19 | + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 20 | + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 21 | + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 22 | + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 | + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | +--> |
| 28 | +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 29 | + <PropertyGroup> |
| 30 | + <BuildSystem>MSBuild</BuildSystem> |
| 31 | + <TaskVersion>3.5.0.2</TaskVersion> |
| 32 | + <TaskKeyToken>eb42632606e9261f</TaskKeyToken> |
| 33 | + <AntlrBuildTaskAssemblyName Condition="'$(AntlrBuildTaskAssemblyName)'==''">AntlrBuildTask, Version=$(TaskVersion), Culture=neutral, PublicKeyToken=$(TaskKeyToken)</AntlrBuildTaskAssemblyName> |
| 34 | + </PropertyGroup> |
| 35 | + |
| 36 | + <PropertyGroup> |
| 37 | + <LoadTimeSensitiveTargets> |
| 38 | + $(LoadTimeSensitiveTargets); |
| 39 | + AntlrCompile; |
| 40 | + </LoadTimeSensitiveTargets> |
| 41 | + <LoadTimeSensitiveProperties> |
| 42 | + $(LoadTimeSensitiveProperties); |
| 43 | + AntlrCompileDependsOn; |
| 44 | + </LoadTimeSensitiveProperties> |
| 45 | + </PropertyGroup> |
| 46 | + |
| 47 | + <PropertyGroup> |
| 48 | + <AntlrBuildTaskLocation Condition="'$(AntlrBuildTaskPath)'==''">$(MSBuildBinPath)</AntlrBuildTaskLocation> |
| 49 | + <AntlrBuildTaskLocation Condition="'$(AntlrBuildTaskPath)'!=''">$(AntlrBuildTaskPath)</AntlrBuildTaskLocation> |
| 50 | + <AntlrToolLocation Condition="'$(AntlrToolPath)'==''">$(MSBuildBinPath)\Antlr3\Antlr3.exe</AntlrToolLocation> |
| 51 | + <AntlrToolLocation Condition="'$(AntlrToolPath)'!=''">$(AntlrToolPath)</AntlrToolLocation> |
| 52 | + </PropertyGroup> |
| 53 | + |
| 54 | + <PropertyGroup> |
| 55 | + <AntlrGenCodeFileNames Condition="'$(AntlrGenCodeFileNames)'==''">$(MSBuildProjectFile).AntlrGeneratedCodeFileListAbsolute.txt</AntlrGenCodeFileNames> |
| 56 | + </PropertyGroup> |
| 57 | + |
| 58 | + <UsingTask Condition="'$(AntlrBuildTaskPath)'==''" TaskName="Antlr3.Build.Tasks.AntlrClassGenerationTask" AssemblyName="$(AntlrBuildTaskAssemblyName)" /> |
| 59 | + <UsingTask Condition="'$(AntlrBuildTaskPath)'!=''" TaskName="Antlr3.Build.Tasks.AntlrClassGenerationTask" AssemblyFile="$(AntlrBuildTaskPath)\AntlrBuildTask.dll" /> |
| 60 | + |
| 61 | + <PropertyGroup> |
| 62 | + <PrepareResourcesDependsOn> |
| 63 | + AntlrCompile; |
| 64 | + AntlrCompileAddFilesGenerated; |
| 65 | + $(PrepareResourcesDependsOn) |
| 66 | + </PrepareResourcesDependsOn> |
| 67 | + </PropertyGroup> |
| 68 | + |
| 69 | + <PropertyGroup> |
| 70 | + <AntlrCompileDependsOn> |
| 71 | + AntlrCompileReadGeneratedFileList |
| 72 | + </AntlrCompileDependsOn> |
| 73 | + </PropertyGroup> |
| 74 | + |
| 75 | + <ItemGroup Condition="'$(BuildingInsideVisualStudio)'=='true'"> |
| 76 | + <AvailableItemName Include="Antlr3" /> |
| 77 | + <AvailableItemName Include="AntlrTokens" /> |
| 78 | + <AvailableItemName Include="AntlrAbstractGrammar" /> |
| 79 | + </ItemGroup> |
| 80 | + |
| 81 | + <ItemDefinitionGroup> |
| 82 | + <Antlr3> |
| 83 | + <Generator>MSBuild:Compile</Generator> |
| 84 | + <TargetLanguage/> |
| 85 | + <DebugGrammar>false</DebugGrammar> |
| 86 | + <ProfileGrammar>false</ProfileGrammar> |
| 87 | + </Antlr3> |
| 88 | + </ItemDefinitionGroup> |
| 89 | + |
| 90 | + <Target Name="AntlrCompileReadGeneratedFileList"> |
| 91 | + <ReadLinesFromFile File="$(IntermediateOutputPath)$(AntlrGenCodeFileNames)"> |
| 92 | + <Output TaskParameter="Lines" ItemName="AntlrOutputCodeFilesList"/> |
| 93 | + </ReadLinesFromFile> |
| 94 | + </Target> |
| 95 | + |
| 96 | + <PropertyGroup> |
| 97 | + <!-- Add grammar compilation to the CoreCompileDependsOn so that the IDE inproc compilers (particularly VB) |
| 98 | + can "see" the generated source files. --> |
| 99 | + <CoreCompileDependsOn Condition="'$(BuildingInsideVisualStudio)' == 'true' "> |
| 100 | + DesignTimeGrammarCompilation; |
| 101 | + $(CoreCompileDependsOn) |
| 102 | + </CoreCompileDependsOn> |
| 103 | + </PropertyGroup> |
| 104 | + |
| 105 | + <Target Name="DesignTimeGrammarCompilation"> |
| 106 | + <!-- Only if we are not actually performing a compile i.e. we are in design mode --> |
| 107 | + <CallTarget Condition="'$(BuildingProject)' != 'true'" |
| 108 | + Targets="AntlrCompile" /> |
| 109 | + </Target> |
| 110 | + |
| 111 | + <Target Name="AntlrCompile" |
| 112 | + DependsOnTargets="$(AntlrCompileDependsOn)" |
| 113 | + Condition="'@(Antlr3)' != ''" |
| 114 | + Inputs="@(Antlr3);@(AntlrTokens);@(AntlrAbstractGrammar)" |
| 115 | + Outputs="@(AntlrOutputCodeFilesList); |
| 116 | + $(IntermediateOutputPath)$(AntlrGenCodeFileNames);"> |
| 117 | + |
| 118 | + <ItemGroup> |
| 119 | + <AntlrGeneratedCodeFiles Remove="@(AntlrGeneratedCodeFiles)" /> |
| 120 | + </ItemGroup> |
| 121 | + |
| 122 | + <PropertyGroup> |
| 123 | + <_IntellisenseOnlyCompile>false</_IntellisenseOnlyCompile> |
| 124 | + <_IntellisenseOnlyCompile Condition="'$(BuildingProject)' != 'true'">true</_IntellisenseOnlyCompile> |
| 125 | + </PropertyGroup> |
| 126 | + <AntlrClassGenerationTask |
| 127 | + AntlrToolPath="$(AntlrToolLocation)" |
| 128 | + BuildTaskPath="$(AntlrBuildTaskLocation)" |
| 129 | + OutputPath="$(IntermediateOutputPath)" |
| 130 | + TargetLanguage="%(Antlr3.TargetLanguage)" |
| 131 | + SourceCodeFiles="@(Antlr3)" |
| 132 | + ContinueOnError="$(_IntellisenseOnlyCompile)" |
| 133 | + TokensFiles="@(AntlrTokens)" |
| 134 | + AbstractGrammarFiles="@(AntlrAbstractGrammar)" |
| 135 | + LanguageSourceExtensions="$(DefaultLanguageSourceExtension)" |
| 136 | + DebugGrammar="%(Antlr3.DebugGrammar)" |
| 137 | + ProfileGrammar="%(Antlr3.ProfileGrammar)"> |
| 138 | + |
| 139 | + <Output ItemName="AntlrGeneratedCodeFiles" TaskParameter="GeneratedCodeFiles" /> |
| 140 | + </AntlrClassGenerationTask> |
| 141 | + |
| 142 | + <WriteLinesToFile |
| 143 | + Condition="'$(_IntellisenseOnlyCompile)' != 'true'" |
| 144 | + File="$(IntermediateOutputPath)$(AntlrGenCodeFileNames)" |
| 145 | + Lines="@(AntlrGeneratedCodeFiles)" |
| 146 | + Overwrite="true"/> |
| 147 | + </Target> |
| 148 | + |
| 149 | + <Target Name="AntlrCompileAddFilesGenerated" |
| 150 | + AfterTargets="AntlrCompile" |
| 151 | + Condition="'@(Antlr3)' != ''"> |
| 152 | + |
| 153 | + <ItemGroup> |
| 154 | + <AntlrGeneratedCodeFiles Condition="'@(AntlrGeneratedCodeFiles)' == ''" Include="@(AntlrOutputCodeFilesList)" /> |
| 155 | + </ItemGroup> |
| 156 | + |
| 157 | + <ItemGroup> |
| 158 | + <FileWrites Include="@(AntlrGeneratedCodeFiles); |
| 159 | + $(IntermediateOutputPath)$(AntlrGenCodeFileNames);" /> |
| 160 | + </ItemGroup> |
| 161 | + |
| 162 | + <ItemGroup> |
| 163 | + <Compile Include="@(AntlrGeneratedCodeFiles)" /> |
| 164 | + <!-- The WinFX "GenerateTemporaryTargetAssembly" target requires generated code files be added here. --> |
| 165 | + <_GeneratedCodeFiles Include="@(AntlrGeneratedCodeFiles)" /> |
| 166 | + </ItemGroup> |
| 167 | + |
| 168 | + </Target> |
| 169 | +</Project> |
0 commit comments