-
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
1 parent
5fc396d
commit 110fec5
Showing
24 changed files
with
833 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
*.lock | ||
*.bin | ||
*.log | ||
*.txt | ||
*.iml | ||
*.ipr | ||
*.iws | ||
*.info | ||
*.xml | ||
*.launch | ||
*.prefs | ||
*.tree | ||
*.class | ||
*.cfg | ||
*.gz | ||
*.kotlin_module | ||
*.ini | ||
eclipse/ | ||
out/ | ||
build/ | ||
idea/ | ||
.idea/ | ||
.gradle/ | ||
*.psd | ||
*.jar1 | ||
*.psd | ||
*.patch | ||
src/main/generated/ | ||
src/main/resources/mixins.*.json | ||
runDir/ | ||
.gitattributes |
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 @@ | ||
# Packet Network |
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 @@ | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
dependencies { | ||
implementation(libs.gradle.kotlin) | ||
implementation(libs.gradle.gitversion) | ||
implementation(libs.gradle.forge) { isChanging = true } | ||
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) | ||
} |
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,45 @@ | ||
import net.minecraftforge.gradle.common.BaseExtension | ||
import org.gradle.accessors.dm.LibrariesForLibs | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.Dependency | ||
import org.gradle.api.artifacts.dsl.DependencyHandler | ||
import org.gradle.api.tasks.SourceSetContainer | ||
import org.gradle.kotlin.dsl.the | ||
import org.gradle.kotlin.dsl.withType | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
fun BaseExtension.commonMinecraft(project: Project) { | ||
project.configureCompileOptions() | ||
minecraftSettings() | ||
} | ||
|
||
private fun BaseExtension.minecraftSettings() { | ||
mappings | ||
mcpVersion | ||
version = "1.7.10-10.13.4.1614-1.7.10" | ||
runDir = "runDir" | ||
} | ||
|
||
private fun Project.configureCompileOptions() { | ||
tasks.withType<KotlinCompile>().configureEach { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
} | ||
|
||
fun DependencyHandler.implementation(dependencyNotation: Any): Dependency? = | ||
add("implementation", dependencyNotation) | ||
|
||
fun DependencyHandler.api(dependencyNotation: Any): Dependency? = | ||
add("api", dependencyNotation) | ||
|
||
fun DependencyHandler.projectImplementation(depName: String) { | ||
add("implementation", (project(mapOf("path" to depName)))) | ||
} | ||
|
||
val Project.libs: LibrariesForLibs | ||
get() = the<LibrariesForLibs>() | ||
|
||
val Project.sourceSets: SourceSetContainer | ||
get() = the<SourceSetContainer>() |
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,30 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
import net.minecraftforge.gradle.common.BaseExtension | ||
|
||
plugins { | ||
id("forge") | ||
kotlin("jvm") | ||
} | ||
|
||
configure<BaseExtension> { | ||
commonMinecraft(project) | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
val modName: String by extra | ||
|
||
tasks.named<ProcessResources>("processResources") { | ||
inputs.property("version", project.version) | ||
inputs.property("mcversion", libs.versions.minecraftVersion.get()) | ||
filesMatching("mcmod.info") { | ||
expand( | ||
"minecraftVersion" to libs.versions.minecraftVersion.get(), | ||
"modVersion" to modName, | ||
"modName" to modName, | ||
) | ||
} | ||
} |
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,91 @@ | ||
@file:Suppress("DSL_SCOPE_VIOLATION") | ||
|
||
import com.palantir.gradle.gitversion.VersionDetails | ||
import groovy.lang.Closure | ||
import groovy.util.Node | ||
import groovy.util.NodeList | ||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.archivesName | ||
|
||
plugins { | ||
kotlin("jvm") | ||
id("com.palantir.git-version") | ||
`maven-publish` | ||
`java-library` | ||
} | ||
|
||
val modId: String by extra | ||
val modName: String by extra | ||
val modGroup: String by extra | ||
val versionDetails: Closure<VersionDetails> by extra | ||
val gitDetails = versionDetails() | ||
group = modGroup | ||
|
||
var versionOverride: String? = System.getenv("VERSION") ?: null | ||
var identifiedVersion: String = runCatching { | ||
versionOverride ?: if (System.getenv("CI") != null) gitDetails.lastTag else gitDetails.version | ||
}.getOrElse { | ||
"unknown".also { | ||
versionOverride = it | ||
} | ||
} | ||
|
||
version = identifiedVersion | ||
val modVersion = identifiedVersion | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
archivesName.set(modId) | ||
|
||
tasks.withType<GenerateModuleMetadata> { | ||
enabled = false | ||
mustRunAfter("reobf") | ||
} | ||
|
||
configure<PublishingExtension> { | ||
publications { | ||
register("mavenJava", MavenPublication::class) { | ||
from(components["java"]) | ||
pom.withXml { | ||
removeRuntimeDependencies(asNode()) | ||
} | ||
val devJar by tasks.registering(Jar::class) { | ||
from(sourceSets["main"].output) | ||
archiveClassifier.set("dev") | ||
} | ||
artifact(devJar.get()) | ||
groupId = "space.impact" | ||
artifactId = modId | ||
version = identifiedVersion | ||
} | ||
} | ||
repositories { | ||
maven { | ||
url = uri("https://maven.accident.space/repository/maven-releases/") | ||
credentials { | ||
username = System.getenv("MAVEN_USER") ?: "NONE" | ||
password = System.getenv("MAVEN_PASSWORD") ?: "NONE" | ||
} | ||
} | ||
} | ||
} | ||
|
||
//hack https://youtrack.jetbrains.com/issue/KT-28355 | ||
fun removeRuntimeDependencies(pomNode: Node) { | ||
val dependencyNodes: NodeList = pomNode.get("dependencies") as NodeList | ||
val dependencies = dependencyNodes.lastOrNull() as? Node | ||
val removeCandidate = arrayListOf<Node>() | ||
dependencies?.children()?.forEach { dependency -> | ||
(dependency as? Node)?.children() | ||
?.mapNotNull { it as? Node } | ||
?.filter { (it.value() as? NodeList)?.lastOrNull() == "runtime" || it.value() == "org.jetbrains.kotlin" } | ||
?.forEach { | ||
removeCandidate += it.parent() | ||
} | ||
} | ||
removeCandidate.forEach { | ||
it.parent().remove(it) | ||
} | ||
} |
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,33 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
maven("https://maven.accident.space/repository/maven-public/") | ||
maven("https://maven.minecraftforge.net") | ||
maven("https://oss.sonatype.org/content/repositories/snapshots/") | ||
maven("https://jitpack.io") | ||
maven("https://plugins.gradle.org/m2/") | ||
mavenLocal() | ||
} | ||
} | ||
|
||
dependencyResolutionManagement { | ||
repositories { | ||
mavenCentral() | ||
maven("https://maven.accident.space/repository/maven-public/") | ||
maven("https://maven.minecraftforge.net") | ||
maven("https://oss.sonatype.org/content/repositories/snapshots/") | ||
maven("https://jitpack.io") | ||
maven("https://plugins.gradle.org/m2/") | ||
mavenLocal() | ||
} | ||
|
||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} | ||
|
||
include(":plugins") |
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,32 @@ | ||
|
||
repositories { | ||
maven("https://maven.accident.space/repository/maven-public/") | ||
maven("https://jitpack.io") | ||
} | ||
|
||
plugins { | ||
alias(libs.plugins.buildconfig) | ||
id("minecraft") | ||
id("publish") | ||
} | ||
|
||
val modId: String by extra | ||
val modName: String by extra | ||
val modGroup: String by extra | ||
val modAdapter: String by extra | ||
|
||
buildConfig { | ||
packageName("space.impact.$modId") | ||
buildConfigField("String", "MODID", "\"${modId}\"") | ||
buildConfigField("String", "MODNAME", "\"${modName}\"") | ||
buildConfigField("String", "VERSION", "\"${project.version}\"") | ||
buildConfigField("String", "GROUPNAME", "\"${modGroup}\"") | ||
buildConfigField("String", "GROUPNAME", "\"${modGroup}\"") | ||
buildConfigField("String", "MODADAPTER", "\"${modAdapter}\"") | ||
useKotlinOutput { topLevelConstants = true } | ||
} | ||
|
||
dependencies { | ||
api("space.impact:forgelin:2.0.+") { isChanging = true } | ||
api("com.github.GTNewHorizons:CodeChickenLib:1.1.+:dev") { isChanging = true } | ||
} |
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,4 @@ | ||
modName = Impact Packet System | ||
modId = packet_network | ||
modGroup = space.impact | ||
modAdapter = net.shadowfacts.forgelin.KotlinAdapter |
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 @@ | ||
[versions] | ||
kotlin = "1.8.21" | ||
minecraftVersion = "1.7.10" | ||
forge = "10.13.4.1614" | ||
minecraft-forge = "1.7.10-10.13.4.1614-1.7.10" | ||
|
||
[libraries] | ||
gradle-forge = { module = "com.anatawa12.forge:ForgeGradle", version = "1.2-1.1.+" } | ||
gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } | ||
gradle-gitversion = { module = "com.palantir.gradle.gitversion:gradle-git-version", version = "3.0.0" } | ||
gradle-buildconfig = { module = "com.github.gmazzo:gradle-buildconfig-plugin", version = "3.1.0" } | ||
|
||
[plugins] | ||
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } | ||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } | ||
minecraft-forge = { id = "forge", version.ref = "forge" } | ||
buildconfig = { id = "com.github.gmazzo.buildconfig", version = "3.1.0" } | ||
gitversion = { id = "com.palantir.git-version", version = "3.0.0" } | ||
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" } |
Binary file not shown.
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 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.