forked from artynova/hexdummy
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add most of the build config stuff from HexDebug
- Loading branch information
1 parent
0916b63
commit 567bde1
Showing
29 changed files
with
1,074 additions
and
7 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
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 @@ | ||
_subdirectory: templates/1.19.2 |
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 @@ | ||
_subdirectory: templates/1.20.1 |
Empty file.
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,19 @@ | ||
author: {{ github_user }} | ||
book_id: "{{ modid }}:{{ book_id_path }}" | ||
default_branch: {{ default_branch }} | ||
github_repo: {{ github_repo }} | ||
gradle_mod_version_key: modVersion | ||
hexdoc_mod_plugin_classname: {{ base_classname }}ModPlugin | ||
hexdoc_plugin_classname: {{ base_classname }}Plugin | ||
java_lang: | ||
ext: java | ||
src: java | ||
java_package: {{ package_path }} | ||
mod_display_name: {{ display_name }} | ||
modid: {{ modid }} | ||
multiloader: true | ||
pages_url: {{ homepage_url }} | ||
pattern_regex: | ||
regex: '(?P<is_per_world>register|registerPerWorld)\(HexPattern\.fromAngles\("(?P<signature>[qweasd]+)",\s*HexDir\.(?P<startdir>\w+)\),\s*"(?P<name>[^"]+)"?' | ||
per_world_value: registerPerWorld | ||
pattern_registry: registry/{{ base_classname }}Patterns.java |
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,11 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). | ||
|
||
## {{ initial_version }} | ||
|
||
### Added | ||
|
||
- Initial version. |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 {{ github_user }} | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 @@ | ||
# {{ display_name }} | ||
|
||
[![powered by hexdoc](https://img.shields.io/endpoint?url=https://hexxy.media/api/v0/badge/hexdoc?label=1)](https://github.com/hexdoc-dev/hexdoc) | ||
|
||
{{ description }} |
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,14 @@ | ||
plugins { | ||
id("{{ modid }}.{{ kotlin_plugin }}") | ||
} | ||
|
||
architectury { | ||
// this looks up the value from gradle/libs.versions.toml | ||
minecraft = libs.versions.minecraft.get() | ||
} | ||
|
||
tasks { | ||
register("runAllDatagen") { | ||
dependsOn(":Forge:runCommonDatagen") | ||
} | ||
} |
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,44 @@ | ||
import org.gradle.api.internal.artifacts.DefaultModuleIdentifier | ||
import org.gradle.api.internal.artifacts.dependencies.DefaultMinimalDependency | ||
import org.gradle.api.internal.artifacts.dependencies.DefaultMutableVersionConstraint | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
maven { url = uri("https://maven.architectury.dev/") } | ||
maven { url = uri("https://maven.fabricmc.net/") } | ||
maven { url = uri("https://maven.minecraftforge.net/") } | ||
maven { url = uri("https://maven.blamejared.com/") } | ||
} | ||
|
||
dependencies { | ||
// plugins | ||
// https://github.com/gradle/gradle/issues/15383#issuecomment-1855984127 | ||
implementation(libs.plugins.kotlin.jvm.toLibrary()) | ||
implementation(libs.plugins.architectury.toLibrary()) | ||
implementation(libs.plugins.architectury.loom.toLibrary()) | ||
implementation(libs.plugins.shadow.toLibrary()) | ||
implementation(libs.plugins.modPublish.toLibrary()) | ||
|
||
// libraries used by script plugins | ||
implementation(libs.pkpcpbp) | ||
|
||
// https://stackoverflow.com/a/70878181 | ||
// https://github.com/gradle/gradle/issues/15383 | ||
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) | ||
} | ||
|
||
// support declaring dependencies on libs.plugins.* | ||
|
||
fun ProviderConvertible<PluginDependency>.toLibrary() = asProvider().toLibrary() | ||
|
||
fun Provider<PluginDependency>.toLibrary() = get().toLibrary() | ||
|
||
fun PluginDependency.toLibrary() = DefaultMinimalDependency( | ||
DefaultModuleIdentifier.newId(pluginId, "$pluginId.gradle.plugin"), | ||
DefaultMutableVersionConstraint(version), | ||
) |
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,8 @@ | ||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
// allow referencing the version catalog from the main project | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...0.1/buildSrc/src/main/kotlin/{{ modid }}/I{{ base_classname }}MinecraftExtension.kt.jinja
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,6 @@ | ||
package {{ modid }} | ||
|
||
// this is in a separate file so it can be referenced both by minecraft.gradle.kts and platform.gradle.kts | ||
interface I{{ base_classname }}MinecraftExtension { | ||
fun platform(platform: String) | ||
} |
7 changes: 7 additions & 0 deletions
7
templates/1.20.1/buildSrc/src/main/kotlin/{{ modid }}/Libs.kt.jinja
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,7 @@ | ||
package {{ modid }} | ||
|
||
import org.gradle.accessors.dm.LibrariesForLibs | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.the | ||
|
||
val Project.libs get() = the<LibrariesForLibs>() |
21 changes: 21 additions & 0 deletions
21
templates/1.20.1/buildSrc/src/main/kotlin/{{ modid }}/json5.gradle.kts.jinja
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,21 @@ | ||
// alternative title: OTJFPOPKPCPBP (Only The JSON5 Flattening Part Of PKPCPBP) | ||
|
||
package {{ modid }} | ||
|
||
import at.petrak.pkpcpbp.filters.FlatteningJson5Transmogrifier | ||
import at.petrak.pkpcpbp.filters.Json5Transmogrifier | ||
|
||
// https://github.com/gamma-delta/PKPCPBP/blob/786194a590/src/main/java/at/petrak/pkpcpbp/PKSubprojPlugin.java#L84 | ||
tasks.withType<ProcessResources>().configureEach { | ||
outputs.upToDateWhen { false } | ||
|
||
filesMatching(listOf("assets/**/*.flatten.json5", "data/**/*.flatten.json5")) { | ||
path = path.replace(".flatten.json5", ".json") | ||
filter<FlatteningJson5Transmogrifier>() | ||
} | ||
|
||
filesMatching(listOf("assets/**/*.json5", "data/**/*.json5")) { | ||
path = path.replace(".json5", ".json") | ||
filter<Json5Transmogrifier>() | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
templates/1.20.1/buildSrc/src/main/kotlin/{{ modid }}/minecraft.gradle.kts.jinja
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,69 @@ | ||
{% from "macros/mappings.jinja" import is_yarn, is_mojmap with context -%} | ||
|
||
// A convention plugin that should be applied to all Minecraft-related subprojects, including {{ common_path }}. | ||
|
||
package {{ modid }} | ||
|
||
plugins { | ||
id("{{ modid }}.kotlin") | ||
id("{{ modid }}.json5") | ||
|
||
`maven-publish` | ||
id("dev.architectury.loom") | ||
} | ||
|
||
// plugin config | ||
|
||
abstract class {{ base_classname }}MinecraftExtension(private val project: Project) : I{{ base_classname }}MinecraftExtension { | ||
override fun platform(platform: String) = project.run { | ||
val modId: String by project | ||
|
||
base.archivesName = "$modId-$platform" | ||
} | ||
} | ||
|
||
val extension = extensions.create<{{ base_classname }}MinecraftExtension>("{{ base_classname|lower }}Minecraft") | ||
|
||
// build logic | ||
|
||
loom { | ||
silentMojangMappingsLicense() | ||
accessWidenerPath = project(":{{ common_path }}").file("src/main/resources/{{ modid }}.accesswidener") | ||
} | ||
|
||
dependencies { | ||
minecraft(libs.minecraft) | ||
|
||
{{ mappings( | ||
mojmap= | ||
"mappings(loom.layered { | ||
officialMojangMappings() | ||
parchment(libs.parchment) | ||
})", | ||
yarn="mappings(libs.yarn)", | ||
) }} | ||
|
||
annotationProcessor(libs.bundles.asm) | ||
} | ||
|
||
sourceSets { | ||
main { | ||
kotlin { | ||
srcDir(file("src/main/java")) | ||
} | ||
resources { | ||
srcDir(file("src/generated/resources")) | ||
} | ||
} | ||
} | ||
|
||
tasks { | ||
val artifactsTask = register<Copy>("githubArtifacts") { | ||
from(remapJar, remapSourcesJar, get("javadocJar")) | ||
into(rootDir.toPath() / "build" / "githubArtifacts") | ||
} | ||
|
||
build { | ||
dependsOn(artifactsTask) | ||
} | ||
} |
Oops, something went wrong.