use of org.mule.runtime.module.artifact.api.descriptor.BundleDependency in project mule by mulesoft.
the class BundlePluginDependenciesResolverTestCase method createBundleDependency.
private static BundleDependency createBundleDependency(BundleDescriptor bundleDescriptor, boolean createBundleUri) {
try {
final BundleDependency.Builder builder = new BundleDependency.Builder();
builder.setDescriptor(bundleDescriptor);
builder.setScope(BundleScope.COMPILE);
if (createBundleUri) {
builder.setBundleUri(temporaryFolder.newFile(bundleDescriptor.getArtifactFileName()).toURI());
}
return builder.build();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of org.mule.runtime.module.artifact.api.descriptor.BundleDependency in project mule by mulesoft.
the class BundlePluginDependenciesResolver method findDependencyPackageClosure.
private Set<String> findDependencyPackageClosure(Set<BundleDependency> pluginDependencies, List<ArtifactPluginDescriptor> resolvedPlugins) {
Set<String> exportedPackages = new HashSet<>();
for (BundleDependency pluginDependency : pluginDependencies) {
final Optional<String> classifier = pluginDependency.getDescriptor().getClassifier();
if (classifier.isPresent() && MULE_PLUGIN_CLASSIFIER.equals(classifier.get())) {
ArtifactPluginDescriptor dependencyDescriptor = findArtifactPluginDescriptor(pluginDependency, resolvedPlugins);
exportedPackages.addAll(dependencyDescriptor.getClassLoaderModel().getExportedPackages());
exportedPackages.addAll(findDependencyPackageClosure(dependencyDescriptor.getClassLoaderModel().getDependencies(), resolvedPlugins));
}
}
return exportedPackages;
}
use of org.mule.runtime.module.artifact.api.descriptor.BundleDependency in project mule by mulesoft.
the class BundlePluginDependenciesResolver method createResolutionErrorMessage.
protected static String createResolutionErrorMessage(List<ArtifactPluginDescriptor> unresolvedPlugins, List<ArtifactPluginDescriptor> resolvedPlugins) {
StringBuilder builder = new StringBuilder("Unable to resolve plugin dependencies:");
for (ArtifactPluginDescriptor unresolvedPlugin : unresolvedPlugins) {
builder.append("\nPlugin: ").append(unresolvedPlugin.getName()).append(" missing dependencies:");
List<BundleDependency> missingDependencies = new ArrayList<>();
for (BundleDependency dependency : unresolvedPlugin.getClassLoaderModel().getDependencies()) {
Optional<String> classifierOptional = dependency.getDescriptor().getClassifier();
if (classifierOptional.isPresent() && MULE_PLUGIN_CLASSIFIER.equals(classifierOptional.get())) {
final ArtifactPluginDescriptor dependencyDescriptor = findArtifactPluginDescriptor(dependency, resolvedPlugins);
if (dependencyDescriptor == null) {
missingDependencies.add(dependency);
}
}
}
builder.append(missingDependencies);
}
return builder.toString();
}
Aggregations