Merge pull request #2821 from samuraiGH/TargetFramework
Директива {$TargetFramework}
This commit is contained in:
commit
e6b6a72dc7
|
|
@ -403,6 +403,14 @@ namespace PascalABCCompiler
|
|||
}
|
||||
}
|
||||
|
||||
public class UnsupportetTargetFramework: CompilerCompilationError
|
||||
{
|
||||
public UnsupportetTargetFramework(string FrameworkName, TreeRealization.location sl)
|
||||
: base(string.Format(StringResources.Get("COMPILATIONERROR_UNSUPPORTED_TARGETFRAMEWORK_{0}"), FrameworkName))
|
||||
{
|
||||
this.sourceLocation = new SourceLocation(sl.doc.file_name, sl.begin_line_num, sl.begin_column_num, sl.end_line_num, sl.end_column_num);
|
||||
}
|
||||
}
|
||||
|
||||
public enum UnitState { BeginCompilation, InterfaceCompiled, Compiled }
|
||||
|
||||
|
|
@ -1986,6 +1994,13 @@ namespace PascalABCCompiler
|
|||
}
|
||||
if (this.compilerOptions.Only32Bit)
|
||||
cdo.platformtarget = NETGenerator.CompilerOptions.PlatformTarget.x86;
|
||||
if (compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.compiler_directive_targetframework, out cds))
|
||||
{
|
||||
cdo.TargetFramework = cds[0].directive;
|
||||
if (!new string[] { "net40", "net403", "net45", "net451", "net452", "net46", "net461", "net462", "net47", "net471", "net472", "net48", "net481" }
|
||||
.Contains(cdo.TargetFramework))
|
||||
ErrorsList.Add(new UnsupportetTargetFramework(cdo.TargetFramework, cds[0].location));
|
||||
}
|
||||
if (compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.product_string, out cds))
|
||||
{
|
||||
cdo.Product = cds[0].directive;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,14 @@ namespace PascalABCCompiler.NETGenerator
|
|||
set { _platformtarget = value; }
|
||||
}
|
||||
|
||||
private string _TargetFramework = "";
|
||||
|
||||
public string TargetFramework
|
||||
{
|
||||
get { return _TargetFramework; }
|
||||
set { _TargetFramework = value; }
|
||||
}
|
||||
|
||||
public string Product
|
||||
{
|
||||
get { return _Product; }
|
||||
|
|
@ -1157,6 +1165,12 @@ namespace PascalABCCompiler.NETGenerator
|
|||
ab.SetCustomAttribute(new CustomAttributeBuilder(typeof(System.Reflection.AssemblyTitleAttribute).GetConstructor(new Type[] { typeof(string) }), new object[] { options.Title }));
|
||||
|
||||
ab.SetCustomAttribute(new CustomAttributeBuilder(typeof(System.Reflection.AssemblyDescriptionAttribute).GetConstructor(new Type[] { typeof(string) }), new object[] { options.Description }));
|
||||
|
||||
if (options.TargetFramework != "")
|
||||
{
|
||||
string frameworkVersion = string.Join(".", options.TargetFramework.Substring(3).AsEnumerable());
|
||||
ab.SetCustomAttribute(new CustomAttributeBuilder(typeof(TargetFrameworkAttribute).GetConstructor(new Type[] { typeof(string) }), new object[] { $".NETFramework,Version=v{frameworkVersion}" }));
|
||||
}
|
||||
|
||||
if (RunOnly)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
<param name="Keyword" value="endregion">
|
||||
<param name="Keyword" value="string_nullbased">
|
||||
<param name="Keyword" value="platformtarget">
|
||||
<param name="Keyword" value="targetframework">
|
||||
</object>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
|
||||
<title></title>
|
||||
|
|
@ -84,6 +85,7 @@ x64}</strong> -
|
|||
<p><b>{$company <компания>}</b> - компания </p>
|
||||
<p><b>{$copyright <копирайт>}</b> - копирайт </p>
|
||||
<p><b>{$trademark <торговая марка>}</b> - торговая марка </p>
|
||||
<p><b>{$targetframework <矼韵<EFBFBD><EFBFBD>>}</b> - 跏辷赭譛轢<E8AD9B> 矼韵<E79FBC><E99FB5> .NET Framework, 鴃縺黼赭<E9BBBC> 粳<> 艢闢驫<E997A2> </p>
|
||||
<p>Директивы <b>$ifdef</b>, <b>$ifndef</b> совместно с директивами <b>$else</b>
|
||||
и <b>$endif</b> управлют условной компиляцией частей исходного файла. Каждой
|
||||
директиве <b>$ifdef</b>, <b>$ifndef</b> должна соответствовать завершающая ее
|
||||
|
|
|
|||
|
|
@ -332,6 +332,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
public static string compiler_directive_resource = "resource";
|
||||
public static string compiler_directive_platformtarget = "platformtarget";
|
||||
public static string compiler_directive_faststrings = "faststrings";
|
||||
public static string compiler_directive_targetframework = "targetframework";
|
||||
|
||||
// SSM (3.1.2011) Перенес эти константы сюда.
|
||||
public static string version_string = "version";
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ NAMESPACE_CAN_BE_COMPILED_ONLY_IN_PROJECTS=Files with namespaces can be compiled
|
|||
NAMESPACE_CANNOT_HAVE_IN_SECTION=Namespace cannot have 'in' section
|
||||
APPTYPE_DLL_IS_ALLOWED_ONLY_FOR_LIBRARIES= {$apptype dll} directive is allowed only for libraries
|
||||
USES_IN_WRONG_NAME=Unit name in uses-in ({0}) must be same as file name ({1})
|
||||
UNSUPPORTED_TARGETFRAMEWORK_{0}=TargetFramework '{0}' not supported
|
||||
|
||||
%PREFIX%=
|
||||
COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Internal compiler error in module {0} :'{1}'
|
||||
|
|
@ -19,6 +19,7 @@ FILE_{0}_NOT_FOUND=Файл '{0}' не найден
|
|||
NAMESPACE_CANNOT_HAVE_IN_SECTION=Для пространства имен не может указываться секция in
|
||||
APPTYPE_DLL_IS_ALLOWED_ONLY_FOR_LIBRARIES=Директива {$apptype dll} возможна только для библиотек
|
||||
USES_IN_WRONG_NAME=Имя модуля в uses-in ({0}) должно совпадать с именем файла ({1})
|
||||
UNSUPPORTED_TARGETFRAMEWORK_{0}=TargetFramework '{0}' не поддерживается
|
||||
|
||||
%PREFIX%=
|
||||
COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Внутренняя ошибка компилятора в модуле {0} :'{1}'
|
||||
|
|
@ -17,6 +17,7 @@ DUPLICATE_DIRECTIVE{0}=Повторное объявление директив
|
|||
FILE_{0}_NOT_FOUND=Файл '{0}' не знайдено
|
||||
NAMESPACE_CAN_BE_COMPILED_ONLY_IN_PROJECTS=Компиляция файлов с пространствами имен допустима только в проектах
|
||||
USES_IN_WRONG_NAME=Ім'я модуля в uses-in ({0}) має збігатися з ім'ям файлу ({1})
|
||||
UNSUPPORTED_TARGETFRAMEWORK_{0}=TargetFramework '{0}' не підтримується
|
||||
|
||||
%PREFIX%=
|
||||
COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Внутрішня помилка компілятора в модулі {0} :'{1}'
|
||||
Loading…
Reference in a new issue