Add CanBuild to target for selective project references compilation
This commit is contained in:
@@ -638,13 +638,18 @@ namespace Flax.Build
|
||||
Log.Verbose("No target selected for build");
|
||||
return;
|
||||
}
|
||||
if (!target.Platforms.Contains(buildData.Platform.Target) || !target.Architectures.Contains(buildData.Architecture))
|
||||
{
|
||||
Log.Verbose($"Referenced target {reference.Project.Name} doesn't support {buildData.Platform.Target} {buildData.Architecture}");
|
||||
return;
|
||||
}
|
||||
if (!buildContext.TryGetValue(target, out var referencedBuildData))
|
||||
{
|
||||
if (!target.CanBuild(buildData.TargetOptions))
|
||||
{
|
||||
Log.Verbose($"Referenced target {reference.Project.Name} doesn't build for {buildData.Platform.Target} {buildData.Architecture} {buildData.Configuration}");
|
||||
return;
|
||||
}
|
||||
if (!target.Platforms.Contains(buildData.Platform.Target) || !target.Architectures.Contains(buildData.Architecture))
|
||||
{
|
||||
Log.Verbose($"Referenced target {reference.Project.Name} doesn't support {buildData.Platform.Target} {buildData.Architecture}");
|
||||
return;
|
||||
}
|
||||
Log.Info($"Building referenced target {reference.Project.Name}");
|
||||
|
||||
// Build target
|
||||
@@ -706,6 +711,11 @@ namespace Flax.Build
|
||||
}
|
||||
if (!buildContext.TryGetValue(target, out var referencedBuildData))
|
||||
{
|
||||
if (!target.CanBuild(buildData.TargetOptions))
|
||||
{
|
||||
Log.Verbose($"Referenced target {reference.Project.Name} doesn't build for {buildData.Platform.Target} {buildData.Architecture} {buildData.Configuration}");
|
||||
return;
|
||||
}
|
||||
Log.Info($"Building referenced target {reference.Project.Name}");
|
||||
|
||||
// Build target
|
||||
|
||||
@@ -207,6 +207,16 @@ namespace Flax.Build
|
||||
return projectTargets.Length != 0 ? projectTargets[0] : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if this target can be built for a given build options. Can be used to skip compiling for unsupported platforms or unused configurations (eg. development-only plugins).
|
||||
/// </summary>
|
||||
/// <param name="options">The build options.</param>
|
||||
/// <returns>True if can build target, otherwise false.</returns>
|
||||
public virtual bool CanBuild(BuildOptions options)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the output file path.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user