forked from WeaponMechanics/MechanicsMain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
90 lines (70 loc) · 2.83 KB
/
build.gradle.kts
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
import com.github.breadmoirai.githubreleaseplugin.GithubReleaseTask
plugins {
id("com.github.breadmoirai.github-release") version "2.4.1"
id("com.cjcrafter.polymart-release") version "1.0.1"
}
polymart {
val weaponMechanicsVersion = findProperty("weaponMechanicsVersion") as? String ?: throw IllegalArgumentException("weaponMechanicsVersion was null")
apiKey = findProperty("polymart_api_key").toString()
title = weaponMechanicsVersion
version = weaponMechanicsVersion
resourceId = 4709
message = "This is a *test update* which was **published automatically**. You may ignore this."
file.set(file("build").resolve("WeaponMechanics.zip"))
}
tasks.register<GithubReleaseTask>("createGithubRelease").configure {
// https://github.com/BreadMoirai/github-release-gradle-plugin
val weaponMechanicsVersion = findProperty("weaponMechanicsVersion") as? String ?: throw IllegalArgumentException("weaponMechanicsVersion was null")
owner.set("WeaponMechanics")
repo.set("MechanicsMain")
authorization.set("Token ${findProperty("pass").toString()}")
tagName.set("v${weaponMechanicsVersion}")
targetCommitish.set("master")
releaseName.set("v${weaponMechanicsVersion}")
draft.set(false)
prerelease.set(false)
generateReleaseNotes.set(true)
body.set("")
overwrite.set(false)
allowUploadToExisting.set(false)
apiEndpoint.set("https://api.github.com")
setReleaseAssets(file("build").listFiles())
// If set to true, you can debug that this would do
dryRun.set(false)
doFirst {
println("Creating GitHub release")
}
}
// This is a helper method to compile MechanicsCore, WeaponMechanics, and to
// put all the stuff in zip files and such for github release.
tasks.register("buildForSpigotRelease").configure {
println("Cleaning build directory")
val folder = file("build")
folder.deleteRecursively()
folder.mkdir()
dependsOn(":BuildMechanicsCore:shadowJar")
dependsOn(":BuildWeaponMechanics:shadowJar")
finalizedBy("resourcePackForSpigotRelease", "zipForSpigotRelease")
}
tasks.register<Copy>("resourcePackForSpigotRelease") {
dependsOn("buildForSpigotRelease")
// !!! Has to be updated when resource pack is updated !!!
val resourcePackVersion = "2.1.0"
from("${layout.projectDirectory}\\resourcepack\\WeaponMechanicsResourcePack-${resourcePackVersion}.zip")
into(layout.buildDirectory)
doFirst {
println("Copy resource pack")
}
}
tasks.register<Zip>("zipForSpigotRelease") {
dependsOn("buildForSpigotRelease", "resourcePackForSpigotRelease")
archiveFileName.set("WeaponMechanics.zip")
destinationDirectory.set(layout.buildDirectory)
from(layout.buildDirectory) {
include("*.jar")
}
from("install-instructions.txt")
doFirst {
println("Generate zip file")
}
}