servo/support/android/apk/servoapp/build.gradle
Gae24 fe6e1cfb29
Android: load url from Intent, plus fixed some warnings (#32160)
* update gitignore folder with android build files

* address some warnings

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* fix servo not loading url from Intent

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* format

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* InitOptions, added url field to avoid override homepage url

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* actually there is a gitignore file in the android folder

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* Restore buildToolsVersion property

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2024-04-29 13:14:10 +00:00

151 lines
3.7 KiB
Groovy

plugins {
id 'com.android.application'
}
import java.util.regex.Matcher
import java.util.regex.Pattern
android {
compileSdk 33
buildToolsVersion = "33.0.2"
namespace 'org.mozilla.servo'
buildDir = rootDir.absolutePath + "/../../../target/android/gradle/servoapp"
defaultConfig {
applicationId "org.mozilla.servo"
minSdk 30
targetSdk 30
versionCode 1
versionName "1.0.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// Share all of that with servoview
flavorDimensions = ["default"]
productFlavors {
basic {
}
}
splits {
density {
enable false
}
abi {
enable false
}
}
sourceSets {
main {
java.srcDirs = ['src/main/java']
}
}
buildTypes {
debug {
}
release {
signingConfig signingConfigs.debug // Change this to sign with a production key
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
// Custom build types
armv7Debug {
initWith(debug)
ndk {
abiFilters getNDKAbi('armv7')
}
}
armv7Release {
initWith(release)
ndk {
abiFilters getNDKAbi('armv7')
}
}
arm64Debug {
initWith(debug)
ndk {
abiFilters getNDKAbi('arm64')
}
}
arm64Release {
initWith(release)
ndk {
abiFilters getNDKAbi('arm64')
}
}
x86Debug {
initWith(debug)
ndk {
abiFilters getNDKAbi('x86')
}
}
x86Release {
initWith(release)
ndk {
abiFilters getNDKAbi('x86')
}
}
x64Debug {
initWith(debug)
ndk {
abiFilters getNDKAbi('x64')
}
}
x64Release {
initWith(release)
ndk {
abiFilters getNDKAbi('x64')
}
}
}
// Ignore default 'debug' and 'release' build types
variantFilter { variant ->
if(variant.buildType.name == 'release' || variant.buildType.name == 'debug') {
variant.setIgnore(true)
}
}
project.afterEvaluate {
android.applicationVariants.all { variant ->
Pattern pattern = Pattern.compile(/^[\w\d]+([A-Z][\w\d]+)(Debug|Release)/)
Matcher matcher = pattern.matcher(variant.name)
if (!matcher.find()) {
throw new GradleException("Invalid variant name for output: " + variant.name)
}
def arch = matcher.group(1)
def debug = variant.name.contains("Debug")
def finalFolder = getTargetDir(debug, arch)
def finalFile = new File(finalFolder, "servoapp.apk")
variant.outputs.all { output ->
Task copyAndRenameAPKTask = project.task("copyAndRename${variant.name.capitalize()}APK", type: Copy) {
from output.outputFile.getParent()
into finalFolder
include output.outputFileName
rename(output.outputFileName, finalFile.getName())
}
variant.assemble.finalizedBy(copyAndRenameAPKTask)
}
}
}
}
dependencies {
if (findProject(':servoview-local')) {
implementation project(':servoview-local')
} else {
implementation project(':servoview')
}
}