mirror of
https://github.com/lone-cloud/prism-android
synced 2026-06-03 11:03:10 -07:00
remove aab release files as this won't be released to the playstore
This commit is contained in:
parent
f9d3343576
commit
04a1a457c1
4 changed files with 1 additions and 174 deletions
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
|
|
@ -46,12 +46,11 @@ jobs:
|
||||||
ANDROID_SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
|
ANDROID_SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
|
||||||
ANDROID_SIGNING_KEY_ALIAS: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}
|
ANDROID_SIGNING_KEY_ALIAS: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}
|
||||||
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
|
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
|
||||||
run: ./gradlew assembleRelease bundleRelease --stacktrace
|
run: ./gradlew assembleRelease --stacktrace
|
||||||
|
|
||||||
- name: Rename artifacts
|
- name: Rename artifacts
|
||||||
run: |
|
run: |
|
||||||
mv app/build/outputs/apk/release/app-release.apk prism.apk
|
mv app/build/outputs/apk/release/app-release.apk prism.apk
|
||||||
mv app/build/outputs/bundle/release/app-release.aab prism.aab
|
|
||||||
|
|
||||||
- name: Upload release artifacts
|
- name: Upload release artifacts
|
||||||
uses: actions/upload-artifact@v6
|
uses: actions/upload-artifact@v6
|
||||||
|
|
@ -59,7 +58,6 @@ jobs:
|
||||||
name: prism-release-artifacts
|
name: prism-release-artifacts
|
||||||
path: |
|
path: |
|
||||||
prism.apk
|
prism.apk
|
||||||
prism.aab
|
|
||||||
|
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
|
|
@ -69,6 +67,5 @@ jobs:
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
files: |
|
files: |
|
||||||
prism.apk
|
prism.apk
|
||||||
prism.aab
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
import RunBundletoolTask.Companion.aapt2
|
|
||||||
import com.android.SdkConstants
|
|
||||||
import org.gradle.kotlin.dsl.register
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
alias(libs.plugins.kotlin.android)
|
alias(libs.plugins.kotlin.android)
|
||||||
|
|
@ -123,35 +119,3 @@ dependencies {
|
||||||
implementation(libs.androidx.navigation.compose)
|
implementation(libs.androidx.navigation.compose)
|
||||||
debugImplementation(libs.androidx.ui.tooling)
|
debugImplementation(libs.androidx.ui.tooling)
|
||||||
}
|
}
|
||||||
|
|
||||||
val buildTools = RunBundletoolTask.Companion.BuildTools(
|
|
||||||
SdkConstants.CURRENT_BUILD_TOOLS_VERSION,
|
|
||||||
SdkConstants.FD_BUILD_TOOLS
|
|
||||||
)
|
|
||||||
|
|
||||||
tasks.register<RunBundletoolTask>("reproduceUniversal") {
|
|
||||||
group = "build"
|
|
||||||
description = "Generate universal .apks from .aab with bundletool"
|
|
||||||
dependsOn("bundleRelease")
|
|
||||||
aabFile = project.rootDir.resolve("app/build/outputs/bundle/release/app-release.aab")
|
|
||||||
universalApks = project.rootDir.resolve("universal.apks")
|
|
||||||
aapt2 = project.aapt2(androidComponents, buildTools)
|
|
||||||
signature.set(RunBundletoolTask.Signature.UnsignedOrDebug)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register<RunBundletoolTask>("bundletoolBuildApks") {
|
|
||||||
group = "build"
|
|
||||||
description = "Generate default and universal .apks from .aab with bundletool"
|
|
||||||
|
|
||||||
val aabPath = System.getenv("AAB") ?: error("AAB not set")
|
|
||||||
aabFile = project.rootDir.resolve(aabPath)
|
|
||||||
universalApks = project.rootDir.resolve("universal.apks")
|
|
||||||
defaultApks = project.rootDir.resolve("app.apks")
|
|
||||||
aapt2 = project.aapt2(androidComponents, buildTools)
|
|
||||||
|
|
||||||
val ks = System.getenv("KS") ?: error("KS not set")
|
|
||||||
val ksPass = System.getenv("KS_PASS") ?: error("KS_PASS not set")
|
|
||||||
val keyAlias = System.getenv("KEY_ALIAS") ?: error("KEY_ALIAS not set")
|
|
||||||
|
|
||||||
signature.set(RunBundletoolTask.Signature.Signed(ks, ksPass, keyAlias))
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ repositories {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.android.tools.build:builder:8.13.2") // version Android Gradle Plugin
|
implementation("com.android.tools.build:builder:8.13.2") // version Android Gradle Plugin
|
||||||
implementation("com.android.tools:common:31.13.2")
|
implementation("com.android.tools:common:31.13.2")
|
||||||
implementation("com.android.tools.build:bundletool:1.18.3")
|
|
||||||
implementation("com.android.tools:sdklib:31.2.2")
|
implementation("com.android.tools:sdklib:31.2.2")
|
||||||
implementation("com.android.tools.build:gradle-api:8.13.2")
|
implementation("com.android.tools.build:gradle-api:8.13.2")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,133 +0,0 @@
|
||||||
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
|
|
||||||
import com.android.repository.Revision
|
|
||||||
import com.android.sdklib.BuildToolInfo
|
|
||||||
import com.android.tools.build.bundletool.androidtools.Aapt2Command
|
|
||||||
import com.android.tools.build.bundletool.commands.BuildApksCommand
|
|
||||||
import com.android.tools.build.bundletool.model.Password
|
|
||||||
import com.android.tools.build.bundletool.model.SigningConfiguration
|
|
||||||
import org.gradle.api.DefaultTask
|
|
||||||
import org.gradle.api.Project
|
|
||||||
import org.gradle.api.file.RegularFileProperty
|
|
||||||
import org.gradle.api.provider.Property
|
|
||||||
import org.gradle.api.tasks.InputFile
|
|
||||||
import org.gradle.api.tasks.Internal
|
|
||||||
import org.gradle.api.tasks.Optional
|
|
||||||
import org.gradle.api.tasks.OutputFile
|
|
||||||
import org.gradle.api.tasks.TaskAction
|
|
||||||
import java.nio.file.Paths
|
|
||||||
|
|
||||||
abstract class RunBundletoolTask : DefaultTask() {
|
|
||||||
abstract class Signature() {
|
|
||||||
object UnsignedOrDebug: Signature()
|
|
||||||
data class Signed(val ks: String, val pass: String, val alias: String) : Signature()
|
|
||||||
}
|
|
||||||
|
|
||||||
@get:InputFile
|
|
||||||
abstract val aabFile: RegularFileProperty
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Output for build with mode=default
|
|
||||||
*/
|
|
||||||
@get:Optional
|
|
||||||
@get:OutputFile
|
|
||||||
abstract val defaultApks: RegularFileProperty
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Output for build with mode=universal
|
|
||||||
*/
|
|
||||||
@get:Optional
|
|
||||||
@get:OutputFile
|
|
||||||
abstract val universalApks: RegularFileProperty
|
|
||||||
|
|
||||||
@get:Internal
|
|
||||||
abstract val aapt2: RegularFileProperty
|
|
||||||
|
|
||||||
@get:Internal
|
|
||||||
abstract val signature: Property<Signature>
|
|
||||||
|
|
||||||
@Suppress("NewApi")
|
|
||||||
@TaskAction
|
|
||||||
fun generateApks() {
|
|
||||||
val aapt2Path = aapt2.get().asFile.toPath()
|
|
||||||
val aabPath = aabFile.get().asFile.toPath()
|
|
||||||
|
|
||||||
println("➡ Compiling $aabPath")
|
|
||||||
println("➡ Using $aapt2Path")
|
|
||||||
|
|
||||||
val aapt2Command = Aapt2Command.createFromExecutablePath(aapt2Path)
|
|
||||||
val signature = signature.get()
|
|
||||||
val signingConfig = if (signature is Signature.Signed) {
|
|
||||||
SigningConfiguration.extractFromKeystore(
|
|
||||||
java.nio.file.Path.of(signature.ks),
|
|
||||||
signature.alias,
|
|
||||||
java.util.Optional.of(
|
|
||||||
Password.createFromStringValue("pass:${signature.pass}")
|
|
||||||
),
|
|
||||||
java.util.Optional.empty<Password>()
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
if (universalApks.isPresent) {
|
|
||||||
val outputFile = universalApks.get().asFile.toPath()
|
|
||||||
|
|
||||||
BuildApksCommand.builder()
|
|
||||||
.setBundlePath(aabFile.get().asFile.toPath())
|
|
||||||
.setOutputFile(outputFile)
|
|
||||||
.setAapt2Command(aapt2Command)
|
|
||||||
.setApkBuildMode(BuildApksCommand.ApkBuildMode.UNIVERSAL)
|
|
||||||
.setOverwriteOutput(true)
|
|
||||||
.apply {
|
|
||||||
signingConfig?.let {
|
|
||||||
setSigningConfiguration(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.build()
|
|
||||||
.execute()
|
|
||||||
|
|
||||||
println("✅ $outputFile generated")
|
|
||||||
}
|
|
||||||
if (defaultApks.isPresent) {
|
|
||||||
val outputFile = defaultApks.get().asFile.toPath()
|
|
||||||
|
|
||||||
BuildApksCommand.builder()
|
|
||||||
.setBundlePath(aabFile.get().asFile.toPath())
|
|
||||||
.setOutputFile(outputFile)
|
|
||||||
.setAapt2Command(aapt2Command)
|
|
||||||
.setApkBuildMode(BuildApksCommand.ApkBuildMode.DEFAULT)
|
|
||||||
.setOverwriteOutput(true)
|
|
||||||
.apply {
|
|
||||||
signingConfig?.let {
|
|
||||||
setSigningConfiguration(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.build()
|
|
||||||
.execute()
|
|
||||||
|
|
||||||
println("✅ $outputFile generated")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
data class BuildTools(val version: String, val fd: String)
|
|
||||||
|
|
||||||
@Suppress("NewApi")
|
|
||||||
fun Project.aapt2(androidComponents: ApplicationAndroidComponentsExtension, buildTools: BuildTools): java.io.File {
|
|
||||||
val path = if (project.hasProperty("android.aapt2FromMavenOverride")) {
|
|
||||||
project.property("android.aapt2FromMavenOverride") as String
|
|
||||||
} else {
|
|
||||||
val buildToolsVersion = buildTools.version
|
|
||||||
val buildToolsDir = Paths.get(
|
|
||||||
androidComponents.sdkComponents.sdkDirectory.get().toString(),
|
|
||||||
buildTools.fd,
|
|
||||||
buildTools.version
|
|
||||||
)
|
|
||||||
BuildToolInfo.fromStandardDirectoryLayout(
|
|
||||||
Revision.parseRevision(buildToolsVersion),
|
|
||||||
buildToolsDir
|
|
||||||
).getPath(BuildToolInfo.PathId.AAPT2)
|
|
||||||
}
|
|
||||||
return project.rootDir.resolve(path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue