shivawu/topcoder-greed — pull request #82 by vexorian (2013-11-26 03:00:06+00:00)
Title: Code folder

Nowadays we have plenty of templates and it is likely we'll get more and more. Each are supposed to be created in the problem's code folder.

What if the coder wants to change this folder? Doesn't like ${Contest.Name}, wants just ".", or wants a folder per problem, or etc? Currently the user has to change the output file location in each of the templates he is using.

Although it is great to allow templates to be saved in different folders, I think that having a ${OutputFolder} variable would be great.

Example default.conf under this idea:

greed {
codeRoot = "."
outputFolder = "${Contest.Name}" #default location for all templates

logging {
logLevel = OFF
logToStderr = true
logFolder = Logs
}

shared {
templateDef {
test {
override = false
outputKey = TestCode
transformers = [ empty-block, cont-blank-line ]
}
filetest {
override = false
outputKey = TestCode
transformers = [ empty-block, cont-blank-line ]
}
source {
override = false
outputFileName = "${outputFolder}/${Problem.Name}"
transformers = [ empty-block, cont-blank-line ]
}
unittest {
override = false
templateFile = None
outputFileName = "${outputFolder}/${Problem.Name}Test"
transformers = [ empty-block, cont-blank-line ]
}
testcase {
override = false
outputFile = "${outputFolder}/${Problem.Name}.sample"
templateFile = "builtin testcase/testcases.tmpl"
}
problem-desc {
override = false
outputFile = "${outputFolder}/${Problem.Name}.html"
templateFile = "builtin problem/desc.html.tmpl"
}
}

defaultLanguage {
templates = [ filetest, source, testcase, problem-desc ]
submitTemplate = source
}

cstyleLanguage = ${greed.shared.defaultLanguage} {
cutBegin = "// CUT begin"
cutEnd = "// CUT end"
}
}

language {
cpp = ${greed.shared.cstyleLanguage} {
longIntTypeName = long long

templateDef = ${greed.shared.templateDef} {
filetest.templateFile = "builtin filetest/cpp.tmpl"
test.templateFile = "builtin test/cpp.tmpl"
source.templateFile = "builtin source/cpp.tmpl"
source.outputFileExtension = cpp
}
}

java = ${greed.shared.cstyleLanguage} {
templateDef = ${greed.shared.templateDef} {
filetest.templateFile = "builtin filetest/java.tmpl"
test.templateFile = "builtin test/java.tmpl"
source.templateFile = "builtin source/java.tmpl"
source.outputFileExtension = java
unittest.templateFile = "builtin unittest/junit.java.tmpl"
}
}

csharp = ${greed.shared.cstyleLanguage} {
templateDef = ${greed.shared.templateDef} {
filetest.templateFile = "builtin filetest/cs.tmpl"
test.templateFile = "builtin test/cs.tmpl"
source.templateFile = "builtin source/cs.tmpl"
source.outputFileExtension = cs
unittest.templateFile = "builtin unittest/nunit.cs.tmpl"
}
}

python = ${greed.shared.defaultLanguage} {
cutBegin = "# CUT begin"
cutEnd = "# CUT end"

templateDef = ${greed.shared.templateDef} {
filetest.templateFile = "builtin filetest/py.tmpl"
test.templateFile = "builtin test/py.tmpl"
source.templateFile = "builtin source/py.tmpl"
source.outputFileExtension = py
}

}
}
}

If user changes outputfolder, all templates will output to the new location.