add extension for loader, add esnesnon maven
All checks were successful
Publish to snapshot maven / build (push) Successful in 18s

This commit is contained in:
moehreag 2024-05-18 18:38:24 +02:00
parent bdcd5c6146
commit 5840712e5e
4 changed files with 34 additions and 18 deletions

View file

@ -18,30 +18,34 @@ import kotlin.io.path.exists
class NonsenseGradlePlugin : Plugin<Project> {
val toInject = listOf("com.electronwill.night-config:toml:3.6.0")
override fun apply(project: Project) {
println("> Applying Nonsense Gradle Plugin")
project.apply {
mapOf("plugin" to "java-library")
mapOf("plugin" to "java")
mapOf("plugin" to "eclipse")
mapOf("plugin" to "idea")
mapOf("plugin" to "maven-publish")
}
project.repositories.maven {
project.repositories.apply {
maven {
it.name = "Esnesnon Releases"
it.url = URI.create("https://maven-esnesnon.ecorous.org/releases")
}
maven {
it.name = "Esnesnon Snapshots"
it.url = URI.create("https://maven-esnesnon.ecorous.org/snapshots")
}
maven {
it.name = "Minecraft/Local"
it.url = project.gradle.gradleUserHomeDir.resolve("caches/nonsense-gradle/").toURI()
}
project.repositories.maven {
maven {
it.name = "Minecraft Libraries"
it.url = URI.create("https://libraries.minecraft.net/")
}
}
project.repositories.mavenCentral()
project.dependencies.apply {
toInject.forEach {
add("implementation", it)
}
}
project.task("genSources").apply {
group = "nonsense"
@ -96,6 +100,14 @@ class NonsenseGradlePlugin : Plugin<Project> {
}
}
}*/
val includeConfiguration = project.configurations.create("include").apply {
extendsFrom(project.configurations.getByName("implementation"))
}
project.tasks.getByName("jar").actions.addLast {
it.outputs.files(includeConfiguration.artifacts.files)
}
}
companion object {

View file

@ -53,3 +53,8 @@ fun Project.minecraft(
}
return this
}
fun Project.loader(version: String){
dependencies.add("implementation", "org.ecorous.esnesnon:nonsense-loader:$version")
dependencies.add("annotationProcessor", "net.fabricmc:sponge-mixin:0.13.4-mixin.0.8.5")
}

View file

@ -7,7 +7,6 @@ import org.ecorous.esnesnon.gradle.run.adapter.EclipseAdapter
import org.ecorous.esnesnon.gradle.run.adapter.IdeaAdapter
import org.gradle.api.Project
import java.nio.file.Files
import java.nio.file.Path
import kotlin.io.path.absolute
import kotlin.io.path.createParentDirectories
import kotlin.io.path.notExists
@ -40,12 +39,12 @@ object RunConfigGenerator {
if (!adapter.shouldGenerate())
continue
for (env in Env.values()) {
for (env in Env.entries) {
adapter.generate(
project,
"Minecraft ${env.pascalName}",
"org.ecorous.esnesnon.nonsense.loader.impl.launch.client.Nonsense${env.pascalName}",
arrayOf("-Dnonsense.development=true", "-Dlog4j.configurationFile=" + assetPath),
arrayOf("-Dnonsense.development=true", "-Dlog4j.configurationFile=$assetPath"),
arrayOf(
"--assetDir", assetPath.toString(),
"--version", "Nonsense",