-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
79 lines (68 loc) · 2.08 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
group 'org.openmbee.swagger'
version '1.0.1'
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.8
String buildTag = project.getProperties().get('buildTag')
if (buildTag != null && !buildTag.isEmpty() && buildTag != version) {
throw new GradleException('Version mismatch.')
}
if (buildTag == null || buildTag.isEmpty() || project.getProperties().getOrDefault('artifactoryRepository', '').toLowerCase().contains('snapshot')) {
version += '-SNAPSHOT'
}
String buildNumber = project.getProperties().getOrDefault('buildNumber', System.currentTimeSeconds());
buildscript {
repositories {
jcenter()
}
dependencies {
classpath group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.4.0'
}
}
repositories {
jcenter()
}
dependencies {
compile group: 'io.swagger', name: 'swagger-codegen', version:'2.2.3'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar {
classifier 'sources'
}
artifact javadocJar {
classifier 'javadoc'
}
}
}
}
artifactory {
contextUrl = project.getProperties().get('artifactoryUrl')
publish {
repository {
repoKey = project.getProperties().get('artifactoryRepository')
username = project.getProperties().get('artifactoryUsername')
password = project.getProperties().get('artifactoryPassword')
}
defaults {
publications('mavenJava')
}
clientConfig.setIncludeEnvVars(true)
if (buildNumber != null && !buildNumber.isEmpty()) {
clientConfig.info.setBuildNumber(buildNumber)
}
}
}
artifactoryPublish.dependsOn(assemble, sourcesJar, javadocJar)