/* 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 plugins { alias(libs.plugins.dependency.analysis) } apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { sourceSets { main { assets { srcDir layout.buildDirectory.dir("generated/assets/") } } } 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") { exclude "run.js" } def topobjdir = gradle.mozconfig.topobjdir from ("$topobjdir/mobile/android") { include "webcompat_addon_run.js" rename "webcompat_addon_run.js", "run.js" } into layout.buildDirectory.dir("generated/assets/extensions/webcompat/") exclude "**/tests/**", "**/components.conf", "**/moz.build", "**/codegen.py", "**/data/interventions" } // Make sure DAGP asset-source exploding happens after syncWebcompatExtension tasks.matching { it.name.startsWith("explodeAssetSource") }.configureEach { t -> t.dependsOn(tasks.named("syncWebcompatExtension")) } dependencies { implementation project(':components:concept-engine') implementation libs.androidx.core.ktx implementation libs.kotlinx.coroutines testImplementation project(':components:support-test') testImplementation project(':components:support-webextensions') testImplementation libs.androidx.test.core testImplementation libs.androidx.test.junit testImplementation libs.kotlinx.coroutines.test testImplementation libs.robolectric } apply from: '../../../common-config.gradle' apply from: '../../../publish.gradle' ext.configurePublish(config.componentsGroupId, project.name, project.ext.description) preBuild.dependsOn syncWebcompatExtension