forked from KyoriPowered/adventure-platform-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
73 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,61 @@ | ||
import ca.stellardrift.build.configurate.ConfigFormats | ||
import ca.stellardrift.build.configurate.transformations.convertFormat | ||
import org.gradle.accessors.dm.LibrariesForLibs | ||
import org.gradle.api.Project | ||
import org.gradle.api.Task | ||
import org.gradle.api.tasks.SourceSet | ||
import org.gradle.api.tasks.Sync | ||
import org.gradle.api.tasks.TaskProvider | ||
import org.gradle.kotlin.dsl.expand | ||
import org.gradle.kotlin.dsl.getByType | ||
import org.gradle.plugins.ide.eclipse.model.EclipseModel | ||
import org.gradle.plugins.ide.idea.model.IdeaModel | ||
import org.jetbrains.gradle.ext.settings | ||
import org.jetbrains.gradle.ext.taskTriggers | ||
|
||
val Project.libs: LibrariesForLibs | ||
get() = extensions.getByType() | ||
|
||
// Convert yaml files to josn | ||
fun Project.createProcessResourceTemplates(name: String, set: SourceSet): TaskProvider<out Task> { | ||
val generatedResourcesDir = layout.buildDirectory.dir("generated-resources").get().asFile | ||
val destinationDir = generatedResourcesDir.resolve(name) | ||
val task = tasks.register(name, Sync::class.java) { | ||
this.destinationDir = destinationDir | ||
from("src/${set.name}/resource-templates") | ||
|
||
inputs.property("version", project.version) | ||
|
||
// Convert data files yaml -> json | ||
filesMatching( | ||
sequenceOf( | ||
"fabric.mod", | ||
"data/**/*", | ||
"assets/**/*" | ||
).flatMap { base -> sequenceOf("$base.yml", "$base.yaml") } | ||
.toList() | ||
) { | ||
convertFormat(ConfigFormats.YAML, ConfigFormats.JSON) | ||
if (this.name.startsWith("fabric.mod")) { | ||
expand("project" to project) | ||
} | ||
this.name = this.name.substringBeforeLast('.') + ".json" | ||
} | ||
// Convert pack meta, without changing extension | ||
filesMatching("pack.mcmeta") { convertFormat(ConfigFormats.YAML, ConfigFormats.JSON) } | ||
} | ||
|
||
tasks.named(set.processResourcesTaskName) { | ||
dependsOn(name) | ||
} | ||
set.resources.srcDir(task.map { it.outputs }) | ||
|
||
// Have templates ready for IDEs | ||
extensions.getByType(EclipseModel::class).synchronizationTasks(task) | ||
rootProject.extensions.getByType(IdeaModel::class).project.settings.taskTriggers { | ||
afterSync(task) | ||
} | ||
extensions.getByType(IdeaModel::class).module.generatedSourceDirs.add(destinationDir) | ||
|
||
return task | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
plugins { | ||
alias(libs.plugins.configurateTransformations) | ||
} | ||
|
||
val generateTemplates = createProcessResourceTemplates("generateTemplates", sourceSets.main.get()) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 0 additions & 130 deletions
130
neoforge/tester/src/main/resource-templates/LICENSE_iosevka.txt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
neoforge/tester/src/main/resource-templates/assets/adventure/font/iosevka.yaml
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
neoforge/tester/src/main/resource-templates/assets/adventure/font/meow.yaml
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
neoforge/tester/src/main/resource-templates/assets/adventure/sounds.yaml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.