465867 - Implement --skip-file-validation=<module>

+ Adding --skip-file-validation=<module> support
This commit is contained in:
Joakim Erdfelt 2015-04-30 12:08:45 -07:00
parent 0443ef7b93
commit 2a86d49ab4
4 changed files with 78 additions and 8 deletions

View File

@ -198,10 +198,18 @@ public class BaseBuilder
// skip ambiguous module
continue;
}
dirty |= builder.addModule(mod);
for (String file : mod.getFiles())
if (mod.isSkipFilesValidation())
{
files.add(new FileArg(mod,file));
StartLog.debug("Skipping [files] validation on %s",mod.getName());
}
else
{
dirty |= builder.addModule(mod);
for (String file : mod.getFiles())
{
files.add(new FileArg(mod,file));
}
}
}
}
@ -211,10 +219,17 @@ public class BaseBuilder
StartIniBuilder builder = new StartIniBuilder(this);
for (Module mod : startIniModules)
{
dirty |= builder.addModule(mod);
for (String file : mod.getFiles())
if (mod.isSkipFilesValidation())
{
files.add(new FileArg(mod,file));
StartLog.debug("Skipping [files] validation on %s",mod.getName());
}
else
{
dirty |= builder.addModule(mod);
for (String file : mod.getFiles())
{
files.add(new FileArg(mod,file));
}
}
}
}

View File

@ -309,6 +309,12 @@ public class Main
args.setAllModules(modules);
List<Module> activeModules = modules.getSelected();
for(String name: args.getSkipFileValidationModules())
{
Module module = modules.get(name);
module.setSkipFilesValidation(true);
}
// ------------------------------------------------------------
// 5) Lib & XML Expansion / Resolution
args.expandLibs(baseHome);

View File

@ -56,20 +56,28 @@ public class Module extends Node<Module>
/** The file of the module */
private Path file;
/** The name of this Module (as a filesystem reference) */
private String fileRef;
/** List of xml configurations for this Module */
private List<String> xmls;
/** List of ini template lines */
private List<String> defaultConfig;
private boolean hasDefaultConfig = false;
/** List of library options for this Module */
private List<String> libs;
/** List of files for this Module */
private List<String> files;
/** Skip File Validation (default: false) */
private boolean skipFilesValidation = false;
/** List of jvm Args */
private List<String> jvmArgs;
/** License lines */
private List<String> license;
@ -137,6 +145,11 @@ public class Module extends Node<Module>
return files;
}
public boolean isSkipFilesValidation()
{
return skipFilesValidation;
}
public String getFilesystemRef()
{
return fileRef;
@ -307,6 +320,11 @@ public class Module extends Node<Module>
throw new RuntimeException("Don't enable directly");
}
public void setSkipFilesValidation(boolean skipFilesValidation)
{
this.skipFilesValidation = skipFilesValidation;
}
@Override
public String toString()
{

View File

@ -73,16 +73,25 @@ public class StartArgs
/** List of enabled modules */
private Set<String> modules = new HashSet<>();
/** List of modules to skip [files] section validation */
private Set<String> skipFileValidationModules = new HashSet<>();
/** Map of enabled modules to the source of where that activation occurred */
private Map<String, List<String>> sources = new HashMap<>();
/** Map of properties to where that property was declared */
private Map<String, String> propertySource = new HashMap<>();
/** List of all active [files] sections from enabled modules */
private List<FileArg> files = new ArrayList<>();
/** List of all active [lib] sections from enabled modules */
private Classpath classpath;
/** List of all active [xml] sections from enabled modules */
private List<Path> xmls = new ArrayList<>();
/** JVM arguments, found via commmand line and in all active [exec] sections from enabled modules */
private List<String> jvmArgs = new ArrayList<>();
@ -137,6 +146,12 @@ public class StartArgs
private void addFile(Module module, String uriLocation)
{
if(module.isSkipFilesValidation())
{
StartLog.debug("Not validating %s [files] for %s",module,uriLocation);
return;
}
FileArg arg = new FileArg(module, uriLocation);
if (!files.contains(arg))
{
@ -603,6 +618,11 @@ public class StartArgs
return properties;
}
public Set<String> getSkipFileValidationModules()
{
return skipFileValidationModules;
}
public List<String> getSources(String module)
{
return sources.get(module);
@ -887,6 +907,17 @@ public class StartArgs
return;
}
// Skip [files] validation on a module
if (arg.startsWith("--skip-file-validation="))
{
List<String> moduleNames = Props.getValues(arg);
for (String moduleName : moduleNames)
{
skipFileValidationModules.add(moduleName);
}
return;
}
// Create graphviz output of module graph
if (arg.startsWith("--write-module-graph="))
{