From eeab915b04778c9ea051175d2a7b716537250ca0 Mon Sep 17 00:00:00 2001 From: Guillermo Mazzola Date: Thu, 19 Dec 2024 13:56:20 +0100 Subject: [PATCH] Adopted `importClasses` plugin (#130) --- gradle/libs.versions.toml | 10 ++++++---- .../main/kotlin/embedded-dependencies.gradle.kts | 1 + plugins/matcher/build.gradle.kts | 15 +++++++++++++-- .../codeowners/matcher/CodeOwnersMatcher.kt | 2 +- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 05647dd..de436b6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,19 +3,21 @@ kotlin = "2.1.0" android = "8.7.3" [libraries] -apache-bcel = "org.apache.bcel:bcel:6.10.0" -jgit = "org.eclipse.jgit:org.eclipse.jgit:6.10.0.202406032230-r" -junit-bom = "org.junit:junit-bom:5.11.4" +apache-bcel = { module = "org.apache.bcel:bcel", version = "6.10.0" } +jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version = "6.10.0.202406032230-r" } +junit-bom = { module = "org.junit:junit-bom", version = "5.11.4" } junit-params = { module = "org.junit.jupiter:junit-jupiter-params" } kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } kotlin-plugin-api = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin-api", version.ref = "kotlin" } kotlin-plugin-compiler-api = { module = "org.jetbrains.kotlin:kotlin-compiler", version.ref = "kotlin" } kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } +slf4j = { module = "org.slf4j:slf4j-api", version = "2.0.16" } [plugins] android-application = { id = "com.android.application", version.ref = "android" } android-library = { id = "com.android.library", version.ref = "android" } -buildConfig = "com.github.gmazzo.buildconfig:5.5.1" +buildConfig = { id = "com.github.gmazzo.buildconfig", version = "5.5.1" } +importClasses = { id = "io.github.gmazzo.importclasses", version = "1.0.0" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } diff --git a/plugins/buildSrc/src/main/kotlin/embedded-dependencies.gradle.kts b/plugins/buildSrc/src/main/kotlin/embedded-dependencies.gradle.kts index c0f49e4..94ab23a 100644 --- a/plugins/buildSrc/src/main/kotlin/embedded-dependencies.gradle.kts +++ b/plugins/buildSrc/src/main/kotlin/embedded-dependencies.gradle.kts @@ -29,4 +29,5 @@ tasks.jar { } } }) + duplicatesStrategy = DuplicatesStrategy.WARN } diff --git a/plugins/matcher/build.gradle.kts b/plugins/matcher/build.gradle.kts index 53b0250..0151b87 100644 --- a/plugins/matcher/build.gradle.kts +++ b/plugins/matcher/build.gradle.kts @@ -1,13 +1,24 @@ plugins { alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.importClasses) `jvm-convention-module` `embedded-dependencies` } description = "CodeOwners Matcher Library" -dependencies { - implementation(libs.jgit) +sourceSets.main { + importClasses(libs.jgit) { + repackageTo = "io.github.gmazzo.codeowners.matcher.jgit" + keep("org.eclipse.jgit.ignore.FastIgnoreRule") + + exclude("META-INF/**/module-info.class") + include("**.class") + exclude("**.*") + } +} +dependencies { + implementation(libs.slf4j) // transitive of libs.jgit, required by FastIgnoreRule testImplementation(libs.junit.params) } diff --git a/plugins/matcher/src/main/kotlin/io/github/gmazzo/codeowners/matcher/CodeOwnersMatcher.kt b/plugins/matcher/src/main/kotlin/io/github/gmazzo/codeowners/matcher/CodeOwnersMatcher.kt index 56cd5bd..8d9e4e1 100644 --- a/plugins/matcher/src/main/kotlin/io/github/gmazzo/codeowners/matcher/CodeOwnersMatcher.kt +++ b/plugins/matcher/src/main/kotlin/io/github/gmazzo/codeowners/matcher/CodeOwnersMatcher.kt @@ -1,6 +1,6 @@ package io.github.gmazzo.codeowners.matcher -import org.eclipse.jgit.ignore.FastIgnoreRule +import io.github.gmazzo.codeowners.matcher.jgit.FastIgnoreRule import java.io.File class CodeOwnersMatcher(