diff --git a/app/build.gradle b/app/build.gradle index 8c2568e57..fa0dadbc7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,4 @@ import org.apache.tools.ant.util.StringUtils -import org.mozilla.fenix.gradle.tasks.ApkSizeTask plugins { id "com.jetbrains.python.envs" version "$python_envs_plugin" diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index fca9a5272..93580dab0 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -17,7 +17,3 @@ repositories { mavenCentral() } } - -dependencies { - implementation "org.json:json:20210307" -} diff --git a/plugins/apksize/build.gradle b/plugins/apksize/build.gradle new file mode 100644 index 000000000..ebc7ab538 --- /dev/null +++ b/plugins/apksize/build.gradle @@ -0,0 +1,30 @@ +/* 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/. */ + +plugins { + id "org.gradle.kotlin.kotlin-dsl" version "2.4.1" +} + +repositories { + if (project.hasProperty("centralRepo")) { + maven { + name "MavenCentral" + url project.property("centralRepo") + allowInsecureProtocol true // Local Nexus in CI uses HTTP + } + } else { + mavenCentral() + } +} + +dependencies { + implementation "org.json:json:20210307" +} + +gradlePlugin { + plugins.register("ApkSizePlugin") { + id = "ApkSizePlugin" + implementationClass = "ApkSizePlugin" + } +} diff --git a/plugins/apksize/settings.gradle b/plugins/apksize/settings.gradle new file mode 100644 index 000000000..8e4fe2448 --- /dev/null +++ b/plugins/apksize/settings.gradle @@ -0,0 +1,5 @@ +/* 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/. */ + +// Prevents gradle builds from looking for a root settings.gradle diff --git a/buildSrc/src/main/java/org/mozilla/fenix/gradle/tasks/ApkSizeTask.kt b/plugins/apksize/src/main/java/ApkSizePlugin.kt similarity index 96% rename from buildSrc/src/main/java/org/mozilla/fenix/gradle/tasks/ApkSizeTask.kt rename to plugins/apksize/src/main/java/ApkSizePlugin.kt index 377d7a689..dd42b2650 100644 --- a/buildSrc/src/main/java/org/mozilla/fenix/gradle/tasks/ApkSizeTask.kt +++ b/plugins/apksize/src/main/java/ApkSizePlugin.kt @@ -2,9 +2,9 @@ * 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/. */ -package org.mozilla.fenix.gradle.tasks - import org.gradle.api.DefaultTask +import org.gradle.api.Plugin +import org.gradle.api.initialization.Settings import org.gradle.api.tasks.Input import org.gradle.api.tasks.TaskAction import org.json.JSONArray @@ -14,6 +14,10 @@ import java.io.File import java.nio.file.Files import java.nio.file.Paths +class ApkSizePlugin : Plugin { + override fun apply(settings: Settings) = Unit +} + /** * Gradle task for determining the size of APKs and logging them in a perfherder compatible format. */ diff --git a/settings.gradle b/settings.gradle index 6f38b5ed9..a29537659 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,10 +6,12 @@ pluginManagement { includeBuild("../android-components/plugins/publicsuffixlist") includeBuild("../android-components/plugins/dependencies") includeBuild("../android-components/plugins/config") + includeBuild("./plugins/apksize") includeBuild("./plugins/fenixdependencies") } plugins { + id 'ApkSizePlugin' id 'FenixDependenciesPlugin' id "mozac.ConfigPlugin" id 'mozac.DependenciesPlugin'