Skip to content

Commit 984cef5

Browse files
committed
Move to Gradle Kotlin DSL & maven-publish plugin
1 parent 266c8c0 commit 984cef5

File tree

11 files changed

+194
-191
lines changed

11 files changed

+194
-191
lines changed

build.gradle

Lines changed: 0 additions & 160 deletions
This file was deleted.

build.gradle.kts

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
import com.github.benmanes.gradle.versions.VersionsPlugin
2+
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
3+
4+
val ossrhUsername: String? = System.getenv("OSSRH_USERNAME")
5+
val ossrhPassword: String? = System.getenv("OSSRH_PASSWORD")
6+
val signingPassword: String? = System.getenv("SIGNING_PASSWORD")
7+
val gitCommit = System.getenv("TRAVIS_COMMIT") ?: ""
8+
9+
tasks.wrapper {
10+
gradleVersion = "5.4"
11+
distributionType = Wrapper.DistributionType.ALL
12+
}
13+
14+
plugins {
15+
id("com.github.ben-manes.versions") version "0.21.0"
16+
idea
17+
}
18+
19+
allprojects {
20+
apply<IdeaPlugin>()
21+
apply<VersionsPlugin>()
22+
23+
repositories {
24+
mavenCentral()
25+
}
26+
}
27+
28+
val javaVersion = JavaVersion.VERSION_1_8
29+
30+
idea {
31+
project.jdkName = javaVersion.name
32+
}
33+
34+
subprojects {
35+
group = "ru.bozaro.gitlfs"
36+
version = "0.13.0-SNAPSHOT"
37+
38+
apply<JavaPlugin>()
39+
apply<MavenPublishPlugin>()
40+
41+
configure<JavaPluginExtension> {
42+
sourceCompatibility = javaVersion
43+
targetCompatibility = javaVersion
44+
}
45+
46+
val compile by configurations
47+
val testCompile by configurations
48+
49+
dependencies {
50+
compile("org.jetbrains:annotations:17.0.0")
51+
52+
testCompile("com.google.guava:guava:27.1-jre")
53+
testCompile("org.testng:testng:6.14.3")
54+
}
55+
56+
idea {
57+
module {
58+
isDownloadJavadoc = true
59+
isDownloadSources = true
60+
61+
// Workaround for https://youtrack.jetbrains.com/issue/IDEA-175172
62+
outputDir = file("build/classes/main")
63+
testOutputDir = file("build/classes/test")
64+
}
65+
}
66+
67+
tasks.withType<JavaCompile> {
68+
options.encoding = "UTF-8"
69+
}
70+
71+
tasks.withType<Test> {
72+
useTestNG {
73+
testLogging {
74+
exceptionFormat = TestExceptionFormat.FULL
75+
showStandardStreams = true
76+
}
77+
}
78+
}
79+
80+
val javadoc by tasks.getting(Javadoc::class) {
81+
(options as? CoreJavadocOptions)?.addStringOption("Xdoclint:none", "-quiet")
82+
}
83+
84+
val javadocJar by tasks.creating(Jar::class) {
85+
from(javadoc)
86+
archiveClassifier.set("javadoc")
87+
}
88+
89+
val sourcesJar by tasks.creating(Jar::class) {
90+
val sourceSets: SourceSetContainer by project
91+
from(sourceSets["main"].allSource)
92+
archiveClassifier.set("sources")
93+
}
94+
95+
val secretKeyRingFile = "${rootProject.projectDir}/secring.gpg"
96+
97+
if (signingPassword != null && file(secretKeyRingFile).exists()) {
98+
extra["signing.secretKeyRingFile"] = secretKeyRingFile
99+
extra["signing.keyId"] = "4B49488E"
100+
extra["signing.password"] = signingPassword
101+
102+
configure<SigningExtension> {
103+
val publications: PublicationContainer by project
104+
sign(publications)
105+
}
106+
}
107+
108+
configure<PublishingExtension> {
109+
publications {
110+
create<MavenPublication>(project.name) {
111+
from(components["java"])
112+
113+
artifact(sourcesJar)
114+
artifact(javadocJar)
115+
116+
pom {
117+
url.set("https://github.com/bozaro/git-lfs-java")
118+
119+
scm {
120+
connection.set("scm:git:git://github.com/bozaro/git-lfs-java.git")
121+
tag.set(gitCommit)
122+
url.set("https://github.com/bozaro/git-lfs-java")
123+
}
124+
125+
licenses {
126+
license {
127+
name.set("Lesser General Public License, version 3 or greater")
128+
url.set("http://www.gnu.org/licenses/lgpl.html")
129+
}
130+
}
131+
132+
developers {
133+
developer {
134+
id.set("bozaro")
135+
name.set("Artem V. Navrotskiy")
136+
email.set("[email protected]")
137+
}
138+
139+
developer {
140+
id.set("slonopotamus")
141+
name.set("Marat Radchenko")
142+
email.set("[email protected]")
143+
}
144+
}
145+
}
146+
}
147+
}
148+
149+
if (ossrhUsername != null) {
150+
repositories {
151+
maven {
152+
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
153+
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
154+
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
155+
156+
credentials {
157+
username = ossrhUsername
158+
password = ossrhPassword
159+
}
160+
}
161+
}
162+
}
163+
}
164+
}

gitlfs-client/build.gradle

Lines changed: 0 additions & 10 deletions
This file was deleted.

gitlfs-client/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
description = "Java Git-LFS client library"
2+
3+
dependencies {
4+
compile(project(":gitlfs-common"))
5+
compile("org.apache.httpcomponents:httpclient:4.5.8")
6+
compile("org.slf4j:slf4j-api:1.7.26")
7+
8+
testCompile("org.yaml:snakeyaml:1.24")
9+
testRuntimeOnly("org.slf4j:slf4j-simple:1.7.26")
10+
}

gitlfs-common/build.gradle

Lines changed: 0 additions & 6 deletions
This file was deleted.

gitlfs-common/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
description = "Java Git-LFS common structures"
2+
3+
dependencies {
4+
compile("com.fasterxml.jackson.core:jackson-databind:2.9.8")
5+
compile("com.google.guava:guava:27.1-jre")
6+
}
File renamed without changes.

gitlfs-server/build.gradle

Lines changed: 0 additions & 10 deletions
This file was deleted.

gitlfs-server/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
description = "Java Git-LFS server implementation-free library"
2+
3+
dependencies {
4+
compile(project(":gitlfs-common"))
5+
compile("javax.servlet:javax.servlet-api:4.0.1")
6+
7+
testCompile(project(":gitlfs-client"))
8+
testCompile("org.eclipse.jetty:jetty-servlet:9.4.15.v20190215")
9+
testRuntimeOnly("org.slf4j:slf4j-simple:1.7.26")
10+
}

settings.gradle

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)