diff --git a/README.md b/README.md index 30b2807..5e1e8af 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,14 @@ # updraft-plugin 🚀 +[![Maven Central](https://maven-badges.sml.io/sonatype-central/com.appswithlove.updraft/updraft/badge.svg)](https://maven-badges.sml.io/sonatype-central/com.appswithlove.updraft/updraft) + This is a gradle plugin for automated upload to updraft. +## ⚠️ Requirements for v3.0.0+ + +**Important:** Version `3.0.0` and above requires **Android Gradle Plugin (AGP) 9.0** or higher. + +If your project relies on an older version of AGP, please stick to plugin version `2.x.x` until you are ready to upgrade your gradle environment. ## Instructions @@ -12,8 +19,6 @@ Preconditions: 1.Add the code below to you `build.gradle` file in the project root folder. -[![Maven Central](https://maven-badges.sml.io/sonatype-central/com.appswithlove.updraft/updraft/badge.svg)](https://maven-badges.sml.io/sonatype-central/com.appswithlove.updraft/updraft) - ```groovy buildscript { repositories { @@ -23,7 +28,7 @@ buildscript { dependencies { // ... - classpath 'com.appswithlove.updraft:updraft:2.3.0' + classpath 'com.appswithlove.updraft:updraft:3.0.0' } } ``` @@ -32,7 +37,7 @@ or ```kotlin plugins { - id("com.appswithlove.updraft") version "2.3.0" + id("com.appswithlove.updraft") version "3.0.0" } ``` @@ -48,16 +53,22 @@ or id("com.appswithlove.updraft") ``` -3.Add one or multiple `urls['YOURPRODUCTFLAVOUR']` wrapped in `updraft` to the file. To get the url, go to your Updraft App and get the https:// url part of the `curl` command. (e.g. [https://app.getupdraft.com/api_upload/.../.../]()) -With this, the plugin knows to which updraft app your apk should be uploaded. +3.Configure URLs for your build variants + +Add one or more urls entries inside your `updraft` configuration block. +Each entry maps a build variant name (e.g., `StagingRelease`, `ProdRelease`) to one or more upload URLs. + +To get the correct URL, open your Updraft App, copy the https:// part from the curl command (e.g. https://app.getupdraft.com/api/app_upload/.../.../), and paste it as shown below. -The part `YourBuildVariant` should be replaced by the exact name your build variant. For example: +This tells the plugin where to upload your APK/AAB files for each build variant. ```groovy updraft { - urls['StagingRelease'] = ["your/staging/url/"] - urls['ProdRelease'] = ["your/prod/url/", "your/prod2/url/"] + urls = [ + "StagingRelease": ["your/staging/url/"], + "ProdRelease": ["your/prod/url/", "your/prod2/url/"] + ] } ``` @@ -114,7 +125,7 @@ buildscript { // ... } dependencies { - classpath 'com.appswithlove.updraft:updraft:2.3.0' + classpath 'com.appswithlove.updraft:updraft:3.0.0' // ... } } diff --git a/build.gradle.kts b/build.gradle.kts index 6e07c3c..2625c9e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,12 +10,12 @@ buildscript { plugins { alias(libs.plugins.android.application) apply false - alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.compose) apply false - alias(libs.plugins.updraft) apply false alias(libs.plugins.maven.publish) apply false alias(libs.plugins.gradle.publish) apply false alias(libs.plugins.coveralls) alias(libs.plugins.kotlin.jvm) apply false id("signing") + // Define Updraft plugin + // alias(libs.plugins.updraft) apply false } diff --git a/gradle.properties b/gradle.properties index a2b2d8a..bc2b64a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ GROUP=com.appswithlove.updraft POM_ARTIFACT_ID=updraft -VERSION_NAME=2.3.0 +VERSION_NAME=3.0.0 POM_NAME=updraft-plugin-android POM_DESCRIPTION=This is a gradle Android plugin for automated uploads to Updraft @@ -44,9 +44,7 @@ SONATYPE_AUTOMATIC_RELEASE=true RELEASE_SIGNING_ENABLED=true android.useAndroidX=true -android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=false -android.nonFinalResIds=false # Enables Gradle caching org.gradle.caching=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c4d8c5b..9a300bb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -agp = "8.11.1" +agp = "9.0.0" kotlin = "2.2.20" composeBom = "2025.10.00" activityCompose = "1.11.0" @@ -32,10 +32,10 @@ kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.re [plugins] android-application = { id = "com.android.application", version.ref = "agp" } -kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } -updraft = { id = "com.appswithlove.updraft", version.ref = "updraft" } maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" } gradle-publish = { id = "com.gradle.plugin-publish", version.ref = "gradle-publish" } coveralls = { id = "com.github.kt3k.coveralls", version.ref = "coveralls" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +# Define Updraft plugin +# updraft = { id = "com.appswithlove.updraft", version.ref = "updraft" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index dcf5dbf..de18eab 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri Oct 20 07:59:33 CEST 2017 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index d4cc35e..f1a8adc 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -85,8 +85,15 @@ gradlePlugin { signing { val signingInMemoryKey = project.findProperty("signingInMemoryKey") as String? val signingInMemoryPassword = project.findProperty("signingInMemoryPassword") as String? + + val isReleaseSigningEnabled = project.findProperty("RELEASE_SIGNING_ENABLED")?.toString()?.toBoolean() == true + isRequired = isReleaseSigningEnabled + if (signingInMemoryKey != null && signingInMemoryPassword != null) { useInMemoryPgpKeys(signingInMemoryKey, signingInMemoryPassword) - sign(publishing.publications) + + if (isReleaseSigningEnabled) { + sign(publishing.publications) + } } } diff --git a/lib/src/main/kotlin/com/appswithlove/updraft/UpdraftPlugin.kt b/lib/src/main/kotlin/com/appswithlove/updraft/UpdraftPlugin.kt index 94b4201..b560805 100644 --- a/lib/src/main/kotlin/com/appswithlove/updraft/UpdraftPlugin.kt +++ b/lib/src/main/kotlin/com/appswithlove/updraft/UpdraftPlugin.kt @@ -1,5 +1,6 @@ package com.appswithlove.updraft +import com.android.build.api.variant.ApplicationAndroidComponentsExtension import org.gradle.api.GradleException import org.gradle.api.Plugin import org.gradle.api.Project @@ -12,12 +13,12 @@ class UpdraftPlugin : Plugin { override fun apply(project: Project) { val updraftExtension = project.extensions.create("updraft", UpdraftExtension::class.java) - val android = project.extensions.getByName("android") as com.android.build.gradle.AppExtension - android.applicationVariants.all { variant -> + val androidComponents = project.extensions.getByType(ApplicationAndroidComponentsExtension::class.java) + androidComponents.onVariants { variant -> val variantName = variant.name val variantNameCapitalized = variantName.replaceFirstChar { it.uppercase() } val flavorName = variant.flavorName - val buildTypeName = variant.buildType.name + val buildTypeName = variant.buildType // Providers val uploadUrlsProvider = project.providers.provider { updraftExtension.urls } @@ -33,7 +34,7 @@ class UpdraftPlugin : Plugin { val gitTagsProvider = project.providers.of(GitTagsValueSource::class.java) {} val gitCommitProvider = project.providers.of(GitCommitValueSource::class.java) {} val gitUrlProvider = project.providers.of(GitUrlValueSource::class.java) {} - val flavors = variant.productFlavors.map { it.name } + val flavors = variant.productFlavors.map { it.second } val releaseNotesProvider = project.providers.provider { getReleaseNotes(project, flavors, updraftExtension) } diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index cb96a3a..033fc8f 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -3,9 +3,9 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile plugins { alias(libs.plugins.android.application) - alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.compose) - alias(libs.plugins.updraft) + // Apply Updraft plugin + // alias(libs.plugins.updraft) } android { @@ -73,12 +73,13 @@ kotlin { jvmToolchain(11) } -updraft { - urls = mapOf( - "StageDebug" to listOf("https://app.getupdraft.com/api_upload/.../.../"), - "ProdRelease" to listOf("https://app.getupdraft.com/api_upload/.../.../"), - ) -} +// Configure URLs for your build variants +// updraft { +// urls = mapOf( +// "StageDebug" to listOf("https://app.getupdraft.com/api_upload/.../.../"), +// "ProdRelease" to listOf("https://app.getupdraft.com/api_upload/.../.../"), +// ) +// } dependencies { implementation(platform(libs.compose.bom))