use resolved dependency version for mapping files

dev/0.11
asie 2018-12-15 14:14:50 +01:00
parent 529db72b25
commit fe194ea64d
2 changed files with 13 additions and 2 deletions

View File

@ -55,9 +55,9 @@ public class MappingsProvider extends DependencyProvider {
public void provide(DependencyInfo dependency, Project project, LoomGradleExtension extension) throws Exception { public void provide(DependencyInfo dependency, Project project, LoomGradleExtension extension) throws Exception {
MinecraftProvider minecraftProvider = getDependencyManager().getProvider(MinecraftProvider.class); MinecraftProvider minecraftProvider = getDependencyManager().getProvider(MinecraftProvider.class);
project.getLogger().lifecycle(":setting up mappings (" + dependency.getDependency().getName() + " " + dependency.getDependency().getVersion() + ")"); project.getLogger().lifecycle(":setting up mappings (" + dependency.getDependency().getName() + " " + dependency.getResolvedVersion() + ")");
String version = dependency.getDependency().getVersion(); String version = dependency.getResolvedVersion();
String[] split = version.split("\\."); String[] split = version.split("\\.");
File mappingsJar = dependency.resolveFile(); File mappingsJar = dependency.resolveFile();

View File

@ -28,6 +28,7 @@ import net.fabricmc.loom.LoomGradleExtension;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency; import org.gradle.api.artifacts.Dependency;
import org.gradle.api.artifacts.ResolvedDependency;
import java.io.File; import java.io.File;
import java.util.Set; import java.util.Set;
@ -72,6 +73,16 @@ public abstract class DependencyProvider {
return dependency; return dependency;
} }
public String getResolvedVersion() {
for (ResolvedDependency rd : sourceConfiguration.getResolvedConfiguration().getFirstLevelModuleDependencies()) {
if (rd.getModuleGroup().equals(dependency.getGroup()) && rd.getModuleName().equals(dependency.getName())) {
return rd.getModuleVersion();
}
}
return dependency.getVersion();
}
public Configuration getSourceConfiguration() { public Configuration getSourceConfiguration() {
return sourceConfiguration; return sourceConfiguration;
} }