Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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 {
Expand All @@ -23,7 +28,7 @@ buildscript {

dependencies {
// ...
classpath 'com.appswithlove.updraft:updraft:2.3.0'
classpath 'com.appswithlove.updraft:updraft:3.0.0'
}
}
```
Expand All @@ -32,7 +37,7 @@ or

```kotlin
plugins {
id("com.appswithlove.updraft") version "2.3.0"
id("com.appswithlove.updraft") version "3.0.0"
}
```

Expand All @@ -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/"]
]
}
```

Expand Down Expand Up @@ -114,7 +125,7 @@ buildscript {
// ...
}
dependencies {
classpath 'com.appswithlove.updraft:updraft:2.3.0'
classpath 'com.appswithlove.updraft:updraft:3.0.0'
// ...
}
}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 1 addition & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
9 changes: 8 additions & 1 deletion lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
9 changes: 5 additions & 4 deletions lib/src/main/kotlin/com/appswithlove/updraft/UpdraftPlugin.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,12 +13,12 @@ class UpdraftPlugin : Plugin<Project> {
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 }
Expand All @@ -33,7 +34,7 @@ class UpdraftPlugin : Plugin<Project> {
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) }

Expand Down
17 changes: 9 additions & 8 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down