1
0
Fork 0
firefox/mobile/android/android-components/components/feature/webcompat/build.gradle
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

81 lines
2.8 KiB
Groovy

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import org.apache.tools.ant.filters.ReplaceTokens
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
defaultConfig {
minSdkVersion = config.minSdkVersion
compileSdk = config.compileSdkVersion
targetSdkVersion = config.targetSdkVersion
}
sourceSets {
main {
assets {
srcDir layout.buildDirectory.dir("generated/assets/")
}
}
}
buildTypes {
release {
minifyEnabled = false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
namespace = 'mozilla.components.feature.webcompat'
}
// We copy the webcompat extension from `browser/extensions/webcompat/` to
// `assets/extensions/webcompat/` by first copying the extension into the
// build directory, which is registered as the assets source directory.
//
// There is an `extensions/` folder in between, which is needed to access
// the extension at: `resource://android/assets/extensions/webcompat/`.
tasks.register("syncWebcompatExtension", Sync) {
def topsrcdir = gradle.mozconfig.topsrcdir
from "$topsrcdir/browser/extensions/webcompat"
into layout.buildDirectory.dir("generated/assets/extensions/webcompat/")
exclude "**/tests/**", "**/components.conf", "**/moz.build"
// webcompat adopted #include directives in Bug 1936031, which are only
// processed for Desktop builds. The filter below pre-processes the files
// that include these directives.
// configuration-cache doesn't allow calling file() from a groovy closure,
// in this case filesMatching callback, so we call file before the closure.
def interventionsJson = file("$topsrcdir/browser/extensions/webcompat/data/interventions.json")
filesMatching([
'**/run.js',
]) {
filter(ReplaceTokens, beginToken: '', endToken: '', tokens: [
'#include data/interventions.json': interventionsJson.text.trim(),
])
}
}
dependencies {
implementation project(':concept-engine')
implementation libs.androidx.core.ktx
implementation libs.kotlin.coroutines
testImplementation project(':support-test')
testImplementation project(':support-webextensions')
testImplementation libs.androidx.test.core
testImplementation libs.androidx.test.junit
testImplementation libs.testing.robolectric
testImplementation libs.testing.coroutines
}
apply from: '../../../android-lint.gradle'
apply from: '../../../publish.gradle'
ext.configurePublish(config.componentsGroupId, project.name, project.ext.description)
preBuild.dependsOn syncWebcompatExtension