forked from jasder/antlr
Automatically select the C# target variant for the current framework
This commit is contained in:
parent
c859debc68
commit
8ee3a2204f
|
@ -130,6 +130,7 @@
|
|||
BuildTaskPath="$(Antlr4BuildTaskLocation)"
|
||||
OutputPath="$(IntermediateOutputPath)"
|
||||
TargetLanguage="%(Antlr4.TargetLanguage)"
|
||||
TargetFrameworkVersion="$(TargetFrameworkVersion)"
|
||||
SourceCodeFiles="@(Antlr4)"
|
||||
ContinueOnError="$(_IntellisenseOnlyCompile)"
|
||||
TokensFiles="@(Antlr4Tokens)"
|
||||
|
|
|
@ -76,6 +76,12 @@ namespace Antlr4.Build.Tasks
|
|||
set;
|
||||
}
|
||||
|
||||
public string TargetFrameworkVersion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string BuildTaskPath
|
||||
{
|
||||
get;
|
||||
|
@ -294,6 +300,7 @@ namespace Antlr4.Build.Tasks
|
|||
wrapper.ToolPath = ToolPath;
|
||||
wrapper.SourceCodeFiles = sourceCodeFiles;
|
||||
wrapper.TargetLanguage = TargetLanguage;
|
||||
wrapper.TargetFrameworkVersion = TargetFrameworkVersion;
|
||||
wrapper.OutputPath = OutputPath;
|
||||
wrapper.LanguageSourceExtensions = LanguageSourceExtensions;
|
||||
wrapper.TargetNamespace = TargetNamespace;
|
||||
|
|
|
@ -65,6 +65,12 @@ namespace Antlr4.Build.Tasks
|
|||
set;
|
||||
}
|
||||
|
||||
public string TargetFrameworkVersion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string OutputPath
|
||||
{
|
||||
get;
|
||||
|
@ -173,7 +179,19 @@ namespace Antlr4.Build.Tasks
|
|||
arguments.Add("-Dabstract=true");
|
||||
|
||||
if (!string.IsNullOrEmpty(TargetLanguage))
|
||||
arguments.Add("-Dlanguage=" + TargetLanguage);
|
||||
{
|
||||
string framework = TargetFrameworkVersion;
|
||||
if (string.IsNullOrEmpty(framework))
|
||||
framework = "v2.0";
|
||||
|
||||
string language;
|
||||
if (TargetLanguage.Equals("CSharp"))
|
||||
language = TargetLanguage + '_' + framework.Replace('.', '_');
|
||||
else
|
||||
language = TargetLanguage;
|
||||
|
||||
arguments.Add("-Dlanguage=" + language);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(TargetNamespace))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue