use of org.eclipse.tycho.ReactorProject in project tycho by eclipse.
the class OsgiBundleProject method resolveClassPath.
@Override
public void resolveClassPath(MavenSession session, MavenProject project) {
DependencyArtifacts artifacts = getDependencyArtifacts(project);
State state = getResolverState(project, artifacts);
if (getLogger().isDebugEnabled() && DebugUtils.isDebugEnabled(session, project)) {
getLogger().debug(resolver.toDebugString(state));
}
BundleDescription bundleDescription = state.getBundleByLocation(project.getBasedir().getAbsolutePath());
List<ClasspathEntry> classpath = new ArrayList<>();
// project itself
ArtifactDescriptor artifact = getArtifact(artifacts, project.getBasedir(), bundleDescription.getSymbolicName());
ReactorProject projectProxy = DefaultReactorProject.adapt(project);
List<File> projectClasspath = getThisProjectClasspath(artifact, projectProxy);
classpath.add(new DefaultClasspathEntry(projectProxy, artifact.getKey(), projectClasspath, null));
// build.properties/jars.extra.classpath
addExtraClasspathEntries(classpath, projectProxy, artifacts);
// dependencies
List<AccessRule> strictBootClasspathAccessRules = new ArrayList<>();
strictBootClasspathAccessRules.add(new DefaultAccessRule("java/**", false));
for (DependencyEntry entry : dependencyComputer.computeDependencies(state.getStateHelper(), bundleDescription)) {
if (EquinoxResolver.SYSTEM_BUNDLE_ID == entry.desc.getBundleId()) {
if (entry.rules != null) {
strictBootClasspathAccessRules.addAll(entry.rules);
}
if (EquinoxResolver.SYSTEM_BUNDLE_SYMBOLIC_NAME.equals(entry.desc.getSymbolicName())) {
// synthetic system.bundle has no filesystem location
continue;
}
}
File location = new File(entry.desc.getLocation());
ArtifactDescriptor otherArtifact = getArtifact(artifacts, location, entry.desc.getSymbolicName());
ReactorProject otherProject = otherArtifact.getMavenProject();
List<File> locations;
if (otherProject != null) {
locations = getOtherProjectClasspath(otherArtifact, otherProject, null);
} else {
locations = getBundleClasspath(otherArtifact);
}
if (locations.isEmpty() && !entry.rules.isEmpty()) {
getLogger().warn("Empty classpath of required bundle " + otherArtifact);
}
classpath.add(new DefaultClasspathEntry(otherProject, otherArtifact.getKey(), locations, entry.rules));
}
project.setContextValue(TychoConstants.CTX_ECLIPSE_PLUGIN_CLASSPATH, classpath);
project.setContextValue(TychoConstants.CTX_ECLIPSE_PLUGIN_STRICT_BOOTCLASSPATH_ACCESSRULES, strictBootClasspathAccessRules);
project.setContextValue(TychoConstants.CTX_ECLIPSE_PLUGIN_BOOTCLASSPATH_EXTRA_ACCESSRULES, dependencyComputer.computeBootClasspathExtraAccessRules(state.getStateHelper(), bundleDescription));
addPDESourceRoots(project);
}
use of org.eclipse.tycho.ReactorProject in project tycho by eclipse.
the class ArtifactCollection method toDebugString.
public void toDebugString(StringBuilder sb, String linePrefix) {
for (ArtifactDescriptor artifact : artifacts.values()) {
sb.append(linePrefix);
sb.append(artifact.getKey().toString());
sb.append(": ");
ReactorProject project = artifact.getMavenProject();
if (project != null) {
sb.append(project.toString());
} else {
sb.append(artifact.getLocation());
}
sb.append("\n");
}
}
use of org.eclipse.tycho.ReactorProject in project tycho by eclipse.
the class LocalDependencyResolver method addProjects.
private void addProjects(MavenSession session, DefaultDependencyArtifacts platform) {
File parentDir = null;
for (MavenProject project : session.getProjects()) {
ReactorProject projectProxy = DefaultReactorProject.adapt(project);
TychoProject dr = projectTypes.get(project.getPackaging());
if (dr != null) {
ArtifactKey key = dr.getArtifactKey(projectProxy);
platform.removeAll(key.getType(), key.getId());
platform.addReactorArtifact(key, projectProxy, null, null);
if (parentDir == null || isSubdir(project.getBasedir(), parentDir)) {
parentDir = project.getBasedir();
}
}
}
}
use of org.eclipse.tycho.ReactorProject in project tycho by eclipse.
the class TychoMavenLifecycleParticipant method afterProjectsRead.
@Override
public void afterProjectsRead(MavenSession session) throws MavenExecutionException {
try {
if (disableLifecycleParticipation(session)) {
return;
}
List<MavenProject> projects = session.getProjects();
validate(projects);
// setting this system property to let EF figure out where the traffic
// is coming from (#467418)
System.setProperty(P2_USER_AGENT_KEY, P2_USER_AGENT_VALUE + TychoVersion.getTychoVersion());
configureComponents(session);
for (MavenProject project : projects) {
resolver.setupProject(session, project, DefaultReactorProject.adapt(project));
}
List<ReactorProject> reactorProjects = DefaultReactorProject.adapt(session);
for (MavenProject project : projects) {
resolver.resolveProject(session, project, reactorProjects);
}
} catch (BuildFailureException e) {
// trace by wrapping it in MavenExecutionException
throw new MavenExecutionException(e.getMessage(), e);
}
}
use of org.eclipse.tycho.ReactorProject in project tycho by eclipse.
the class DefaultReactorProject method adapt.
public static ReactorProject adapt(MavenProject project) {
if (project == null) {
return null;
}
ReactorProject reactorProject = (ReactorProject) project.getContextValue(CTX_REACTOR_PROJECT);
if (reactorProject == null) {
reactorProject = new DefaultReactorProject(project);
project.setContextValue(CTX_REACTOR_PROJECT, reactorProject);
}
return reactorProject;
}
Aggregations