Skip to content

Commit

Permalink
Remove support for deployableFeature option
Browse files Browse the repository at this point in the history
The deployableFeature option will create "standard eclipse update site
directory with feature content will be created under target folder" but
we already removed site-packaging from tycho for a while, if one wants
to archive similar a category.xml with eclipse-repository packaging
gives much more control and power to the user.
  • Loading branch information
laeubi committed Jan 7, 2024
1 parent 963075e commit c5ff94b
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 386 deletions.
9 changes: 9 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ If filtering provided artifacts is enabled, the repository references automatica
using exclusion and inclusion patterns and therefore allows more fine-grained control which references are added.
Additionally the automatically added references can be filter based on if they provide any of the filtered units or not.
If `addOnlyProviding` is `true` repositories that don't provide any filtered unit are not added to the assembled repo.

```xml
<plugin>
<groupId>org.eclipse.tycho</groupId>
Expand All @@ -148,6 +149,14 @@ If `addOnlyProviding` is `true` repositories that don't provide any filtered uni

```

### Remove support for deployableFeature option

The deployableFeature option will create "standard eclipse update site directory with feature content will
be created under target folder" but we already removed site-packaging from Tycho for a while, if one wants to
archive similar a category.xml with eclipse-repository packaging gives much more control and power to the user.
Alternativly new `mirror-target-platform` mojo can be used.


## 4.0.4

Backports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import java.io.File;

import org.eclipse.tycho.model.Feature;
import org.eclipse.tycho.model.ProductConfiguration;
import org.eclipse.tycho.model.UpdateSite;

