Files
servo/support/android/apk/servoapp/build.gradle.kts
Jonathan Schwender d0be4e845d release: Bump version number to 0.1 (#43797)
In preparation for the next release, bump the version number to 0.1. 0.1
will be an LTS release, which receives extended support in terms of
security updates (e.g. spidermonkey security updates). Please keep in
mind that as always no specific guarantees or response times are given,
and any updated are provided on a best effort basis.

Previously some projects had a demo integration of servo based on some
version of servo, and then never or rarely updated it. Providing an LTS
release offers an option to embedders to integrate servo, while reducing
API churn and having a somewhat fixed schedule to adhere to in terms of
upgrades. Currently, the plan is for a new LTS release every 6 months,
with additional documentation regarding API changes and recommended
migration patterns (best-effort and subject to change).

Testing: No functional changes. Additional testing will be performed
post-merge on the newly created release branch.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2026-04-01 09:18:50 +00:00

177 lines
4.8 KiB
Kotlin

import java.util.regex.Pattern
plugins {
id("com.android.application")
}
android {
compileSdk = 33
buildToolsVersion = "34.0.0"
namespace = "org.servo.servoshell"
layout.buildDirectory = File(rootDir.absolutePath, "/../../../target/android/gradle/servoapp")
defaultConfig {
applicationId = "org.servo.servoshell"
minSdk = 30
targetSdk = 33
versionCode = generatedVersionCode
versionName = "0.1.0"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
// Share all of that with servoview
flavorDimensions.add("default")
productFlavors {
register("basic") {
}
}
splits {
density {
isEnable = false
}
abi {
isEnable = false
}
}
sourceSets {
named("main") {
java.srcDirs("src/main/java")
}
}
val signingKeyInfo = getSigningKeyInfo()
if (signingKeyInfo != null) {
signingConfigs {
register("release") {
storeFile = signingKeyInfo["storeFile"] as File
storePassword = signingKeyInfo["storePassword"] as String
keyAlias = signingKeyInfo["keyAlias"] as String
keyPassword = signingKeyInfo["keyPassword"] as String
}
}
}
buildTypes {
debug {
}
release {
signingConfig =
signingConfigs.getByName(if (signingKeyInfo != null) "release" else "debug")
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
// Custom build types
val debug = getByName("debug")
val release = getByName("release")
register("armv7Debug") {
initWith(debug)
ndk {
abiFilters.add(getNDKAbi("armv7"))
}
}
register("armv7Release") {
initWith(release)
ndk {
abiFilters.add(getNDKAbi("armv7"))
}
}
register("arm64Debug") {
initWith(debug)
ndk {
abiFilters.add(getNDKAbi("arm64"))
}
}
register("arm64Release") {
initWith(release)
ndk {
abiFilters.add(getNDKAbi("arm64"))
}
}
register("x86Debug") {
initWith(debug)
ndk {
abiFilters.add(getNDKAbi("x86"))
}
}
register("x86Release") {
initWith(release)
ndk {
abiFilters.add(getNDKAbi("x86"))
}
}
register("x64Debug") {
initWith(debug)
ndk {
abiFilters.add(getNDKAbi("x64"))
}
}
register("x64Release") {
initWith(release)
ndk {
abiFilters.add(getNDKAbi("x64"))
}
}
}
// Ignore default "debug" and "release" build types
androidComponents {
beforeVariants {
if (it.buildType == "release" || it.buildType == "debug") {
it.enable = false
}
}
}
project.afterEvaluate {
android.applicationVariants.forEach { variant ->
val pattern = Pattern.compile("^[\\w\\d]+([A-Z][\\w\\d]+)(Debug|Release)")
val matcher = pattern.matcher(variant.name)
if (!matcher.find()) {
throw GradleException("Invalid variant name for output: " + variant.name)
}
val arch = matcher.group(1)
val debug = variant.name.contains("Debug")
val finalFolder = getTargetDir(debug, arch)
val finalFile = File(finalFolder, "servoapp.apk")
variant.outputs.forEach { output ->
val copyAndRenameAPKTask =
project.task<Copy>("copyAndRename${variant.name.capitalize()}APK") {
from(output.outputFile.parent)
into(finalFolder)
include(output.outputFile.name)
rename(output.outputFile.name, finalFile.name)
}
variant.assembleProvider.get().finalizedBy(copyAndRenameAPKTask)
}
}
}
}
dependencies {
if (findProject(":servoview-local") != null) {
implementation(project(":servoview-local"))
} else {
implementation(project(":servoview"))
}
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
implementation("androidx.preference:preference-ktx:1.2.0")
}