This repository was archived by the owner on Sep 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
94 lines (79 loc) · 3.37 KB
/
build.gradle
File metadata and controls
94 lines (79 loc) · 3.37 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
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.openapitools:openapi-generator-gradle-plugin:4.1.3"
}
}
apply plugin: 'org.openapi.generator'
def clientOutputDir = "$projectDir/../$rootProject.gereratedClientsDirName/java".toString()
def resourcesDir = "$projectDir/resources".toString()
def basePackage = "com.criteo.marketing"
def basePackagePath = basePackage.replace(".", "/")
task cleanPreviousJavaBuild(type: Delete) {
group 'Criteo'
description 'Clean up generated client output folder'
delete clientOutputDir
followSymlinks = true
}
task copyLicense(type: Copy) {
group 'Criteo'
description 'Copy the license into the client output folder'
from "$projectDir/../LICENSE"
into clientOutputDir
rename 'LICENSE', 'LICENSE.txt'
}
task copyExamples(type: Copy) {
from "$resourcesDir/examples"
into "$clientOutputDir/src/examples/java/$basePackagePath/".toString()
}
task copyTests(type: Copy) {
from "$resourcesDir/tests/"
into "$clientOutputDir/src/test/java/$basePackagePath/".toString()
}
task removeUnwantedFiles(type: Delete) {
group 'Criteo'
description 'Remove files generated by openapi-generator that we don\'t want to push'
delete fileTree(clientOutputDir) {
include '.openapi-generator-ignore', '.travis.yml', 'git_push.sh',\
'build.sbt', 'src/main/AndroidManifest.xml', 'gradle.properties'
}
followSymlinks = true
}
task generateClient(type: GradleBuild) {
group "Criteo"
description 'Generate the Java client using openapi-generator and custom templates'
tasks = ['cleanPreviousJavaBuild', 'openApiGenerate', 'copyExamples', 'copyTests', 'copyLicense', 'removeUnwantedFiles']
}
def clientPatch = hasProperty('buildNumber') ? buildNumber : '0'
openApiGenerate {
generatorName = "java"
templateDir = "$resourcesDir/templates/".toString()
inputSpec = rootProject.swaggerURL
outputDir = clientOutputDir
removeOperationIdPrefix = true
generateApiTests = false
generateModelTests = false
configOptions = [
groupId : 'com.criteo',
apiPackage : "${basePackage}.api".toString(),
artifactId : 'marketing.java-client',
artifactVersion : "$apiVersion.$clientPatch".toString(),
artifactDescription : 'Criteo Marketing SDK for Java',
artifactUrl : 'https://github.com/criteo/criteo-java-marketing-sdk',
modelPackage : "${basePackage}.model".toString(),
scmConnection : 'scm:git:git://github.com/criteo/criteo-java-marketing-sdk.git',
scmDeveloperConnection : 'scm:git:ssh://github.com:criteo/criteo-java-marketing-sdk.git',
scmUrl : 'https://github.com/criteo/criteo-java-marketing-sdk',
developerName : 'Criteo',
developerEmail : '[email protected]',
developerOrganization : 'Criteo',
developerOrganizationUrl : 'https://www.criteo.com/',
licenseName : 'Apache License, version 2.0',
licenseUrl : 'https://www.apache.org/licenses/LICENSE-2.0.txt',
hideGenerationTimestamp : 'true',
dateLibrary : 'java8',
]
}