Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ val generateSources =

tasks {
// Run tests with UTF-16 encoding
test {
withType<Test> {
useJUnitPlatform()
jvmArgs("-Dfile.encoding=UTF-16")
}
Expand Down Expand Up @@ -90,6 +90,27 @@ tasks {
archiveClassifier = "with-dependencies"
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
failOnDuplicateEntries = true
minimize {
r8 {
keepRuleFiles.from(layout.projectDirectory.file("src/main/rules.txt"))
}
}
}

val testShadow =
register("testShadow", Test::class) {
group = "verification"
description =
"Runs unit tests against the R8-processed shadowed JAR to ensure Maven API compatibility."
// Replace normal Jar with shadowJar in tests.
classpath =
(sourceSets["test"].runtimeClasspath - sourceSets["main"].output) +
files(shadowJar.flatMap { it.archiveFile })
testClassesDirs = sourceSets["test"].output.classesDirs
}

check {
dependsOn(testShadow)
}
}

Expand Down
28 changes: 28 additions & 0 deletions core/src/main/rules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-dontobfuscate
-keepattributes SourceFile, LineNumberTable


-dontwarn com.google.auto.**
-dontwarn gnu.trove.**
-dontwarn kotlin.annotations.jvm.**
-dontwarn kotlinx.coroutines.internal.intellij.**
-dontwarn org.checkerframework.checker.nullness.qual.Nullable
-dontwarn org.jetbrains.annotations.**
-dontwarn org.jetbrains.kotlin.com.google.errorprone.annotations.**
-dontwarn org.jetbrains.kotlin.com.google.j2objc.annotations.**
-dontwarn org.jetbrains.kotlin.com.intellij.util.**


# Keep all ktfmt library classes and methods for Maven API, CLI, and unit test compatibility.
-keep class org.jetbrains.ktfmt.** { *; }

# IntelliJ platform classes required for Kotlin AST parsing & CoreApplicationEnvironment.
-keep class org.jetbrains.kotlin.com.intellij.**

# Kotlin AST PSI and KDoc elements (keep constructors for reflective ASTFactory instantiation).
-keepclassmembers class org.jetbrains.kotlin.psi.** {
public <init>(...);
}
-keepclassmembers class org.jetbrains.kotlin.kdoc.** {
public <init>(...);
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ org-junit-junit-bom = "6.1.2"
gradlePlugin-dependencyAnalysis = "3.18.0"
gradlePlugin-dokka = "2.2.0"
gradlePlugin-intelliJPlatform = "2.12.0"
gradlePlugin-shadowJar = "9.0.2"
gradlePlugin-shadowJar = "9.6.1"

[libraries]
ec4j = { module = "org.ec4j.core:ec4j-core", version.ref = "org-ec4j-core" }
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dependencyResolutionManagement {
}
repositories {
mavenCentral()
google()
}
}

Expand Down