-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
96 lines (83 loc) · 2.54 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
plugins {
id 'java'
id 'maven-publish'
id 'jacoco'
}
group 'grapefruit'
version '1.5.0'
sourceCompatibility = JavaVersion.VERSION_16
repositories {
mavenCentral()
google()
}
dependencies {
compileOnly 'org.jetbrains:annotations:23.0.0'
implementation ('com.google.guava:guava:31.0.1-jre') {
exclude module: 'gson'
exclude module: 'error_prone_annotations'
exclude module: 'jsr305'
exclude module: 'failureaccess'
exclude module: 'listenablefuture'
exclude module: 'j2objc-annotations'
exclude module: 'checker-qual'
}
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}
test {
useJUnitPlatform()
}
test.finalizedBy jacocoTestReport
jacocoTestReport.dependsOn test
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.java.srcDirs
}
artifacts {
archives sourcesJar
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'grapefruit'
from components.java
artifact sourcesJar
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'Grapefruit'
description = 'A command parsing library'
url = 'https://github.com/HgeX/grapefruit'
licenses {
license {
name = 'GNU General Public License v3.0'
url = 'https://www.gnu.org/licenses/gpl-3.0.txt'
}
}
}
pom.withXml {
asNode().dependencies.'*'.findAll() {
it.scope.text() == 'runtime' && project.configurations.default.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each() {
it.scope*.value = 'compile'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = layout.buildDirectory.dir('repos/releases')
def snapshotsRepoUrl = layout.buildDirectory.dir('repos/snapshots')
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}