-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
134 lines (111 loc) · 3.96 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
plugins {
id "com.gradle.plugin-publish" version "0.16.0"
id 'maven-publish'
id 'java-gradle-plugin'
id 'com.github.johnrengelman.shadow' version '7.1.0'
id 'groovy'
id "com.github.ethankhall.semantic-versioning" version "1.1.0"
id "com.github.ben-manes.versions" version "0.39.0"
id "com.github.hierynomus.license" version "0.16.1"
}
project.version.with {
major = badassJarVersionMajor as int
minor= badassJarVersionMinor as int
patch = badassJarVersionPatch as int
if (project.hasProperty('badassJarVersionLabel')) {
preRelease = badassJarVersionLabel
}
releaseBuild = Boolean.valueOf(badassJarReleaseBuild)
}
ext.badassJarVersion = project.version as String
ext.badassJarTag = Boolean.valueOf(badassJarReleaseBuild) ? "v$ext.badassJarVersion" : 'master'
group = 'org.beryx'
version = badassJarVersion
ext.asmVersion = '9.2'
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
sourceCompatibility = 1.8
def defaultEncoding = 'UTF-8'
[compileJava, compileTestJava]*.options*.encoding = defaultEncoding
[compileGroovy, compileTestGroovy]*.options*.encoding = defaultEncoding
[compileGroovy, compileTestGroovy]*.groovyOptions*.encoding = defaultEncoding
sourceSets.main.java.srcDirs = []
sourceSets.main.groovy.srcDirs = ["src/main/java", "src/main/groovy"]
configurations {
plugin.description = 'Plugin\'s dependencies'
implementation.extendsFrom plugin
[apiElements, runtimeElements].each {
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) }
it.outgoing.artifact(shadowJar)
}
}
dependencies {
implementation gradleTestKit()
implementation localGroovy()
plugin 'com.github.javaparser:javaparser-core:3.13.5'
plugin "org.ow2.asm:asm:$asmVersion"
plugin "org.ow2.asm:asm-commons:$asmVersion"
plugin "org.ow2.asm:asm-tree:$asmVersion"
plugin "org.ow2.asm:asm-util:$asmVersion"
plugin "org.ow2.asm:asm-analysis:$asmVersion"
testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0'
testImplementation 'cglib:cglib-nodep:3.3.0'
testImplementation 'org.objenesis:objenesis:3.2'
testImplementation 'com.athaydes:spock-reports:2.1-groovy-3.0'
}
shadowJar {
configurations = [project.configurations.plugin]
archiveClassifier = null
dependencies {
include(dependency('com.github.javaparser:javaparser-core:3.13.5'))
include(dependency("org.ow2.asm:asm:$asmVersion"))
include(dependency("org.ow2.asm:asm-commons:$asmVersion"))
include(dependency("org.ow2.asm:asm-tree:$asmVersion"))
include(dependency("org.ow2.asm:asm-util:$asmVersion"))
include(dependency("org.ow2.asm:asm-anaysis:$asmVersion"))
}
relocate 'com.github.javaparser', 'org.beryx.jar.shadow.javaparser'
relocate 'org.objectweb.asm', 'org.beryx.jar.shadow.asm'
}
jar.enabled = false
jar.dependsOn shadowJar
gradlePlugin {
plugins {
badassJar {
id = 'org.beryx.jar'
implementationClass = 'org.beryx.jar.BadassJarPlugin'
}
}
}
pluginBundle {
website = 'https://github.com/beryx/badass-jar-plugin/'
vcsUrl = 'https://github.com/beryx/badass-jar-plugin'
description = 'A Gradle plugin that lets you create modular jars compatible with pre-Java 9 versions'
tags = ['jar', 'jpms', 'module-info']
plugins {
badassJar {
displayName = 'Badass Jar Plugin'
}
}
}
jar {
manifest {
attributes 'Implementation-Title': "${project.archivesBaseName}",
'Implementation-Version': badassJarVersion
}
}
license {
header rootProject.file("license-header.txt")
skipExistingHeaders true
ignoreFailures false
excludes(['**/*.properties'])
}
test {
testLogging {
exceptionFormat = 'full'
}
}