Skip to content

Commit 4593c54

Browse files
Gradle KTS: convert objectbox-java-api build script
1 parent 02e9418 commit 4593c54

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

objectbox-java-api/build.gradle.kts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,32 @@ plugins {
55

66
// Note: use release flag instead of sourceCompatibility and targetCompatibility to ensure only JDK 8 API is used.
77
// https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation
8-
tasks.withType(JavaCompile).configureEach {
8+
tasks.withType<JavaCompile> {
99
options.release.set(8)
1010
}
1111

12-
tasks.register('javadocJar', Jar) {
13-
dependsOn javadoc
14-
archiveClassifier.set('javadoc')
15-
from 'build/docs/javadoc'
12+
val javadocJar by tasks.registering(Jar::class) {
13+
dependsOn(tasks.javadoc)
14+
archiveClassifier.set("javadoc")
15+
from("build/docs/javadoc")
1616
}
1717

18-
tasks.register('sourcesJar', Jar) {
19-
from sourceSets.main.allSource
20-
archiveClassifier.set('sources')
18+
val sourcesJar by tasks.registering(Jar::class) {
19+
from(sourceSets.main.get().allSource)
20+
archiveClassifier.set("sources")
2121
}
2222

2323
// Set project-specific properties.
24-
publishing.publications {
25-
mavenJava(MavenPublication) {
26-
from components.java
27-
artifact sourcesJar
28-
artifact javadocJar
29-
pom {
30-
name = 'ObjectBox API'
31-
description = 'ObjectBox is a fast NoSQL database for Objects'
24+
publishing {
25+
publications {
26+
getByName<MavenPublication>("mavenJava") {
27+
from(components["java"])
28+
artifact(sourcesJar)
29+
artifact(javadocJar)
30+
pom {
31+
name.set("ObjectBox API")
32+
description.set("ObjectBox is a fast NoSQL database for Objects")
33+
}
3234
}
3335
}
3436
}

0 commit comments

Comments
 (0)