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

93 lines
1.8 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-30 00:32:07 +00:00
def nodeModules = new File(typescriptRootFile, 'node_modules')
2020-04-29 23:41:08 +00:00
task typescriptInstall(group: 'typescript', type: Exec) {
inputs.file new File(typescriptRootFile, 'package.json')
outputs.dir nodeModules
workingDir typescriptRootFile
executable 'npm'
args 'install'
}
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 23:41:08 +00:00
typescript.dependsOn typescriptInstall
2020-05-23 16:57:31 +00:00
task typescriptAPI(group: 'typescript', type: Jar) {
2020-05-23 16:34:41 +00:00
into('types') {
from new File(typescriptRootFile as File, 'src/types')
}
into('lib') {
from dtsOut
2020-04-29 01:13:08 +00:00
}
2020-04-29 14:58:27 +00:00
classifier 'api'
2020-04-29 01:13:08 +00:00
}
2020-04-29 16:47:26 +00:00
typescriptAPI.dependsOn typescript
2020-04-29 14:58:27 +00:00
artifacts {
2020-04-29 16:47:26 +00:00
archives typescriptAPI
2020-04-29 14:58:27 +00:00
}
2020-04-29 01:13:08 +00:00
task eslint(group: 'typescript', type: Exec) {
2020-04-28 14:16:47 +00:00
workingDir typescriptRootFile
executable 'npm'
args 'run', 'eslint'
}
2020-04-29 23:41:08 +00:00
eslint.dependsOn typescriptInstall
2020-04-28 14:16:47 +00:00
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
}
}
}
2020-04-29 23:41:08 +00:00
typedoc.dependsOn typescriptInstall
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
}