forked from joffrey-bion/fx-gson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
148 lines (128 loc) · 3.74 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
// bintray plugin is used to upload artifacts to a bintray repo
plugins { id "com.jfrog.bintray" version "1.7.3" }
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
group = 'org.hildan.fxgson'
version = '3.1.0'
description = 'A set of type adapters for Google Gson to make JavaFX properties serialization more natural.'
ext.labels = ['json', 'gson', 'javafx', 'property']
ext.licenses = ['MIT']
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
configurations {
checkstyleConfig
}
dependencies {
compile 'com.google.code.gson:gson:2.8.1'
compile 'org.jetbrains:annotations:15.0'
testCompile 'junit:junit:4.+'
checkstyleConfig 'org.hildan.checkstyle:checkstyle-config:2.1.0'
}
checkstyle {
maxWarnings = 0
toolVersion = '8.2'
config = resources.text.fromArchiveEntry(configurations.checkstyleConfig, "checkstyle.xml")
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 1.0
}
}
}
}
check.dependsOn jacocoTestCoverageVerification
def getPropOrEnv = { String prop, String envVar, String defaultValue = null ->
if (project.hasProperty(prop)) {
return project.property(prop)
}
return System.getenv(envVar) ?: defaultValue
}
ext {
githubUser = getPropOrEnv('githubUser', 'GITHUB_USER')
githubRepoName = project.name
githubSlug = "$githubUser/$githubRepoName"
githubRepoUrl = "https://github.com/$githubSlug"
ossrhUserToken = getPropOrEnv('ossrhUserToken', 'OSSRH_USER_TOKEN')
ossrhKey = getPropOrEnv('ossrhKey', 'OSSRH_KEY')
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
}
def pomConfig = {
scm {
url githubRepoUrl
connection 'scm:git:' + githubRepoUrl + '.git'
developerConnection 'scm:git:[email protected]:' + githubSlug + '.git'
}
licenses {
license {
name 'The MIT License'
url 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
name 'Joffrey Bion'
email '[email protected]'
}
}
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom.withXml {
def root = asNode()
root.appendNode('name', project.name)
root.appendNode('description', project.description)
root.appendNode('url', githubRepoUrl)
root.children().last() + pomConfig
}
}
}
}
bintray {
user = getPropOrEnv('bintrayUser', 'BINTRAY_USER')
key = getPropOrEnv('bintrayApiKey', 'BINTRAY_KEY')
publications = ['maven']
publish = true
pkg {
repo = getPropOrEnv('bintrayRepoLibs', 'BINTRAY_REPO_LIBS')
name = project.name
desc = project.description
labels = project.labels ?: [project.name]
licenses = project.licenses ?: []
websiteUrl = githubRepoUrl
issueTrackerUrl = githubRepoUrl + '/issues'
vcsUrl = githubRepoUrl + '.git'
githubRepo = githubSlug
version {
desc = project.description
vcsTag = 'v' + project.version
gpg { sign = true }
mavenCentralSync {
sync = true
user = ossrhUserToken
password = ossrhKey
}
}
}
}
apply from: 'gradle/scripts/release.gradle'
bintrayUpload.dependsOn(build)
release.dependsOn(bintrayUpload)