mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Merge remote-tracking branch 'upstream/dev/1.13' into dev/1.13
This commit is contained in:
@@ -11,7 +11,7 @@ lorenz-tiny = "4.0.2"
|
|||||||
mercury = "0.4.3.18"
|
mercury = "0.4.3.18"
|
||||||
mercury-mixin = "0.2.2"
|
mercury-mixin = "0.2.2"
|
||||||
loom-native = "0.2.0"
|
loom-native = "0.2.0"
|
||||||
unpick = "3.0.0-beta.9"
|
unpick = "3.0.0-beta.13"
|
||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
spotless = "7.2.1"
|
spotless = "7.2.1"
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ public abstract class AbstractRemapJarTask extends Jar {
|
|||||||
final WorkQueue workQueue = getWorkerExecutor().noIsolation();
|
final WorkQueue workQueue = getWorkerExecutor().noIsolation();
|
||||||
|
|
||||||
workQueue.submit(workAction, params -> {
|
workQueue.submit(workAction, params -> {
|
||||||
params.getMainInputFile().set(getInputFile());
|
params.getInputFile().set(getInputFile());
|
||||||
params.getArchiveFile().set(getArchiveFile());
|
params.getArchiveFile().set(getArchiveFile());
|
||||||
|
|
||||||
params.getSourceNamespace().set(getSourceNamespace());
|
params.getSourceNamespace().set(getSourceNamespace());
|
||||||
@@ -199,7 +199,7 @@ public abstract class AbstractRemapJarTask extends Jar {
|
|||||||
protected abstract Provider<? extends ClientEntriesService.Options> getClientOnlyEntriesOptionsProvider(SourceSet clientSourceSet);
|
protected abstract Provider<? extends ClientEntriesService.Options> getClientOnlyEntriesOptionsProvider(SourceSet clientSourceSet);
|
||||||
|
|
||||||
public interface AbstractRemapParams extends WorkParameters {
|
public interface AbstractRemapParams extends WorkParameters {
|
||||||
RegularFileProperty getMainInputFile();
|
RegularFileProperty getInputFile();
|
||||||
RegularFileProperty getArchiveFile();
|
RegularFileProperty getArchiveFile();
|
||||||
|
|
||||||
Property<String> getSourceNamespace();
|
Property<String> getSourceNamespace();
|
||||||
@@ -263,24 +263,26 @@ public abstract class AbstractRemapJarTask extends Jar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: the inputFile parameter is the remapping input file.
|
||||||
|
// The main input jar is available in the parameters, but should not be used
|
||||||
|
// for remapping as it might be missing some files added manually to this task.
|
||||||
protected abstract void execute(Path inputFile) throws IOException;
|
protected abstract void execute(Path inputFile) throws IOException;
|
||||||
|
|
||||||
protected void modifyJarManifest() throws IOException {
|
protected void modifyJarManifest() throws IOException {
|
||||||
int count = ZipUtils.transform(outputFile, Map.of(Constants.Manifest.PATH, bytes -> {
|
int count = ZipUtils.transform(outputFile, Map.of(Constants.Manifest.PATH, bytes -> {
|
||||||
var manifest = new Manifest(new ByteArrayInputStream(bytes));
|
var manifest = new Manifest(new ByteArrayInputStream(bytes));
|
||||||
|
byte[] sourceManifestBytes = ZipUtils.unpackNullable(getParameters().getInputFile().get().getAsFile().toPath(), Constants.Manifest.PATH);
|
||||||
if (!getParameters().getPlatform().get().isForgeLike()) {
|
|
||||||
getParameters().getJarManifestService().get().apply(manifest, getParameters().getManifestAttributes().get());
|
|
||||||
manifest.getMainAttributes().putValue(Constants.Manifest.MAPPING_NAMESPACE, getParameters().getTargetNamespace().get());
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] sourceManifestBytes = ZipUtils.unpackNullable(getParameters().getMainInputFile().get().getAsFile().toPath(), Constants.Manifest.PATH);
|
|
||||||
|
|
||||||
if (sourceManifestBytes != null) {
|
if (sourceManifestBytes != null) {
|
||||||
var sourceManifest = new Manifest(new ByteArrayInputStream(sourceManifestBytes));
|
var sourceManifest = new Manifest(new ByteArrayInputStream(sourceManifestBytes));
|
||||||
mergeManifests(manifest, sourceManifest);
|
mergeManifests(manifest, sourceManifest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!getParameters().getPlatform().get().isForgeLike()) {
|
||||||
|
getParameters().getJarManifestService().get().apply(manifest, getParameters().getManifestAttributes().get());
|
||||||
|
manifest.getMainAttributes().putValue(Constants.Manifest.MAPPING_NAMESPACE, getParameters().getTargetNamespace().get());
|
||||||
|
}
|
||||||
|
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
manifest.write(out);
|
manifest.write(out);
|
||||||
return out.toByteArray();
|
return out.toByteArray();
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ class RemapJarContentsTest extends Specification implements GradleProjectTestTra
|
|||||||
ZipUtils.contains(gradle.getOutputFile('fabric-example-mod-1.0.0-sources.jar').toPath(), 'test_src_file.txt')
|
ZipUtils.contains(gradle.getOutputFile('fabric-example-mod-1.0.0-sources.jar').toPath(), 'test_src_file.txt')
|
||||||
def manifest = readManifest(gradle.getOutputFile('fabric-example-mod-1.0.0.jar'))
|
def manifest = readManifest(gradle.getOutputFile('fabric-example-mod-1.0.0.jar'))
|
||||||
manifest.mainAttributes.getValue('Hello-World') == 'test'
|
manifest.mainAttributes.getValue('Hello-World') == 'test'
|
||||||
|
manifest.mainAttributes.getValue('Inherited-In-Remap-Jar') == '1234'
|
||||||
|
manifest.getAttributes('fabric.mod.json').getValue('Inherited-In-Remap-Jar') == '5678'
|
||||||
|
manifest.getAttributes('modid.mixins.json').getValue('Hello-World') == 'another test'
|
||||||
|
manifest.getAttributes('modid.mixins.json').getValue('Inherited-In-Remap-Jar') == '9'
|
||||||
|
|
||||||
where:
|
where:
|
||||||
version << STANDARD_TEST_VERSIONS
|
version << STANDARD_TEST_VERSIONS
|
||||||
|
|||||||
@@ -78,11 +78,21 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes 'Inherited-In-Remap-Jar': '1234'
|
||||||
|
attributes(['Inherited-In-Remap-Jar': '5678'], 'fabric.mod.json') // category not present in remapJar
|
||||||
|
attributes(['Inherited-In-Remap-Jar': '9'], 'modid.mixins.json') // category present in remapJar
|
||||||
|
attributes 'Hello-World': 'shadowed in remapJar'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
remapJar {
|
remapJar {
|
||||||
from 'test_file.txt'
|
from 'test_file.txt'
|
||||||
|
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'Hello-World': 'test'
|
attributes 'Hello-World': 'test'
|
||||||
|
attributes(['Hello-World': 'another test'], 'modid.mixins.json')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user