use of org.eclipse.tycho.dev.DevBundleInfo in project tycho by eclipse.
the class TestMojo method createEclipseInstallation.
private EquinoxInstallation createEclipseInstallation() throws MojoExecutionException {
DependencyResolver platformResolver = dependencyResolverLocator.lookupDependencyResolver(project);
final List<Dependency> extraDependencies = getExtraDependencies();
List<ReactorProject> reactorProjects = getReactorProjects();
final DependencyResolverConfiguration resolverConfiguration = new DependencyResolverConfiguration() {
@Override
public OptionalResolutionAction getOptionalResolutionAction() {
return OptionalResolutionAction.IGNORE;
}
@Override
public List<Dependency> getExtraRequirements() {
return extraDependencies;
}
};
DependencyArtifacts testRuntimeArtifacts = platformResolver.resolveDependencies(session, project, null, reactorProjects, resolverConfiguration);
if (testRuntimeArtifacts == null) {
throw new MojoExecutionException("Cannot determinate build target platform location -- not executing tests");
}
work.mkdirs();
EquinoxInstallationDescription testRuntime = new DefaultEquinoxInstallationDescription();
testRuntime.setDefaultBundleStartLevel(defaultStartLevel);
testRuntime.addBundlesToExplode(getBundlesToExplode());
testRuntime.addFrameworkExtensions(getFrameworkExtensions());
if (bundleStartLevel != null) {
for (BundleStartLevel level : bundleStartLevel) {
testRuntime.addBundleStartLevel(level);
}
}
TestFrameworkProvider provider = providerHelper.selectProvider(getProjectType().getClasspath(project), getMergedProviderProperties(), providerHint);
createSurefireProperties(provider);
for (ArtifactDescriptor artifact : testRuntimeArtifacts.getArtifacts(ArtifactType.TYPE_ECLIPSE_PLUGIN)) {
// note that this project is added as directory structure rooted at project basedir.
// project classes and test-classes are added via dev.properties file (see #createDevProperties())
// all other projects are added as bundle jars.
ReactorProject otherProject = artifact.getMavenProject();
if (otherProject != null) {
if (otherProject.sameProject(project)) {
testRuntime.addBundle(artifact.getKey(), project.getBasedir());
continue;
}
File file = otherProject.getArtifact(artifact.getClassifier());
if (file != null) {
testRuntime.addBundle(artifact.getKey(), file);
continue;
}
}
testRuntime.addBundle(artifact);
}
Set<Artifact> testFrameworkBundles = providerHelper.filterTestFrameworkBundles(provider, pluginArtifacts);
for (Artifact artifact : testFrameworkBundles) {
DevBundleInfo devInfo = workspaceState.getBundleInfo(session, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), project.getPluginArtifactRepositories());
if (devInfo != null) {
testRuntime.addBundle(devInfo.getArtifactKey(), devInfo.getLocation(), true);
testRuntime.addDevEntries(devInfo.getSymbolicName(), devInfo.getDevEntries());
} else {
File bundleLocation = artifact.getFile();
ArtifactKey bundleArtifactKey = getBundleArtifactKey(bundleLocation);
testRuntime.addBundle(bundleArtifactKey, bundleLocation, true);
}
}
testRuntime.addDevEntries(getTestBundleSymbolicName(), getBuildOutputDirectories());
reportsDirectory.mkdirs();
return installationFactory.createInstallation(testRuntime, work);
}
use of org.eclipse.tycho.dev.DevBundleInfo in project tycho by eclipse.
the class WorkspaceTychoOsgiRuntimeLocator method addBundle.
public boolean addBundle(EquinoxRuntimeDescription result, Artifact pom) {
DevBundleInfo bundleInfo = workspaceState.getBundleInfo(pom.getFile().getParentFile());
if (bundleInfo == null) {
return false;
}
addBundle(result, bundleInfo);
return true;
}
use of org.eclipse.tycho.dev.DevBundleInfo in project tycho by eclipse.
the class WorkspaceTychoOsgiRuntimeLocator method addProduct.
public boolean addProduct(EquinoxRuntimeDescription result, Artifact pom) throws MavenExecutionException {
ProductConfiguration product;
try {
product = ProductConfiguration.read(new File(pom.getFile().getParentFile(), pom.getArtifactId() + ".product"));
} catch (IOException e) {
return false;
}
// the above fails with IOException if .product file is not available or can't be read
// we get here only when we have valid product instance
Set<String> missing = new LinkedHashSet<>();
for (PluginRef pluginRef : product.getPlugins()) {
DevBundleInfo bundleInfo = workspaceState.getBundleInfo(pluginRef.getId(), pluginRef.getVersion());
if (bundleInfo != null) {
addBundle(result, bundleInfo);
} else {
missing.add(pluginRef.toString());
}
}
if (!missing.isEmpty()) {
throw new MavenExecutionException("Inconsistent m2e-tycho workspace state, missing bundles: " + missing.toString(), (Throwable) null);
}
Map<String, BundleConfiguration> bundleConfigurations = product.getPluginConfiguration();
if (bundleConfigurations != null) {
for (BundleConfiguration bundleConfiguration : bundleConfigurations.values()) {
result.addBundleStartLevel(bundleConfiguration.getId(), bundleConfiguration.getStartLevel(), bundleConfiguration.isAutoStart());
}
}
return true;
}
Aggregations