Skip to content

Commit

Permalink
pass me the Gradle (#2368)
Browse files Browse the repository at this point in the history
  • Loading branch information
ROMVoid95 authored Jul 30, 2023
1 parent 069332f commit 917fa17
Show file tree
Hide file tree
Showing 8 changed files with 300 additions and 158 deletions.
19 changes: 11 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import java.util.TimeZone

plugins {
idea
id("net.minecraftforge.gradle") version "5.1.+"
id("wtf.gofancy.fancygradle") version "1.1.+"
id("net.minecraftforge.gradle") version "6.+"
id("wtf.gofancy.fancygradle") version "1.+"
id("org.ajoberstar.grgit") version "4.1.1"
id("com.matthewprenger.cursegradle") version "1.4.0"
id("se.bjurr.gitchangelog.git-changelog-gradle-plugin") version "1.72.0"
Expand Down Expand Up @@ -46,6 +46,12 @@ version = "$mcVersion-$modVersion-$buildNumber"

println("$archiveBase v$version")

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}

//sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
tasks.compileJava {
sourceCompatibility = "1.8"
Expand Down Expand Up @@ -121,7 +127,7 @@ repositories {
}
maven {
name = "Galacticraft"
url = uri("https://maven.galacticraft.dev")
url = uri("https://maven.galacticraft.dev/repository/legacy-releases/")
}
maven {
name = "LibVulpes"
Expand All @@ -139,10 +145,7 @@ dependencies {
compileOnly("net.industrial-craft:industrialcraft-2:$icVersion:dev")
//implementation("zmaster587.libVulpes:LibVulpes:$mcVersion-$libVulpesVersion-$libVulpesBuildNum-deobf")

compileOnly("micdoodle8.mods:galacticraft-api:$gcVersion")
compileOnly("micdoodle8.mods:galacticraft-core:$gcVersion")
compileOnly("micdoodle8.mods:galacticraft-planets:$gcVersion")
compileOnly("micdoodle8.mods:micdoodlecore:$gcVersion")
compileOnly(fg.deobf("dev.galacticraft:galacticraft-legacy:$gcVersion"))

compileOnly(fg.deobf("mezz.jei:jei_${mcVersion}:${jeiVersion}:api"))
runtimeOnly(fg.deobf("mezz.jei:jei_${mcVersion}:${jeiVersion}"))
Expand Down Expand Up @@ -216,7 +219,7 @@ tasks.withType(Jar::class) {

val deobfJar by tasks.registering(Jar::class) {
from(sourceSets["main"].output)
classifier = "deobf"
archiveClassifier.set("deobf")
}

tasks.build {
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.gradle.daemon=false
# Project
mcVersion=1.12.2
forgeVersion=14.23.5.2860
Expand All @@ -11,7 +12,7 @@ libVulpesVersion=0.4.2
libVulpesBuildNum=84
jeiVersion=4.16.1.301
icVersion=2.7.39-ex111
gcVersion=4.0.2.280
gcVersion=4.0.6

libVulpesRepo=https://github.com/slava110/libVulpes.git
libVulpesBranch=1.12
66 changes: 66 additions & 0 deletions gradle/resources.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
def resourceTargets = [ 'mcmod.info' ]
def intoTargets = [
"$rootDir/out/production/resources/",
"$rootDir/out/production/${project.name}.main/",
"$rootDir/bin/main/"
]
def replaceProperties = [ mod_version: version.toString(), minecraft_version: "${mc_version}" ]

processResources {
inputs.properties replaceProperties
replaceProperties.put 'project', project

filesMatching(resourceTargets) {
expand replaceProperties
}

intoTargets.each { target ->
if (file(target).exists()) {
copy {
from(sourceSets.main.resources) {
include resourceTargets
expand replaceProperties
}
into target
}
}
}
}

def modFileTokens = [
gcVersion: version.toString()
]
def included = [ "micdoodle8/mods/galacticraft/core/Constants.java" ]
def includedPaths = included.collect { java.nio.file.Paths.get(it) }
def expandedSrc = new File(project.buildDir, 'expandedSrc')
def srcMainJava = project.file('src/main/java').toPath()

task javaReplaceTokens(type: Copy) {
inputs.property 'tokens', modFileTokens
from(srcMainJava) {
include included
}
into expandedSrc
filter(org.apache.tools.ant.filters.ReplaceTokens, beginToken: '${', endToken: '}', tokens: modFileTokens)
}

compileJava {
dependsOn javaReplaceTokens
exclude {
srcMainJava.relativize(it.file.toPath()) in includedPaths
}
source expandedSrc

options.compilerArgs << "-Xlint:none"
options.encoding = 'UTF-8'
options.fork = true
options.incremental = true
}

tasks.withType(Javadoc) {
failOnError false
options.memberLevel = JavadocMemberLevel.PUBLIC
options.encoding = 'UTF-8'
options.charSet = 'UTF-8'
options.links = ["https://docs.oracle.com/javase/8/docs/api/".toString()]
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
12 changes: 6 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Aug 05 23:26:33 EDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 917fa17

Please sign in to comment.