mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Add simple utility method for defining an entrypoint with a language adapter (#1451)
This commit is contained in:
@@ -122,6 +122,19 @@ public abstract class FabricModJsonV1Spec {
|
||||
entrypoint(entrypoint, value, metadata -> { });
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new entrypoint with the given name, value, and language adapter.
|
||||
*
|
||||
* @param entrypoint The name of the entrypoint, such as "main" or "client"
|
||||
* @param value The value of the entrypoint, typically a fully qualified class name
|
||||
* @param adapter The language adapter of the entrypoint, such as "kotlin" or "scala"
|
||||
*/
|
||||
public void entrypoint(String entrypoint, String value, String adapter) {
|
||||
entrypoint(entrypoint, value, metadata -> {
|
||||
metadata.getAdapter().set(adapter);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new entrypoint with the given name and value, and configure it with the given action.
|
||||
*
|
||||
|
||||
@@ -303,6 +303,7 @@ class FabricModJsonV1GeneratorTest extends Specification {
|
||||
spec.entrypoint("client", "com.example.KotlinClient::init") {
|
||||
it.adapter.set("kotlin")
|
||||
}
|
||||
spec.entrypoint("client", "com.example.KotlinClient", "kotlin")
|
||||
spec.entrypoint("client") {
|
||||
it.value.set("com.example.Client")
|
||||
}
|
||||
@@ -322,6 +323,10 @@ class FabricModJsonV1GeneratorTest extends Specification {
|
||||
"value": "com.example.KotlinClient::init",
|
||||
"adapter": "kotlin"
|
||||
},
|
||||
{
|
||||
"value": "com.example.KotlinClient",
|
||||
"adapter": "kotlin"
|
||||
},
|
||||
"com.example.Client"
|
||||
],
|
||||
"main": [
|
||||
|
||||
Reference in New Issue
Block a user