Merge branch 'Tryibion-aab-building'
This commit is contained in:
@@ -364,6 +364,33 @@ bool AndroidPlatformTools::OnPostProcess(CookingData& data)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
const bool distributionPackage = buildSettings->ForDistribution || data.Configuration == BuildConfiguration::Release;
|
const bool distributionPackage = buildSettings->ForDistribution || data.Configuration == BuildConfiguration::Release;
|
||||||
|
|
||||||
|
if (platformSettings->BuildAAB)
|
||||||
|
{
|
||||||
|
// .aab
|
||||||
|
{
|
||||||
|
CreateProcessSettings procSettings;
|
||||||
|
procSettings.FileName = String::Format(TEXT("\"{0}\" {1}"), data.OriginalOutputPath / gradlew, distributionPackage ? TEXT(":app:bundle") : TEXT(":app:bundleDebug"));
|
||||||
|
procSettings.WorkingDirectory = data.OriginalOutputPath;
|
||||||
|
const int32 result = Platform::CreateProcess(procSettings);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
data.Error(String::Format(TEXT("Failed to build Gradle project into .aab package (result code: {0}). See log for more info."), result));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Copy result package
|
||||||
|
const String aab = data.OriginalOutputPath / (distributionPackage ? TEXT("app/build/outputs/bundle/release/app-release.aab") : TEXT("app/build/outputs/bundle/debug/app-debug.aab"));
|
||||||
|
const String outputAab = data.OriginalOutputPath / EditorUtilities::GetOutputName() + TEXT(".aab");
|
||||||
|
if (FileSystem::CopyFile(outputAab, aab))
|
||||||
|
{
|
||||||
|
LOG(Error, "Failed to copy .aab package from {0} to {1}", aab, outputAab);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
LOG(Info, "Output Android AAB application package: {0} (size: {1} MB)", outputAab, FileSystem::GetFileSize(outputAab) / 1024 / 1024);
|
||||||
|
}
|
||||||
|
|
||||||
|
// .apk
|
||||||
{
|
{
|
||||||
CreateProcessSettings procSettings;
|
CreateProcessSettings procSettings;
|
||||||
procSettings.FileName = String::Format(TEXT("\"{0}\" {1}"), data.OriginalOutputPath / gradlew, distributionPackage ? TEXT("assemble") : TEXT("assembleDebug"));
|
procSettings.FileName = String::Format(TEXT("\"{0}\" {1}"), data.OriginalOutputPath / gradlew, distributionPackage ? TEXT("assemble") : TEXT("assembleDebug"));
|
||||||
@@ -371,20 +398,20 @@ bool AndroidPlatformTools::OnPostProcess(CookingData& data)
|
|||||||
const int32 result = Platform::CreateProcess(procSettings);
|
const int32 result = Platform::CreateProcess(procSettings);
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
{
|
{
|
||||||
data.Error(String::Format(TEXT("Failed to build Gradle project into package (result code: {0}). See log for more info."), result));
|
data.Error(String::Format(TEXT("Failed to build Gradle project into .apk package (result code: {0}). See log for more info."), result));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy result package
|
// Copy result package
|
||||||
const String apk = data.OriginalOutputPath / (distributionPackage ? TEXT("app/build/outputs/apk/release/app-release-unsigned.apk") : TEXT("app/build/outputs/apk/debug/app-debug.apk"));
|
const String apk = data.OriginalOutputPath / (distributionPackage ? TEXT("app/build/outputs/apk/release/app-release-unsigned.apk") : TEXT("app/build/outputs/apk/debug/app-debug.apk"));
|
||||||
const String outputApk = data.OriginalOutputPath / EditorUtilities::GetOutputName() + TEXT(".apk");
|
const String outputApk = data.OriginalOutputPath / EditorUtilities::GetOutputName() + TEXT(".apk");
|
||||||
if (FileSystem::CopyFile(outputApk, apk))
|
if (FileSystem::CopyFile(outputApk, apk))
|
||||||
{
|
{
|
||||||
LOG(Error, "Failed to copy package from {0} to {1}", apk, outputApk);
|
LOG(Error, "Failed to copy .apk package from {0} to {1}", apk, outputApk);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
LOG(Info, "Output Android application package: {0} (size: {1} MB)", outputApk, FileSystem::GetFileSize(outputApk) / 1024 / 1024);
|
LOG(Info, "Output Android APK application package: {0} (size: {1} MB)", outputApk, FileSystem::GetFileSize(outputApk) / 1024 / 1024);
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,6 +108,12 @@ API_CLASS(sealed, Namespace="FlaxEditor.Content.Settings") class FLAXENGINE_API
|
|||||||
API_FIELD(Attributes="EditorOrder(500), EditorDisplay(\"General\")")
|
API_FIELD(Attributes="EditorOrder(500), EditorDisplay(\"General\")")
|
||||||
TextureQuality TexturesQuality = TextureQuality::ASTC_Medium;
|
TextureQuality TexturesQuality = TextureQuality::ASTC_Medium;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether to build Android App Bundle (aab) side by side with apk.
|
||||||
|
/// </summary>
|
||||||
|
API_FIELD(Attributes="EditorOrder(500), EditorDisplay(\"General\", \"Build .aab\")")
|
||||||
|
bool BuildAAB = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Custom icon texture to use for the application (overrides the default one).
|
/// Custom icon texture to use for the application (overrides the default one).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user