Introduce 'common-configuration' convention plugin
This plugin should do project common configuration in the Kotlin repo. As a first thing I moved gson version constraint into it, because current approach has Gradle bug: https://github.com/gradle/gradle/issues/20548
This commit is contained in:
+1
-2
@@ -1,7 +1,5 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.crypto.checksum.Checksum
|
||||
import org.gradle.plugins.ide.idea.model.IdeaModel
|
||||
import proguard.gradle.ProGuardTask
|
||||
|
||||
buildscript {
|
||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||
@@ -419,6 +417,7 @@ fun Task.listConfigurationContents(configName: String) {
|
||||
val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures)
|
||||
|
||||
allprojects {
|
||||
pluginManager.apply("common-configuration")
|
||||
val mirrorRepo: String? = findProperty("maven.repository.mirror")?.toString()
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import gradle.kotlin.dsl.accessors._6fcc03dc3ac2d481a1d2799d95ed6983.implementation
|
||||
import org.gradle.kotlin.dsl.dependencies
|
||||
|
||||
// Contains common configuration that should be applied to all projects
|
||||
|
||||
// Forcing minimal gson dependency version
|
||||
val gsonVersion = rootProject.extra["versions.gson"] as String
|
||||
dependencies {
|
||||
constraints {
|
||||
configurations.all {
|
||||
this@constraints.add(name, "com.google.code.gson:gson") {
|
||||
version {
|
||||
require(gsonVersion)
|
||||
}
|
||||
because("Force using same gson version because of https://github.com/google/gson/pull/1991")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,28 +39,6 @@ plugins {
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.6.5" apply false
|
||||
}
|
||||
|
||||
File versionPropertiesFile = new File(rootProject.projectDir, "gradle/versions.properties")
|
||||
def versionProperties = new Properties()
|
||||
versionPropertiesFile.withInputStream {
|
||||
versionProperties.load(it)
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
components {
|
||||
withModule("com.google.code.gson:gson") {
|
||||
allVariants {
|
||||
withDependencies {
|
||||
add("com.google.code.gson:gson") {
|
||||
version {
|
||||
it.require(versionProperties['versions.gson'])
|
||||
}
|
||||
because("Force using same gson version because of https://github.com/google/gson/pull/1991")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def buildProperties = BuildPropertiesKt.getKotlinBuildPropertiesForSettings(settings)
|
||||
|
||||
if (buildProperties.buildScanServer != null) {
|
||||
|
||||
Reference in New Issue
Block a user