1+ // For those who want the bleeding edge
12buildscript {
23 repositories {
34 mavenCentral()
@@ -8,18 +9,21 @@ buildscript {
89 }
910 }
1011 dependencies {
11- classpath ' net.minecraftforge.gradle: ForgeGradle:2.3-SNAPSHOT '
12+ classpath group : ' net.minecraftforge.gradle' , name : ' ForgeGradle' , version : ' 3.+ ' , changing : true
1213 }
1314}
1415
1516plugins {
1617 // For people who want stable
1718 // id "net.minecraftforge.gradle.forge" version "2.0.2"
18- id ' com.matthewprenger.cursegradle' version ' 1.1 .0'
19+ id ' com.matthewprenger.cursegradle' version ' 1.4 .0'
1920}
2021
21- // For those who want the bleeding edge
22- apply plugin : ' net.minecraftforge.gradle.forge'
22+ apply plugin : ' net.minecraftforge.gradle'
23+ apply plugin : ' idea'
24+ apply plugin : ' maven'
25+
26+ import net.minecraftforge.gradle.common.task.SignJar
2327
2428loadProperties()
2529
@@ -44,21 +48,265 @@ def loadProperties() {
4448 project. buildnumber = System . getenv(). BUILD_NUMBER
4549 if (System . getenv(). TRAVIS_BUILD_NUMBER )
4650 project. buildnumber = System . getenv(). TRAVIS_BUILD_NUMBER
47- if (System . getenv(). CI ) {
48- // project.buildnumber += "-DEV"
49- }
51+
5052 if (System . getenv(). RELEASE || System . getenv(). TRAVIS_TAG )
5153 project. buildnumber = " RELEASE"
5254 logger. lifecycle " BUILDING VERSION: " + project. buildnumber
5355}
5456
55- apply from : ' gradle/forge.gradle'
56- apply from : ' gradle/dev.gradle'
57- apply from : ' gradle/deploy.gradle'
57+ sourceSets {
58+ api
59+ main {
60+ compileClasspath + = sourceSets. api. output
61+ runtimeClasspath + = sourceSets. api. output
62+ }
63+ test {
64+ compileClasspath + = sourceSets. api. output
65+ runtimeClasspath + = sourceSets. api. output
66+ }
67+ }
68+
69+ configurations {
70+ apiCompile. extendsFrom(compile)
71+ javadoc. classpath + = sourceSets. api. output
72+ }
73+
74+ repositories {
75+ mavenCentral()
76+ mavenLocal()
77+ maven {
78+ name " Cyclops Repo"
79+ url " https://oss.jfrog.org/artifactory/simple/libs-release/"
80+ }
81+ }
82+
83+ dependencies {
84+ minecraft " net.minecraftforge:forge:${ config.minecraft_version} -${ config.forge_version} "
85+
86+ // Add something like 'cyclopscore_version_local=0.1.0-DEV' to your gradle.properties if you want to use a custom local CyclopsCore version.
87+ if (project. hasProperty(" cyclopscore_version_local" )) {
88+ compile " org.cyclops.cyclopscore:CyclopsCore:${ config.minecraft_version} -${ project.cyclopscore_version_local} :deobf"
89+ } else {
90+ compile " org.cyclops.cyclopscore:CyclopsCore:${ config.minecraft_version} -${ config.cyclopscore_version} :deobf"
91+ }
92+
93+ // Project lombok
94+ compileOnly " org.projectlombok:lombok:1.16.4"
95+ }
96+
97+ minecraft {
98+ mappings channel : " ${ config.mcp_mappings_channel} " , version : " ${ config.mcp_mappings_version} "
99+
100+ accessTransformer = file(' src/main/resources/META-INF/accesstransformer.cfg' )
101+
102+ runs {
103+ client {
104+ workingDirectory project. file(' run' )
105+ // property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
106+ property ' forge.logging.console.level' , ' debug'
107+ mods {
108+ structuredcrafting {
109+ source sourceSets. main
110+ source sourceSets. api
111+ }
112+ }
113+ }
114+
115+ server {
116+ workingDirectory project. file(' run' )
117+ property ' forge.logging.console.level' , ' debug'
118+ mods {
119+ structuredcrafting {
120+ source sourceSets. main
121+ source sourceSets. api
122+ }
123+ }
124+ }
125+
126+ data {
127+ workingDirectory project. file(' run' )
128+ property ' forge.logging.console.level' , ' debug'
129+ args ' --mod' , ' structuredcrafting' , ' --all' , ' --output' , file(' src/generated/resources/' )
130+ mods {
131+ structuredcrafting {
132+ source sourceSets. main
133+ source sourceSets. api
134+ }
135+ }
136+ }
137+ }
138+ }
139+
140+ if (project. buildnumber. equals(" RELEASE" ))
141+ version = " ${ config.minecraft_version} -${ config.mod_version} "
142+ else
143+ version = " ${ config.minecraft_version} -${ config.mod_version} -${ buildnumber} "
144+
145+ jar {
146+ manifest {
147+ attributes([
148+ " FMLAT" : " accesstransformer.cfg" ,
149+ " Specification-Title" : " ${ project.name} " ,
150+ " Specification-Vendor" : " rubensworks" ,
151+ " Specification-Version" : " ${ config.mod_version} " ,
152+ " Implementation-Title" : " ${ project.name} " ,
153+ " Implementation-Version" : " ${ config.mod_version} " ,
154+ " Implementation-Vendor" :" rubensworks" ,
155+ " Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
156+ ])
157+ }
158+ }
159+
160+ task signJar (type : SignJar , dependsOn : jar) {
161+ onlyIf {
162+ System . getenv(). SIGN_KEYSTORE
163+ }
164+
165+ keyStore = System . getenv(). SIGN_KEYSTORE
166+ alias = System . getenv(). SIGN_ALIAS
167+ storePass = System . getenv(). SIGN_STOREPASS
168+ keyPass = System . getenv(). SIGN_KEYPASS
169+ inputFile = jar. archivePath
170+ outputFile = jar. archivePath
171+ }
172+ build. dependsOn signJar
173+
174+ task deobfJar (type : Jar ) {
175+ from sourceSets. main. output
176+ classifier = ' deobf'
177+ manifest {
178+ attributes([
179+ " FMLAT" : " accesstransformer.cfg" ,
180+ " Specification-Title" : " ${ project.name} " ,
181+ " Specification-Vendor" : " rubensworks" ,
182+ " Specification-Version" : " ${ config.mod_version} " ,
183+ " Implementation-Title" : " ${ project.name} " ,
184+ " Implementation-Version" : " ${ config.mod_version} " ,
185+ " Implementation-Vendor" :" rubensworks" ,
186+ " Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
187+ ])
188+ }
189+ }
190+
191+ task apiJar (type : Jar ) {
192+ from sourceSets. main. output
193+ from sourceSets. main. java
194+ classifier = ' api'
195+ include ' structuredcrafting/api/**'
196+ }
197+
198+ task sourceJar (type : Jar ) {
199+ classifier = " sources"
200+ from sourceSets. main. allJava
201+ }
202+
203+ task javadocJar (type : Jar , dependsOn : javadoc) {
204+ from javadoc. destinationDir
205+ classifier ' javadoc'
206+ }
207+
208+ artifacts {
209+ archives deobfJar
210+ archives apiJar
211+ archives sourceJar
212+ archives javadocJar
213+ }
214+
215+ curseforge {
216+ if (project. hasProperty(" curseforge_key" )) {
217+ apiKey = project. curseforge_key
218+ } else if (System . getenv(). TRAVIS && System . getenv(). CURSEFORGE_KEY_SECRET ) {
219+ apiKey = System . getenv(). CURSEFORGE_KEY_SECRET
220+ }
221+
222+ project {
223+ id = " 233151" // my project url is http://minecraft.curseforge.com/mc-mods/233151/
224+ releaseType = project. config. release_type
225+ mainArtifact(jar) {
226+ relations {
227+ requiredDependency ' cyclops-core'
228+ }
229+ }
230+
231+ changelog = " "
232+ if (new File (" resources/changelog/${ project.version} .txt" ). exists()) {
233+ changelog = new File (" resources/changelog/${ project.version} .txt" ). text
234+ }
235+
236+ addArtifact deobfJar
237+ addArtifact sourceJar
238+ addArtifact javadocJar
239+ }
240+ }
241+
242+ configurations {
243+ deployerJars
244+ }
245+
246+ dependencies {
247+ deployerJars " org.apache.maven.wagon:wagon-ftp:2.2"
248+ }
249+
250+ uploadArchives {
251+ repositories {
252+ add getProject(). repositories. mavenLocal()
253+ }
254+ repositories. mavenDeployer {
255+ configuration = configurations. deployerJars
256+
257+ if (project. hasProperty(" filesmaven_url" )) {
258+ logger. info(' Publishing to files server' )
259+ repository(url : project. filesmaven_url) {
260+ authentication(userName : project. filesmaven_username, password : project. filesmaven_key)
261+ }
262+ } else if (System . getenv(). MAVEN_URL ) {
263+ logger. info(' Publishing to files server' )
264+ repository(url : System . getenv(). MAVEN_URL ) {
265+ authentication(userName : System . getenv(). MAVEN_USERNAME , password : System . getenv(). MAVEN_KEY )
266+ }
267+ } else {
268+ logger. info(' Publishing to repo folder' )
269+ repository(url : ' file://localhost/' + project. file(' ~/.m2/repository' ). getAbsolutePath())
270+ }
271+
272+ pom {
273+ groupId = project. group
274+ version = project. version
275+ artifactId = project. archivesBaseName
276+ }
277+ pom. project {
278+ name project. archivesBaseName
279+ packaging ' jar'
280+ description ' todo'
281+ url ' https://github.com/CyclopsMC/StructuredCrafting'
282+
283+ scm {
284+ url ' https://github.com/CyclopsMC/StructuredCrafting'
285+ connection ' scm:git:git://github.com/CyclopsMC/StructuredCrafting.git'
286+ developerConnection ' scm:git:git@github.com:CyclopsMC/StructuredCrafting.git'
287+ }
288+
289+ issueManagement {
290+ system ' github'
291+ url ' https://github.com/CyclopsMC/StructuredCrafting/issues'
292+ }
293+
294+ developers {
295+ developer {
296+ id ' rubensworks'
297+ name ' rubensworks'
298+ roles { role ' developer' }
299+ }
300+ }
301+ }
302+ }
303+ }
58304
59- // Mark API directory as source directory in IDEA.
60305idea {
61306 module {
62- sourceDirs + = file(' src/api/java' )
307+ for (String excludeDirName in [" run" , " out" , " logs" , " gradle" ]) {
308+ File excludeDir = new File (projectDir, excludeDirName)
309+ excludeDirs. add(excludeDir)
310+ }
63311 }
64312}
0 commit comments