public interface ArtifactDependencyWalker {
/**
Expand All @@ -31,8 +29,4 @@ public interface ArtifactDependencyWalker {
*/
void traverseFeature(File location, Feature feature, ArtifactDependencyVisitor visitor);

void traverseUpdateSite(UpdateSite site, ArtifactDependencyVisitor visitor);

void traverseProduct(ProductConfiguration productConfiguration, ArtifactDependencyVisitor visitor);

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.eclipse.tycho.model.PluginRef;
import org.eclipse.tycho.model.ProductConfiguration;
import org.eclipse.tycho.model.ProductConfiguration.ProductType;
import org.eclipse.tycho.model.UpdateSite;

public abstract class AbstractArtifactDependencyWalker implements ArtifactDependencyWalker {

Expand All @@ -56,15 +55,6 @@ protected AbstractArtifactDependencyWalker(DependencyArtifacts artifacts, Target
this.environments = environments;
}

@Override
public void traverseUpdateSite(UpdateSite site, ArtifactDependencyVisitor visitor) {
WalkbackPath visited = new WalkbackPath();

for (FeatureRef ref : site.getFeatures()) {
traverseFeature(ref, visitor, visited);
}
}

@Override
public void traverseFeature(File location, Feature feature, ArtifactDependencyVisitor visitor) {
traverseFeature(location, feature, null, visitor, new WalkbackPath());
Expand Down Expand Up @@ -111,11 +101,6 @@ protected ArtifactDescriptor getArtifact(File location, String id) {
return null;
}

@Override
public void traverseProduct(ProductConfiguration product, ArtifactDependencyVisitor visitor) {
traverseProduct(product, visitor, new WalkbackPath());
}

protected void traverseProduct(ProductConfiguration product, ArtifactDependencyVisitor visitor,
WalkbackPath visited) {
ProductType type = product.getType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.osgi.container.namespaces.EclipsePlatformNamespace;
import org.eclipse.osgi.internal.framework.FilterImpl;
Expand All @@ -61,11 +60,9 @@
import org.eclipse.tycho.TargetEnvironment;
import org.eclipse.tycho.TargetPlatform;
import org.eclipse.tycho.TychoConstants;
import org.eclipse.tycho.core.ArtifactDependencyVisitor;
import org.eclipse.tycho.core.ArtifactDependencyWalker;
import org.eclipse.tycho.core.BundleProject;
import org.eclipse.tycho.core.DependencyResolverConfiguration;
import org.eclipse.tycho.core.PluginDescription;
import org.eclipse.tycho.core.TargetPlatformConfiguration;
import org.eclipse.tycho.core.TychoProject;
import org.eclipse.tycho.core.ee.ExecutionEnvironmentUtils;
Expand All @@ -77,9 +74,6 @@
import org.eclipse.tycho.core.osgitools.project.EclipsePluginProjectImpl;
import org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts;
import org.eclipse.tycho.core.resolver.P2ResolverFactory;
import org.eclipse.tycho.model.Feature;
import org.eclipse.tycho.model.ProductConfiguration;
import org.eclipse.tycho.model.UpdateSite;
import org.eclipse.tycho.model.classpath.JUnitBundle;
import org.eclipse.tycho.model.classpath.JUnitClasspathContainerEntry;
import org.eclipse.tycho.model.classpath.LibraryClasspathEntry;
Expand Down Expand Up @@ -122,40 +116,7 @@ public class OsgiBundleProject extends AbstractTychoProject implements BundlePro

@Override
public ArtifactDependencyWalker getDependencyWalker(ReactorProject project) {
final DependencyArtifacts artifacts = getDependencyArtifacts(project);

final List<ClasspathEntry> cp = getClasspath(project);

return new ArtifactDependencyWalker() {
@Override
public void walk(ArtifactDependencyVisitor visitor) {
for (ClasspathEntry entry : cp) {
ArtifactDescriptor artifact = artifacts.getArtifact(entry.getArtifactKey());
ArtifactKey key = artifact.getKey();
File location = artifact.getLocation(true);
ReactorProject project = artifact.getMavenProject();
String classifier = artifact.getClassifier();
Collection<IInstallableUnit> installableUnits = artifact.getInstallableUnits();

PluginDescription plugin = new DefaultPluginDescription(key, location, project, classifier, null,
installableUnits);

visitor.visitPlugin(plugin);
}
}

@Override
public void traverseFeature(File location, Feature feature, ArtifactDependencyVisitor visitor) {
}

@Override
public void traverseUpdateSite(UpdateSite site, ArtifactDependencyVisitor artifactDependencyVisitor) {
}

@Override
public void traverseProduct(ProductConfiguration productConfiguration, ArtifactDependencyVisitor visitor) {
}
};
throw new UnsupportedOperationException();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.eclipse.tycho.DefaultArtifactKey;
import org.eclipse.tycho.ReactorProject;
import org.eclipse.tycho.TargetEnvironment;
import org.eclipse.tycho.core.ArtifactDependencyVisitor;
import org.eclipse.tycho.core.ArtifactDependencyWalker;
import org.eclipse.tycho.core.TychoProject;
import org.eclipse.tycho.model.IU;
Expand All @@ -28,13 +27,7 @@
public class P2IUProject extends AbstractArtifactBasedProject {
@Override
protected ArtifactDependencyWalker newDependencyWalker(ReactorProject project, TargetEnvironment environment) {
return new AbstractArtifactDependencyWalker(getDependencyArtifacts(project, environment),
getEnvironments(project, environment)) {
@Override
public void walk(ArtifactDependencyVisitor visitor) {
//Nothing to do
}
};
throw new UnsupportedOperationException();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,14 @@
import org.eclipse.tycho.DefaultArtifactKey;
import org.eclipse.tycho.ReactorProject;
import org.eclipse.tycho.TargetEnvironment;
import org.eclipse.tycho.core.ArtifactDependencyVisitor;
import org.eclipse.tycho.core.ArtifactDependencyWalker;
import org.eclipse.tycho.core.TychoProject;

@Component(role = TychoProject.class, hint = org.eclipse.tycho.ArtifactType.TYPE_P2_MAVEN_REPOSITORY)
public class P2SiteProject extends AbstractArtifactBasedProject {
@Override
protected ArtifactDependencyWalker newDependencyWalker(ReactorProject project, TargetEnvironment environment) {
return new AbstractArtifactDependencyWalker(getDependencyArtifacts(project, environment),
getEnvironments(project, environment)) {
@Override
public void walk(ArtifactDependencyVisitor visitor) {
//Nothing to do
}
};
throw new UnsupportedOperationException();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts;
import org.eclipse.tycho.core.resolver.target.ArtifactTypeHelper;
import org.eclipse.tycho.model.Feature;
import org.eclipse.tycho.model.ProductConfiguration;
import org.eclipse.tycho.model.UpdateSite;
import org.eclipse.tycho.targetplatform.P2TargetPlatform;

@Component(role = TychoProject.class, hint = PackagingType.TYPE_ECLIPSE_TARGET_DEFINITION)
Expand All @@ -50,16 +48,6 @@ public void walk(ArtifactDependencyVisitor visitor) {

}

@Override
public void traverseUpdateSite(UpdateSite site, ArtifactDependencyVisitor visitor) {

}

@Override
public void traverseProduct(ProductConfiguration productConfiguration, ArtifactDependencyVisitor visitor) {

}

@Override
public void traverseFeature(File location, Feature feature, ArtifactDependencyVisitor visitor) {

Expand All @@ -78,8 +66,7 @@ public DependencyArtifacts getDependencyArtifacts(ReactorProject reactorProject)
DefaultDependencyArtifacts artifacts = new DefaultDependencyArtifacts(reactorProject);
MavenSession mavenSession = getMavenSession(reactorProject);
MavenProject mavenProject = getMavenProject(reactorProject);
TargetPlatform targetPlatform = dependencyResolver.getPreliminaryTargetPlatform(mavenSession,
mavenProject);
TargetPlatform targetPlatform = dependencyResolver.getPreliminaryTargetPlatform(mavenSession, mavenProject);
if (targetPlatform instanceof P2TargetPlatform p2) {
Set<IInstallableUnit> installableUnits = p2.getInstallableUnits();
for (IInstallableUnit iu : installableUnits) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,26 @@
import org.apache.maven.it.Verifier;
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

@Ignore("deployable feature no longer supported")
public class DeployableFeatureTest extends AbstractTychoIntegrationTest {

@Test
public void testDeployableFeature() throws Exception {
Verifier v01 = getVerifier("TYCHO321deployableFeature");
v01.executeGoal("install");
v01.verifyErrorFreeLog();
@Test
public void testDeployableFeature() throws Exception {
Verifier v01 = getVerifier("TYCHO321deployableFeature");
v01.executeGoal("install");
v01.verifyErrorFreeLog();

File site = new File(v01.getBasedir(), "target/site");
Assert.assertTrue(site.isDirectory());
File site = new File(v01.getBasedir(), "target/site");
Assert.assertTrue(site.isDirectory());

Assert.assertTrue(new File(site, "features").list().length > 0);
Assert.assertTrue(new File(site, "plugins").list().length > 0);
Assert.assertTrue(new File(site, "features").list().length > 0);
Assert.assertTrue(new File(site, "plugins").list().length > 0);

Assert.assertTrue(new File(site, "artifacts.jar").isFile());
Assert.assertTrue(new File(site, "content.jar").isFile());
}
Assert.assertTrue(new File(site, "artifacts.jar").isFile());
Assert.assertTrue(new File(site, "content.jar").isFile());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,6 @@ public class PackageFeatureMojo extends AbstractTychoPackagingMojo {
@Parameter(property = "project.build.finalName", alias = "jarName", required = true)
private String finalName;

/**
* If set to <code>true</code>, standard eclipse update site directory with
* feature content will be created under target folder.
*
* @deprecated use the new <code>mirror-target-platform</code> instead.
*/
@Parameter(defaultValue = "false")
@Deprecated
private boolean deployableFeature = false;

@Parameter(defaultValue = "${project.build.directory}/site")
private File target;

Expand Down Expand Up @@ -203,10 +193,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}

project.getArtifact().setFile(outputJar);

if (deployableFeature) {
assembleDeployableFeature();
}
}
}

Expand Down Expand Up @@ -281,11 +267,6 @@ private FileSet getManuallyIncludedFiles(BuildProperties buildProperties) {
return getFileSet(basedir, buildProperties.getBinIncludes(), binExcludes);
}

private void assembleDeployableFeature() throws MojoExecutionException {
UpdateSiteAssembler assembler = new UpdateSiteAssembler(plexus, target);
getTychoProjectFacet().getDependencyWalker(DefaultReactorProject.adapt(project)).walk(assembler);
}

private void expandVersionQualifiers(Feature feature) throws MojoFailureException {
ReactorProject reactorProject = DefaultReactorProject.adapt(project);
feature.setVersion(reactorProject.getExpandedVersion());
Expand Down
Loading

0 comments on commit c5ff94b

Please sign in to comment.