use of org.jenkins.tools.test.maven.InternalMavenRunner in project plugin-compat-tester by jenkinsci.
the class MultiParentCompileHook method action.
@Override
public Map<String, Object> action(Map<String, Object> moreInfo) throws Exception {
try {
System.out.println("Executing multi-parent compile hook");
PluginCompatTesterConfig config = (PluginCompatTesterConfig) moreInfo.get("config");
MavenCoordinates core = (MavenCoordinates) moreInfo.get("core");
runner = config.getExternalMaven() == null ? new InternalMavenRunner() : new ExternalMavenRunner(config.getExternalMaven());
mavenConfig = getMavenConfig(config);
File pluginDir = (File) moreInfo.get("pluginDir");
System.out.println("Plugin dir is " + pluginDir);
if (config.getLocalCheckoutDir() != null) {
Path pluginSourcesDir = config.getLocalCheckoutDir().toPath();
boolean isMultipleLocalPlugins = config.getIncludePlugins() != null && config.getIncludePlugins().size() > 1;
// If not it must be located on the parent of the localCheckoutDir
if (!isMultipleLocalPlugins) {
pluginSourcesDir = pluginSourcesDir.getParent();
}
// Copy the file if it exists
Files.walk(pluginSourcesDir, 1).filter(this::isEslintFile).forEach(eslintrc -> copy(eslintrc, pluginDir));
}
// We need to compile before generating effective pom overriding jenkins.version
// only if the plugin is not already compiled
boolean ranCompile = moreInfo.containsKey(OVERRIDE_DEFAULT_COMPILE) ? (boolean) moreInfo.get(OVERRIDE_DEFAULT_COMPILE) : false;
if (!ranCompile) {
compile(mavenConfig, pluginDir);
moreInfo.put(OVERRIDE_DEFAULT_COMPILE, true);
}
System.out.println("Executed multi-parent compile hook");
return moreInfo;
// Exceptions get swallowed, so we print to console here and rethrow again
} catch (Exception e) {
System.out.println("Exception executing hook");
System.out.println(e);
throw e;
}
}
Aggregations