mirror of
https://github.com/Minres/RDL-Editor.git
synced 2025-01-22 11:05:47 +01:00
Minor fixes in Main rgd. CLI processing
This commit is contained in:
parent
d865faf127
commit
8ceb09beed
@ -4,7 +4,6 @@ import com.google.inject.Inject
|
|||||||
import com.google.inject.Provider
|
import com.google.inject.Provider
|
||||||
import com.minres.rdl.RDLStandaloneSetup
|
import com.minres.rdl.RDLStandaloneSetup
|
||||||
import java.lang.reflect.MalformedParametersException
|
import java.lang.reflect.MalformedParametersException
|
||||||
import java.util.ArrayList
|
|
||||||
import org.eclipse.emf.common.util.URI
|
import org.eclipse.emf.common.util.URI
|
||||||
import org.eclipse.emf.ecore.resource.ResourceSet
|
import org.eclipse.emf.ecore.resource.ResourceSet
|
||||||
import org.eclipse.emf.mwe.utils.ProjectMapping
|
import org.eclipse.emf.mwe.utils.ProjectMapping
|
||||||
@ -23,7 +22,7 @@ import com.minres.rdl.generator.Options.Separator
|
|||||||
|
|
||||||
class Main {
|
class Main {
|
||||||
|
|
||||||
private static String USAGE_STR = "RDL2code [-h] [-v] [-o=<output file>] [-d=<output dir>] [-p=<output prefix>] <input file> <input file>";
|
private val USAGE_STR = "RDL2code [-h] [-v] [-I <RDL include dir] [-i <include output dir>] [-s <source output dir>] [-g <generated files output dir>] <input file> <input file>";
|
||||||
|
|
||||||
def static main(String[] args) {
|
def static main(String[] args) {
|
||||||
if (args.empty) {
|
if (args.empty) {
|
||||||
@ -31,7 +30,7 @@ class Main {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
val injector = new RDLStandaloneSetup().createInjectorAndDoEMFRegistration
|
val injector = new RDLStandaloneSetup().createInjectorAndDoEMFRegistration
|
||||||
val Main main = injector.getInstance(Main)
|
val main = injector.getInstance(Main)
|
||||||
try {
|
try {
|
||||||
main.run(args)
|
main.run(args)
|
||||||
} catch (MalformedParametersException e) {
|
} catch (MalformedParametersException e) {
|
||||||
@ -60,14 +59,13 @@ class Main {
|
|||||||
val opt = new Options(args, 0, Integer.MAX_VALUE);
|
val opt = new Options(args, 0, Integer.MAX_VALUE);
|
||||||
opt.getSet().addOption("h", Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("h", Multiplicity.ZERO_OR_ONE);
|
||||||
opt.getSet().addOption("v", Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("v", Multiplicity.ZERO_OR_ONE);
|
||||||
opt.getSet().addOption("i", Separator.EQUALS, Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("i", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
|
||||||
opt.getSet().addOption("s", Separator.EQUALS, Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("s", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
|
||||||
opt.getSet().addOption("g", Separator.EQUALS, Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("g", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
|
||||||
opt.getSet().addOption("I", Separator.EQUALS, Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("I", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
|
||||||
if (!opt.check(false, false)) { // Print usage hints
|
if (!opt.check(false, false)) { // Print usage hints
|
||||||
System.err.println("Error processing command line: " + opt.getCheckErrors());
|
|
||||||
System.err.println("Usage is: " + USAGE_STR);
|
System.err.println("Usage is: " + USAGE_STR);
|
||||||
throw new MalformedParametersException("Error processing command line: " + opt.getCheckErrors());
|
throw new MalformedParametersException(opt.getCheckErrors());
|
||||||
}
|
}
|
||||||
// Normal processing
|
// Normal processing
|
||||||
if (opt.getSet().isSet("h")) {
|
if (opt.getSet().isSet("h")) {
|
||||||
@ -84,7 +82,7 @@ class Main {
|
|||||||
}
|
}
|
||||||
// Configure and start the generator
|
// Configure and start the generator
|
||||||
fileAccess.outputPath = 'src-gen/'
|
fileAccess.outputPath = 'src-gen/'
|
||||||
#{'incl-out' -> false, 'src-out' -> false, 'gen-out'->true}.forEach[p1, p2|
|
#{'incl-out' -> false, 'src-out' -> false, 'gen-out' -> true}.forEach[p1, p2|
|
||||||
if(opt.getSet().isSet(p1.substring(0, 1)))
|
if(opt.getSet().isSet(p1.substring(0, 1)))
|
||||||
fileAccess.setOutputPath(p1, opt.getSet().getOption(p1.substring(0, 1)).getResultValue(0)+'/')
|
fileAccess.setOutputPath(p1, opt.getSet().getOption(p1.substring(0, 1)).getResultValue(0)+'/')
|
||||||
else
|
else
|
||||||
|
@ -36,7 +36,7 @@ import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
|
|||||||
|
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
public class Main {
|
public class Main {
|
||||||
private static String USAGE_STR = "RDL2code [-h] [-v] [-o=<output file>] [-d=<output dir>] [-p=<output prefix>] <input file> <input file>";
|
private final String USAGE_STR = "RDL2code [-h] [-v] [-I <RDL include dir] [-i <include output dir>] [-s <source output dir>] [-g <generated files output dir>] <input file> <input file>";
|
||||||
|
|
||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) {
|
||||||
boolean _isEmpty = ((List<String>)Conversions.doWrapArray(args)).isEmpty();
|
boolean _isEmpty = ((List<String>)Conversions.doWrapArray(args)).isEmpty();
|
||||||
@ -94,24 +94,20 @@ public class Main {
|
|||||||
final Options opt = new Options(args, 0, Integer.MAX_VALUE);
|
final Options opt = new Options(args, 0, Integer.MAX_VALUE);
|
||||||
opt.getSet().addOption("h", Options.Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("h", Options.Multiplicity.ZERO_OR_ONE);
|
||||||
opt.getSet().addOption("v", Options.Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("v", Options.Multiplicity.ZERO_OR_ONE);
|
||||||
opt.getSet().addOption("i", Options.Separator.EQUALS, Options.Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("i", Options.Separator.BLANK, Options.Multiplicity.ZERO_OR_ONE);
|
||||||
opt.getSet().addOption("s", Options.Separator.EQUALS, Options.Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("s", Options.Separator.BLANK, Options.Multiplicity.ZERO_OR_ONE);
|
||||||
opt.getSet().addOption("g", Options.Separator.EQUALS, Options.Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("g", Options.Separator.BLANK, Options.Multiplicity.ZERO_OR_ONE);
|
||||||
opt.getSet().addOption("I", Options.Separator.EQUALS, Options.Multiplicity.ZERO_OR_ONE);
|
opt.getSet().addOption("I", Options.Separator.BLANK, Options.Multiplicity.ZERO_OR_ONE);
|
||||||
boolean _check = opt.check(false, false);
|
boolean _check = opt.check(false, false);
|
||||||
boolean _not = (!_check);
|
boolean _not = (!_check);
|
||||||
if (_not) {
|
if (_not) {
|
||||||
|
System.err.println(("Usage is: " + this.USAGE_STR));
|
||||||
String _checkErrors = opt.getCheckErrors();
|
String _checkErrors = opt.getCheckErrors();
|
||||||
String _plus = ("Error processing command line: " + _checkErrors);
|
throw new MalformedParametersException(_checkErrors);
|
||||||
System.err.println(_plus);
|
|
||||||
System.err.println(("Usage is: " + Main.USAGE_STR));
|
|
||||||
String _checkErrors_1 = opt.getCheckErrors();
|
|
||||||
String _plus_1 = ("Error processing command line: " + _checkErrors_1);
|
|
||||||
throw new MalformedParametersException(_plus_1);
|
|
||||||
}
|
}
|
||||||
boolean _isSet = opt.getSet().isSet("h");
|
boolean _isSet = opt.getSet().isSet("h");
|
||||||
if (_isSet) {
|
if (_isSet) {
|
||||||
InputOutput.<String>println(("Usage: " + Main.USAGE_STR));
|
InputOutput.<String>println(("Usage: " + this.USAGE_STR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean _xifexpression = false;
|
boolean _xifexpression = false;
|
||||||
@ -137,8 +133,8 @@ public class Main {
|
|||||||
boolean _isSet_3 = opt.getSet().isSet(p1.substring(0, 1));
|
boolean _isSet_3 = opt.getSet().isSet(p1.substring(0, 1));
|
||||||
if (_isSet_3) {
|
if (_isSet_3) {
|
||||||
String _resultValue = opt.getSet().getOption(p1.substring(0, 1)).getResultValue(0);
|
String _resultValue = opt.getSet().getOption(p1.substring(0, 1)).getResultValue(0);
|
||||||
String _plus_2 = (_resultValue + "/");
|
String _plus = (_resultValue + "/");
|
||||||
this.fileAccess.setOutputPath(p1, _plus_2);
|
this.fileAccess.setOutputPath(p1, _plus);
|
||||||
} else {
|
} else {
|
||||||
this.fileAccess.setOutputPath(p1, "src-gen/");
|
this.fileAccess.setOutputPath(p1, "src-gen/");
|
||||||
}
|
}
|
||||||
@ -162,16 +158,16 @@ public class Main {
|
|||||||
boolean _not_1 = (!_isEmpty);
|
boolean _not_1 = (!_isEmpty);
|
||||||
if (_not_1) {
|
if (_not_1) {
|
||||||
URI _uRI = resource.getURI();
|
URI _uRI = resource.getURI();
|
||||||
String _plus_2 = ("Error validating " + _uRI);
|
String _plus = ("Error validating " + _uRI);
|
||||||
System.err.println(_plus_2);
|
System.err.println(_plus);
|
||||||
final Consumer<Issue> _function_2 = (Issue it) -> {
|
final Consumer<Issue> _function_2 = (Issue it) -> {
|
||||||
System.err.println(it);
|
System.err.println(it);
|
||||||
};
|
};
|
||||||
issues.forEach(_function_2);
|
issues.forEach(_function_2);
|
||||||
URI _uRI_1 = resource.getURI();
|
URI _uRI_1 = resource.getURI();
|
||||||
String _plus_3 = ("error validating " + _uRI_1);
|
String _plus_1 = ("error validating " + _uRI_1);
|
||||||
int _size = issues.size();
|
int _size = issues.size();
|
||||||
throw new ParseException(_plus_3, _size);
|
throw new ParseException(_plus_1, _size);
|
||||||
}
|
}
|
||||||
GeneratorContext _generatorContext = new GeneratorContext();
|
GeneratorContext _generatorContext = new GeneratorContext();
|
||||||
final Procedure1<GeneratorContext> _function_3 = (GeneratorContext it) -> {
|
final Procedure1<GeneratorContext> _function_3 = (GeneratorContext it) -> {
|
||||||
@ -185,17 +181,17 @@ public class Main {
|
|||||||
try {
|
try {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
URI _uRI_2 = this.fileAccess.getURI("", "incl-out");
|
URI _uRI_2 = this.fileAccess.getURI("", "incl-out");
|
||||||
String _plus_4 = ("includes are in " + _uRI_2);
|
String _plus_2 = ("includes are in " + _uRI_2);
|
||||||
String _plus_5 = (_plus_4 + ", ");
|
String _plus_3 = (_plus_2 + ", ");
|
||||||
InputOutput.<String>print(_plus_5);
|
InputOutput.<String>print(_plus_3);
|
||||||
}
|
}
|
||||||
} catch (final Throwable _t) {
|
} catch (final Throwable _t) {
|
||||||
if (_t instanceof Exception) {
|
if (_t instanceof Exception) {
|
||||||
final Exception e = (Exception)_t;
|
final Exception e = (Exception)_t;
|
||||||
URI _uRI_3 = this.fileAccess.getURI("");
|
URI _uRI_3 = this.fileAccess.getURI("");
|
||||||
String _plus_6 = ("includes are in " + _uRI_3);
|
String _plus_4 = ("includes are in " + _uRI_3);
|
||||||
String _plus_7 = (_plus_6 + ", ");
|
String _plus_5 = (_plus_4 + ", ");
|
||||||
InputOutput.<String>print(_plus_7);
|
InputOutput.<String>print(_plus_5);
|
||||||
} else {
|
} else {
|
||||||
throw Exceptions.sneakyThrow(_t);
|
throw Exceptions.sneakyThrow(_t);
|
||||||
}
|
}
|
||||||
@ -203,17 +199,17 @@ public class Main {
|
|||||||
try {
|
try {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
URI _uRI_4 = this.fileAccess.getURI("", "src-out");
|
URI _uRI_4 = this.fileAccess.getURI("", "src-out");
|
||||||
String _plus_8 = ("sources are in " + _uRI_4);
|
String _plus_6 = ("sources are in " + _uRI_4);
|
||||||
String _plus_9 = (_plus_8 + ", ");
|
String _plus_7 = (_plus_6 + ", ");
|
||||||
InputOutput.<String>println(_plus_9);
|
InputOutput.<String>println(_plus_7);
|
||||||
}
|
}
|
||||||
} catch (final Throwable _t_1) {
|
} catch (final Throwable _t_1) {
|
||||||
if (_t_1 instanceof Exception) {
|
if (_t_1 instanceof Exception) {
|
||||||
final Exception e_1 = (Exception)_t_1;
|
final Exception e_1 = (Exception)_t_1;
|
||||||
URI _uRI_5 = this.fileAccess.getURI("");
|
URI _uRI_5 = this.fileAccess.getURI("");
|
||||||
String _plus_10 = ("sources are in " + _uRI_5);
|
String _plus_8 = ("sources are in " + _uRI_5);
|
||||||
String _plus_11 = (_plus_10 + ", ");
|
String _plus_9 = (_plus_8 + ", ");
|
||||||
InputOutput.<String>println(_plus_11);
|
InputOutput.<String>println(_plus_9);
|
||||||
} else {
|
} else {
|
||||||
throw Exceptions.sneakyThrow(_t_1);
|
throw Exceptions.sneakyThrow(_t_1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user