diff options
author | Jake Petroules <jake.petroules@petroules.com> | 2015-05-05 23:50:44 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@petroules.com> | 2015-05-08 01:49:26 +0000 |
commit | 86325123df6c8b3d69e1134276b1cacf13a33fb8 (patch) | |
tree | db7fc7c65ee45a9f78e2b7918810e35707e2d4c8 /share/qbs/modules | |
parent | 3dac2a96bd8f8814cf8a9e71319030449af0c242 (diff) | |
download | qbs-86325123df6c8b3d69e1134276b1cacf13a33fb8.tar.gz |
Refactor javac arguments into the JS file to prepare for fixes.
Change-Id: Ibfd1740fe2a28da0f6b21132038df96819660109
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'share/qbs/modules')
-rw-r--r-- | share/qbs/modules/java/JavaModule.qbs | 36 | ||||
-rw-r--r-- | share/qbs/modules/java/utils.js | 37 |
2 files changed, 39 insertions, 34 deletions
diff --git a/share/qbs/modules/java/JavaModule.qbs b/share/qbs/modules/java/JavaModule.qbs index d89e91b24..cb6b19277 100644 --- a/share/qbs/modules/java/JavaModule.qbs +++ b/share/qbs/modules/java/JavaModule.qbs @@ -91,40 +91,8 @@ Module { return oFilePaths; } prepare: { - var i; - var outputDir = ModUtils.moduleProperty(product, "classFilesDir"); - var classPaths = [outputDir]; - var additionalClassPaths = ModUtils.moduleProperties(product, "additionalClassPaths"); - if (additionalClassPaths) - classPaths = classPaths.concat(additionalClassPaths); - for (i in inputs["java.jar"]) - classPaths.push(inputs["java.jar"][i].filePath); - var debugArg = product.moduleProperty("qbs", "buildVariant") === "debug" - ? "-g" : "-g:none"; - var args = [ - "-classpath", classPaths.join(product.moduleProperty("qbs", "pathListSeparator")), - "-s", product.buildDirectory, - debugArg, "-d", outputDir - ]; - var runtimeVersion = ModUtils.moduleProperty(product, "runtimeVersion"); - if (runtimeVersion) - args.push("-target", runtimeVersion); - var languageVersion = ModUtils.moduleProperty(product, "languageVersion"); - if (languageVersion) - args.push("-source", languageVersion); - var bootClassPaths = ModUtils.moduleProperties(product, "bootClassPaths"); - if (bootClassPaths && bootClassPaths.length > 0) - args.push("-bootclasspath", bootClassPaths.join(';')); - if (!ModUtils.moduleProperty(product, "enableWarnings")) - args.push("-nowarn"); - if (ModUtils.moduleProperty(product, "warningsAsErrors")) - args.push("-Werror"); - var otherFlags = ModUtils.moduleProperty(product, "additionalCompilerFlags") - if (otherFlags) - args = args.concat(otherFlags); - for (i = 0; i < inputs["java.java"].length; ++i) - args.push(inputs["java.java"][i].filePath); - var cmd = new Command(ModUtils.moduleProperty(product, "compilerFilePath"), args); + var cmd = new Command(ModUtils.moduleProperty(product, "compilerFilePath"), + JavaUtils.javacArguments(product, inputs)); cmd.description = "Compiling Java sources"; cmd.highlight = "compiler"; return [cmd]; diff --git a/share/qbs/modules/java/utils.js b/share/qbs/modules/java/utils.js index fc8f1392c..133769b36 100644 --- a/share/qbs/modules/java/utils.js +++ b/share/qbs/modules/java/utils.js @@ -41,3 +41,40 @@ function extractPackageName(filePath) return ""; return packageName; } + +function javacArguments(product, inputs) { + var i; + var outputDir = ModUtils.moduleProperty(product, "classFilesDir"); + var classPaths = [outputDir]; + var additionalClassPaths = ModUtils.moduleProperties(product, "additionalClassPaths"); + if (additionalClassPaths) + classPaths = classPaths.concat(additionalClassPaths); + for (i in inputs["java.jar"]) + classPaths.push(inputs["java.jar"][i].filePath); + var debugArg = product.moduleProperty("qbs", "buildVariant") === "debug" + ? "-g" : "-g:none"; + var args = [ + "-classpath", classPaths.join(product.moduleProperty("qbs", "pathListSeparator")), + "-s", product.buildDirectory, + debugArg, "-d", outputDir + ]; + var runtimeVersion = ModUtils.moduleProperty(product, "runtimeVersion"); + if (runtimeVersion) + args.push("-target", runtimeVersion); + var languageVersion = ModUtils.moduleProperty(product, "languageVersion"); + if (languageVersion) + args.push("-source", languageVersion); + var bootClassPaths = ModUtils.moduleProperties(product, "bootClassPaths"); + if (bootClassPaths && bootClassPaths.length > 0) + args.push("-bootclasspath", bootClassPaths.join(';')); + if (!ModUtils.moduleProperty(product, "enableWarnings")) + args.push("-nowarn"); + if (ModUtils.moduleProperty(product, "warningsAsErrors")) + args.push("-Werror"); + var otherFlags = ModUtils.moduleProperty(product, "additionalCompilerFlags") + if (otherFlags) + args = args.concat(otherFlags); + for (i = 0; i < inputs["java.java"].length; ++i) + args.push(inputs["java.java"][i].filePath); + return args; +} |