Skip to content

Commit 472fe0a

Browse files
committed
Gradle script configured.
1 parent 49e2da0 commit 472fe0a

2 files changed

Lines changed: 126 additions & 105 deletions

File tree

build.gradle

Lines changed: 108 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,153 @@
11
buildscript {
22
repositories {
3-
maven { url = 'https://files.minecraftforge.net/maven' }
3+
maven { url("https://files.minecraftforge.net/maven") }
4+
maven { url("https://libraries.minecraft.net") }
5+
maven { url("https://plugins.gradle.org/m2/") }
46
jcenter()
57
mavenCentral()
68
}
79
dependencies {
8-
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
10+
classpath(
11+
group: "net.minecraftforge.gradle",
12+
name: "ForgeGradle",
13+
version: forgeGradleVersion,
14+
changing: true
15+
)
16+
classpath(
17+
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
18+
)
19+
classpath(
20+
"org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion"
21+
)
922
}
1023
}
11-
apply plugin: 'net.minecraftforge.gradle'
12-
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
13-
apply plugin: 'eclipse'
14-
apply plugin: 'maven-publish'
1524

16-
version = '1.0'
17-
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
18-
archivesBaseName = 'modid'
25+
apply(plugin: "net.minecraftforge.gradle")
26+
apply(plugin: "kotlin")
27+
apply(plugin: "java")
28+
apply(plugin: "kotlinx-serialization")
1929

20-
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
30+
version = projectEssentialsVersion
31+
group = "com.mairwunnx.$projectEssentialsId"
32+
archivesBaseName = projectEssentialsName
33+
34+
configurations {
35+
modClientDependencies
36+
modServerDependencies
37+
}
2138

