generated from ivoa/DataModelTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
161 lines (132 loc) · 5.25 KB
/
build.gradle.kts
File metadata and controls
161 lines (132 loc) · 5.25 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
plugins {
// this plugin provides all the vo-dml functionality
id("net.ivoa.vo-dml.vodmltools") version "0.5.31"
id("org.kordamp.gradle.jandex") version "1.1.0"
`maven-publish`
signing
}
group = "net.ivoa.dm"
version = "0.9-SNAPSHOT"
vodml {
vodmlDir.set(file("vo-dml"))
vodslDir.set(file("model"))
bindingFiles.setFrom(file("vo-dml/ADQLGeomDM-v1.vodml-binding.xml"))
outputDocDir.set(layout.projectDirectory.dir("doc/std/vodml-generated"))
outputSiteDir.set(layout.projectDirectory.dir("doc/site/generated")) // N.B the last part of this path must be "generated"
}
/* uncomment below to run the generation of vodml from vodsl automatically */
//tasks.named("vodmlJavaGenerate") {
// dependsOn("vodslToVodml")
//}
//tasks.named("vodmlSchema") {
// dependsOn("vodslToVodml")
//}
//tasks.named("vodmlSite") {
// dependsOn("vodslToVodml")
//}
tasks.test {
useJUnitPlatform()
}
tasks.compileTestJava { //gradle forces us to make this declaration.
mustRunAfter(tasks.jandex)
}
dependencies {
//all data models will want to depend on the base model at least
api("net.ivoa.vo-dml:ivoa-base:1.0-SNAPSHOT") //use API if model exposes any of these base types in API
api("org.javastro.ivoa.core:pgsphere:0.9-SNAPSHOT")
// the dependencies below are related to testing
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
implementation("org.slf4j:slf4j-api:1.7.32")
testRuntimeOnly("ch.qos.logback:logback-classic:1.5.13")
testImplementation("org.javastro:jaxbjpa-utils:0.2.3")
testImplementation("org.javastro:jaxbjpa-utils:0.2.3:test")
testImplementation("org.geolatte:geolatte-geom:1.9.0")
implementation("org.hibernate.orm:hibernate-spatial:6.5.3.Final")
testImplementation("org.orbisgis:h2gis:2.2.5")
}
// site tasks
tasks.register<Copy>("copyJavaDocForSite") {
from(layout.buildDirectory.dir("docs/javadoc"))
into(vodml.outputSiteDir.dir("javadoc"))
dependsOn(tasks.javadoc)
}
tasks.register<Copy>("copySchemaForSite") {
from(layout.buildDirectory.dir("generated/sources/vodml/schema"))
into(vodml.outputSiteDir.dir("schema"))
dependsOn("vodmlSchema")
}
tasks.register<Exec>("makeSiteNav")
{
commandLine("yq","eval", "(.nav | .. | select(has(\"AutoGenerated Documentation\"))|.[\"AutoGenerated Documentation\"]) += (load(\"doc/site/generated/allnav.yml\")|sort_by(keys|.[0]))", "mkdocs_template.yml")
standardOutput= file("mkdocs.yml").outputStream()
dependsOn("vodmlSite")
dependsOn("copyJavaDocForSite")
dependsOn("copySchemaForSite")
}
tasks.register<Exec>("testSite"){
commandLine("mkdocs", "serve")
dependsOn("makeSiteNav")
}
tasks.register<Exec>("doSite"){
commandLine("mkdocs", "gh-deploy", "--force")
dependsOn("makeSiteNav")
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
withSourcesJar()
}
tasks.withType<Jar> { duplicatesStrategy = DuplicatesStrategy.INCLUDE } //IMPL bugfix - see https://stackoverflow.com/questions/67265308/gradle-entry-classpath-is-a-duplicate-but-no-duplicate-handling-strategy-has-b
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
name.set("ADQL Geometry types data model")
description.set("A model for organising execution in a distributed system")
url.set("https://github.com/ivoa/ADQLGeomDM")
licenses {
license {
name.set("GNU General Public License v3.0")
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
}
}
developers {
developer {
id.set("pahjbo")
name.set("Paul Harrison")
email.set("paul.harrison@manchester.ac.uk")
}
}
scm {
connection.set("scm:git:git://github.com/ivoa/ADQLGeomDM.git")
developerConnection.set("scm:git:ssh://github.com/ivoa/ADQLGeomDM.git")
url.set("https://github.com/ivoa/ADQLGeomDM")
}
}
}
}
repositories {
// TODO really want to publish to a repo run by the IVOA
maven {
name = "uksrcrepo"
credentials {
username = (findProperty("uksrcNexusUsername") ?: System.getenv("UKSRC_REPO_USERNAME")) as String?
password = (findProperty("uksrcNexusPassword") ?: System.getenv("UKSRC_REPO_PASSWORD")) as String?
}
val releasesRepoUrl = uri("https://repo.dev.uksrc.org/repository/maven-releases/")
val snapshotsRepoUrl = uri("https://repo.dev.uksrc.org/repository/maven-snapshots/")
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
}
}
}
extra["isReleaseVersion"] = !version.toString().endsWith("SNAPSHOT")
signing {
useGpgCmd()
sign(publishing.publications["mavenJava"])
}
tasks.withType<Sign>().configureEach {
onlyIf("isReleaseVersion is set") { project.extra["isReleaseVersion"] as Boolean }
}