Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Nathanael Jones 2015-04-29 09:19:53 -04:00
Родитель 2955e57ccc 5e7d7a39b1
Коммит d6ea9528fc
6 изменённых файлов: 24 добавлений и 4 удалений

Просмотреть файл

@ -27,4 +27,5 @@
24=-configurationClass: Overwrites default configuration Class with input class name. The default is 'sharpen.core.DefaultConfiguration'. For example: -configurationClass sharpen.core.MyConfiguration
25=-junitConversion: JUnit conversion mode on
26=-sharpenNamespace: Maps a java package name to a .NET namespace. For example:-namespaceMapping java.util.concurrent.locks Sharpen
27=-help: Display Help
27=-flatDirectoryStructure: Flat namespace directory structure mode on. For example: "sharpen.core" package will go into a folder named "sharpen.core" and sub-folders won't be created like "sharpen/core"
28=-help: Display Help

Просмотреть файл

@ -100,6 +100,8 @@ public abstract class Configuration {
private boolean _junitConvert;
private boolean _flatNamespaceDirectoryStructure;
private String _sharpenNamespace = "Sharpen";
private List<String> _fullyQualifiedTypes = new ArrayList<String>();
@ -441,6 +443,14 @@ public abstract class Configuration {
return _junitConvert;
}
public void enableFlatNamespaceDirectoryStructure() {
this._flatNamespaceDirectoryStructure = true;
}
public boolean flatNamespaceDirectoryStructure() {
return this._flatNamespaceDirectoryStructure;
}
public void setSharpenNamespace(String sharpenNamespace) {
if (null == sharpenNamespace) throw new IllegalArgumentException("sharpenNamespace");
_sharpenNamespace = sharpenNamespace;

Просмотреть файл

@ -205,6 +205,10 @@ public class SharpenApplication {
ods("JUnit conversion mode on.");
configuration.enableJUnitConversion();
}
if (this._args.flatNamespaceDirectoryStructure) {
ods("Flat namespace directory structure mode on.");
configuration.enableFlatNamespaceDirectoryStructure();
}
if (_args.sharpenNamespace != null) {
ods("Sharpen namespace: " + _args.sharpenNamespace);
configuration.setSharpenNamespace(_args.sharpenNamespace);

Просмотреть файл

@ -87,6 +87,7 @@ public class SharpenCommandLine {
public final Map<String, String> conditionalCompilation = new HashMap<String, String>();
public String configurationClass;
public boolean junitConversion;
public boolean flatNamespaceDirectoryStructure;
public String sharpenNamespace;
public boolean help;
}

Просмотреть файл

@ -146,6 +146,8 @@ class SharpenCommandLineParser extends CommandLineParser {
_cmdLine.configurationClass = consumeNext();
} else if (areEqual(arg, "-junitConversion")) {
_cmdLine.junitConversion = true;
} else if (this.areEqual(arg, "-flatDirectoryStructure")) {
this._cmdLine.flatNamespaceDirectoryStructure = true;
} else if (areEqual(arg, "-sharpenNamespace")) {
_cmdLine.sharpenNamespace = consumeNext();
} else if (areEqual(arg, "-help")) {

Просмотреть файл

@ -129,8 +129,10 @@ public class SharpenConversionBatch extends ConversionBatch {
}
private String getTargetPackageFolder(String targetFolder, String packageName) {
targetFolder = targetFolder +"/" + packageName.replace('.', '/').toLowerCase();
return targetFolder;
if (!this._configuration.flatNamespaceDirectoryStructure()) {
packageName = packageName.replace('.', '/').toLowerCase();
}
return targetFolder +"/" + packageName;
}
private String getNameWithoutExtension(String name) {