mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-20 02:00:55 +07:00
fix: separate oss/play build
This commit is contained in:
@@ -854,7 +854,7 @@ jobs:
|
||||
VERSION=$(grep CMAKE_PROJECT_VERSION:STATIC deploy/build/CMakeCache.txt | cut -d= -f2)
|
||||
|
||||
(cd deploy/build/client/android-build && mv AmneziaVPN.apk AmneziaVPN_${VERSION}_android9+_universal.apk)
|
||||
(cd deploy/build/client/android-build/build/outputs/bundle/ossRelease && mv android-build-oss-release.aab AmneziaVPN_${VERSION}_oss.aab)
|
||||
(cd deploy/build/client/android-build/build/outputs/bundle/release && mv android-build-release.aab AmneziaVPN_${VERSION}_oss.aab)
|
||||
|
||||
for abi in arm64-v8a armeabi-v7a x86 x86_64; do
|
||||
deploy/build.sh -t android --sign --abi ${abi} --build ./deploy/build/${abi}
|
||||
@@ -873,7 +873,7 @@ jobs:
|
||||
|
||||
deploy/build.sh -t android --sign --aab --play --build ./deploy/build/play
|
||||
|
||||
(cd deploy/build/play/client/android-build/build/outputs/bundle/playRelease && mv android-build-play-release.aab AmneziaVPN_${VERSION}_play.aab)
|
||||
(cd deploy/build/play/client/android-build/build/outputs/bundle/release && mv android-build-release.aab AmneziaVPN_${VERSION}_play.aab)
|
||||
|
||||
- name: 'Build Play APK'
|
||||
env:
|
||||
@@ -887,7 +887,7 @@ jobs:
|
||||
|
||||
deploy/build.sh -t android --sign --apk --play --build ./deploy/build/play-apk
|
||||
|
||||
(cd deploy/build/play-apk/client/android-build && mv AmneziaVPN.apk AmneziaVPN_${VERSION}_play.apk)
|
||||
(cd deploy/build/play-apk/client/android-build/build/outputs/apk && mv android-build-release-unsigned.apk AmneziaVPN_${VERSION}_play.apk)
|
||||
|
||||
- name: 'Upload universal APK'
|
||||
uses: actions/upload-artifact@v7
|
||||
@@ -899,21 +899,21 @@ jobs:
|
||||
- name: 'Upload OSS AAB'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
path: deploy/build/client/android-build/build/outputs/bundle/ossRelease/*.aab
|
||||
path: deploy/build/client/android-build/build/outputs/bundle/release/*.aab
|
||||
archive: false
|
||||
retention-days: 7
|
||||
|
||||
- name: 'Upload Play AAB'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
path: deploy/build/play/client/android-build/build/outputs/bundle/playRelease/*.aab
|
||||
path: deploy/build/play/client/android-build/build/outputs/bundle/release/*.aab
|
||||
archive: false
|
||||
retention-days: 7
|
||||
|
||||
- name: 'Upload Play APK'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
path: deploy/build/play-apk/client/android-build/*.apk
|
||||
path: deploy/build/play-apk/client/android-build/build/outputs/apk/*.apk
|
||||
archive: false
|
||||
retention-days: 7
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
#include "version.h"
|
||||
|
||||
#include "platforms/ios/QRCodeReaderBase.h"
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "platforms/android/android_controller.h"
|
||||
#endif
|
||||
|
||||
|
||||
bool AmneziaApplication::m_forceQuit = false;
|
||||
@@ -132,6 +136,12 @@ void AmneziaApplication::init()
|
||||
m_engine->rootContext()->setContextProperty("IsMacOsNeBuild", false);
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
m_engine->rootContext()->setContextProperty("IsPlayBuild", AndroidController::instance()->isPlay());
|
||||
#else
|
||||
m_engine->rootContext()->setContextProperty("IsPlayBuild", false);
|
||||
#endif
|
||||
|
||||
m_vpnConnection.reset(new VpnConnection(nullptr, nullptr));
|
||||
m_vpnConnection->moveToThread(&m_vpnConnectionThread);
|
||||
m_vpnConnectionThread.start();
|
||||
|
||||
@@ -78,9 +78,11 @@ android {
|
||||
productFlavors {
|
||||
create("oss") {
|
||||
dimension = "billing"
|
||||
buildConfigField("boolean", "IS_PLAY_BUILD", "false")
|
||||
}
|
||||
create("play") {
|
||||
dimension = "billing"
|
||||
buildConfigField("boolean", "IS_PLAY_BUILD", "true")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,26 +125,46 @@ android {
|
||||
output.outputFileName = "$outputBaseName-${buildType.name}.apk"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Qt cmake expects APK at build/outputs/apk/{outputBaseName}-{buildType}-unsigned.apk
|
||||
// (no flavor subdirectory). With product flavors Gradle puts the signed APK under
|
||||
// build/outputs/apk/{flavor}/{buildType}/{outputBaseName}-{buildType}.apk.
|
||||
// Copy to the path Qt cmake looks for so its zipalign/apksigner step can proceed.
|
||||
val flavorName = productFlavors.firstOrNull()?.name ?: ""
|
||||
if (flavorName.isNotEmpty()) {
|
||||
val buildTypeName = buildType.name
|
||||
// Qt cmake expects APK at build/outputs/apk/{outputBaseName}-{buildType}-unsigned.apk
|
||||
// (no flavor subdirectory). With product flavors Gradle puts it under
|
||||
// build/outputs/apk/{flavor}/{buildType}/. Copy to the flat path Qt cmake looks for.
|
||||
packageApplicationProvider.configure {
|
||||
doLast {
|
||||
val srcDir = layout.buildDirectory.dir("outputs/apk/$flavorName/$buildTypeName").get().asFile
|
||||
val dstDir = layout.buildDirectory.dir("outputs/apk").get().asFile
|
||||
dstDir.mkdirs()
|
||||
srcDir.listFiles()?.filter { it.name.endsWith(".apk") }?.forEach { apk ->
|
||||
val dstName = apk.name.replace("${buildTypeName}.apk", "${buildTypeName}-unsigned.apk")
|
||||
apk.copyTo(File(dstDir, dstName), overwrite = true)
|
||||
}
|
||||
// androiddeployqt expects:
|
||||
// APK: build/outputs/apk/{base}-{buildType}[-unsigned].apk (no flavor subdir)
|
||||
// AAB: build/outputs/bundle/{buildType}/{base}-{buildType}.aab (no flavor subdir)
|
||||
// where {base} = outputBaseName (set by Qt Creator) or "android-build" (CI fallback).
|
||||
// Release APK gets -unsigned suffix (Qt cmake signs it); debug does not.
|
||||
applicationVariants.all {
|
||||
val flavorName = productFlavors.firstOrNull()?.name ?: ""
|
||||
val buildTypeName = buildType.name
|
||||
// Copy play flavor only when invoked explicitly (android_play_apk/aab cmake targets pass -DexplicitRun=1).
|
||||
// This prevents play from overwriting oss in the flat output dir during normal Qt Creator builds.
|
||||
val isExplicitRun = project.findProperty("explicitRun") == "1"
|
||||
val shouldCopy = flavorName == "oss" || (flavorName == "play" && isExplicitRun)
|
||||
if (shouldCopy) {
|
||||
val base = outputBaseName.ifEmpty { "android-build" }
|
||||
val unsignedSuffix = if (buildTypeName == "release") "-unsigned" else ""
|
||||
|
||||
// APK: copy to outputs/apk/{base}-{buildType}[-unsigned].apk
|
||||
packageApplicationProvider.configure {
|
||||
doLast {
|
||||
val srcDir = layout.buildDirectory.dir("outputs/apk/$flavorName/$buildTypeName").get().asFile
|
||||
val dstDir = layout.buildDirectory.dir("outputs/apk").get().asFile
|
||||
dstDir.mkdirs()
|
||||
srcDir.listFiles()?.filter { it.name.endsWith(".apk") }?.forEach { apk ->
|
||||
apk.copyTo(File(dstDir, "$base-$buildTypeName$unsignedSuffix.apk"), overwrite = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AAB: copy to outputs/bundle/{buildType}/{base}-{buildType}.aab
|
||||
tasks.named("bundle${name.replaceFirstChar { it.uppercase() }}") {
|
||||
doLast {
|
||||
val variantBundleDir = "${flavorName}${buildTypeName.replaceFirstChar { it.uppercase() }}"
|
||||
val srcDir = layout.buildDirectory.dir("outputs/bundle/$variantBundleDir").get().asFile
|
||||
val dstDir = layout.buildDirectory.dir("outputs/bundle/$buildTypeName").get().asFile
|
||||
dstDir.mkdirs()
|
||||
srcDir.listFiles()?.filter { it.name.endsWith(".aab") }?.forEach { aab ->
|
||||
aab.copyTo(File(dstDir, "$base-$buildTypeName.aab"), overwrite = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,15 +64,15 @@ if(ANDROID_BUILD_PLAY)
|
||||
else()
|
||||
set(_gradle_suffix "Release")
|
||||
endif()
|
||||
set(_android_build_dir "${CMAKE_CURRENT_BINARY_DIR}/android-build-${PROJECT}")
|
||||
set(_android_build_dir "${CMAKE_CURRENT_BINARY_DIR}/android-build")
|
||||
add_custom_target(android_play_apk
|
||||
COMMAND ./gradlew assemblePlay${_gradle_suffix} -DexplicitRun=1
|
||||
COMMAND ./gradlew assemblePlay${_gradle_suffix} -PexplicitRun=1
|
||||
WORKING_DIRECTORY "${_android_build_dir}"
|
||||
COMMENT "Building Android Play APK (assemblePlay${_gradle_suffix})"
|
||||
DEPENDS ${PROJECT}
|
||||
)
|
||||
add_custom_target(android_play_aab
|
||||
COMMAND ./gradlew bundlePlay${_gradle_suffix} -DexplicitRun=1
|
||||
COMMAND ./gradlew bundlePlay${_gradle_suffix} -PexplicitRun=1
|
||||
WORKING_DIRECTORY "${_android_build_dir}"
|
||||
COMMENT "Building Android Play AAB (bundlePlay${_gradle_suffix})"
|
||||
DEPENDS ${PROJECT}
|
||||
|
||||
@@ -366,7 +366,7 @@ PageType {
|
||||
property string title: qsTr("Restore purchases")
|
||||
property string description: qsTr("")
|
||||
property string imageSource: "qrc:/images/controls/refresh-cw.svg"
|
||||
property bool isVisible: Qt.platform.os === "ios" || IsMacOsNeBuild || Qt.platform.os === "android"
|
||||
property bool isVisible: Qt.platform.os === "ios" || IsMacOsNeBuild || IsPlayBuild
|
||||
property var handler: function() {
|
||||
PageController.showBusyIndicator(true)
|
||||
if (Qt.platform.os === "android") {
|
||||
|
||||
Reference in New Issue
Block a user