This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Keep the class that is reflected on and its methods. | |
-keep,allowobfuscation class ReflectOnMe { | |
<methods>; | |
} | |
# Keep kotlin.Metadata annotations to maintain metadata on kept items. | |
-keepattributes RuntimeVisibleAnnotations | |
-keep class kotlin.Metadata { *; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ReflectOnMe() { | |
fun String.extension(): String { | |
return capitalize() | |
} | |
} | |
fun reflect(receiver: ReflectOnMe): String { | |
return ReflectOnMe::class | |
.declaredMemberExtensionFunctions | |
.first() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Keep the D8CommandBuilder and all their methods. | |
-keep class com.example.mylibrary.D8CommandBuilder { | |
<methods>; | |
} | |
# Keep the extension functions. | |
-keep class com.example.mylibrary.CommandBuilderKt { | |
<methods>; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.mylibrary | |
/** D8CommandBuilder to build a D8 command. */ | |
class D8CommandBuilder: CommandBuilderBase() { | |
internal var intermediateOutput: Boolean = false | |
override fun getCommandName() = "d8" | |
override fun getExtraArgs() = "--intermediate=$intermediateOutput" | |
} | |
fun D8CommandBuilder.setIntermediateOutput(intermediate: Boolean) : D8CommandBuilder { | |
intermediateOutput = intermediate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.mylibrary | |
/** CommandBuilderBase contains options common for D8 and R8. */ | |
abstract class CommandBuilderBase { | |
internal var minApi: Int = 0 | |
internal var inputs: MutableList<String> = mutableListOf() | |
abstract fun getCommandName(): String | |
abstract fun getExtraArgs(): String |