-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
80 lines (75 loc) · 2.59 KB
/
build.gradle.kts
File metadata and controls
80 lines (75 loc) · 2.59 KB
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
plugins {
kotlin("jvm") version "1.5.20"
id("me.qoomon.git-versioning") version "2.1.1"
id("com.github.johnrengelman.shadow") version "5.2.0"
}
group = "cf.wayzer"
version = "v1.x.x" //采用3位版本号v1.2.3 1为大版本 2为插件版本 3为脚本版本
gitVersioning.apply(closureOf<me.qoomon.gradle.gitversioning.GitVersioningPluginConfig> {
tag(closureOf<me.qoomon.gradle.gitversioning.GitVersioningPluginConfig.VersionDescription> {
pattern = "v(?<tagVersion>[0-9].*)"
versionFormat = "\${tagVersion}"
})
commit(closureOf<me.qoomon.gradle.gitversioning.GitVersioningPluginConfig.CommitVersionDescription> {
versionFormat = "\${commit.short}-SNAPSHOT"
})
})
sourceSets {
main {
java.srcDir("scripts")
}
create("plugin") {
java.srcDir("plugin/src")
resources.srcDir("plugin/res")
}
}
apply {
from("dependencies.gradle.kts")
}
tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs = listOf(
"-Xinline-classes",
"-Xopt-in=kotlin.RequiresOptIn"
)
}
withType<ProcessResources> {
inputs.property("version", rootProject.version)
filter(
filterType = org.apache.tools.ant.filters.ReplaceTokens::class,
properties = mapOf("tokens" to mapOf("version" to rootProject.version))
)
}
named<Delete>("clean") {
this.delete += fileTree("scripts").filter { it.name.endsWith(".cache.jar") }
this.delete += fileTree("scripts/cache")
}
create<Zip>("scriptsZip") {
group = "application"
from(sourceSets.main.get().allSource) {
exclude("*.ktc")
exclude("cache.jar")
exclude(".metadata")
}
archiveClassifier.set("scripts")
}
create<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("buildApplication") {
dependsOn("scriptsZip")
group = "application"
from(sourceSets.getByName("plugin").output)
archiveClassifier.set("")
archiveVersion.set(rootProject.version.toString().substringBeforeLast('.'))
configurations = listOf(project.configurations.getByName("pluginCompileClasspath"))
dependencies {
include(dependency("cf.wayzer:ScriptAgent"))
include(dependency("cf.wayzer:LibraryManager"))
}
manifest {
attributes("Main-Class" to "cf.wayzer.scriptAgent.LoaderKt")
}
afterEvaluate {
println(archiveFile.get())
}
}
}