0

I'm trying to run two different tasks, one for a staging environment and the other for production. These tasks have dependency on the architecture where it is being ran, because they use Native Libraries. Is it possible to run the task with an argument so I can point the proper native library for the run?

task stagingRun(type: JavaExec) {

classpath = sourceSets.main.runtimeClasspath
main = 'project.JavaApp'

systemProperty "java.library.path", "libs/NORDIC/NativeLibraries/NatLinux64"

systemProperty 'SILVERBACK_URL', 'https://myback.com/api/'
systemProperty 'DATABASE_PATH', 'jdbc:h2:file:./data/backUp;AUTO_RECONNECT=TRUE'
systemProperty 'BACKUP_PATH', "main/data/backup.json"
}

task deployRun(type: JavaExec) {

classpath = sourceSets.main.runtimeClasspath
main = 'project.JavaApp'

systemProperty "java.library.path", "libs/NORDIC/NativeLibraries/NatWin64"

systemProperty 'SILVERBACK_URL', 'https://myback.production.com/api/'
systemProperty 'DATABASE_PATH', 'jdbc:h2:file:/data/backUp;AUTO_RECONNECT=TRUE'
systemProperty 'BACKUP_PATH', "/data/backup.json"
}
JoshDM
  • 4,939
  • 7
  • 43
  • 72
Nilo_DS
  • 889
  • 7
  • 14
  • 1
    Your staging environment is a different architecture than your production environment? ::shudder:: – dnault Apr 26 '16 at 23:22
  • yes, Stagging is in an Ubuntu computer and production is in a Windows. But we also need to run the staging task in MacOS. and we want to know if it is possible to run it with the same task or we need to have a different task for each architecture? – Nilo_DS Apr 27 '16 at 13:44
  • What about different [source sets](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.SourceSet.html) for different environments? – franta kocourek Jul 13 '16 at 10:14

0 Answers0