Created
February 3, 2020 11:54
-
-
Save baba-s/ddcdabbea31cad501fee7160a86f0bcf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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