forked from otymko/phoenixbsl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
119 lines (99 loc) · 3.49 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
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
import java.net.URI
import com.github.gradle_git_version_calculator.GitRepository;
import com.github.gradle_git_version_calculator.GitCommandsFactory;
import com.github.gradle_git_version_calculator.GitVersionCalculator;
plugins {
java
jacoco
id("org.openjfx.javafxplugin") version "0.0.10"
id("com.github.johnrengelman.shadow") version "7.0.0"
id("org.sonarqube") version "3.3"
id("io.franzbecker.gradle-lombok") version "4.0.0"
id("com.github.gradle-git-version-calculator") version "1.1.0"
}
repositories {
mavenCentral()
maven { url = URI("https://jitpack.io") }
}
group = "com.github.otymko.phoenixbsl"
version = gitVersionCalculator.calculateVersion("v")
val semver = calculateVersion("v", false)
dependencies {
implementation("net.java.dev.jna:jna-platform:5.9.0")
implementation("org.eclipse.lsp4j:org.eclipse.lsp4j:0.12.0")
implementation("ch.qos.logback:logback-classic:1.2.6")
implementation("lc.kra.system:system-hook:3.8")
implementation("com.github.silverbulleters:sonarlint-core:123a8b2")
// ui
implementation("com.jfoenix:jfoenix:9.0.10")
implementation("com.fasterxml.jackson.core:jackson-databind:2.12.5")
compileOnly("org.projectlombok", "lombok", lombok.version)
testImplementation("com.hynnet:jacob:1.18")
testImplementation("junit:junit:4.13.2")
testImplementation("org.assertj:assertj-core:3.20.2")
}
java {
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.add("-Xlint:unchecked")
options.compilerArgs.add("-Xlint:deprecation")
}
tasks.jar {
val mainClass = "com.github.otymko.phoenixbsl.PhoenixLauncher"
manifest {
attributes["Main-Class"] = mainClass
attributes["Implementation-Version"] = project.version
}
enabled = false
dependsOn(tasks.shadowJar)
}
tasks.shadowJar {
project.configurations.implementation.get().isCanBeResolved = true
configurations = listOf(project.configurations["implementation"])
archiveClassifier.set("")
}
tasks.register<Exec>("jpackage") {
dependsOn(tasks.shadowJar)
val jpackage = "jpackage"
executable(jpackage)
args(
"--name", "phoenixbsl",
"--type", "msi",
"--input", "build/libs",
"--main-jar", "phoenix-$version.jar",
"--win-dir-chooser",
"--win-shortcut",
"--win-menu",
"--app-version", semver,
"--vendor", "otymko"
)
}
sonarqube {
properties {
property("sonar.sourceEncoding", "UTF-8")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.organization", "phoenixbsl")
property("sonar.projectKey", "phoenixbsl")
property("sonar.projectName", "Phoenix BSL")
property("sonar.exclusions", "**/gen/**/*.*")
}
}
javafx {
version = "17"
modules("javafx.controls", "javafx.fxml")
}
lombok {
version = "1.18.20"
}
/* Получить версия проекта без дополнительной информации
(только major, minor, patch)
*/
fun calculateVersion(prefix: String?, withSnapshot: Boolean): String? {
val repository = GitRepository(GitCommandsFactory(project.projectDir.absolutePath))
val calculator = GitVersionCalculator(repository)
val semver = calculator.calculateSemVer(prefix, withSnapshot)
return String.format("%d.%d.%d", semver.major, semver.minor, semver.patch)
}