Skip to content

Commit

Permalink
Updates jar classifiers and r8 config
Browse files Browse the repository at this point in the history
  • Loading branch information
popematt committed May 30, 2023
1 parent 98ce1c9 commit de52d69
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
8 changes: 6 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ tasks {
// In Java 9+ we can use `release` but for now we're still building with JDK 8, 11
}

jar {
archiveClassifier.set("original")
}

shadowJar {
relocate("kotlin", "com.amazon.ion_.shaded.kotlin")
minimize()
Expand All @@ -80,7 +84,7 @@ tasks {

inputs.file("build/libs/ion-java-$version-all.jar")
inputs.file(rules)
outputs.file("build/libs/ion-java-$version-r8.jar")
outputs.file("build/libs/ion-java-$version.jar")

dependsOn(shadowJar)
dependsOn(configurations.runtimeClasspath)
Expand All @@ -90,7 +94,7 @@ tasks {
args = listOf(
"--release",
"--classfile",
"--output", "build/libs/ion-java-$version-minified.jar",
"--output", "build/libs/ion-java-$version.jar",
"--pg-conf", rules.toString(),
"--lib", System.getProperty("java.home").toString(),
"build/libs/ion-java-$version-all.jar",
Expand Down
13 changes: 8 additions & 5 deletions config/r8/rules.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
-keepattributes SourceFile, LineNumberTable

-keep class com.amazon.ion.***
-keep interface com.amazon.ion.***
-keep enum com.amazon.ion.***
-dontobfuscate
-keepattributes SourceFile, LineNumberTable, Signature
-keepclasseswithmembers class com.amazon.ion.*** {
*;
}
-keep public class com.amazon.ion.***
-keep public interface com.amazon.ion.***
-keep public enum com.amazon.ion.***
-keeppackagenames ***
2 changes: 1 addition & 1 deletion src/com/amazon/ion/IonExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fun IonValue.childValuesOrNull(): List<IonValue>? = (this as? IonSequence)?.take
/**
* Returns the fields of an [IonStruct] or `null` if this [IonValue] is another type or an Ion null.
*/
fun IonValue.fieldsOrNull(): List<Pair<String, IonValue>>? = (this as? IonStruct)?.takeIf { !it.isNullValue }?.map { it.fieldName to it }
fun IonValue.fieldsOrNull(): List<IonValue>? = (this as? IonStruct)?.takeIf { !it.isNullValue }?.toList()

/**
* If this [IonValue] is a container type, returns an iterator over the contained values. Otherwise returns an iterator
Expand Down

0 comments on commit de52d69

Please sign in to comment.