-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated javalin and start to add neoforge
- Loading branch information
1 parent
a8806ce
commit 8296c97
Showing
10 changed files
with
377 additions
and
33 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,295 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
|
||
maven { | ||
name = "forge" | ||
url = "https://maven.minecraftforge.net" | ||
} | ||
maven { | ||
url = 'https://maven.parchmentmc.org' | ||
} | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
maven { | ||
url = 'https://repo.spongepowered.org/maven' | ||
} | ||
} | ||
|
||
dependencies { | ||
classpath("io.github.goooler.shadow:shadow-gradle-plugin:8.1.7") | ||
classpath group: 'com.modrinth.minotaur', name: 'Minotaur', version: '2.+' | ||
} | ||
} | ||
|
||
plugins { | ||
id "java-library" | ||
id "idea" | ||
id "net.neoforged.gradle.userdev" version "[7.0.142,)" | ||
id 'net.darkhax.curseforgegradle' version '1.+' | ||
} | ||
|
||
|
||
apply plugin: 'io.github.goooler.shadow' | ||
apply plugin: "com.modrinth.minotaur" | ||
apply plugin: "maven-publish" | ||
|
||
version = "${project.mod_version}+${project.minecraft_version}" | ||
def modVersion = "${project.mod_version}" | ||
|
||
group = project.group_id | ||
archivesBaseName = project.base_name | ||
|
||
configurations { | ||
shade | ||
} | ||
|
||
configurations.all { | ||
// Check for snapshots more frequently than Gradle's default of 1 day. 0 = every build. | ||
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' | ||
} | ||
|
||
dependencies { | ||
implementation "net.neoforged:neoforge:${neoforge_version}" | ||
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' | ||
implementation group: "info.journeymap", name: "journeymap-api-neoforge", version: "${project.journeymap_api_version}-${project.minecraft_version}-SNAPSHOT", changing: true | ||
// implementation fg.deobf("curse.maven:journeymap-32274:${project.jourenymap_forge_version}") | ||
testImplementation 'junit:junit:4.12' | ||
testImplementation 'org.mockito:mockito-inline:4.1.+' | ||
|
||
shade group: 'info.journeymap', name: 'webmap-client', version: project.journeymap_webmap_version, changing: true | ||
|
||
//external libs shade | ||
shade group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1' | ||
shade group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.6.10' | ||
shade group: 'io.javalin', name: 'javalin', version: '6.0.0' | ||
shade group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.3' | ||
|
||
compileOnly project(":Common") | ||
} | ||
|
||
mixin { | ||
add sourceSets.main, "journeymap-refmap.json" | ||
} | ||
|
||
runs { | ||
configureEach { | ||
systemProperty "mixin.debug.export", "true" | ||
systemProperty "forge.logging.console.level", "info" | ||
systemProperty "journeymap.map_testing", "true" | ||
|
||
modSource project.sourceSets.main | ||
} | ||
client { | ||
workingDirectory project.file("run/client") | ||
} | ||
server { | ||
programArgument "--nogui" | ||
workingDirectory project.file("run/server") | ||
} | ||
} | ||
|
||
tasks.build.dependsOn shadowJar | ||
jar.finalizedBy('shadowJar') | ||
|
||
shadowJar { | ||
archiveName = "${baseName}-${version}-forge.${extension}" | ||
classifier = '' | ||
configurations = [project.configurations.shade] | ||
duplicatesStrategy = DuplicatesStrategy.INCLUDE | ||
dependencies { | ||
exclude("META-INF/maven/**") | ||
exclude("META-INF/services/org.*") | ||
exclude("META-INF/services/jakarta.*") | ||
exclude(dependency("org.ow2.asm:.*:.*")) | ||
} | ||
minimize { | ||
// API has utility classes that must be included | ||
exclude(dependency("info.journeymap:.*:.*")) | ||
exclude(dependency("org.slf4j:.*:.*")) | ||
} | ||
|
||
relocate "jakarta", "info.journeymap.shaded.jakarta" | ||
relocate "javax.servlet", "info.journeymap.shaded.org.javax.servlet" | ||
relocate "org.intellij", "info.journeymap.shaded.org.intellij" | ||
relocate "org.jetbrains", "info.journeymap.shaded.org.jetbrains" | ||
relocate "org.slf4j", "info.journeymap.shaded.org.slf4j" | ||
relocate "org.eclipse", "info.journeymap.shaded.org.eclipse" | ||
|
||
relocate "kotlin", "info.journeymap.shaded.kotlin.kotlin" | ||
relocate "io.javalin", "info.journeymap.shaded.io.javalin" | ||
|
||
exclude 'dummyThing' | ||
exclude 'LICENSE.txt' | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
source(project(":Common").sourceSets.main.allSource) | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
|
||
// This block of code expands all the gradle properties in the specified resource targets. | ||
// It copies them into the targets and expands all the defined properties. | ||
def resourceTargets = ['META-INF/neoforge.mods.toml', 'pack.mcmeta', 'license.txt'] | ||
def intoTargets = ["$rootDir/out/production/resources/", "$rootDir/out/production/${project.name}.main/", "$rootDir/bin/main/"] | ||
def replaceProperties = [ | ||
version : project.version, | ||
modVersion : modVersion, | ||
mcversion : project.minecraft_version, | ||
date : getDate() | ||
] | ||
|
||
processResources() { | ||
from project(":Common").sourceSets.main.resources | ||
// duplicatesStrategy = DuplicatesStrategy.INCLUDE | ||
// this will ensure that this task is redone when the versions change. | ||
inputs.properties replaceProperties | ||
filesMatching(resourceTargets) { | ||
expand replaceProperties | ||
} | ||
|
||
intoTargets.each { target -> | ||
if (file(target).exists()) { | ||
copy { | ||
from(sourceSets.main.resources) { | ||
include resourceTargets | ||
expand replaceProperties | ||
} | ||
into target | ||
} | ||
} | ||
} | ||
} | ||
|
||
task processDocs(type: Copy) { | ||
// update docs | ||
from(file("../doc/")) { | ||
include '*.html' | ||
expand 'version': project.version, | ||
'date': getDate(), | ||
'mcversion': project.minecraft_version, | ||
'loaderversion': project.forge_version, | ||
'loadername': "Forge" | ||
} | ||
into 'build/doc' | ||
} | ||
|
||
|
||
clean.doFirst { | ||
// Remove the Webpack bundled assets as part of the clean task | ||
delete "$projectDir/src/main/resources/assets/journeymap/web/" | ||
} | ||
|
||
jar { | ||
classifier = 'slim' | ||
dependsOn 'processDocs' | ||
manifest { | ||
attributes([ | ||
"Specification-Title" : project.name, | ||
"Specification-Vendor" : project.group_id, | ||
"Specification-Version" : "1", // We are version 1 of ourselves | ||
"Implementation-Title" : project.name, | ||
"Implementation-Version" : "${version}", | ||
"Implementation-Vendor" : project.group_id, | ||
"Implementation-URL" : "http://journeymap.info", | ||
"Implementation-Timestamp": getDate(), | ||
"FMLAT" : "accesstransformer.cfg", | ||
]) | ||
} | ||
} | ||
|
||
|
||
artifacts { | ||
archives shadowJar | ||
} | ||
|
||
def getDate() { | ||
def date = new Date() | ||
def formattedDate = date.format(project.dateFormat) | ||
return formattedDate | ||
} | ||
|
||
// Automated upload to CurseForge for the win! | ||
if (!project.hasProperty("curseForgeApiKey")) { | ||
ext.curseForgeApiKey = "notset" | ||
} | ||
if (!project.hasProperty("modrinthApiKey")) { | ||
ext.modrinthApiKey = "notset" | ||
} | ||
|
||
curseforge { | ||
project { | ||
id = '793035' | ||
apiKey = "${curseForgeApiKey}" | ||
changelogType = 'html' | ||
releaseType = release_type | ||
addGameVersion project.minecraft_version | ||
relations { | ||
requiredDependency 'journeymap' | ||
} | ||
|
||
mainArtifact(shadowJar) { | ||
displayName = "${archivesBaseName}-${version}-forge" | ||
changelog = file('/build/doc/changelog.html') | ||
} | ||
} | ||
} | ||
|
||
|
||
tasks.modrinth.dependsOn(tasks.assemble) | ||
|
||
modrinth { | ||
token = "${modrinthApiKey}" | ||
projectId = "YaZ1fUTg" | ||
versionNumber = "${version}-forge" | ||
versionName = "${archivesBaseName}-${version}-forge" | ||
versionType = release_type | ||
uploadFile = shadowJar | ||
gameVersions = ["${project.minecraft_version}"] | ||
loaders = ["forge"] | ||
changelog = file('/build/doc/changelog.html').exists() ? file('/build/doc/changelog.html').text : null | ||
dependencies { | ||
required.project "journeymap" | ||
} | ||
} | ||
|
||
// Ensure build is done prior to cursegradle tasks | ||
project.afterEvaluate { | ||
project.tasks.findAll { task -> | ||
(task.name.startsWith('curseforge') || task.name.startsWith('modrinth')) | ||
&& (task.name != 'curseforge' || task.name != 'modrinth') | ||
}.each { projectTask -> | ||
projectTask.dependsOn build | ||
} | ||
} | ||
tasks.withType(PublishToMavenRepository) { task -> | ||
task.dependsOn reobfShadowJar | ||
} | ||
tasks.named('assemble').configure { dependsOn 'shadowJar' } | ||
jar.finalizedBy 'reobfJar' | ||
shadowJar.finalizedBy 'reobfShadowJar' | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = "JourneyMap" | ||
url = uri("https://jm.gserv.me/repository/maven-releases/") | ||
|
||
credentials { | ||
username = project.findProperty("journeymap.user") ?: System.getenv("JOURNEYMAP_WEB_USER") | ||
password = project.findProperty("journeymap.password") ?: System.getenv("JOURNEYMAP_WEB_PASSWORD") | ||
} | ||
} | ||
} | ||
|
||
publications { | ||
mavenJava(MavenPublication) { | ||
groupId project.group | ||
artifactId project.archivesBaseName | ||
version "${project.version}-forge" | ||
artifact shadowJar | ||
} | ||
} | ||
} |
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 @@ | ||
public com.mojang.blaze3d.platform.NativeImage m_85064_(Ljava/nio/channels/WritableByteChannel;)Z #writeToChannel |
Oops, something went wrong.