update:更新补单逻辑
This commit is contained in:
@@ -55,31 +55,17 @@ public class BuildTool
|
||||
BuildiOS(bparams);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Build Android")]
|
||||
public static void BuildAndroid()
|
||||
{
|
||||
|
||||
BuildParams bparams = new BuildParams()
|
||||
{
|
||||
outPath = "../Bin/tysdkTest.apk"
|
||||
};
|
||||
|
||||
BuildAndroid(bparams);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Build Android With Debug")]
|
||||
public static void BuildAndroidWithDebug()
|
||||
{
|
||||
|
||||
BuildParams bparams = new BuildParams()
|
||||
{
|
||||
outPath = "../Bin/tysdkTest_debug.apk",
|
||||
};
|
||||
|
||||
var buildOptions = BuildOptions.Development | BuildOptions.AllowDebugging | BuildOptions.WaitForPlayerConnection;
|
||||
|
||||
BuildAndroid(bparams, buildOptions);
|
||||
}
|
||||
[MenuItem("Tools/Build Android")]
|
||||
public static void BuildAndroid()
|
||||
{
|
||||
ChannelBuildTool.Build_GooglePlay();
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Build Android With Debug")]
|
||||
public static void BuildAndroidWithDebug()
|
||||
{
|
||||
ChannelBuildTool.Build_GooglePlay_Debug();
|
||||
}
|
||||
|
||||
public static void CIBuildAndroid()
|
||||
{
|
||||
|
||||
@@ -7,6 +7,8 @@ public class ChannelBuildTool
|
||||
{
|
||||
public static readonly string[] SupportedChannels = { "GooglePlay", "Rustore", "Flexion" };
|
||||
|
||||
private const string DefaultChannel = "GooglePlay";
|
||||
private const string DefaultAndroidBundleIdentifier = "com.arkgame.ft";
|
||||
private const string ExtraCfgRoot = "../ExtraPluginCfgs/Android";
|
||||
private const string TysdkPlugins = "Packages/tysdk/Plugins/Android";
|
||||
private const string TysdkFiles = "Packages/tysdk/Files";
|
||||
@@ -113,35 +115,51 @@ public class ChannelBuildTool
|
||||
|
||||
// ==================== Build ====================
|
||||
|
||||
private static void RestoreDefaultChannel()
|
||||
{
|
||||
Debug.Log($"[ChannelBuild] Restore default channel -> {DefaultChannel}");
|
||||
SwitchChannel(DefaultChannel);
|
||||
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, DefaultAndroidBundleIdentifier);
|
||||
Debug.Log($"[ChannelBuild] Restore bundle identifier -> {DefaultAndroidBundleIdentifier}");
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
private static void BuildAndroidForChannel(string channel, bool debug)
|
||||
{
|
||||
SwitchChannel(channel);
|
||||
|
||||
string fileName = debug ? $"tysdkTest_{channel}_debug.apk" : $"tysdkTest_{channel}.apk";
|
||||
string outPath = $"../Bin/{fileName}";
|
||||
var buildOptions = debug
|
||||
? BuildOptions.Development | BuildOptions.AllowDebugging | BuildOptions.WaitForPlayerConnection
|
||||
: BuildOptions.None;
|
||||
|
||||
var buildPlayerOptions = new BuildPlayerOptions
|
||||
try
|
||||
{
|
||||
scenes = EditorBuildSettings.scenes.Select(x => x.path).ToArray(),
|
||||
locationPathName = outPath,
|
||||
target = BuildTarget.Android,
|
||||
options = buildOptions,
|
||||
};
|
||||
SwitchChannel(channel);
|
||||
|
||||
Debug.Log($"[ChannelBuild] Building {channel} → {outPath}");
|
||||
var buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||
string fileName = debug ? $"tysdkTest_{channel}_debug.apk" : $"tysdkTest_{channel}.apk";
|
||||
string outPath = $"../Bin/{fileName}";
|
||||
var buildOptions = debug
|
||||
? BuildOptions.Development | BuildOptions.AllowDebugging | BuildOptions.WaitForPlayerConnection
|
||||
: BuildOptions.None;
|
||||
|
||||
if (buildReport?.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
||||
{
|
||||
Debug.Log($"[ChannelBuild] Success: {Path.GetFullPath(outPath)}");
|
||||
AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
|
||||
var buildPlayerOptions = new BuildPlayerOptions
|
||||
{
|
||||
scenes = EditorBuildSettings.scenes.Select(x => x.path).ToArray(),
|
||||
locationPathName = outPath,
|
||||
target = BuildTarget.Android,
|
||||
options = buildOptions,
|
||||
};
|
||||
|
||||
Debug.Log($"[ChannelBuild] Building {channel} → {outPath}");
|
||||
var buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||
|
||||
if (buildReport?.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
||||
{
|
||||
Debug.Log($"[ChannelBuild] Success: {Path.GetFullPath(outPath)}");
|
||||
AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"[ChannelBuild] Failed: {buildReport?.summary}");
|
||||
}
|
||||
}
|
||||
else
|
||||
finally
|
||||
{
|
||||
Debug.LogError($"[ChannelBuild] Failed: {buildReport?.summary}");
|
||||
RestoreDefaultChannel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,29 +177,7 @@ public class ChannelBuildTool
|
||||
public static void Switch_Flexion() => SwitchChannel("Flexion");
|
||||
|
||||
// ==================== Menu: Build ====================
|
||||
|
||||
[MenuItem("Tools/Build Android (Current Channel)")]
|
||||
public static void Build_CurrentChannel()
|
||||
{
|
||||
if (string.IsNullOrEmpty(currentChannel))
|
||||
{
|
||||
Debug.LogError("[ChannelBuild] No channel selected. Use Tools/Switch Channel first.");
|
||||
return;
|
||||
}
|
||||
BuildAndroidForChannel(currentChannel, false);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Build Android (Current Channel) Debug")]
|
||||
public static void Build_CurrentChannel_Debug()
|
||||
{
|
||||
if (string.IsNullOrEmpty(currentChannel))
|
||||
{
|
||||
Debug.LogError("[ChannelBuild] No channel selected. Use Tools/Switch Channel first.");
|
||||
return;
|
||||
}
|
||||
BuildAndroidForChannel(currentChannel, true);
|
||||
}
|
||||
|
||||
|
||||
[MenuItem("Tools/Build Android (Channel)/GooglePlay")]
|
||||
public static void Build_GooglePlay() => BuildAndroidForChannel("GooglePlay", false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user