Merge branch 'master' into 1.1

# Conflicts:
#	Source/Engine/Content/JsonAsset.h
#	Source/Engine/Core/Config/Settings.h
This commit is contained in:
Wojtek Figat
2021-02-15 10:40:59 +01:00
77 changed files with 1111 additions and 531 deletions

View File

@@ -528,10 +528,7 @@ namespace Flax.Build.Bindings
{
if (comment.Contains("/// <returns>"))
continue;
var c = comment.Replace("::", ".");
contents.Append(indent);
contents.Append(c);
contents.AppendLine();
contents.Append(indent).Append(comment.Replace("::", ".")).AppendLine();
}
GenerateCSharpAttributes(buildData, contents, indent, classInfo, eventInfo, useUnmanaged);
@@ -626,11 +623,7 @@ namespace Flax.Build.Bindings
{
if (comment.Contains("/// <returns>"))
continue;
var c = comment.Replace("::", ".");
contents.Append(indent);
contents.Append(c);
contents.AppendLine();
contents.Append(indent).Append(comment.Replace("::", ".")).AppendLine();
}
GenerateCSharpAttributes(buildData, contents, indent, classInfo, fieldInfo, useUnmanaged, fieldInfo.DefaultValue);
@@ -690,14 +683,7 @@ namespace Flax.Build.Bindings
{
if (comment.Contains("/// <returns>") || comment.Contains("<param name="))
continue;
var c = comment.Replace("::", ".");
contents.Append(indent);
if (propertyInfo.Getter != null && propertyInfo.Setter != null)
contents.Append(c.Replace("/// Gets ", "/// Gets or sets "));
else
contents.Append(c);
contents.AppendLine();
contents.Append(indent).Append(comment.Replace("::", ".")).AppendLine();
}
GenerateCSharpAttributes(buildData, contents, indent, classInfo, propertyInfo, useUnmanaged);

View File

@@ -786,6 +786,35 @@ namespace Flax.Build.Bindings
else
propertyInfo.Setter = functionInfo;
if (propertyInfo.Getter != null && propertyInfo.Setter != null)
{
// Check if getter and setter types are matching (const and ref specifiers are skipped)
var getterType = propertyInfo.Getter.ReturnType;
var setterType = propertyInfo.Setter.Parameters[0].Type;
if (!string.Equals(getterType.Type, setterType.Type) ||
getterType.IsPtr != setterType.IsPtr ||
getterType.IsArray != setterType.IsArray ||
getterType.IsBitField != setterType.IsBitField ||
getterType.ArraySize != setterType.ArraySize ||
getterType.BitSize != setterType.BitSize ||
!TypeInfo.Equals(getterType.GenericArgs, setterType.GenericArgs))
{
// Skip compatible types
if (getterType.Type == "String" && setterType.Type == "StringView")
return propertyInfo;
if (getterType.Type == "Array" && setterType.Type == "Span" && getterType.GenericArgs?.Count == 1 && setterType.GenericArgs?.Count == 1 && getterType.GenericArgs[0].Equals(setterType.GenericArgs[0]))
return propertyInfo;
throw new Exception($"Property {propertyName} in class {classInfo.Name} (line {context.Tokenizer.CurrentLine}) has mismatching getter return type ({getterType}) and setter parameter type ({setterType}). Both getter and setter methods must use the same value type used for property.");
}
// Fix documentation comment to reflect both getter and setters available
for (var i = 0; i < propertyInfo.Comment.Length; i++)
{
ref var comment = ref propertyInfo.Comment[i];
comment = comment.Replace("/// Gets ", "/// Gets or sets ");
}
}
return propertyInfo;
}

View File

@@ -83,7 +83,7 @@ namespace Flax.Build.Bindings
return sb.ToString();
}
private static bool Equals(List<TypeInfo> a, List<TypeInfo> b)
public static bool Equals(List<TypeInfo> a, List<TypeInfo> b)
{
if (a == null && b == null)
return true;

View File

@@ -258,9 +258,8 @@ namespace Flax.Deps.Dependencies
"mono_type_normalize",
};
private void BuildMsvc(BuildOptions options, TargetPlatform platform, TargetArchitecture architecture)
private void BuildMsvc(BuildOptions options, TargetPlatform platform, TargetArchitecture architecture, string configuration = "Release")
{
var configuration = "Release";
string buildPlatform;
switch (architecture)
{
@@ -491,12 +490,13 @@ namespace Flax.Deps.Dependencies
{
case TargetPlatform.Windows:
{
BuildMsvc(options, platform, TargetArchitecture.x64);
var configuration = "Release";
BuildMsvc(options, platform, TargetArchitecture.x64, configuration);
//BuildBcl(options, platform);
// Export header files
Deploy.VCEnvironment.BuildSolution(Path.Combine(root, "msvc", "libmono-dynamic.vcxproj"), "Release", "x64");
Deploy.VCEnvironment.BuildSolution(Path.Combine(root, "msvc", "build-install.vcxproj"), "Release", "x64");
Deploy.VCEnvironment.BuildSolution(Path.Combine(root, "msvc", "libmono-dynamic.vcxproj"), configuration, "x64");
Deploy.VCEnvironment.BuildSolution(Path.Combine(root, "msvc", "build-install.vcxproj"), configuration, "x64");
// Get exported mono methods to forward them in engine module (on Win32 platforms)
GetMonoExports(options);