-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathbuild.gradle
176 lines (142 loc) · 5.87 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
plugins{
id "dev.architectury.loom" version "1.9-SNAPSHOT" apply false
id "architectury-plugin" version "3.4-SNAPSHOT" apply true
id "com.gradleup.shadow" version "8.3.5" apply false
id "com.matthewprenger.cursegradle" version "1.4.0" apply false
id "com.github.breadmoirai.github-release" version "2.4.1"
id "com.modrinth.minotaur" version "2.8.4" apply false
}
allprojects {
apply plugin: "java"
group = rootProject.maven_group
repositories {
maven{
name = "TerraformersMC maven"
url = 'https://maven.terraformersmc.com/'
}
maven {
url 'https://repo.redlance.org/public'
}
maven {
url "https://libraries.minecraft.net"
}
maven { url "https://maven.neoforged.net/releases" }
}
tasks.withType(JavaCompile).configureEach {
//apply plugin: "architectury-plugin"
def targetVersion = project.java_version
sourceCompatibility = JavaVersion.toVersion(targetVersion)
targetCompatibility = JavaVersion.toVersion(targetVersion)
//options.compilerArgs << '-Xlint:unchecked'
//options.deprecation = true //deprecated warning on compile
repositories {
mavenCentral()
}
dependencies {
// put common dependencies here
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
}
}
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
java {
withSourcesJar()
}
}
//---------------- Publishing ----------------
ext.ENV = System.getenv()
ext.cfType = ENV.RELEASE_TYPE ? ENV.RELEASE_TYPE : "alpha"
ext.isRelease = cfType == "release"
ext.changes = ENV.CHANGELOG ? ENV.CHANGELOG.replaceAll("\\\\n", "\n") : ""
ext.mod_version = project.version_base
if(!isRelease){
ext.mod_version = "${project.version_base}-${cfType[0]}.${ ENV.BUILD_NUMBER ? "build.${ENV.BUILD_NUMBER}" : 'git rev-parse --verify --short HEAD'.execute().text.trim()}"
}
List<File> releaseArtifacts
ext.keysExists = ENV.GH_TOKEN != null || project.getGradle().getStartParameter().isDryRun()
if(keysExists) {
project.ext.keys = new Properties()
if (project.getGradle().getStartParameter().isDryRun()) {
println("Dry run, loading publish scripts")
//All of these are fake, don't waste your time with it. (Copied from API docs and random generated)
project.ext.keys.modrinth_token = "gho_pJ9dGXVKpfzZp4PUHSxYEq9hjk0h288Gwj4S"
project.ext.keys.curseforge_key = "00000000-0000-0000-0000-000000000000"
project.ext.keys.github_token = "gh_0123456789"
project.ext.keys.kosmx_maven = "V2h5IGRpZCB5b3UgZGVjb2RlIGl0PyAg"
} else {
println("Keys loaded, loading publish scripts")
project.ext.keys.modrinth_token = ENV.MODRINTH_TOKEN
project.ext.keys.curseforge_key = ENV.CURSEFORGE_TOKEN
project.ext.keys.github_token = ENV.GH_TOKEN
project.ext.keys.kosmx_maven = ENV.KOSMX_TOKEN
}
githubRelease {
token project.keys.github_token // This is your personal access token with Repo permissions
// You get this from your user settings > developer settings > Personal Access Tokens
owner "KosmX"
// default is the last part of your group. Eg group: "com.github.breadmoirai" => owner: "breadmoirai"
repo "emotes" // by default this is set to your project name
tagName "${project.mod_version}" // by default this is set to "v${project.version}"
targetCommitish "dev" // by default this is set to "master"
releaseName "Emotecraft-${project.mod_version}" // Release title, by default this is the same as the tagName
body changes // by default this is empty
draft false // by default this is false
prerelease !isRelease // by default this is false
//releaseAssets = releaseArtifacts
// this points to which files you want to upload as assets with your release
//releaseAssets jar.destinationDir.listFiles
overwrite true // by default false; if set to true, will delete an existing release with the same tag and name
dryRun false // by default false; you can use this to see what actions would be taken without making a release
apiEndpoint "https://api.github.com" // should only change for github enterprise users
client // This is the okhttp client used for http requests
}
task autoPublish {
//dependsOn(':forge:build',)
//dependsOn(':fabric:build', ':bukkit:build')
dependsOn('collectArtifacts')
//Configure Modrinth and GitHub with artifacts to release
doFirst {
tasks.githubRelease.releaseAssets = releaseArtifacts
}
finalizedBy(tasks.githubRelease)
finalizedBy(':minecraft:publishMod')
finalizedBy(':emotesAPI:publish')
finalizedBy(':executor:publish')
finalizedBy(':emotesServer:publish')
finalizedBy(':emotesAssets:publish')
finalizedBy(':bukkit:publish')
finalizedBy(":bukkit:modrinth")
finalizedBy(":bungee:modrinth")
finalizedBy(":velocity:modrinth")
}
}
else {
println("Keys are not in ENV, publishing is not possible")
}
//Build all modules task :D
task buildAll{
dependsOn(':bukkit:build')
dependsOn(':bungee:build')
dependsOn(':velocity:build')
dependsOn(':minecraft:buildAll')
}
task cleanupArtifacts{
doLast {
delete "${project.projectDir}/artifacts"
}
}
task collectArtifacts{
dependsOn('cleanupArtifacts')
dependsOn(':bukkit:copyArtifacts')
dependsOn(':bungee:copyArtifacts')
dependsOn(':velocity:copyArtifacts')
dependsOn('minecraft:copyArtifacts')
doLast {
releaseArtifacts = project.getProjectDir().toPath().resolve("artifacts").toFile().listFiles()
}
}
clean{
delete "${project.projectDir}/artifacts"
}