Merge remote-tracking branch 'origin/master' into 1.7

This commit is contained in:
Wojtek Figat
2023-08-01 14:05:49 +02:00
25 changed files with 646 additions and 136 deletions

View File

@@ -2059,7 +2059,7 @@ namespace Flax.Build.Bindings
if (code.StartsWith("using"))
CSharpUsedNamespaces.Add(code.Substring(6));
else if (code.Length > 0)
contents.Append(injectCodeInfo.Code).AppendLine(";");
contents.Append(code).AppendLine(";");
}
}
else

View File

@@ -159,6 +159,7 @@ namespace Flax.Build
var outputPath = Path.GetDirectoryName(buildData.Target.GetOutputFilePath(buildOptions));
var outputFile = Path.Combine(outputPath, name + ".dll");
var outputDocFile = Path.Combine(outputPath, name + ".xml");
var outputGeneratedFiles = Path.Combine(buildOptions.IntermediateFolder);
string cscPath, referenceAssemblies;
#if USE_NETCORE
var dotnetSdk = DotNetSdk.Instance;
@@ -263,6 +264,9 @@ namespace Flax.Build
#endif
args.Add(string.Format("/out:\"{0}\"", outputFile));
args.Add(string.Format("/doc:\"{0}\"", outputDocFile));
#if USE_NETCORE
args.Add(string.Format("/generatedfilesout:\"{0}\"", outputGeneratedFiles));
#endif
if (buildOptions.ScriptingAPI.Defines.Count != 0)
args.Add("/define:" + string.Join(";", buildOptions.ScriptingAPI.Defines));
if (buildData.Configuration == TargetConfiguration.Debug)
@@ -272,8 +276,10 @@ namespace Flax.Build
foreach (var reference in fileReferences)
args.Add(string.Format("/reference:\"{0}\"", reference));
#if USE_NETCORE
foreach (var analyzer in buildOptions.ScriptingAPI.SystemAnalyzers)
args.Add(string.Format("/analyzer:\"{0}{1}.dll\"", referenceAnalyzers, analyzer));
foreach (var systemAnalyzer in buildOptions.ScriptingAPI.SystemAnalyzers)
args.Add(string.Format("/analyzer:\"{0}{1}.dll\"", referenceAnalyzers, systemAnalyzer));
foreach (var analyzer in buildOptions.ScriptingAPI.Analyzers)
args.Add(string.Format("/analyzer:\"{0}\"", analyzer));
#endif
foreach (var sourceFile in sourceFiles)
args.Add("\"" + sourceFile + "\"");

View File

@@ -200,14 +200,19 @@ namespace Flax.Build.NativeCpp
public HashSet<string> SystemReferences;
/// <summary>
/// The .Net libraries references (dll or exe files paths).
/// The system analyzers/source generators.
/// </summary>
public HashSet<string> SystemAnalyzers;
/// <summary>
/// The .NET libraries references (dll or exe files paths).
/// </summary>
public HashSet<string> FileReferences;
/// <summary>
/// The .Net libraries references (dll or exe files paths).
/// The .NET analyzers (dll or exe files paths).
/// </summary>
public HashSet<string> SystemAnalyzers;
public HashSet<string> Analyzers;
/// <summary>
/// True if ignore compilation warnings due to missing code documentation comments.
@@ -232,6 +237,7 @@ namespace Flax.Build.NativeCpp
Defines.AddRange(other.Defines);
SystemReferences.AddRange(other.SystemReferences);
FileReferences.AddRange(other.FileReferences);
Analyzers.AddRange(other.Analyzers);
IgnoreMissingDocumentationWarnings |= other.IgnoreMissingDocumentationWarnings;
}
}
@@ -305,6 +311,7 @@ namespace Flax.Build.NativeCpp
"Microsoft.Interop.SourceGeneration",
},
FileReferences = new HashSet<string>(),
Analyzers = new HashSet<string>(),
};
/// <summary>

View File

@@ -247,6 +247,14 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine(" </ItemGroup>");
}
}
foreach (var analyzer in configuration.TargetBuildOptions.ScriptingAPI.Analyzers)
{
csProjectFileContent.AppendLine(string.Format(" <ItemGroup Condition=\" '$(Configuration)|$(Platform)' == '{0}' \">", configuration.Name));
csProjectFileContent.AppendLine(string.Format(" <Analyzer Include=\"{0}\">", Path.GetFileNameWithoutExtension(analyzer)));
csProjectFileContent.AppendLine(string.Format(" <HintPath>{0}</HintPath>", Utilities.MakePathRelativeTo(analyzer, projectDirectory).Replace('/', '\\')));
csProjectFileContent.AppendLine(" </Analyzer>");
csProjectFileContent.AppendLine(" </ItemGroup>");
}
csProjectFileContent.AppendLine("");
}