mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 13:37:45 -05:00
Use the stable kotlin-metadata (#1222)
* Use the stable kotlin-metadata since Kotlin 2 * More fixes * Fix build * Fix unit test
This commit is contained in:
@@ -28,7 +28,7 @@ import java.util.List;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.gson.Gson;
|
||||
import kotlinx.metadata.jvm.KotlinClassMetadata;
|
||||
import kotlin.metadata.jvm.KotlinClassMetadata;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.commons.ClassRemapper;
|
||||
|
||||
@@ -61,17 +61,16 @@ public final class KotlinClasspathService extends Service<KotlinClasspathService
|
||||
|
||||
return createOptions(
|
||||
project,
|
||||
KotlinPluginUtils.getKotlinPluginVersion(project),
|
||||
KotlinPluginUtils.getKotlinMetadataVersion()
|
||||
KotlinPluginUtils.getKotlinPluginVersion(project)
|
||||
);
|
||||
}
|
||||
|
||||
private static Provider<Options> createOptions(Project project, String kotlinVersion, String kotlinMetadataVersion) {
|
||||
private static Provider<Options> createOptions(Project project, String kotlinVersion) {
|
||||
// Create a detached config to resolve the kotlin std lib for the provided version.
|
||||
Configuration detachedConfiguration = project.getConfigurations().detachedConfiguration(
|
||||
project.getDependencies().create("org.jetbrains.kotlin:kotlin-stdlib:" + kotlinVersion),
|
||||
// Load kotlinx-metadata-jvm like this to work around: https://github.com/gradle/gradle/issues/14727
|
||||
project.getDependencies().create("org.jetbrains.kotlinx:kotlinx-metadata-jvm:" + kotlinMetadataVersion)
|
||||
project.getDependencies().create("org.jetbrains.kotlin:kotlin-metadata-jvm:" + kotlinVersion)
|
||||
);
|
||||
|
||||
return TYPE.create(project, options -> {
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import kotlinx.metadata.jvm.KotlinClassMetadata;
|
||||
import org.gradle.api.Project;
|
||||
|
||||
public class KotlinPluginUtils {
|
||||
@@ -56,8 +55,4 @@ public class KotlinPluginUtils {
|
||||
|
||||
return props.getProperty(property);
|
||||
}
|
||||
|
||||
public static String getKotlinMetadataVersion() {
|
||||
return KotlinClassMetadata.class.getPackage().getImplementationVersion().split("-")[0];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user