From 0b45aaf75e346759bc987eac640c5596ce80c17b Mon Sep 17 00:00:00 2001 From: Josh Hagins Date: Thu, 4 Jun 2015 14:30:24 -0400 Subject: [PATCH] Add target_directory linter setting This allows the user to specify where to put generated class files. If unset, class files will be put in the same directory as their source files. Closes #1. --- README.md | 13 +++++++++++++ linter.py | 8 +++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b80cf7c..bc66f38 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,19 @@ You can also add whitespace between classpath entries for better readability: :/path/to/project/libs/lib.jar ``` +### `target_directory` + +This setting tells `scalac` where to put generated class files. If unset, class +files will be put in the same directory as their source files. + +For example: + +```json +"scalac": { + "target_directory": "$PROJECT_PATH/target/scala-2.11/classes" +} +``` + ## Contributing If you would like to contribute enhancements or fixes, please do the following: diff --git a/linter.py b/linter.py index 4c0da83..e172d8a 100644 --- a/linter.py +++ b/linter.py @@ -41,7 +41,8 @@ class Scalac(Linter): defaults = { 'lint': '', 'classpath': '', - 'classpath_filename': '' + 'classpath_filename': '', + 'target_directory': '' } inline_settings = ['classpath', 'classpath_filename'] inline_overrides = 'lint' @@ -117,6 +118,11 @@ def cmd(self): if classpath: command += ['-classpath', classpath] + target_directory = settings.get('target_directory') + + if target_directory: + command += ['-d', target_directory] + return command @property