This repository has been archived by the owner on Jul 16, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
112 lines (99 loc) · 3.64 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
// eb4j-tools gradle build script.
//
// EB4j tools is built by Graalvm native image utility.
//
// Copyright (c) 2016,2020-2021 Hiroshi Miura
//
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
plugins {
id 'java'
id 'checkstyle'
id 'application'
id 'com.palantir.git-version' version "0.15.0"
id 'org.mikeneck.graalvm-native-image' version '1.4.1'
}
// calculate version string from git tag, hash and commit distance
// It treat as release tag when current HEAD has a tag,
// and repository is clean, no modification,and no untracked files,
if (versionDetails().isCleanTag) {
// drop first 'v' from version tag
version = gitVersion().substring(1)
} else {
version = versionDetails().lastTag.substring(1) + '-' + versionDetails().commitDistance + '-' + versionDetails().gitHash + '-SNAPSHOT'
}
group = projectGroup
application {
mainClassName = 'io.github.eb4j.tool.Main'
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
implementation('io.github.eb4j:eb4j:2.3.1')
// for CLI
implementation 'info.picocli:picocli:4.6.3'
annotationProcessor 'info.picocli:picocli-codegen:4.6.3'
// for appendix compilation
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.apache.commons:commons-text:1.9'
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.3'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.3'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.3'
// for EB4j logging backend
implementation 'org.slf4j:slf4j-simple:1.7.36'
//
testImplementation 'commons-io:commons-io:2.11.0'
testImplementation 'org.testng:testng:7.6.0'
}
test.useTestNG()
compileJava {
options.compilerArgs += ["-Aproject=${project.group}/${project.name}"]
options.encoding = "UTF-8"
}
compileTestJava {options.encoding = "UTF-8"}
// Generate native command image by Graalvm native image utility
nativeImage {
graalVmHome = System.getProperty('java.home')
buildType { build ->
build.executable {
main = 'io.github.eb4j.tool.Main'
}
}
executableName = 'eb'
outputDirectory = file("$buildDir/bin")
arguments {
add '--no-fallback'
add '-H:ReflectionConfigurationFiles=config/native-image/reflect-config.json'
add '--initialize-at-build-time=com.fasterxml.jackson,com.fasterxml.jackson.annotation,org.slf4j,org.yaml.snakeyaml'
add '--enable-all-security-services'
add '-H:+AddAllCharsets'
// add '--initialize-at-run-time='
// add '--report-unsupported-elements-at-runtime'
}
}
// generate native command distribution zip file for each supported platform.
task zipExecutable(type: Zip) {
dependsOn 'nativeImage'
// distribution contents
from("$buildDir/bin")
from('README.md')
from('LICENSE.txt')
// output zip file path and name
destinationDirectory = file("$buildDir/distributions")
def os = DefaultNativePlatform.currentOperatingSystem;
def arch = DefaultNativePlatform.currentArchitecture;
if (os.name.startsWith("Windows")) {
archiveFileName = "eb-win32-${arch.name}-${project.version}.zip"
} else if (os.name.startsWith("Mac")) {
archiveFileName = "eb-mac-${arch.name}-${project.version}.zip"
} else if (os.name.startsWith("Linux")) {
archiveFileName = "eb-linux-${arch.name}-${project.version}.zip"
} else {
archiveFileName = "eb-other-${arch.name}-${project.version}.zip"
}
}
checkstyle {
config = resources.text.fromFile("${rootProject.projectDir}/config/checkstyle/checkstyle.xml")
toolVersion = '6.16.1'
}