-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.gradle
162 lines (123 loc) · 3.8 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
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
}
}
plugins {
id 'org.ajoberstar.github-pages' version '1.3.1'
id 'org.asciidoctor.gradle.asciidoctor' version '1.5.1'
}
String currentVersion = '0.4.1'
version = currentVersion
subprojects {
apply plugin: 'groovy'
apply plugin: 'checkstyle'
apply plugin: 'codenarc'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
group = 'org.modelcatalogue'
sourceCompatibility = 1.6
targetCompatibility = 1.6
repositories {
jcenter()
}
dependencies {
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
}
// don't forget to update version in CaseReportFormSerializer
version = currentVersion
jar {
manifest.attributes provider: 'gradle'
}
checkstyle {
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
}
codenarc {
configFile = rootProject.file('config/codenarc.xml')
}
test {
reports {
junitXml.enabled = true
html.enabled = true
}
}
// publishing
publishing {
publications {
groovyMaven(MavenPublication) {
from components.java
artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
}
}
}
// set bintrayUser & bintrayKey in gradle.properties
bintray {
user = getPropertyOrUseDefault('bintrayUser', 'fake_user')
key = getPropertyOrUseDefault('bintrayKey', 'fake_key')
publications = ['groovyMaven']
def projectName = project.name
def projectDescription = project.description
pkg {
websiteUrl = 'http://metadataregistry.github.io/spreadsheet-builder/'
issueTrackerUrl = 'https://github.com/MetadataRegistry/spreadsheet-builder/issues'
vcsUrl = 'https://github.com/MetadataRegistry/spreadsheet-builder.git'
repo = 'model-catalogue' // or your repo name
userOrg = 'metadata'
name = projectName // somehow project.* doesn't work in this closure
desc = projectDescription
licenses = ['Apache-2.0']
}
// dryRun = true // whether to run this as dry-run, without deploying
}
// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar, javadocJar
}
}
// asciidoctor publishing
asciidoctor {
sourceDir = file('docs')
resources {
from(sourceDir) {
include 'css/**', 'images/**'
}
}
attributes 'docinfo1': ['version': currentVersion],
'imagesdir': 'images',
'source-highlighter': 'highlight.js',
'stylesdir': 'css',
icons: 'font',
'toc': 'left',
version: project.version,
'projectUrl': 'https://github.com/MetadataRegistry/spreadsheet-builder'
}
githubPages {
repoUri = 'https://github.com/MetadataRegistry/spreadsheet-builder.git'
credentials {
username = getPropertyOrUseDefault('githubToken', '')
password = ''
}
pages {
from file(asciidoctor.outputDir.path + '/html5')
}
}
publishGhPages.dependsOn asciidoctor
String getPropertyOrUseDefault(String propertyName, String defaultValue) {
hasProperty(propertyName) ? getProperty(propertyName) : defaultValue
}