Created
May 8, 2013 08:30
-
-
Save zoodor/5539057 to your computer and use it in GitHub Desktop.
Generate the appropriate XML for a Run Configuration in an IntelliJ IDEA workspace file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def createOptionNode(Node parentNode, String nameAttributeValue, String valueAttributeValue) { | |
def patternOption = createNode(parentNode, 'option', nameAttributeValue) | |
patternOption.@value = valueAttributeValue | |
} | |
def createNode(Node parentNode, String nodeName, String nameAttributeValue) { | |
def node = new Node(parentNode, nodeName) | |
node.@name = nameAttributeValue | |
return node | |
} | |
def ensureApplicationConfigurationExists( | |
Node runManagerNode, | |
String name, | |
String packagePattern, | |
String mainClassName, | |
String moduleName, | |
String programParameters) { | |
if (runManagerNode.find { it.@name == name } != null) { | |
return | |
} | |
def configuration = createNode(runManagerNode, 'configuration', name) | |
configuration.@type = 'Application' | |
configuration.@factoryName = 'Application' | |
def extension = createNode(configuration, 'extension', 'coverage') | |
extension.@enabled = 'false' | |
extension.@merge = 'false' | |
extension.@runner = 'idea' | |
def pattern = new Node(extension, 'pattern') | |
createOptionNode(pattern, 'PATTERN', packagePattern) | |
createOptionNode(pattern, 'ENABLED', 'true') | |
createOptionNode(configuration, 'MAIN_CLASS_NAME', mainClassName) | |
createOptionNode(configuration, 'VM_PARAMETERS', '') | |
createOptionNode(configuration, 'PROGRAM_PARAMETERS', programParameters) | |
createOptionNode(configuration, 'WORKING_DIRECTORY', '$PROJECT_DIR$') | |
createOptionNode(configuration, 'ALTERNATIVE_JRE_PATH_ENABLED', 'false') | |
createOptionNode(configuration, 'ALTERNATIVE_JRE_PATH', '') | |
createOptionNode(configuration, 'ENABLE_SWING_INSPECTOR', 'false') | |
createNode(configuration, 'option', 'ENV_VARIABLES') | |
createOptionNode(configuration, 'PASS_PARENT_ENVS', 'true') | |
def module = new Node(configuration, 'module') | |
module.@name = moduleName | |
def runnerSettings = new Node(configuration, 'RunnerSettings') | |
runnerSettings.@RunnerId = 'Debug' | |
createOptionNode(runnerSettings, 'DEBUG_PORT', '') | |
createOptionNode(runnerSettings, 'TRANSPORT', '0') | |
createOptionNode(runnerSettings, 'LOCAL', 'true') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment