[M] all functional
This commit is contained in:
@@ -55,6 +55,64 @@ public class BuildTool
|
||||
BuildiOS(bparams);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Build Android")]
|
||||
public static void BuildAndroid()
|
||||
{
|
||||
|
||||
BuildParams bparams = new BuildParams()
|
||||
{
|
||||
outPath = "../Bin/tysdkTest.apk"
|
||||
};
|
||||
|
||||
BuildiOS(bparams);
|
||||
}
|
||||
|
||||
public static void CIBuildAndroid()
|
||||
{
|
||||
List<string> args = new List<string>(Environment.GetCommandLineArgs());
|
||||
|
||||
BuildParams bparams = new BuildParams()
|
||||
{
|
||||
outPath = args[args.IndexOf(Param_Out_Path) + 1],
|
||||
//version = args[args.IndexOf(Param_Version) + 1],
|
||||
defineSymbol = args.IndexOf(Param_Define_Symbol) == -1 ? string.Empty : args[args.IndexOf(Param_Define_Symbol) + 1],
|
||||
buildType = args.IndexOf(Param_Build_Type) == -1 ? "New" : args[args.IndexOf(Param_Build_Type) + 1],
|
||||
//bundlesVersion = int.Parse(args[args.IndexOf(Param_Bundle_Version_Code) + 1]),
|
||||
isPatch = args.Contains(Param_Patch),
|
||||
split = args.Contains(Param_Split),
|
||||
aab = args.Contains(Param_Aab),
|
||||
bundleType = Enum.Parse<EBundleType>(args[args.IndexOf(Param_Bundle_Type) + 1])
|
||||
};
|
||||
|
||||
BuildAndroid(bparams);
|
||||
}
|
||||
|
||||
private static void BuildAndroid(BuildParams buildParams)
|
||||
{
|
||||
|
||||
var buildPlayerOptions = new BuildPlayerOptions
|
||||
{
|
||||
scenes = EditorBuildSettings.scenes.Select(x => x.path).ToArray(),
|
||||
locationPathName = buildParams.outPath,
|
||||
|
||||
target = BuildTarget.Android,
|
||||
options = BuildOptions.None,
|
||||
};
|
||||
|
||||
var build_report = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||
|
||||
if (build_report?.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
||||
{
|
||||
UnityEngine.Debug.Log($"[Build Player Success] {System.IO.Path.GetFullPath(buildParams.outPath)}");
|
||||
AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityEngine.Debug.LogError($"Build Player Failed: {build_report?.summary}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[MenuItem("Tools/Build iOS")]
|
||||
public static void BuildiOS()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user