-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathbuild.gradle
More file actions
106 lines (91 loc) · 2.91 KB
/
Copy pathbuild.gradle
File metadata and controls
106 lines (91 loc) · 2.91 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
plugins {
id "com.diffplug.spotless" version "8.1.0" apply false
id("com.vanniktech.maven.publish") version "0.35.0"
}
if (!hasProperty("release") && !version.endsWith("-SNAPSHOT")) {
version += "-SNAPSHOT"
}
// Display version
println "Building version: $version"
// Configuración común para todos los subproyectos
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'com.diffplug.spotless'
apply plugin: 'com.vanniktech.maven.publish'
group = 'com.bladecoder.ink'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'junit:junit:4.13'
}
// DISABLES JAVADOC ULTRACHECKS IN JDK8
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
spotless {
java {
target fileTree('src') {
include '**/*.java'
}
toggleOffOn()
palantirJavaFormat()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}
jar {
manifest {
attributes(
'github' : 'https://github.com/bladecoder/blade-ink/',
'license' : 'Apache-2.0',
'group' : project.group,
'version' : project.version,
'java' : project.java.targetCompatibility,
'timestamp': System.currentTimeMillis()
)
}
}
javadoc {
options {
memberLevel = JavadocMemberLevel.PUBLIC
author true
setUse true
encoding "UTF-8"
}
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
publishing {
repositories {
maven {
def releasesRepoUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://central.sonatype.com/repository/maven-snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username project.hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "$System.env.NEXUS_USERNAME"
password project.hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "$System.env.NEXUS_PASSWORD"
}
}
}
}
}