How to install and build additional dependency?
falk-stefan opened this issue · 1 comments
falk-stefan commented
I am generating a TypeScript API-client via the task :server.generateClient
in my web-app build.gradle
.
In order to compile the web-app, I need to build and compile the API-client as well which will be located at $rootDir/generated/meditation-rest-client
.
My problem is that I don't know how I can run these two commands
npm --prefix generated/meditation-rest-client/ run build --aot --prod
npm --prefix generated/meditation-rest-client/dist install
at the and of the makeClients
task and then the following for building the web-app:
npm run ng -- build --configuration=development --base-href / --output-path build/ --deploy-url / --prod
How can I run the above commands in my gradle script?
npm_run_build {
inputs.files fileTree('src')
inputs.file 'package.json'
inputs.file 'package-lock.json'
outputs.dir 'build'
}
task makeClients {
doFirst {
def clientDir = tasks.getByPath(':server:generateClient').apiClientDir()
copy {
from clientDir
into 'generated/meditation-rest-client'
}
}
doLast {
// TODO
// npm --prefix generated/meditation-rest-client/ run build --aot --prod
// npm --prefix generated/meditation-rest-client/dist install
}
dependsOn ':server:generateClient'
}
task buildWebApp {
dependsOn tasks.makeClients, npm_run_build
}
assemble.dependsOn buildWebApp
deepy commented
You could create a NpmTask
and have your makeClients
be finalizedBy
that