forked from KosmX/collar-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
105 lines (94 loc) · 4.25 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
plugins {
id 'java'
id 'dev.architectury.loom' version '1.2.+' apply false //For forge 1.16, 1.17. It can be used to build Fabric too, we won't use both, only arch
id "architectury-plugin" version "3.4-SNAPSHOT" apply false //Need for common module management.
id "com.github.johnrengelman.shadow" version "8.1.1" apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id "com.github.breadmoirai.github-release" version "2.5.2" //TODO automate GitHub releases
}
group project.maven_group
version "${project.collar_mod_version}-${getCheckedOutGitCommitHash()}"
allprojects {
repositories {
mavenLocal() //TODO not use this as soon as Collar will be in the maven
mavenCentral()
maven{
name = "TerraformersMC maven"
url = 'https://maven.terraformersmc.com/'
}
maven {
url "https://libraries.minecraft.net"
}
maven {
name = 'Collar'
url = 'https://raw.githubusercontent.com/collarmc/maven/main/'
}
}
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'//do all warnings
//options.deprecation = true //deprecated warning on compile
//We implement these in every submodule...
dependencies {
implementation "com.mojang:brigadier:${project.brigadier_version}"
implementation group: 'com.collarmc', name: 'pounce', version: "${project.pounce_version}"
implementation group: 'com.collarmc', name: 'client', version: "${project.collar_version}", classifier: 'full'
}
}
}
def getCheckedOutGitCommitHash() {
'git rev-parse --verify --short HEAD'.execute().text.trim()
}
//A list, we can use for auto-publishing and for some other based automations
List<File> releaseArtifacts
task cleanupArtifacts{
doLast {
delete "${project.projectDir}/artifacts"
}
}
//A fancy task to collect every implementation into root_project/artifacts
//Can be VERY useful :D
task collectArtifacts{
dependsOn('cleanupArtifacts')
dependsOn('1.20.4:copyArtifacts')
dependsOn('1.20.3:copyArtifacts')
dependsOn('1.20.2:copyArtifacts')
dependsOn('1.20.1:copyArtifacts')
dependsOn('1.20:copyArtifacts')
dependsOn(':1.19.4:copyArtifacts')
dependsOn(':1.19.3:copyArtifacts')
dependsOn(':1.19:copyArtifacts')
dependsOn(':1.17:copyArtifacts')
doLast {
releaseArtifacts = project.getProjectDir().toPath().resolve("artifacts").toFile().listFiles()
}
}
clean{
delete "${project.projectDir}/artifacts"
}
//CI
if(System.getenv("GITHUB_TOKEN") != null) {
githubRelease {
token System.getenv("GITHUB_TOKEN") // This is your personal access token with Repo permissions
// You get this from your user settings > developer settings > Personal Access Tokens
owner "CaptainRexPL"
// default is the last part of your group. Eg group: "com.github.breadmoirai" => owner: "breadmoirai"
repo "collar-mod" // by default this is set to your project name
tagName "${project.version}" // by default this is set to "v${project.version}"
targetCommitish "grade/arch" // by default this is set to "master"
releaseName "collar-${project.version}" // Release title, by default this is the same as the tagName
body ":D" // by default this is empty
draft false // by default this is false
prerelease false // 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
}
}