This repository has been archived by the owner on Jul 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
/
build.gradle
158 lines (133 loc) · 4.73 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
plugins {
id "com.jfrog.bintray" version "1.8.4"
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'osgi'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenLocal()
jcenter()
}
dependencies {
compile ("com.vaadin:vaadin-server:${vaadinVersion}")
testCompile "junit:junit:4.12"
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
javadoc {
// this fixes a javadoc issue with vaadin packaging which is quite uncommon
options.addStringOption("sourcepath", "")
}
task createAddonPom {
pom { artifactId = project.artifactId }.writeTo("${sourceSets.main.output.resourcesDir}/META-INF/maven/${project.group}/${project.artifactId}/pom.xml")
}
jar {
createAddonPom
baseName = project.artifactId
// Include sources
// sourceSets.main.java.srcDirs.each {
// from it
// }
manifest {
// the manifest of the default jar is of type OsgiManifest
name = project.artifactId
attributes "Vaadin-Package-Version": "1"
attributes "Implementation-Title": "Chart.js Add-on"
attributes "Implementation-Version": project.version
attributes "Implementation-Vendor": 'Michael Oberwasserlechner'
instruction 'Import-Package', '!com.google.gwt.*', '!com.vaadin.client.*', '*'
instruction 'Bundle-Vendor', 'Michael Oberwasserlechner'
instruction 'Bundle-Description', 'Chart.js Add-on'
instruction 'Bundle-DocURL', 'https://github.com/moberwasserlechner/vaadin-chartjs'
}
}
task vaadinDirectory(type: Zip) {
dependsOn 'jar'
dependsOn 'sourcesJar'
dependsOn 'javadocJar'
// create manifest
mkdir 'build/libs/META-INF'
new File("build/libs/META-INF/MANIFEST.MF").text =
"""Manifest-Version: 1.0
Vaadin-Package-Version: 1
Vaadin-Addon: """+project.artifactId+"""-"""+project.version+""".jar
Vaadin-License-Title: MIT
Implementation-Vendor: Michael Oberwasserlechner
Implementation-Title: Chart.js Add-on
Implementation-Version: """+project.version+"""
"""
from 'build/libs'
include '*.jar'
include '*/*'
destinationDir(file('build/libs/'))
}
// 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
}
// add javadoc/source jar tasks as artifacts
artifacts {
archives sourcesJar, javadocJar
}
// ###################################
// ### Publish to local maven repo ###
// ###################################
publishing {
publications {
mavenJava(MavenPublication) {
artifactId project.artifactId
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
// ##########################
// ### Publish to bintray ###
// ##########################
bintray {
user = project.hasProperty('BINTRAY_USER') ? BINTRAY_USER : null //this usually comes from gradle.properties file in ~/.gradle
key = project.hasProperty('BINTRAY_API_KEY') ? BINTRAY_API_KEY : null //this usually comes from gradle.properties file in ~/.gradle
// configurations = ['archives'] //When uploading configuration files
// - OR -
publications = ['mavenJava'] //When uploading Maven-based publication files
dryRun = false //Whether to run this as dry-run, without deploying
publish = false //If version should be auto published after an upload
// Package configuration. The plugin will use the repo and name properties to check if the package already exists.
// In that case, there's no need to configure the other package properties (like userOrg, desc, etc).
pkg {
repo = 'maven'
name = 'vaadin-chartjs'
//userOrg = 'byteowls' //An optional organization name when the repo belongs to one of the user's orgs
desc = 'Vaadin Add-on for Chart.js chart library'
websiteUrl = 'https://github.com/moberwasserlechner/vaadin-chartjs'
issueTrackerUrl = 'https://github.com/moberwasserlechner/vaadin-chartjs/issues'
vcsUrl = 'https://github.com/moberwasserlechner/vaadin-chartjs.git'
licenses = ['MIT']
labels = ['vaadin', 'addon', 'chartjs', 'charting']
publicDownloadNumbers = true
version {
name = project.version //Bintray logical version name
// desc = 'optional'
vcsTag = project.version
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.6'
}