mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-19 19:42:17 +02:00
Use plugins block to declare the plugins used
See https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block The plugins that are to be used in different modules are added in the top level build file with apply "false"(doesn't make sense to apply them on the root project). Then the project modules, from the plugins already available on the classpath, actually apply the ones they need. Ktlint plugin was applied directly to all subprojects(initially it was added through allprojects {} but it doesn't make sense to add it to the root project as it doesn't contain source code, so subprojects{} was used instead). The amazonappstorepublisher plugin also required some custom configuration as we need the latest versions which are not available in mavenCentral() but can be fetched from jitpack.io.
This commit is contained in:
parent
529a19b4a0
commit
6b65c45386
@ -1,16 +1,14 @@
|
||||
plugins {
|
||||
// Gradle plugin portal
|
||||
id 'com.github.triplet.play' version '3.8.4'
|
||||
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.10'
|
||||
// Gradle plugin portal
|
||||
id 'com.github.triplet.play' version '3.8.4'
|
||||
id 'com.android.application'
|
||||
id 'app.brant.amazonappstorepublisher'
|
||||
id 'idea'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-parcelize'
|
||||
id 'org.jetbrains.kotlin.plugin.serialization'
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'app.brant.amazonappstorepublisher'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
|
35
build.gradle
35
build.gradle
@ -1,7 +1,6 @@
|
||||
import org.gradle.internal.jvm.Jvm
|
||||
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
// The version for the Kotlin plugin and dependencies
|
||||
// If changing this, make sure to update org.jetbrains.kotlin.plugin.serialization version too
|
||||
@ -17,23 +16,8 @@ buildscript {
|
||||
ext.androidx_test_version = '1.5.0'
|
||||
ext.androidx_test_junit_version = '1.1.5'
|
||||
ext.robolectric_version = '4.10.3'
|
||||
ext.android_gradle_plugin = "8.0.2"
|
||||
|
||||
repositories {
|
||||
google()
|
||||
maven {
|
||||
url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.0.2'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
classpath "com.github.BrantApps.gradle-amazon-app-store-publisher:amazonappstorepublisher:master-SNAPSHOT"
|
||||
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.5.1"
|
||||
}
|
||||
configurations.all {
|
||||
resolutionStrategy.eachDependency { details ->
|
||||
if (details.requested.group == 'org.jetbrains.kotlinx'
|
||||
@ -45,12 +29,14 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: "org.jlleitschuh.gradle.ktlint"
|
||||
plugins {
|
||||
id 'com.android.application' version "$android_gradle_plugin" apply false
|
||||
id 'com.android.library' version "$android_gradle_plugin" apply false
|
||||
id 'org.jetbrains.kotlin.jvm' version "$kotlin_version" apply false
|
||||
id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
|
||||
id 'org.jetbrains.kotlin.plugin.parcelize' version "$kotlin_version" apply false
|
||||
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version" apply false
|
||||
id 'org.jlleitschuh.gradle.ktlint' version '11.5.1' apply false
|
||||
}
|
||||
|
||||
Properties localProperties = new Properties()
|
||||
@ -61,8 +47,9 @@ Boolean fatalWarnings = !(localProperties['fatal_warnings'] == "false")
|
||||
|
||||
// Here we extract per-module "best practices" settings to a single top-level evaluation
|
||||
subprojects {
|
||||
afterEvaluate { project ->
|
||||
apply plugin: "org.jlleitschuh.gradle.ktlint"
|
||||
|
||||
afterEvaluate { project ->
|
||||
if (project.hasProperty('android')) {
|
||||
project.android.testOptions.unitTests {
|
||||
includeAndroidResources = true
|
||||
|
@ -1,4 +1,6 @@
|
||||
apply plugin: 'kotlin'
|
||||
plugins {
|
||||
id 'kotlin'
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
|
@ -5,6 +5,14 @@ pluginManagement {
|
||||
mavenCentral()
|
||||
maven(url = "https://jitpack.io") // only needed for the "amazonappstorepublisher" plugin
|
||||
}
|
||||
resolutionStrategy {
|
||||
// TODO try to find another plugin for this functionality?
|
||||
eachPlugin {
|
||||
if (requested.id.id == "app.brant.amazonappstorepublisher") {
|
||||
useModule("com.github.BrantApps.gradle-amazon-app-store-publisher:amazonappstorepublisher:master-SNAPSHOT")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include(":lint-rules", ":api", ":AnkiDroid")
|
||||
|
Loading…
Reference in New Issue
Block a user