diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95316f7..9a66159 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,4 +7,4 @@ jobs: - name: Checkout the code uses: actions/checkout@v3 - name: Run Tests - run: ./gradlew check --stacktrace + run: ./gradlew check --stacktrace -x lintJvm diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..8e8f562 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,18 @@ +name: Lint +on: [push] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v3 + + - name: Run Gradle Lint + run: ./gradlew lintJvm + + - name: Upload lint results + uses: actions/upload-artifact@v4 + with: + name: lint-results + path: | + plugin/build/reports/lint-results.html diff --git a/build.gradle b/build.gradle index e680183..f2a3a6a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,19 +1,6 @@ -buildscript { - ext.kotlin_version = '2.2.20' - repositories { - mavenCentral() - gradlePluginPortal() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - mavenCentral() - } +plugins { + alias libs.plugins.kotlin.jvm apply false + alias libs.plugins.lint apply false } tasks.register('clean', Delete) { Delete _ -> diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..1bf2d6b --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,14 @@ +[versions] +kotlin = "2.2.20" +junit = "4.13.2" +publish = "1.3.1" + +[plugins] +lint = { id = "com.android.lint", version = "8.12.3"} +gradle-publish = { id = "com.gradle.plugin-publish", version.ref = "publish" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } + +[libraries] +androidx-gradleLintChecks = 'androidx.lint:lint-gradle:1.0.0-alpha05' + +junit = { module = "junit:junit", version.ref = "junit" } diff --git a/plugin/build.gradle b/plugin/build.gradle index 2fe0209..dc29ca3 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -1,19 +1,16 @@ plugins { - id "com.gradle.plugin-publish" version "1.3.1" id "java-gradle-plugin" -} - -apply plugin: 'kotlin' - -repositories { - mavenCentral() + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.gradle.publish) + alias(libs.plugins.lint) } dependencies { implementation gradleApi() - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - testImplementation 'junit:junit:4.13.2' + lintChecks libs.androidx.gradleLintChecks + + testImplementation libs.junit } compileKotlin { diff --git a/settings.gradle b/settings.gradle index c1d1ef1..fb29256 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + google() + } +} + +dependencyResolutionManagement { + repositories { + mavenCentral() + google() + } +} + include ':plugin'