-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
140 lines (112 loc) · 3.59 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer
plugins {
id 'java-gradle-plugin'
id "org.jetbrains.kotlin.jvm" version "1.3.21"
id 'com.gradle.plugin-publish' version '0.12.0'
id 'com.github.johnrengelman.shadow' version '5.2.0'
id "com.diffplug.spotless" version "5.8.2"
}
ext {
thisPluginVersion = project.hasProperty('pluginVersion')?
project.property('pluginVersion'):
'snapshot'
junitJupiterVersion = '5.7.0'
}
group = 'org.mikeneck'
version = thisPluginVersion
repositories {
mavenCentral()
}
sourceSets {
functionalTest {
}
}
configurations {
jackson
}
dependencies {
compileOnly 'org.jetbrains:annotations:20.1.0'
jackson 'com.fasterxml.jackson.core:jackson-databind:2.11.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation configurations.jackson
testCompileOnly 'org.jetbrains:annotations:20.1.0'
testImplementation "org.junit.jupiter:junit-jupiter:$junitJupiterVersion"
testImplementation 'org.assertj:assertj-core:3.17.2'
functionalTestImplementation 'org.assertj:assertj-core:3.17.2'
functionalTestImplementation 'io.github.classgraph:classgraph:4.8.78'
}
jar.enabled = false
shadowJar {
dependsOn 'classes'
relocate 'com.fasterxml.jackson', 'org.mikeneck.com.fasterxml.jackson'
configurations = [project.configurations.jackson]
exclude('module-info.class')
transform(new ServiceFileTransformer())
}
task replaceJar(type: Copy, dependsOn: ['jar', 'shadowJar'], group: 'build') {
from shadowJar
into "$buildDir/libs"
rename {
if ("$it".endsWith('-all.jar')) "$it".replace('-all.jar', ".jar")
else null
}
}
jar.finalizedBy(replaceJar)
gradlePlugin {
plugins {
graalvmNativeImage {
id = 'org.mikeneck.graalvm-native-image'
implementationClass = 'org.mikeneck.graalvm.GraalvmNativeImagePlugin'
}
}
}
pluginBundle {
website = 'https://github.com/mike-neck/graalvm-native-image-plugin'
vcsUrl = 'https://github.com/mike-neck/graalvm-native-image-plugin'
description = 'Generates native image via GraalVM'
tags = ['graalvm', 'native-image']
plugins {
graalvmNativeImage {
displayName = 'GraalVM Native Image Plugin'
}
}
}
if (!project.hasProperty('gradle.publish.key') || !project.hasProperty('gradle.publish.secret')) {
tasks.publishPlugins.enabled(false)
}
gradlePlugin.testSourceSets(sourceSets.functionalTest)
configurations.functionalTestImplementation.extendsFrom(configurations.testImplementation)
// Add a task to run the functional tests
task functionalTest(type: Test) {
group = 'verification'
description = 'Run functional tests using GraalVM'
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
}
task removeFunctionalTestProjects(type: Delete) {
group = 'build'
description = 'Removes test projects'
delete "$buildDir/functionalTest"
}
tasks.withType(Test) {
useJUnitPlatform()
}
tasks.compileFunctionalTestJava.dependsOn('pluginDescriptors')
spotless {
java {
googleJavaFormat()
}
}
check {
dependsOn(tasks.functionalTest)
}
task showVersion {
group = 'help'
doLast {
logger.lifecycle("project: ${project.name}")
logger.lifecycle("group: ${project.group}")
logger.lifecycle("version: ${project.version}")
logger.lifecycle("artifact: ${tasks.jar.archiveFileName.orNull}")
logger.lifecycle("can release plugin: ${tasks.publishPlugins.enabled}")
}
}