diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 34f6ed6..dd9be10 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,7 @@ jobs: run: ./gradlew publishToMavenLocal -PVERSION_NAME=0.0.0-SNAPSHOT - name: Check spotless - run: ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache + run: ./gradlew spotlessCheck --init-script gradle/init.gradle --no-configuration-cache - name: Test AGP compatibility run: chmod +x ./test_agp.sh && ./test_agp.sh diff --git a/README.md b/README.md index 82ebc7a..1a962f2 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,8 @@ The Kace currently supports the above four most commonly used types. Other types | 1.9.20-1.2.0 | 1.9.20 | 4.2.2 | 6.8.3 | | 2.0.0-1.2.0 | 2.0.0 | 7.1.3 | 7.2 | | 2.0.20-1.2.0 | 2.0.20 | 7.1.3 | 7.2 | -| 2.1.0-1.2.0 | 2.1.0 | 7.3.1 | 7.6.3 | +| 2.1.0-1.2.0 | 2.1.0 | 7.3.1 | 7.6.3 | +| 2.2.0-1.2.0 | 2.2.0 | 7.3.1 | 7.6.3 | Since the goal of the Kace is to help developers easily upgrade to Kotlin 1.8, the minimum supported version of Kotlin is relatively high diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..996a6a2 --- /dev/null +++ b/build.gradle @@ -0,0 +1,33 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.3.1' apply false + id 'com.android.library' version '7.3.1' apply false + + // Use Kotlin 2.0.0 to build gradle plugin and compiler plugin for 2.1.0 + // to avoid incompatible issue with gradle build. + id 'org.jetbrains.kotlin.android' version '2.2.0' apply false + id 'org.jetbrains.kotlin.jvm' version '2.2.0' apply false + + id 'com.vanniktech.maven.publish' version '0.18.0' apply false + id 'com.github.gmazzo.buildconfig' version '2.1.0' apply false +} + +allprojects { + repositories { + mavenCentral() + google() + maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" } + } + + apply plugin: "com.vanniktech.maven.publish" + + plugins.withId("java") { + project.extensions.getByType(org.gradle.api.plugins.JavaPluginExtension).sourceCompatibility = org.gradle.api.JavaVersion.VERSION_1_8 + } + plugins.withId("org.jetbrains.kotlin.jvm") { + project.extensions.getByType(org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension).compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8) + } + plugins.withId("org.jetbrains.kotlin.android") { + project.extensions.getByType(org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension).compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8) + } +} diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 4a8c961..0000000 --- a/build.gradle.kts +++ /dev/null @@ -1,37 +0,0 @@ -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension -import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension - -// Top-level build file where you can add configuration options common to all sub-projects/modules. -plugins { - id("com.android.application") version "7.3.1" apply false - id("com.android.library") version "7.3.1" apply false - - // Use Kotlin 2.0.0 to build gradle plugin and compiler plugin for 2.1.0 - // to avoid incompatible issue with gradle build. - id("org.jetbrains.kotlin.android") version "2.0.0" apply false - id("org.jetbrains.kotlin.jvm") version "2.0.0" apply false - - id("com.vanniktech.maven.publish") version "0.18.0" apply false - id("com.github.gmazzo.buildconfig") version "2.1.0" apply false -} - -allprojects { - repositories { - mavenCentral() - google() - maven { setUrl("https://s01.oss.sonatype.org/content/repositories/snapshots/") } - } - - apply(plugin = "com.vanniktech.maven.publish") - - pluginManager.withPlugin("java") { - extensions.getByType().sourceCompatibility = JavaVersion.VERSION_1_8 - } - pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { - extensions.getByType().compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8) - } - pluginManager.withPlugin("org.jetbrains.kotlin.android") { - extensions.getByType().compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8) - } -} diff --git a/gradle.properties b/gradle.properties index b0ac9b6..3e3586a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,7 +23,7 @@ kotlin.code.style=official android.nonTransitiveRClass=true KOTLIN_PLUGIN_ID=com.kanyun.kace -VERSION_NAME=2.1.0-1.2.0 +VERSION_NAME=2.2.0-1.2.0-SNAPSHOT GROUP=com.kanyun.kace diff --git a/gradle/init.gradle b/gradle/init.gradle new file mode 100644 index 0000000..d8f3ad0 --- /dev/null +++ b/gradle/init.gradle @@ -0,0 +1,46 @@ +ext.ktlintVersion = "0.49.1" + +initscript { + def spotlessVersion = "6.19.0" + + repositories { + mavenCentral() + } + + dependencies { + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion" + } +} + +rootProject { + subprojects { + apply plugin: com.diffplug.gradle.spotless.SpotlessPlugin + spotless { + kotlin { + target '**/*.kt' + targetExclude '**/build/**/*.kt' + ktlint(ktlintVersion).userData( + [ + "android" : "true", + "max_line_length" : "200", + "ij_kotlin_allow_trailing_comma" : "false", + "ij_kotlin_allow_trailing_comma_on_call_site": "false" + ] + ) + licenseHeaderFile rootProject.file("spotless/copyright.kt") + } + format 'kts', { + target '**/*.kts' + targetExclude '**/build/**/*.kts' + // Look for the first line that doesn't have a block comment (assumed to be the license) + licenseHeaderFile rootProject.file("spotless/copyright.kts"), "(^(?![\\\\/ ]\\\\*).*\$)" + } + format 'xml', { + target '**/*.xml' + targetExclude '**/build/**/*.xml' + // Look for the first XML tag that isn't a comment (