Skip to content

Commit

Permalink
Fix #1229 (#1237)
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 authored Dec 29, 2024
1 parent 3fce262 commit cc51c64
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,13 @@ private synchronized void setupMinecraft(ConfigContext configContext) throws Exc
extension.setMinecraftProvider(minecraftProvider);
minecraftProvider.provide();

// Realise the dependencies without actually resolving them, this forces any lazy providers to be created, populating the layered mapping factories.
project.getConfigurations().getByName(Configurations.MAPPINGS).getDependencies().toArray();

// Created any layered mapping files.
LayeredMappingsFactory.afterEvaluate(configContext);

// Resolve the mapping files from the configuration
final DependencyInfo mappingsDep = DependencyInfo.create(getProject(), Configurations.MAPPINGS);
final MappingConfiguration mappingConfiguration = MappingConfiguration.create(getProject(), configContext.serviceFactory(), mappingsDep, minecraftProvider);
extension.setMappingConfiguration(mappingConfiguration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,30 @@ class MojangMappingsProjectTest extends Specification implements GradleProjectTe
where:
version << STANDARD_TEST_VERSIONS
}
@Unroll
def "mojang mappings via lazy provider (gradle #version)"() {
setup:
def gradle = gradleProject(project: "minimalBase", version: version)
gradle.buildGradle << '''
dependencies {
minecraft "com.mojang:minecraft:1.18-pre5"
mappings project.provider {
loom.layered() {
officialMojangMappings()
}
}
}
'''
when:
def result = gradle.run(task: "build")
then:
result.task(":build").outcome == SUCCESS
where:
version << STANDARD_TEST_VERSIONS
}
}

0 comments on commit cc51c64

Please sign in to comment.