aboutsummaryrefslogtreecommitdiff
path: root/build.gradle.kts
blob: 4d0258ed0b9ccad18e4f94ee1d87141eb40c5754 (plain)
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/*
 * Copyright (c) 2018-2020 bartimaeusnek
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

import net.minecraftforge.gradle.user.UserExtension

buildscript {
    repositories {
        mavenCentral()
        maven("https://gregtech.overminddl1.com")
        maven("https://jitpack.io")
    }
    dependencies {
        classpath("com.github.GTNewHorizons:ForgeGradle:1.2.4")
    }
}

plugins {
    idea
    java
    id("org.ajoberstar.grgit") version("3.1.1")
}

apply(plugin = "forge")

idea {
    module {
        this.isDownloadJavadoc = true
        this.isDownloadSources = true
    }
}

java {
    this.sourceCompatibility = JavaVersion.VERSION_1_8
    this.targetCompatibility = JavaVersion.VERSION_1_8
}

configurations.all {
    resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
    isTransitive = false
}

tasks.withType<JavaCompile> {
    options.encoding = "UTF-8"
}

val majorUpdate: String by project
val minorUpdate: String by project
val buildNumber: String by project

minecraft.version = "1.7.10-10.13.4.1614-1.7.10"
version = "$majorUpdate.$minorUpdate.$buildNumber"
group = "com.github.bartimaeusnek.bartworks"

//minecraft block
configure<UserExtension> {
    this.includes.addAll(
            arrayOf(
                    "MainMod.java",
                    "API_REFERENCE.java"
            )
    )
    val apiVersion: String by project
    this.replacements.putAll(
            mapOf(
                Pair("@version@", project.version),
                Pair("@apiversion@", apiVersion)
            )
    )
    this.runDir = "run"
}

repositories {
    mavenLocal()
    maven("https://gregtech.overminddl1.com/") { this.name = "GT6Maven" }
    maven("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/") { this.name = "ic2" }
    maven("http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/") { this.name = "UsrvDE/GTNH" }
    ivy {
        this.name = "gtnh_download_source_stupid_underscore_typo"
        this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]_[revision].[ext]")
    }
    ivy {
        this.name = "gtnh_download_source"
        this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]")
    }
    ivy {
        this.name = "BuildCraft"
        this.artifactPattern("http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision](-[classifier]).[ext]")
    }
    ivy {
        this.name = "vexatos"
        this.artifactPattern("https://files.vexatos.com/[organisation]/[module]-[revision]-[classifier].[ext]")
    }
    maven("http://maven.cil.li/") { this.name = "OpenComputers" }
    maven("http://default.mobiusstrip.eu/maven") { this.name = "Jabba" }
    maven("http://chickenbones.net/maven/") { this.name = "CodeChicken" }
    maven("http://www.ryanliptak.com/maven/") { this.name = "appleCore" }
    maven("http://maven.tterrag.com") { this.name = "tterrag Repo" }
    maven("https://jitpack.io")
}

dependencies {
    //Needed properties
    val ic2Version: String by project
    val galacticraftVersion: String by project
    val applecoreVersion: String by project
    val enderCoreVersion: String by project
    val enderioVersion: String by project

    //hard deps
    compile("net.industrial-craft:industrialcraft-2:$ic2Version:dev")
    //jitpack
    compile("com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev") {
        this.isChanging = true
    }
    compile ("com.github.GTNewHorizons:StructureLib:1.0.6:deobf")
    compile("com.github.GTNewHorizons:TinkersConstruct:master-SNAPSHOT:dev") {
        this.isChanging = true
    }
    compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-1.7.10-SNAPSHOT:dev") {
        this.isChanging = true
    }
    //soft deps
    compileOnly("com.azanor.baubles:Baubles:1.7.10-1.0.1.10:deobf")
    compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
    compileOnly("mods.railcraft:Railcraft_1.7.10:9.12.3.0:dev")
    compile("micdoodle8.mods:MicdoodleCore:$galacticraftVersion:Dev")
    compile("micdoodle8.mods:GalacticraftCore:$galacticraftVersion:Dev")
    compile("micdoodle8.mods:Galacticraft-Planets:$galacticraftVersion:Dev")
    compileOnly("li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api")
    compileOnly("net.sengir.forestry:forestry_1.7.10:4.4.0.0:dev")
    compileOnly("TGregworks:TGregworks:1.7.10-GTNH-1.0.19:deobf")
    //jitpack
    compileOnly("com.github.GTNewHorizons:GalacticGregGT5:master-SNAPSHOT") {
        this.isChanging = true
    }
    //compileOnly("com.github.Technus:Tectech:master-SNAPSHOT") {
    //    this.isChanging = true
    //}
    //Files
    compileOnly(fileTree("libs") { this.include("*.jar") })

    //CoreLibs for compile-age
    //compileOnly("com.github.GTNH2:Yamcl:master-SNAPSHOT") //broken jitpack.io dep
    compileOnly("applecore:AppleCore:$applecoreVersion:api")
    compileOnly("com.enderio.core:EnderCore:$enderCoreVersion:dev")
    compileOnly("com.enderio:EnderIO:$enderioVersion:dev")

    //NEI
    compile("com.github.GTNewHorizons:CodeChickenLib:master-SNAPSHOT:dev")
    compile("com.github.GTNewHorizons:CodeChickenCore:master-SNAPSHOT:dev")
    compile("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev")
}

val Project.minecraft: UserExtension
    get() = extensions.getByName<UserExtension>("minecraft")

tasks.withType<Jar> {
    // this will ensure that this task is redone when the versions change.
    this.inputs.properties += "version" to project.version
    this.inputs.properties += "mcversion" to project.minecraft.version
    this.archiveBaseName.set("bartworks[${project.minecraft.version}]-[${getVersionAppendage()}]")

    // replace stuff in mcmod.info, nothing else
    this.filesMatching("/mcmod.info") {
        this.expand(
                mapOf(
                    "version" to project.version,
                    "mcversion" to project.minecraft.version
                )
        )
    }
}

tasks.jar {
    this.exclude(
            "assets/gregtech/textures/items/materialicons/copy.bat",
            "assets/gregtech/textures/blocks/materialicons/copy.bat"
    )
    this.manifest.attributes(
                mapOf(
                        Pair("FMLCorePlugin","com.github.bartimaeusnek.ASM.BWCorePlugin"),
                        Pair("FMLCorePluginContainsFMLMod","true")
                )
        )
}

val apiJar by tasks.creating(Jar::class) {
    this.from(sourceSets.main.get().output) {
        this.include(
                "com/github/bartimaeusnek/bartworks/API/**",
                "com/github/bartimaeusnek/bartworks/util/**",
                "com/github/bartimaeusnek/bartworks/system/material/Werkstoff.class",
                "com/github/bartimaeusnek/crossmod/thaumcraft/util/**"
        )
    }
    this.archiveClassifier.set("API")
}

val sourcesJar by tasks.creating(Jar::class) {
    this.from(sourceSets.main.get().allSource)
    this.archiveClassifier.set("sources")
}

val devJar by tasks.creating(Jar::class) {
    this.from(sourceSets.main.get().output)
    this.archiveClassifier.set("dev")
}

artifacts {
    this.archives(apiJar)
    this.archives(sourcesJar)
    this.archives(devJar)
}

fun getVersionAppendage() : String {
    return org.ajoberstar.grgit.Grgit.open(mapOf("currentDir" to project.rootDir)).log().last().abbreviatedId
}