-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
230 lines (201 loc) · 7.11 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
id 'com.jfrog.bintray' version '1.8.4'
id 'maven'
id 'org.jetbrains.dokka' version '0.9.18'
id 'org.ajoberstar.git-publish' version '2.1.1'
}
group 'br.com.gamemods'
version '2.0.1-SNAPSHOT'
sourceSets.main.java.srcDirs = ["src/main/kotlin"]
sourceSets.test.java.srcDirs = ["src/test/kotlin"]
sourceCompatibility = 1.8
targetCompatibility = sourceCompatibility
repositories {
jcenter()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect'
compile 'br.com.gamemods:nbt-manipulator:2.0.0'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
install {
repositories.mavenInstaller {
pom.project {
packaging 'jar'
groupId project.group
artifactId project.name
version project.version
name project.name
description "A kotlin/java lib that allows you to read and write MCA files in a clean way"
url "https://github.com/GameModsBR/Region-Manipulator"
inceptionYear '2020'
licenses {
license {
name 'MIT'
url 'https://raw.githubusercontent.com/GameModsBR/Region-Manipulator/master/LICENSE'
distribution 'repo'
}
}
developers {
developer {
id = 'joserobjr'
name = 'José Roberto de Araújo Júnior'
email = '[email protected]'
}
}
scm {
connection "https://github.com/GameModsBR/Region-Manipulator.git"
developerConnection "https://github.com/GameModsBR/Region-Manipulator.git"
url "https://github.com/GameModsBR/Region-Manipulator"
}
}
}
}
if (!ext.has('gamemodsBintrayUser')) {
ext.gamemodsBintrayUser = ""
}
if (!ext.has('gamemodsBintrayApiKey')) {
ext.gamemodsBintrayApiKey = ""
}
bintray {
user = "$gamemodsBintrayUser"
key = "$gamemodsBintrayApiKey"
configurations = ['archives']
pkg {
repo = 'GameMods'
name = 'Region-Manipulator'
userOrg = 'gamemods'
licenses = ['MIT']
vcsUrl = 'https://github.com/GameModsBR/Region-Manipulator.git'
websiteUrl = 'https://github.com/GameModsBR/Region-Manipulator'
//publish = false
version {
name = project.version
desc = "Region-Manipulator version ${project.version}"
//released = new Date()
vcsTag = "v${project.version}"
gpg {
sign = !project.hasProperty('binariesOnly') //Determines whether to GPG sign the files. The default is false
//passphrase = '123' //Optional. The passphrase for GPG signing'
}
}
}
}
//signing {
// sign configurations.archives
//}
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
}
task dokkaKdoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = 'gfm'
outputDirectory = "$buildDir/kdoc"
}
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
task createReadmeFiles(dependsOn: dokkaKdoc) {
doFirst {
Files.walk(Paths.get(dokkaKdoc.outputDirectory))
.filter { it.getFileName().toString().toLowerCase() == "index.md" }
.forEach {
try {
Files.copy(it, it.resolveSibling("README.md"), StandardCopyOption.REPLACE_EXISTING)
} catch (Throwable e) {
throw new RuntimeException(e)
}
}
}
}
task createIndexMd(type: Copy) {
from file("$projectDir/README.md")
into "$buildDir/pages"
rename 'README.md', 'index.md'
}
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
classifier = 'javadoc'
from dokkaJavadoc.outputDirectory
from file("$projectDir/LICENSE")
from file("$projectDir/README.md")
from file("$projectDir/CHANGELOG.md")
}
task sourcesJar(type: Jar) {
from sourceSets.main.java.srcDirs
from file("$projectDir/build.gradle")
from file("$projectDir/gradle.properties")
from file("$projectDir/settings.gradle")
from file("$projectDir/LICENSE")
from file("$projectDir/README.md")
from file("$projectDir/CHANGELOG.md")
classifier = 'sources'
}
jar {
from file("$projectDir/LICENSE")
from file("$projectDir/README.md")
from file("$projectDir/CHANGELOG.md")
}
if (!project.hasProperty('binariesOnly')) {
artifacts {
archives sourcesJar
}
// dokka will fail to build the javadoc jar on newest java versions
// https://github.com/Kotlin/dokka/issues/294
if (JavaVersion.current().majorVersion == "8") {
artifacts {
archives javadocJar
}
if (ext.has('org.ajoberstar.grgit.auth.username')) {
System.setProperty('org.ajoberstar.grgit.auth.username', ext['org.ajoberstar.grgit.auth.username'].toString())
System.setProperty('org.ajoberstar.grgit.auth.password', ext['org.ajoberstar.grgit.auth.password'].toString())
}
dokka {
externalDocumentationLink {
url = new URL('https://gamemodsbr.github.io/NBT-Manipulator/javadoc/')
packageListUrl = new URL("https://gamemodsbr.github.io/NBT-Manipulator/javadoc/package-list")
}
}
gitPublish {
// where to publish to (repo must exist)
repoUri = 'https://github.com/GameModsBR/Region-Manipulator.git'
// where to fetch from prior to fetching from the remote (i.e. a local repo to save time)
referenceRepoUri = file("$projectDir/gh-pages").toURI().toString()
// branch will be created if it doesn't exist
branch = 'gh-pages'
// generally, you don't need to touch this
repoDir = file("$buildDir/gh-pages-repo") // defaults to $buildDir/gitPublish
// what to publish, this is a standard CopySpec
contents {
from("$buildDir/javadoc") {
into 'javadoc'
}
from("$buildDir/kdoc") {
into 'kdoc'
}
from "$buildDir/pages"
from 'src/pages'
from 'README.md'
from 'CHANGELOG.md'
}
// what to keep in the existing branch (include=keep)
preserve {
include '1.0.0/**'
exclude '1.0.0/temp.txt'
}
// message used when committing changes
commitMessage = 'Github Pages update' // defaults to 'Generated by gradle-git-publish'
}
}
}
gitPublishCopy.dependsOn dokkaJavadoc
gitPublishCopy.dependsOn createReadmeFiles
gitPublishCopy.dependsOn createIndexMd