-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
61 lines (52 loc) · 1.87 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
//
// Objectives:
//
// - The webui needs to talk to the API server via a HTTP client layer,
// which is generated from a yaml definition file.
// So we need to get hold of a generator tool so we can generate the client.
plugins {
id "org.openapi.generator" version "6.6.0"
}
// Right now, the REST interface spec is always the same version as the galasa framework bundles.
def galasaFrameworkVersion = "0.40.0"
def galasaOpenApiYamlVersion = galasaFrameworkVersion
repositories {
gradlePluginPortal()
mavenCentral()
mavenLocal()
maven {
url "$sourceMaven"
}
}
configurations {
download
}
dependencies {
download group: "dev.galasa", name: "dev.galasa.framework.api.openapi", version: "$galasaOpenApiYamlVersion", ext: "yaml"
}
task downloadRawDependencies(type: Copy) {
// Download the dependencies onto the local disk.
from configurations.download
into 'build/dependencies'
dependsOn configurations.download
}
task downloadDependencies(type: Copy) {
// Rename the complex openapi.yaml file into something easier to use elsewhere.
// So the path to the new file is build/dependencies/openapi.yaml
from "build/dependencies/dev.galasa.framework.api.openapi-${galasaOpenApiYamlVersion}.yaml"
into "build/dependencies"
rename { fileName -> "openapi.yaml" }
dependsOn downloadRawDependencies
}
task generateTypeScriptClient(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
// Generate a TypeScript client using our openapi.yaml file
generatorName.set("typescript")
inputSpec.set("$rootDir/build/dependencies/openapi.yaml")
outputDir.set("$rootDir/galasa-ui/src/generated/galasaapi")
globalProperties.set([
apiTests: "false"
])
// Make sure we download the openapi.yaml file before generating the client code
dependsOn downloadDependencies
}
description = 'Galasa Web UI'