fabric-loom icon indicating copy to clipboard operation
fabric-loom copied to clipboard

Remap jar task overwrites any copy functionality provided by/to Gradle

Open ghost opened this issue 2 years ago • 2 comments

The RemapJarTask executes two actions:

  1. Jar#copy method which copies the whole jar including any user defined copy specs.
  2. RemapJarTask#doTask method which copies and transforms the input jar and overwrites the previous actions' output.

This prevents the use of user defined copy specs, for example:

remapJar {
  from('LICENSE')
}

Potential Solutions

  1. Don't implement Jar and copy desirable properties from it and parent classes e.g. archive classifiers.
  2. Ideally the task would be converted to a CopySpec however binary transformations are currently not possible however it seems they were intended to be. (blocked by) https://github.com/gradle/gradle/issues/4010

If anyone can think of any better fixes feel free to comment.

ghost avatar Jul 30 '21 16:07 ghost

IMO it should be done like @Chocohead's RemappingJar does it (iirc): remap the output from this jar task with a custom task action. The input property would be replaced by Gradle's own methods for zips.

Juuxel avatar Jul 30 '21 17:07 Juuxel

Im not too sure this is easily fixable, I rewrote the jar remapping in 0.11 and had a quick go at using this as an input without much success. If anyone has any ideas please let me know.

modmuss50 avatar Dec 30 '21 00:12 modmuss50