TheBrokenRail
48796de9de
Some checks failed
ScriptCraft/pipeline/head There was a failure building this commit
76 lines
1.6 KiB
Groovy
76 lines
1.6 KiB
Groovy
def typescriptRoot = 'src/main/ts'
|
|
def typescriptRootFile = new File(rootDir.absolutePath, typescriptRoot)
|
|
|
|
def typescriptOut = new File(typescriptRootFile, 'build/ts')
|
|
|
|
def nodeModules = new File(typescriptRootFile, 'node_modules')
|
|
|
|
task typescriptInstall(group: 'typescript', type: Exec) {
|
|
inputs.file new File(typescriptRootFile, 'package.json')
|
|
outputs.dir nodeModules
|
|
|
|
workingDir typescriptRootFile
|
|
|
|
executable 'npm'
|
|
|
|
args 'install'
|
|
|
|
doFirst {
|
|
project.delete {
|
|
delete nodeModules
|
|
}
|
|
}
|
|
}
|
|
|
|
def typescriptDependencies = new File(typescriptRootFile, 'build/dependencies')
|
|
|
|
configurations {
|
|
typescript {
|
|
transitive false
|
|
}
|
|
}
|
|
|
|
task extractTypescriptDependencies(group: 'typescript') {
|
|
doFirst {
|
|
project.delete {
|
|
delete typescriptDependencies
|
|
}
|
|
typescriptDependencies.mkdirs()
|
|
configurations.typescript.resolve().each { file ->
|
|
project.copy {
|
|
from(zipTree(file).matching {
|
|
exclude 'META-INF', 'META-INF/**'
|
|
})
|
|
into typescriptDependencies
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
task typescript(group: 'typescript', type: Exec) {
|
|
inputs.dir typescriptRootFile
|
|
outputs.dirs typescriptOut
|
|
|
|
workingDir typescriptRootFile
|
|
|
|
executable 'npm'
|
|
|
|
args 'run', 'build'
|
|
|
|
doFirst {
|
|
project.delete {
|
|
delete typescriptOut
|
|
}
|
|
}
|
|
}
|
|
|
|
typescript.dependsOn typescriptInstall
|
|
typescript.dependsOn extractTypescriptDependencies
|
|
|
|
processResources.dependsOn typescript
|
|
|
|
processResources {
|
|
from(typescriptOut.absolutePath) {
|
|
into 'scriptcraft'
|
|
}
|
|
} |