Skip to content

Instantly share code, notes, and snippets.

@baba-s
Created February 3, 2020 11:54
Show Gist options
  • Save baba-s/ddcdabbea31cad501fee7160a86f0bcf to your computer and use it in GitHub Desktop.
Save baba-s/ddcdabbea31cad501fee7160a86f0bcf to your computer and use it in GitHub Desktop.
using NUnit.Framework;
using System.IO;
using UnityEditor;
using UnityEditor.Build.Player;
internal sealed class CompileChecker
{
private const string OUTPUT_FOLDER = "Temp/CompileChecker";
[Test]
public void CheckiOS()
{
Check( BuildTarget.iOS, BuildTargetGroup.iOS );
}
[Test]
public void CheckAndroid()
{
Check( BuildTarget.Android, BuildTargetGroup.Android );
}
[Test]
public void CheckWebGL()
{
Check( BuildTarget.WebGL, BuildTargetGroup.WebGL );
}
private static void Check( BuildTarget target, BuildTargetGroup group )
{
var input = new ScriptCompilationSettings
{
target = target,
group = group,
};
var result = PlayerBuildInterface.CompilePlayerScripts( input, OUTPUT_FOLDER );
var assemblies = result.assemblies;
var isSuccess =
assemblies != null &&
assemblies.Count != 0 &&
result.typeDB != null
;
if ( Directory.Exists( OUTPUT_FOLDER ) )
{
Directory.Delete( OUTPUT_FOLDER, true );
}
Assert.IsTrue( isSuccess );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment