mirror of
https://github.com/JakeWharton/mosaic.git
synced 2025-11-01 12:01:22 +08:00
Migrate to version catalogs
This commit is contained in:
12
build.gradle
12
build.gradle
@ -1,16 +1,14 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
buildscript {
|
||||
apply from: 'dependencies.gradle'
|
||||
|
||||
dependencies {
|
||||
classpath deps.kotlinGradlePlugin
|
||||
classpath libs.kotlin.gradlePlugin
|
||||
// We don't use this dependency directly. However, we reference a type from the Kotlin Gradle
|
||||
// plugin whose classloading causes com.android.build.gradle.api.BaseVariant to also be loaded.
|
||||
classpath 'com.android.tools.build:gradle:7.2.2'
|
||||
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.13.0'
|
||||
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.7.10'
|
||||
classpath 'com.github.gmazzo:gradle-buildconfig-plugin:3.1.0'
|
||||
classpath libs.android.gradlePlugin
|
||||
classpath libs.maven.publish.gradlePlugin
|
||||
classpath libs.dokka.gradlePlugin
|
||||
classpath libs.buildconfig.gradlePlugin
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
buildscript {
|
||||
ext.versions = [
|
||||
'kotlin': '1.7.10',
|
||||
'kotlinxCoroutines': '1.6.1',
|
||||
'composeCompiler': '1.3.0',
|
||||
]
|
||||
ext.deps = [
|
||||
'androidxComposeCompiler': "androidx.compose.compiler:compiler:${versions.composeCompiler}",
|
||||
'kotlinCompiler': "org.jetbrains.kotlin:kotlin-compiler:${versions.kotlin}",
|
||||
'kotlinGradlePlugin': "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
|
||||
'kotlinxCoroutinesCore': "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinxCoroutines}",
|
||||
'kotlinxCoroutinesTest': "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.kotlinxCoroutines}",
|
||||
'jetbrainsComposeRuntime': 'org.jetbrains.compose.runtime:runtime:1.1.1',
|
||||
'junit': 'junit:junit:4.13.2',
|
||||
'truth': 'com.google.truth:truth:1.1.3',
|
||||
'jansi': 'org.fusesource.jansi:jansi:2.4.0',
|
||||
]
|
||||
}
|
||||
27
gradle/libs.versions.toml
Normal file
27
gradle/libs.versions.toml
Normal file
@ -0,0 +1,27 @@
|
||||
[versions]
|
||||
kotlin = "1.7.10"
|
||||
androidGradlePlugin = "7.2.2"
|
||||
mavenPublishPlugin = "0.13.0"
|
||||
buildConfigPlugin = "3.1.0"
|
||||
kotlinxCoroutines = "1.6.1"
|
||||
composeCompiler = "1.3.0"
|
||||
composeRuntime = "1.1.1"
|
||||
junit4 = "4.13.2"
|
||||
truth = "1.1.3"
|
||||
jansi = "2.4.0"
|
||||
|
||||
[libraries]
|
||||
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
|
||||
maven-publish-gradlePlugin = { group = "com.vanniktech", name = "gradle-maven-publish-plugin", version.ref = "mavenPublishPlugin" }
|
||||
dokka-gradlePlugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "kotlin" }
|
||||
buildconfig-gradlePlugin = { group = "com.github.gmazzo", name = "gradle-buildconfig-plugin", version.ref = "buildConfigPlugin" }
|
||||
androidx-compose-compiler = { group = "androidx.compose.compiler", name = "compiler", version.ref = "composeCompiler" }
|
||||
kotlin-compiler = { group = "org.jetbrains.kotlin", name = "kotlin-compiler", version.ref = "kotlin" }
|
||||
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
|
||||
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" }
|
||||
jetbrains-compose-runtime = { group = "org.jetbrains.compose.runtime", name = "runtime", version.ref = "composeRuntime" }
|
||||
junit4 = { group = "junit", name = "junit", version.ref = "junit4" }
|
||||
truth = { group = "com.google.truth", name = "truth", version.ref = "truth" }
|
||||
jansi = { group = "org.fusesource.jansi", name = "jansi", version.ref = "jansi" }
|
||||
|
||||
@ -5,10 +5,10 @@ apply plugin: 'com.github.gmazzo.buildconfig'
|
||||
|
||||
dependencies {
|
||||
compileOnly gradleApi()
|
||||
compileOnly deps.kotlinGradlePlugin
|
||||
compileOnly libs.kotlin.gradlePlugin
|
||||
|
||||
testImplementation deps.junit
|
||||
testImplementation deps.truth
|
||||
testImplementation libs.junit4
|
||||
testImplementation libs.truth
|
||||
testImplementation gradleTestKit()
|
||||
}
|
||||
|
||||
@ -35,6 +35,6 @@ buildConfig {
|
||||
}
|
||||
|
||||
packageName('com.jakewharton.mosaic.gradle')
|
||||
buildConfigField("String", "composeCompilerVersion", "\"${versions.composeCompiler}\"")
|
||||
buildConfigField("String", "composeCompilerVersion", "\"${libs.versions.composeCompiler.get()}\"")
|
||||
buildConfigField("String", "mosaicVersion", "\"${project.version}\"")
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
buildscript {
|
||||
apply from: "../../../../../dependencies.gradle"
|
||||
|
||||
dependencies {
|
||||
classpath deps.kotlinGradlePlugin
|
||||
classpath libs.kotlin.gradlePlugin
|
||||
classpath "com.jakewharton.mosaic:mosaic-gradle-plugin:${mosaicVersion}"
|
||||
}
|
||||
repositories {
|
||||
@ -17,7 +15,7 @@ apply plugin: 'org.jetbrains.kotlin.jvm'
|
||||
apply plugin: 'com.jakewharton.mosaic'
|
||||
|
||||
dependencies {
|
||||
testImplementation deps.junit
|
||||
testImplementation libs.junit4
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@ -25,7 +25,7 @@ class FixtureTest(
|
||||
@Test fun todo() {
|
||||
val fixtureDir = File(fixturesDir, fixtureName)
|
||||
val gradleRoot = File(fixtureDir, "gradle").also { it.mkdir() }
|
||||
File("../gradle/wrapper").copyRecursively(File(gradleRoot, "wrapper"), true)
|
||||
File("../gradle").copyRecursively(File(gradleRoot.path), true)
|
||||
|
||||
GradleRunner.create()
|
||||
.withProjectDir(fixtureDir)
|
||||
|
||||
@ -4,11 +4,11 @@ apply plugin: 'org.jetbrains.kotlin.jvm'
|
||||
apply plugin: 'com.vanniktech.maven.publish'
|
||||
|
||||
dependencies {
|
||||
api deps.jetbrainsComposeRuntime
|
||||
implementation deps.jansi
|
||||
api libs.jetbrains.compose.runtime
|
||||
implementation libs.jansi
|
||||
|
||||
testImplementation deps.junit
|
||||
testImplementation deps.truth
|
||||
testImplementation libs.junit4
|
||||
testImplementation libs.truth
|
||||
|
||||
add(KotlinPluginKt.PLUGIN_CLASSPATH_CONFIGURATION_NAME, deps.androidxComposeCompiler)
|
||||
add(KotlinPluginKt.PLUGIN_CLASSPATH_CONFIGURATION_NAME, libs.androidx.compose.compiler)
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
buildscript {
|
||||
apply from: '../dependencies.gradle'
|
||||
|
||||
dependencies {
|
||||
classpath deps.kotlinGradlePlugin
|
||||
classpath libs.kotlin.gradlePlugin
|
||||
|
||||
// Normally you would declare a version here, but we use dependency substitution in
|
||||
// settings.gradle to use the version built from inside the repo.
|
||||
|
||||
@ -8,3 +8,11 @@ includeBuild('..') {
|
||||
substitute module('com.jakewharton.mosaic:mosaic-runtime') using project(':mosaic-runtime')
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
libs {
|
||||
from(files("../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user