-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
88 lines (66 loc) · 1.85 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
import org.apache.tools.ant.taskdefs.condition.Os
plugins {
id 'org.openapi.generator' version "$openApiGenVersion"
}
def genFolder = "$rootDir/generated"
def rtFolder = "$rootDir/Runtime"
task clean(type: Delete) {
delete "$genFolder"
delete "$rtFolder"
delete fileTree("$rootDir") { include "**/*.meta" }
}
task generateOpenApi(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
generatorName = 'csharp'
inputSpec = "vrem-oas.json"
packageName = "Ch.Unibas.Dmi.Dbis.Vrem.Client"
outputDir = "$genFolder"
skipValidateSpec = true
configOptions = [
optionalEmitDefaultValues: "true"
]
}
task modex(type: Exec) {
mustRunAfter generateOpenApi
workingDir "$genFolder"
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine "chmod", "+x", "$genFolder/build.sh"
}
}
task buildOpenApi(type: Exec) {
dependsOn generateOpenApi
mustRunAfter modex
workingDir "$genFolder"
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine = "$genFolder.bat"
} else {
dependsOn "modex"
commandLine = "$genFolder/build.sh"
}
}
task purgeLibs(type: Delete) {
mustRunAfter buildOpenApi
delete "$genFolder/bin/JsonSubTypes.dll"
// delete "$genFolder/bin/Newtonsoft.Json.dll"
}
task deployLibs(type: Copy) {
dependsOn buildOpenApi
dependsOn purgeLibs
from file("$genFolder/bin")
into file("$rtFolder")
// Automatically rename everything to prevent Unity from identifying packages as duplicates.
rename('(.*)\\.([a-zA-Z0-9_-]*)', '$1.Vrem.$2')
}
task deployLink(type: Copy) {
dependsOn buildOpenApi
from file("link.xml")
into file("$rtFolder")
}
task deploy {
dependsOn deployLibs
dependsOn deployLink
}
task deployAndTidy(type: Delete) {
dependsOn deploy
mustRunAfter deploy
delete "$genFolder"
}