2239
minecraft {
23-
// The mappings can be changed at any time, and must be in the following format.
24-
// snapshot_YYYYMMDD Snapshot are built nightly.
25-
// stable_# Stables are built at the discretion of the MCP team.
26-
// Use non-default mappings at your own risk. they may not always work.
27-
// Simply re-run your setup task after changing the mappings to update your workspace.
28-
mappings channel: 'snapshot', version: '20190719-1.14.3'
29-
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
30-
31-
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
32-
33-
// Default run configurations.
34-
// These can be tweaked, removed, or duplicated as needed.
40+
mappings(
41+
channel: mappingsChannelType,
42+
version: mappingsChannelVersion
43+
)
44+
3545
runs {
3646
client {
37-
workingDirectory project.file('run')
38-
39-
// Recommended logging data for a userdev environment
40-
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
41-
42-
// Recommended logging level for the console
43-
property 'forge.logging.console.level', 'debug'
44-
47+
workingDirectory(project.file(devRunClientPath))
48+
property("forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP")
49+
property("forge.logging.console.level", "debug")
4550
mods {
46-
examplemod {
47-
source sourceSets.main
51+
ProjectEssentialsSpawn {
52+
source(sourceSets.main)
4853
}
4954
}
5055
}
5156

5257
server {
53-
workingDirectory project.file('run')
54-
55-
// Recommended logging data for a userdev environment
56-
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
57-
58-
// Recommended logging level for the console
59-
property 'forge.logging.console.level', 'debug'
60-
61-
mods {
62-
examplemod {
63-
source sourceSets.main
64-
}
65-
}
66-
}
67-
68-
data {
69-
workingDirectory project.file('run')
70-
71-
// Recommended logging data for a userdev environment
72-
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
73-
74-
// Recommended logging level for the console
75-
property 'forge.logging.console.level', 'debug'
76-
77-
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/')
78-
58+
workingDirectory(project.file(devRunServerPath))
59+
property("forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP")
60+
property("forge.logging.console.level", "debug")
7961
mods {
80-
examplemod {
81-
source sourceSets.main
62+
ProjectEssentialsSpawn {
63+
source(sourceSets.main)
8264
}
8365
}
8466
}
8567
}
8668
}
8769

70+
repositories {
71+
jcenter()
72+
mavenCentral()
73+
maven { url("https://minecraft.curseforge.com/api/maven/") }
74+
maven { url("https://libraries.minecraft.net") }
75+
maven { url("https://jitpack.io") }
76+
}
77+
8878
dependencies {
89-
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
90-
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
91-
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
92-
minecraft 'net.minecraftforge:forge:1.14.4-28.0.73'
79+
minecraft(group: "net.minecraftforge", name: "forge", version: forgeBaseVersion)
80+
compile(group: "com.mojang", name: "brigadier", version: brigadierBaseVersion)
81+
compile(
82+
group: "org.jetbrains.kotlinx",
83+
name: "kotlinx-serialization-runtime",
84+
version: kotlinxSerializationVersion
85+
)
86+
compile(
87+
group: "org.jetbrains.kotlin",
88+
name: "kotlin-stdlib-$kotlinJdkVersionTarget",
89+
version: kotlinVersion
90+
)
91+
compile(
92+
group: "com.github.projectessentials",
93+
name: "ProjectEssentials-Permissions",
94+
version: "v1.14.4-0.1.0.1"
95+
)
96+
}
9397

94-
// You may put jars on which you depend on in ./libs or you may define them like so..
95-
// compile "some.group:artifact:version:classifier"
96-
// compile "some.group:artifact:version"
98+
task installMods(type: Copy) {
99+
dependsOn("installClientMods")
100+
dependsOn("installServerMods")
101+
}
97102

98-
// Real examples
99-
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
100-
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
103+
task installClientMods(type: Copy, dependsOn: "deinstallClientMods") {
104+
from { configurations.modClientDependencies }
105+
include("**/*.jar")
106+
into(file("$devRunClientPath/mods"))
107+
}
101108

102-
// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
103-
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
109+
task installServerMods(type: Copy, dependsOn: "deinstallServerMods") {
110+
from { configurations.modServerDependencies }
111+
include("**/*.jar")
112+
into(file("$devRunServerPath/mods"))
113+
}
104114

105-
// These dependencies get remapped to your current MCP mappings
106-
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
115+
task deinstallClientMods(type: Delete) {
116+
delete(fileTree(dir: "$devRunClientPath/mods", include: "*.jar"))
117+
}
107118

108-
// For more info...
109-
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
110-
// http://www.gradle.org/docs/current/userguide/dependency_management.html
119+
task deinstallServerMods(type: Delete) {
120+
delete(fileTree(dir: "$devRunServerPath/mods", include: "*.jar"))
121+
}
111122

123+
project.afterEvaluate {
124+
project.tasks["prepareRuns"].dependsOn(project.tasks["installClientMods"])
125+
project.tasks["prepareRuns"].dependsOn(project.tasks["installServerMods"])
112126
}
113127

114-
// Example for how to get properties into the manifest for reading by the runtime..
115128
jar {
116129
manifest {
117130
attributes([
118-
"Specification-Title": "examplemod",
119-
"Specification-Vendor": "examplemodsareus",
120-
"Specification-Version": "1", // We are version 1 of ourselves
121-
"Implementation-Title": project.name,
122-
"Implementation-Version": "${version}",
123-
"Implementation-Vendor" :"examplemodsareus",
131+
"Specification-Title" : projectEssentialsName,
132+
"Specification-Vendor" : projectEssentialsVendor,
133+
"Specification-Version" : projectEssentialsVersion,
134+
"Implementation-Title" : projectEssentialsName,
135+
"Implementation-Version" : projectEssentialsVersion,
136+
"Implementation-Vendor" : projectEssentialsVendor,
124137
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
125138
])
126139
}
127140
}
128141

129-
// Example configuration to allow publishing using the maven-publish task
130-
// we define a custom artifact that is sourced from the reobfJar output task
131-
// and then declare that to be published
132-
// Note you'll need to add a repository here
133-
def reobfFile = file("$buildDir/reobfJar/output.jar")
134-
def reobfArtifact = artifacts.add('default', reobfFile) {
135-
type 'jar'
136-
builtBy 'reobfJar'
137-
}
138-
publishing {
139-
publications {
140-
mavenJava(MavenPublication) {
141-
artifact reobfArtifact
142-
}
143-
}
144-
repositories {
145-
maven {
146-
url "file:///${project.projectDir}/mcmodsrepo"
147-
}
142+
sourceCompatibility = targetCompatibility =
143+
compileJava.sourceCompatibility =
144+
compileJava.targetCompatibility = jvmVersionTarget
145+
146+
compileKotlin.kotlinOptions.jvmTarget =
147+
compileTestKotlin.kotlinOptions.jvmTarget = jvmVersionTarget
148+
149+
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
150+
kotlinOptions {
151+
freeCompilerArgs += "-Xuse-experimental=kotlin.Experimental"
148152
}
149-
}
153+
}

gradle.properties

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
22
# This is required to provide enough memory for the Minecraft decompilation process.
33
org.gradle.jvmargs=-Xmx3G
4-
org.gradle.daemon=false
4+
org.gradle.daemon=false
5+
org.gradle.caching=true
6+
kotlin.code.style=official
7+
devRunClientPath=run-client
8+
devRunServerPath=run-server
9+
forgeGradleVersion=3.+
10+
forgeBaseVersion=1.14.4-28.0.73
11+
brigadierBaseVersion=1.0.17
12+
mappingsChannelType=snapshot
13+
mappingsChannelVersion=20190719-1.14.3
14+
kotlinJdkVersionTarget=jdk8
15+
kotlinxSerializationVersion=0.12.0
16+
kotlinVersion=1.3.50
17+
projectEssentialsVersion=1.14.4-1.0.0.0
18+
projectEssentialsName=Project Essentials Spawn
19+
projectEssentialsId=project_essentials_spawn
20+
projectEssentialsVendor=MairwunNx (Pavel Erokhin)
21+
jvmVersionTarget=1.8

0 commit comments

Comments
 (0)