Skip to content

Commit

Permalink
Add support for TargetDefinition#implicitDependencies
Browse files Browse the repository at this point in the history
PDE has support for implicitDependencies defined in the target that
Tycho currently ignores.

This adds the required support to Tycho to understand dependencies
defined in this way.
  • Loading branch information
laeubi committed Dec 14, 2024
1 parent 18acc30 commit fe73236
Show file tree
Hide file tree
Showing 3 changed files with 497 additions and 454 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Stream;

import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.tycho.ArtifactKey;
import org.eclipse.tycho.ArtifactType;
import org.eclipse.tycho.DefaultArtifactKey;
import org.eclipse.tycho.OptionalResolutionAction;
import org.eclipse.tycho.TargetEnvironment;
import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode;
Expand Down Expand Up @@ -267,7 +270,9 @@ public DependencyResolverConfiguration getDependencyResolverConfiguration() {

@Override
public List<ArtifactKey> getAdditionalArtifacts() {
return extraRequirements;
Stream<DefaultArtifactKey> targetFiles = getTargets().stream().flatMap(tdf -> tdf.implicitDependencies())
.map(id -> new DefaultArtifactKey(ArtifactType.TYPE_ECLIPSE_PLUGIN, id.getId()));
return Stream.concat(extraRequirements.stream(), targetFiles).distinct().toList();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Properties;
import java.util.stream.Stream;

import org.eclipse.tycho.IArtifactFacade;
import org.eclipse.tycho.MavenArtifactRepositoryReference;
Expand Down Expand Up @@ -54,9 +55,21 @@ public interface TargetDefinition {
@Override
public boolean equals(Object obj);

/**
*
* @return a stream of implicit dependencies defined in the target to add as an
* additional dependency to every project
*/
Stream<ImplicitDependency> implicitDependencies();

@Override
public int hashCode();

public interface ImplicitDependency {

String getId();
}

public interface Location {

/**
Expand Down
Loading

0 comments on commit fe73236

Please sign in to comment.