Skip to content

Commit

Permalink
add multi-release settings to gradle plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Aug 1, 2024
1 parent b5a31bd commit 4f52838
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ abstract class JVMDowngraderExtension @Inject constructor(@get:Internal val proj
debugSkipStubs.convention(emptySet()).finalizeValueOnRead()
debugDumpClasses.convention(false).finalizeValueOnRead()
shadePath.convention { it.substringBefore(".").substringBeforeLast("-").replace(Regex("[.;\\[/]"), "-") + "/" }
multiReleaseOriginal.convention(false).finalizeValueOnRead()
multiReleaseVersions.convention(emptySet()).finalizeValueOnRead()
}

fun convention(flags: ShadeFlags) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ interface DowngradeFlags : TransformParameters {
@get:Optional
val debugDumpClasses: Property<Boolean>

/**
* sets if the original versions of classes should be retained in the output jar as a Multi-Release
* @since 1.0.0
*/
@get:Input
@get:Optional
val multiReleaseOriginal: Property<Boolean>

/**
* sets if semi-downgraded versions of classes should be retained in the output jar as a Multi-Release
* @since 1.0.0
*/
@get:Input
@get:Optional
val multiReleaseVersions: SetProperty<JavaVersion>
}

fun DowngradeFlags.toFlags(): Flags {
Expand All @@ -106,5 +121,7 @@ fun DowngradeFlags.toFlags(): Flags {
flags.debugSkipStubs = debugSkipStubs.getOrElse(emptySet()).map { it.toOpcode() }.toSet()
ignoreWarningsIn.getOrElse(emptyList()).forEach { flags.addIgnore(it) }
flags.debugDumpClasses = debugDumpClasses.getOrElse(false)
flags.multiReleaseOriginal = multiReleaseOriginal.getOrElse(false)
flags.multiReleaseVersions = multiReleaseVersions.getOrElse(emptySet()).map { it.toOpcode() }.toSet()
return flags
}

0 comments on commit 4f52838

Please sign in to comment.