-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
593 additions
and
259 deletions.
There are no files selected for viewing
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
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
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
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
71 changes: 71 additions & 0 deletions
71
src/api/kotlin/xyz/wagyourtail/unimined/api/minecraft/task/AbstractRemapJarTask.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package xyz.wagyourtail.unimined.api.minecraft.task | ||
|
||
import groovy.lang.Closure | ||
import groovy.lang.DelegatesTo | ||
import org.gradle.api.file.RegularFileProperty | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.InputFile | ||
import org.gradle.api.tasks.Internal | ||
import org.gradle.api.tasks.Optional | ||
import org.gradle.api.tasks.bundling.Jar | ||
import org.jetbrains.annotations.ApiStatus | ||
import xyz.wagyourtail.unimined.api.mapping.mixin.MixinRemapOptions | ||
import xyz.wagyourtail.unimined.mapping.Namespace | ||
import xyz.wagyourtail.unimined.util.FinalizeOnRead | ||
|
||
/** | ||
* task responsible for transforming your built jar to production. | ||
* @since 0.1.0 | ||
*/ | ||
@Suppress("LeakingThis") | ||
abstract class AbstractRemapJarTask : Jar() { | ||
|
||
@get:InputFile | ||
abstract val inputFile: RegularFileProperty | ||
|
||
@get:Internal | ||
@set:Internal | ||
var devNamespace: Namespace? by FinalizeOnRead(null) | ||
|
||
@get:Internal | ||
@set:Internal | ||
var prodNamespace: Namespace? by FinalizeOnRead(null) | ||
|
||
/** | ||
* whether to remap AccessTransformers to the legacy format (<=1.7.10) | ||
*/ | ||
@get:Input | ||
@get:Optional | ||
abstract val remapATToLegacy: Property<Boolean?> | ||
|
||
@get:Internal | ||
@set:Internal | ||
@set:ApiStatus.Experimental | ||
abstract var allowImplicitWildcards: Boolean | ||
|
||
abstract fun devNamespace(namespace: String) | ||
|
||
@Deprecated(message = "no longer needed", replaceWith = ReplaceWith("")) | ||
fun devFallbackNamespace(namespace: String) {} | ||
|
||
abstract fun prodNamespace(namespace: String) | ||
|
||
abstract fun mixinRemap(action: MixinRemapOptions.() -> Unit) | ||
|
||
fun mixinRemap( | ||
@DelegatesTo(value = MixinRemapOptions::class, strategy = Closure.DELEGATE_FIRST) | ||
action: Closure<*> | ||
) { | ||
mixinRemap { | ||
action.delegate = this | ||
action.resolveStrategy = Closure.DELEGATE_FIRST | ||
action.call() | ||
} | ||
} | ||
|
||
init { | ||
remapATToLegacy.convention(null as Boolean?).finalizeValueOnRead() | ||
} | ||
|
||
} |
67 changes: 2 additions & 65 deletions
67
src/api/kotlin/xyz/wagyourtail/unimined/api/minecraft/task/RemapJarTask.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,5 @@ | ||
package xyz.wagyourtail.unimined.api.minecraft.task | ||
|
||
import groovy.lang.Closure | ||
import groovy.lang.DelegatesTo | ||
import org.gradle.api.file.RegularFileProperty | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.InputFile | ||
import org.gradle.api.tasks.Internal | ||
import org.gradle.api.tasks.Optional | ||
import org.gradle.jvm.tasks.Jar | ||
import org.jetbrains.annotations.ApiStatus | ||
import xyz.wagyourtail.unimined.api.mapping.mixin.MixinRemapOptions | ||
import xyz.wagyourtail.unimined.mapping.Namespace | ||
import xyz.wagyourtail.unimined.util.FinalizeOnRead | ||
import xyz.wagyourtail.unimined.util.JarInterface | ||
|
||
/** | ||
* task responsible for transforming your built jar to production. | ||
* @since 0.1.0 | ||
*/ | ||
@Suppress("LeakingThis") | ||
abstract class RemapJarTask : Jar() { | ||
|
||
@get:InputFile | ||
abstract val inputFile: RegularFileProperty | ||
|
||
@get:Internal | ||
@set:Internal | ||
var devNamespace: Namespace? by FinalizeOnRead(null) | ||
|
||
@get:Internal | ||
@set:Internal | ||
var prodNamespace: Namespace? by FinalizeOnRead(null) | ||
|
||
/** | ||
* whether to remap AccessTransformers to the legacy format (<=1.7.10) | ||
*/ | ||
@get:Input | ||
@get:Optional | ||
abstract val remapATToLegacy: Property<Boolean?> | ||
|
||
@get:Internal | ||
@set:Internal | ||
@set:ApiStatus.Experimental | ||
abstract var allowImplicitWildcards: Boolean | ||
|
||
abstract fun devNamespace(namespace: String) | ||
|
||
abstract fun prodNamespace(namespace: String) | ||
|
||
abstract fun mixinRemap(action: MixinRemapOptions.() -> Unit) | ||
|
||
fun mixinRemap( | ||
@DelegatesTo(value = MixinRemapOptions::class, strategy = Closure.DELEGATE_FIRST) | ||
action: Closure<*> | ||
) { | ||
mixinRemap { | ||
action.delegate = this | ||
action.resolveStrategy = Closure.DELEGATE_FIRST | ||
action.call() | ||
} | ||
} | ||
|
||
init { | ||
remapATToLegacy.convention(null as Boolean?).finalizeValueOnRead() | ||
} | ||
|
||
} | ||
interface RemapJarTask : JarInterface<AbstractRemapJarTask> |
5 changes: 5 additions & 0 deletions
5
src/api/kotlin/xyz/wagyourtail/unimined/api/minecraft/task/RemapSourcesJarTask.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package xyz.wagyourtail.unimined.api.minecraft.task | ||
|
||
import xyz.wagyourtail.unimined.util.JarInterface | ||
|
||
interface RemapSourcesJarTask : JarInterface<AbstractRemapJarTask> |
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
29 changes: 29 additions & 0 deletions
29
src/api/kotlin/xyz/wagyourtail/unimined/util/JarInterface.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package xyz.wagyourtail.unimined.util | ||
|
||
import groovy.lang.Closure | ||
import groovy.lang.DelegatesTo | ||
import org.gradle.api.Task | ||
import org.gradle.api.tasks.Internal | ||
import org.gradle.api.tasks.bundling.Jar | ||
|
||
interface JarInterface<T : Jar> : Task { | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
val asJar: T | ||
@Internal | ||
get() = this as T | ||
|
||
fun asJar(action: T.() -> Unit) { | ||
asJar.action() | ||
} | ||
|
||
fun asJar( | ||
@DelegatesTo(Jar::class, strategy = Closure.DELEGATE_FIRST) | ||
closure: Closure<*> | ||
) { | ||
asJar { | ||
closure.delegate = this | ||
closure.call() | ||
} | ||
} | ||
} |
Oops, something went wrong.