This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
ScriptCraft/typescript.build.gradle

72 lines
1.4 KiB
Groovy
Raw Normal View History

2020-04-28 16:44:44 +00:00
def typescriptRoot = 'src/main/ts'
2020-04-28 14:16:47 +00:00
def typescriptRootFile = new File(rootDir.absolutePath, typescriptRoot)
2020-04-29 01:13:08 +00:00
def typescriptOut = new File(typescriptRootFile, 'lib/ts')
def dtsOut = new File(typescriptRootFile, 'lib/dts')
task typescript(group: 'typescript', type: Exec) {
2020-04-28 14:16:47 +00:00
inputs.dir typescriptRootFile
2020-04-29 01:13:08 +00:00
outputs.dirs typescriptOut, dtsOut
2020-04-28 14:16:47 +00:00
2020-04-29 01:13:08 +00:00
workingDir typescriptRootFile
2020-04-28 14:16:47 +00:00
2020-04-29 01:13:08 +00:00
executable 'npm'
2020-04-28 14:16:47 +00:00
2020-04-29 01:13:08 +00:00
args 'run', 'build'
2020-04-28 14:16:47 +00:00
2020-04-29 01:13:08 +00:00
doFirst {
project.delete {
delete typescriptOut, dtsOut
2020-04-28 14:16:47 +00:00
}
}
}
2020-04-29 01:13:08 +00:00
task typescriptDist(group: 'typescript', type: Tar) {
into('/types') {
from new File(typescriptRootFile as File, 'src/types')
}
into('/lib') {
from dtsOut
}
archiveName 'typescript-dist.tar.gz'
destinationDir new File(buildDir, 'libs')
compression Compression.GZIP
}
typescriptDist.dependsOn typescript
task eslint(group: 'typescript', type: Exec) {
2020-04-28 14:16:47 +00:00
workingDir typescriptRootFile
executable 'npm'
args 'run', 'eslint'
}
processResources.dependsOn typescript
2020-04-29 01:13:08 +00:00
def typedocOut = new File(typescriptRootFile, 'lib/typedoc')
2020-04-28 14:16:47 +00:00
2020-04-29 01:13:08 +00:00
task typedoc(group: 'typescript', type: Exec) {
2020-04-28 14:16:47 +00:00
inputs.dir typescriptRootFile
outputs.dir typedocOut
2020-04-29 01:13:08 +00:00
workingDir typescriptRootFile
2020-04-28 14:16:47 +00:00
2020-04-29 01:13:08 +00:00
executable 'npm'
2020-04-28 14:16:47 +00:00
2020-04-29 01:13:08 +00:00
args 'run', 'typedoc'
2020-04-28 14:16:47 +00:00
2020-04-29 01:13:08 +00:00
doFirst {
project.delete {
delete typedocOut
2020-04-28 14:16:47 +00:00
}
}
}
processResources {
2020-04-28 16:44:44 +00:00
from(typescriptOut.absolutePath) {
into 'scriptcraft'
}
2020-04-28 14:16:47 +00:00
}