-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
134 lines (116 loc) · 3.4 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
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
import org.codehaus.groovy.runtime.GStringImpl
buildscript {
def versionMajor = 1
def versionMinor = 1
def versionPatch = 2
ext {
versionName = "${versionMajor}.${versionMinor}.${versionPatch}" as GStringImpl
}
dependencies {
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:0.10.1'
}
repositories {
jcenter()
}
}
plugins {
id 'java'
id 'java-library'
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'nu.studer.credentials' version '1.0.7'
}
ext {
mavenUsername = credentials.SONATYPE_NEXUS_USERNAME
mavenPassword = credentials.SONATYPE_NEXUS_PASSWORD
}
group 'net.joeaustin.easyxml'
version "$versionName"
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile group: 'junit', name: 'junit', version: '4.12'
}
apply plugin: 'org.jetbrains.dokka'
def dokkaDir = "$buildDir/dokka"
dokka {
outputFormat = 'html'
outputDirectory = dokkaDir
}
def dokkaJarTaskProvider = tasks.register('dokkaJar', Jar) { task ->
task.archiveClassifier.set('javadoc')
task.from(dokkaDir)
task.dependsOn('dokka')
}
def javadocJarTaskProvider = tasks.register('javadocJar', org.jetbrains.dokka.gradle.DokkaTask) { task ->
task.outputFormat = 'javadoc'
task.outputDirectory = "$buildDir/javadoc"
}
tasks.named('assemble').configure {
it.dependsOn(javadocJarTaskProvider)
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
def isReleaseBuild = !version.endsWith('-SNAPSHOT')
apply plugin: 'maven-publish'
apply plugin: 'nu.studer.credentials'
publishing {
publications {
release(MavenPublication) {
from components.java
artifact dokkaJarTaskProvider.get()
artifact kotlinSourcesJar
pom {
name = 'EasyXml'
description = 'Makes authoring and reading xml very simple.'
url = 'https://github.com/Joe-Austin/EasyXml'
licenses {
license {
name = 'The MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'Joe-Austin'
name = 'Joe AUstin'
}
}
scm {
connection = 'scm:git:git://github.com:Joe-Austin/EasyXml.git'
developerConnection = 'scm:git:ssh://[email protected]:Joe-Austin/EasyXml.git'
url = 'https://github.com/Joe-Austin/EasyXml'
}
}
}
}
repositories {
maven {
url = isReleaseBuild
? 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
: 'https://oss.sonatype.org/content/repositories/snapshots/'
credentials {
username = mavenUsername
password = mavenPassword
}
}
}
}
if (isReleaseBuild) {
apply plugin: 'signing'
signing {
required { gradle.taskGraph.hasTask("publish") }
sign publishing.publications
}
}
tasks.register('publishSnapshot').configure { task ->
if (!isReleaseBuild) {
task.dependsOn(tasks.getByName('publish'))
}
}