-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
140 lines (120 loc) · 3.74 KB
/
build.gradle.kts
File metadata and controls
140 lines (120 loc) · 3.74 KB
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
plugins {
id("edu.sc.seis.version-class") version "1.3.0"
// Apply the java-library plugin to add support for Java Library
`java-library`
`java-library-distribution`
`maven-publish`
signing
id("com.github.ben-manes.versions") version "0.51.0"
}
group = "edu.sc.seis"
version = "1.2.0"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
tasks.register("versionToVersionFile") {
inputs.files("build.gradle.kts")
outputs.files("VERSION")
File("VERSION").writeText(""+version)
}
distributions {
main {
distributionBaseName = "seedCodec"
contents {
from(tasks.named("javadoc")) {
into("javadoc")
}
from(tasks.named("versionToVersionFile")) {
into(".")
}
from(".") {
include("LICENSE")
include("README.md")
include("build.gradle.kts")
include("settings.gradle.kts")
include("src/**")
include("gradle/**")
include("gradlew")
include("gradlew.bat")
}
}
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
name.set("seedCodec")
description.set("A collection of compression and decompression routines for standard seismic data formats in Java.")
url.set("http://www.seis.sc.edu/seedCodec.html")
scm {
connection.set("scm:git:https://github.com/crotwell/seedCodec.git")
developerConnection.set("scm:git:https://github.com/crotwell/seedCodec.git")
url.set("https://github.com/crotwell/seedCodec")
}
licenses {
license {
name.set("GNU Lesser General Public License, Version 3")
url.set("https://www.gnu.org/licenses/lgpl-3.0.txt")
}
}
developers {
developer {
id.set("crotwell")
name.set("Philip Crotwell")
email.set("[email protected]")
}
}
}
}
}
repositories {
maven {
name = "TestDeploy"
url = uri(layout.buildDirectory.dir("repos/test-deploy"))
}
maven {
val releaseRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotRepo = "https://oss.sonatype.org/content/repositories/snapshots/"
url = uri(if ( version.toString().lowercase().endsWith("snapshot")) snapshotRepo else releaseRepo)
name = "ossrh"
// credentials in gradle.properties as ossrhUsername and ossrhPassword
credentials(PasswordCredentials::class)
}
}
}
signing {
sign(publishing.publications["mavenJava"])
}
repositories {
mavenCentral()
}
dependencies {
// Use JUnit Jupiter API for testing.
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.0")
// Use JUnit Jupiter Engine for testing.
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.0")
}
tasks {
jar {
manifest {
attributes(
mapOf("Automatic-Module-Name" to "edu.sc.seis.seedCodec",
"Implementation-Title" to project.name,
"Implementation-Version" to project.version)
)
}
}
}
val test by tasks.getting(Test::class) {
// Use junit platform for unit tests
useJUnitPlatform()
}
tasks.named("sourcesJar") {
dependsOn("makeVersionClass")
}
tasks.get("assemble").dependsOn("versionToVersionFile")