ConfigBuilderArgParser extends ArgParser<ConfigBuilder> { public ConfigBuilder setProperties(ConfigBuilder configBuilder, List<String> values) { List<Arch> archs = new ArrayList<>(); OS os = null; String target = null; if (values == null) { return configBuilder; } for (String value : values) { if (isPropertyType(value, "os")) { os = getOSFromProperty(value); } if (isPropertyType(value, "target")) { target = getTargetFromProperty(value); } if (isPropertyType(value, "arch")) { archs.add(getArchProperties(value)); } } if (archs.size() > 0) { configBuilder.archs(archs); } if (notNull(os)) { configBuilder.os(os); } if (notNull(target)) { configBuilder.targetType(target); } return configBuilder; } ConfigBuilderArgParser(Options options, String[] args); @Override ConfigBuilder populateObject(ConfigBuilder configBuilder); ConfigBuilder processArg(Option option, String argName,ConfigBuilder configBuilder); ConfigBuilder setResources(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setFrameworks(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setWeakFrameworks(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setUnhideSymbols(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setExportedSymbols(ConfigBuilder configBuilder, List<String> values); void printVersionAndExit(); ConfigBuilder setVerbose(ConfigBuilder configBuilder); ConfigBuilder setThreads(ConfigBuilder configBuilder, String value); ConfigBuilder setForceLink(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setTreeshake(ConfigBuilder configBuilder, String value); ConfigBuilder dumpConfiguration(ConfigBuilder configBuilder, String value); ConfigBuilder dumpIntermediates(ConfigBuilder configBuilder); ConfigBuilder skipRuntime(ConfigBuilder configBuilder); ConfigBuilder enableDynamicJNI(ConfigBuilder configBuilder); ConfigBuilder setConfig(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setRun(ConfigBuilder configBuilder); ConfigBuilder setOutBin(ConfigBuilder configBuilder, String value); ConfigBuilder setProperties(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setJar(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setDebugLibs(ConfigBuilder configBuilder); @Override void usage(Options options); ConfigBuilder setLibs(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setTemp(ConfigBuilder configBuilder, String value); ConfigBuilder setHome(ConfigBuilder configBuilder, String value); ConfigBuilder setCCompiler(ConfigBuilder configBuilder, String value); ConfigBuilder enableClean(ConfigBuilder configBuilder); ConfigBuilder setCache(ConfigBuilder configBuilder, String value); void invalidOption(Option option); ConfigBuilder setOutDir(ConfigBuilder configBuilder, String value); ConfigBuilder setClasspath(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setBootClass(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setBuildAsLib(ConfigBuilder configBuilder); boolean validateArgs(CommandLine cli);  }
@Test public void testSetProperties() throws Exception { List<String> validProperties = Arrays.asList( "arch=x86", "os=linux", "target=console" ); configBuilder = configBuilderArgParser.setProperties(configBuilder, validProperties); assert(configBuilder.getConfig().getArchs().contains(Arch.x86)); assert(configBuilder.getConfig().getOs() == OS.linux); assert(configBuilder.getConfig().getTargetType().equals(ConsoleTarget.TYPE)); exception.expect(IllegalArgumentException.class); configBuilder = configBuilderArgParser.setProperties(configBuilder, Collections.singletonList("arch=invalid")); exception.expect(IllegalArgumentException.class); configBuilder = configBuilderArgParser.setProperties(configBuilder, Collections.singletonList("os=invalid")); exception.expect(IllegalArgumentException.class); configBuilder = configBuilderArgParser.setProperties(configBuilder, Collections.singletonList("invalid=invalid")); exception.expect(IllegalArgumentException.class); configBuilder = configBuilderArgParser.setProperties(configBuilder, Collections.singletonList("invalid")); }