Skip to content

Commit

Permalink
[WeaverGenerator] Removes option L, deletes unused class
Browse files Browse the repository at this point in the history
  • Loading branch information
joaobispo committed Jan 5, 2025
1 parent 43d74e4 commit 647f43c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 232 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,6 @@ public static void main(String[] args) {
if (cmdLine.hasOption(GeneratorOption.C.getOption())) {
System.out.println("Warning: option 'C' is deprecated and was not tested after a Weaver Generator refactoring, proceed at your own risk");
generator = new TemplatedGenerator(XMLSpecDir);
} else if (cmdLine.hasOption(GeneratorOption.L.getOption())) {
optionValue = cmdLine.getOptionValue(GeneratorOption.L.getOption());
if (optionValue.equals("java2cpp")) {
throw new RuntimeException("Option java2cpp no longer supported");
}

generator = new JavaAbstractsGenerator(XMLSpecDir);

} else {
// Create the JavaAbstractGenerator
generator = new JavaAbstractsGenerator(XMLSpecDir);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,33 @@
/*
* Copyright 2013 SPeCS.
*
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License. under the License.
*/
package org.lara.interpreter.weaver.generator.commandline;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.*;
import org.apache.commons.cli.Option.Builder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.lara.interpreter.weaver.generator.generator.utils.GenConstants;

class WeaverGeneratorOptions extends Options {
private static HelpFormatter formatter = new HelpFormatter();

/**
*
*
*/
private static final long serialVersionUID = -7738963410049098076L;

/**
* Arguments for options
*
*
* @author Tiago Carvalho
*
*/
private enum ArgOption {
NO_ARGS,
Expand All @@ -49,7 +42,6 @@ protected enum GeneratorOption {
W("w", "weaver"),

X("x", "XMLspec"),
L("l", "language"),
O("o", "output"),
P("p", "package"),
// A("a", "abstractGetters"), //replaced with -f
Expand Down Expand Up @@ -91,18 +83,12 @@ protected WeaverGeneratorOptions() {
final Option xmlDir = newOption("dir", GeneratorOption.X, ArgOption.ONE_ARG,
"location of the target language specification (default: " + GenConstants.getDefaultXMLDir() + ")");

final Option language = newOption("language", GeneratorOption.L, ArgOption.ONE_ARG,
"define in which language the code will be generated (default: Java)");

final Option outDir = newOption("dir", GeneratorOption.O, ArgOption.ONE_ARG,
"change output directory (default: " + GenConstants.getDefaultOutputDir() + ")");

final Option packDir = newOption("packageName", GeneratorOption.P, ArgOption.ONE_ARG,
"define the package for the java files");

// final Option abstractGetters = newOption(null, GeneratorOption.A, ArgOption.NO_ARGS,
// "don't use fields for attributes and and define getter methods as abstract"); //Replaced with
// GeneratorOption.F

final Option fields = newOption(null, GeneratorOption.F, ArgOption.NO_ARGS,
"use fields for attributes");

Expand All @@ -127,7 +113,6 @@ protected WeaverGeneratorOptions() {
addOption(help);
addOption(weaver);
addOption(xmlDir);
addOption(language);
addOption(outDir);
addOption(packDir);
// addOption(abstractGetters);
Expand Down Expand Up @@ -163,7 +148,7 @@ protected void help() {

/**
* Create a new Option with all the description
*
*
* @param argName
* @param shortOpt
* @param longOpt
Expand All @@ -172,7 +157,7 @@ protected void help() {
* @return
*/
protected static Option newOption(String argName, GeneratorOption shortOpt, ArgOption argOption,
String description) {
String description) {

Builder builder = Option.builder(shortOpt.getOption());

Expand All @@ -181,22 +166,22 @@ protected static Option newOption(String argName, GeneratorOption shortOpt, ArgO
builder.desc(description);

switch (argOption) {
case ONE_ARG:
builder.hasArg();
break;
case SEVERAL_ARGS:
builder.hasArgs();
break;
case OPTIONAL_ARG:
builder.hasArg();
builder.optionalArg(true);
break;
case OPTIONAL_ARGS:
builder.hasArgs();
builder.optionalArg(true);
break;
default:
break;
case ONE_ARG:
builder.hasArg();
break;
case SEVERAL_ARGS:
builder.hasArgs();
break;
case OPTIONAL_ARG:
builder.hasArg();
builder.optionalArg(true);
break;
case OPTIONAL_ARGS:
builder.hasArgs();
builder.optionalArg(true);
break;
default:
break;
}
return builder.build();
}
Expand Down

0 comments on commit 647f43c

Please sign in to comment.