-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
154 lines (132 loc) · 4.75 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
maven { url = "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'co.riiid:gradle-github-plugin:0.4.2'
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.10"
classpath "org.ajoberstar.reckon:reckon-gradle:0.8.0"
}
}
//ForgeGradle
apply plugin: 'net.minecraftforge.gradle.forge'
//GithubRelease
apply plugin: 'co.riiid.gradle'
//CurseGradle
apply plugin: "com.matthewprenger.cursegradle"
//Reckon project version
apply plugin: "org.ajoberstar.reckon"
file "build.properties" withReader {
def prop = new Properties()
prop.load(it)
ext.config = new ConfigSlurper().parse prop
}
//version starts out inferred by reckon
//final <major>.<minor>.<patch> 1.2.3
//significant <major>.<minor>.<patch>-<stage>.<num> 1.3.0-rc.1
//insignificant <major>.<minor>.<patch>-<stage>.<num>.<commits>+<hash> 1.3.0-rc.1.8+3bb416187b0a478677b274ae29fb4deb664acda3
reckon {
scopeFromProp()
stageFromProp('beta', 'rc', 'final')
}
// Command lines
// ./gradlew build (defaults to minor, beta)
// --
// Dev builds
// ./gradlew build -Preckon.scope=patch -Preckon.stage=beta
// ./gradlew build -Preckon.scope=minor -Preckon.stage=beta
// ./gradlew build -Preckon.scope=major -Preckon.stage=beta
// --
// Create tags for releases, use githubrelease and curseforge targets to publish
// API key properties go in ~/.gradle/gradle.properties
// --
// ./gradlew build reckonTagPush -Preckon.scope=patch -Preckon.stage=beta
// ./gradlew build reckonTagPush -Preckon.scope=patch -Preckon.stage=rc
// ./gradlew build reckonTagPush -Preckon.scope=patch -Preckon.stage=final
// --
// ./gradlew build reckonTagPush -Preckon.scope=minor -Preckon.stage=beta
// ./gradlew build reckonTagPush -Preckon.scope=minor -Preckon.stage=rc
// ./gradlew build reckonTagPush -Preckon.scope=minor -Preckon.stage=final
// --
// ./gradlew build reckonTagPush -Preckon.scope=major -Preckon.stage=beta
// ./gradlew build reckonTagPush -Preckon.scope=major -Preckon.stage=rc
// ./gradlew build reckonTagPush -Preckon.scope=major -Preckon.stage=final
group = config.mod.group
archivesBaseName = "${config.mod.name}-MC${config.minecraft.version}"
ext.versionSimple = (String)version
//version = "MC${config.minecraft.version}-${project.version}"
//file name ends up archiveBaseName-version-classifier.jar
//Example: ThaumicComputers-MC1.12.2-0.3.0-deobf.jar
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = "${config.minecraft.version}-${config.forge.version}"
runDir = "run"
mappings = config.minecraft.mappings
replaceIn "Reference.java"
replace "@VERSION@", project.versionSimple
}
repositories {
maven { url = "http://maven.cil.li/" }
}
dependencies {
compile "li.cil.oc:OpenComputers:${config.oc.version}:api"
provided files('lib/Thaumcraft-1.12.2-6.1.BETA26-deobf.jar')
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.versionSimple
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.versionSimple, 'mcversion':project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
task deobfJar(type: Jar, dependsOn: 'jar') {
from "build/source/main"
classifier "deobf"
}
artifacts {
archives deobfJar
archives sourceJar
}
githubRelease.dependsOn build
github {
owner = "jco2641"
repo = "Thaumic_Computers"
token = GITHUB_API
tagName = project.versionSimple
name = "Version " + project.versionSimple
body = new File('CHANGELOG.md').text
draft = true
assets = [
"build/libs/${project.archivesBaseName}-${project.version}.jar",
"build/libs/${project.archivesBaseName}-${project.version}-deobf.jar",
"build/libs/${project.archivesBaseName}-${project.version}-sources.jar"
]
}
curseforge {
apiKey = CURSE_API
project {
id = '293768'
changelogType ="markdown"
changelog = file("CHANGELOG.md")
releaseType = "release"
mainArtifact(jar) {
displayName = "${project.archivesBaseName}-${project.version}.jar"
}
addArtifact deobfJar
addArtifact sourceJar
}
}