use of org.walkmod.conf.entities.InitializerConfig in project walkmod-core by walkmod.
the class ConfigurationImpl method prepareInitializers.
@Override
public void prepareInitializers() {
InitializerConfig init = null;
File pom = new File("pom.xml").getAbsoluteFile();
if (pom.exists()) {
init = new InitializerConfigImpl();
init.setType("maven-initializer");
} else {
File gradle = new File("settings.gradle");
if (gradle.exists()) {
init = new InitializerConfigImpl();
init.setType("gradle-initializer");
} else {
gradle = new File("build.gradle");
if (gradle.exists()) {
init = new InitializerConfigImpl();
init.setType("gradle-initializer");
}
}
}
if (init != null) {
List<InitializerConfig> list = getInitializers();
if (list == null) {
list = new LinkedList<InitializerConfig>();
}
list.add(init);
setInitializers(list);
}
}
use of org.walkmod.conf.entities.InitializerConfig in project walkmod-core by walkmod.
the class ConfigurationImpl method preparePlugins.
@Override
public void preparePlugins() {
Collection<PluginConfig> pluginCfg = getPlugins();
HashSet<String> plugins = new HashSet<String>();
HashSet<String> previousPlugins = new HashSet<String>();
if (pluginCfg == null || pluginCfg.isEmpty()) {
pluginCfg = new LinkedList<PluginConfig>();
} else {
for (PluginConfig pc : pluginCfg) {
previousPlugins.add(pc.getGroupId() + ":" + pc.getArtifactId());
}
}
Collection<ChainConfig> chains = getChainConfigs();
if (chains != null) {
Iterator<ChainConfig> it = chains.iterator();
while (it.hasNext()) {
ChainConfig cc = it.next();
composeName(cc.getReaderConfig().getType(), plugins);
composeName(cc.getWalkerConfig().getParserConfig().getType(), plugins);
List<TransformationConfig> trans = cc.getWalkerConfig().getTransformations();
if (trans != null) {
for (TransformationConfig transformation : trans) {
String type = transformation.getType();
if (!type.equals("script") && !type.equals("template")) {
composeName(type, plugins);
}
}
}
composeName(cc.getWriterConfig().getType(), plugins);
}
}
Collection<ProviderConfig> providers = getProviderConfigurations();
if (providers != null) {
for (ProviderConfig provider : providers) {
String type = provider.getType();
composeName(type, plugins);
}
}
Collection<InitializerConfig> initializers = getInitializers();
if (initializers != null) {
for (InitializerConfig initializer : initializers) {
plugins.add(initializer.getPluginGroupId() + ":walkmod-" + initializer.getPluginArtifactId() + "-plugin");
}
}
for (String id : plugins) {
if (!previousPlugins.contains(id)) {
String[] parts = id.split(":");
PluginConfig cfg = new PluginConfigImpl();
cfg.setGroupId(parts[0].trim());
cfg.setArtifactId(parts[1].trim());
cfg.setVersion("latest.integration");
pluginCfg.add(cfg);
}
}
setPlugins(pluginCfg);
}
Aggregations