First of all, thank you for this amazing package and the test suite.
I could not find a way to trigger a script compilation without building the entire freaking game 😅
Now...
Here:
https://github.com/needle-tools/compilation-visualizer/blob/18e171af30b8765d40dfd0c067807d7c10e5cd9e/Tests/CompilePlayerScripts.cs#L37C17-L37C149
Could we have some way to expose which targets we want to test / which one we want to exclude?
Right now it's loading consoles and other things that I don't have the SDK nor the intention to target 😅
Thanks for the amazing tools <3
Edit: I feel like a crybaby 🤦
I checked and the code to test compilation can be used standalone. Only the Net Framework compliance tests need the visualizer
In case anyone wants to steal the test code. Fill the array with your targets to test, watch it go BRRRRRR
public class CompilePlayerScripts
{
// Set me up :D
private static readonly BuildTarget[] TargetsToTest = new[] { BuildTarget.Android };
[Test]
public void BuildTargetCompiles([ValueSource(nameof(CompilePlayerScripts.GetTestableTargets))] BuildTarget buildTarget)
{
ScriptCompilationSettings settings = new ScriptCompilationSettings
{
group = BuildPipeline.GetBuildTargetGroup(buildTarget),
target = buildTarget,
options = ScriptCompilationOptions.None
};
PlayerBuildInterface.CompilePlayerScripts(settings, CompilePlayerScripts.TEMP_DIR + "_" + buildTarget);
}
private const string TEMP_DIR = "Temp/PlayerScriptCompilationTests";
private static IEnumerable<BuildTarget> GetTestableTargets()
{
return CompilePlayerScripts.TargetsToTest
.Where(x => CompilePlayerScripts.GetAttributeOfType<ObsoleteAttribute>(x) == null)
.Except(new[] { BuildTarget.WSAPlayer, BuildTarget.NoTarget }); // excluded because they have errors even with just Unity packages.
}
private static T GetAttributeOfType<T>(Enum enumVal) where T : Attribute
{
MemberInfo[] memInfo = enumVal.GetType().GetMember(enumVal.ToString());
object[] attributes = memInfo[0].GetCustomAttributes(typeof(T), false);
return attributes.Length > 0 ? (T)attributes[0] : null;
}
}
First of all, thank you for this amazing package and the test suite.
I could not find a way to trigger a script compilation without building the entire freaking game 😅
Now...
Here:
https://github.com/needle-tools/compilation-visualizer/blob/18e171af30b8765d40dfd0c067807d7c10e5cd9e/Tests/CompilePlayerScripts.cs#L37C17-L37C149
Could we have some way to expose which targets we want to test / which one we want to exclude?
Right now it's loading consoles and other things that I don't have the SDK nor the intention to target 😅
Thanks for the amazing tools <3
Edit: I feel like a crybaby 🤦
I checked and the code to test compilation can be used standalone. Only the Net Framework compliance tests need the visualizer
In case anyone wants to steal the test code. Fill the array with your targets to test, watch it go BRRRRRR