forked from Mach30/dof
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
38 lines (33 loc) · 1.2 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
/*
* This file was generated by the Gradle 'init' task.
*
* This is a general purpose Gradle build.
* Learn more about Gradle by exploring our samples at https://docs.gradle.org/8.1.1/samples
*/
plugins {
id 'base'
}
def src = "$projectDir/src/linkml"
def schemaOutDir = "schema"
def schemaBuildDir = "$buildDir/$schemaOutDir"
def unifiedSchemaPath = "$schemaBuildDir/dof-cubesat.yaml"
tasks.register('buildUnifiedYaml', Exec) {
inputs.files(fileTree("$src"))
.withPropertyName('sourceFiles')
.withPathSensitivity(PathSensitivity.ABSOLUTE)
outputs.dir(layout.buildDirectory.dir("$schemaOutDir"))
.withPropertyName('outputDir')
commandLine "bash", "-c", "gen-yaml $src/dof_datastructures.yaml --mergeimports > $unifiedSchemaPath"
}
tasks.register('cleanupUnifiedYaml', Exec) {
dependsOn(buildUnifiedYaml)
inputs.files(fileTree("$schemaOutDir"))
.withPropertyName('sourceFiles')
.withPathSensitivity(PathSensitivity.ABSOLUTE)
outputs.dir(layout.buildDirectory.dir("$schemaOutDir"))
.withPropertyName('outputDir')
commandLine "yq", "-i", "del(.imports)", "$unifiedSchemaPath"
}
tasks.named("assemble") {
dependsOn(cleanupUnifiedYaml)
}