This repository has been archived by the owner on Nov 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
156 lines (128 loc) · 4.62 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
155
156
/*
* Copyright (C) 2020 boomboompower
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import proguard.gradle.ProGuardTask
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "https://files.minecraftforge.net/maven"
}
}
dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT"
classpath 'net.sf.proguard:proguard-gradle:6.0.3'
classpath 'net.sf.proguard:proguard-base:6.0.3'
}
}
apply plugin: "net.minecraftforge.gradle.forge"
version = '3.0.0'
group = "wtf.boomy.skinchanger"
archivesBaseName = "SkinChangerMod"
// We use Java 8
sourceCompatibility = targetCompatibility = 1.8
minecraft {
// Default run directory will be located in 'PROJECT_DIR/run'
runDir = "run"
// Version retrieved off https://files.minecraftforge.net/
version = "1.8.9-11.15.1.1722"
// The mapping to use http://export.mcpbot.bspk.rs/stable/
mappings = "stable_22"
replace '@VERSION@', this.version
replace '@MC_VERSION@', "1.8.9"
replace '@FINGERPRINT@', System.getenv('SHA1Signature') ?: ""
}
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
}
// General mod dependencies
dependencies {
// Updater functionality
provided 'com.github.boomboompower:ApagogeJava:master-SNAPSHOT'
// UI functionality
implementation 'com.github.boomboompower:ModernUI:ebc86f3af1'
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
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.version, "mcversion": project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude "mcmod.info"
}
}
// Makes the output jar name contain no versioning scheme so the build script
// can find the jar easily without hardcoding a version inside of the buildscript.
//
// Fixes an issue with Mixin where it tries to add a class to the jar which
// is already inside of the jar (I honestly have no idea why this occurs).
//
// Also places all valid META-INF/MANIFEST.MF information inside of the mod such as
// The mixin tweaker location & the installer main class.
jar {
archiveName = "$baseName.$extension"
from configurations.provided.asFileTree.files.collect {
// Fixes an issue where Mixin's copies a duplicate file into the build jar...
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'com/google/*/**'
zipTree(it)
}
manifest.attributes(
'Main-Class' : 'wtf.boomy.mods.skinchanger.installer.InstallerCore',
'FMLCorePlugin': 'wtf.boomy.mods.skinchanger.core.FMLLoadingPlugin',
'FMLCorePluginContainsFMLMod' : true,
'ForceLoadAsMod' : true
)
}
// A simple patch to the sourceJar so it does not contain the
// version information. The installer will place the versioned file
// in the mods directory but we must exclude the version so the build
// script on github works properly.
sourceJar {
// Rename the jar so it doesn't contain "SNAPSHOT"
archiveName = "$baseName-sources.$extension"
}
sourceSets {
//noinspection GroovyAssignabilityCheck
main {
// Hidden dev environment variables and credentials
java {
exclude '**/priv'
}
}
}
// Makes the "compile" configuration extend from the provided
// configuration (this makes it inherit similar build properties)
configurations {
provided
compile.extendsFrom(provided)
}
// For obfuscating the jar file.
task proguard(type: ProGuardTask) {
configuration 'proguard/proguard.txt'
injars "build/libs/${jar.archiveName}"
outjars "build/libs/PRO-${jar.archiveName}"
}