Skip to content

Commit

Permalink
Fail on missing plugin product requirement
Browse files Browse the repository at this point in the history
Currently Tycho does not fail if a requirement of a product can't be
found in the resolve phase but only if the product is materialized. Even
then it fails with an obscure error that claims the products bundle is
not found where actually the dependency can't be found.
  • Loading branch information
laeubi committed Jan 21, 2024
1 parent 6b9cefe commit 5fe9ea7
Show file tree
Hide file tree
Showing 18 changed files with 434 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,45 @@
public class TargetPlatformConfigurationMojo extends AbstractMojo {

/**
* <p>
* Target environments (os/ws/arch) to consider.
* </p>
* Example:
*
* <pre>
*&lt;environments&gt;
* &lt;environment&gt;
* &lt;os&gt;linux&lt;/os&gt;
* &lt;ws&gt;gtk&lt;/ws&gt;
* &lt;arch&gt;x86_64&lt;/arch&gt;
* &lt;/environment&gt;
* &lt;environment&gt;
* &lt;os&gt;linux&lt;/os&gt;
* &lt;ws&gt;gtk&lt;/ws&gt;
* &lt;arch&gt;ppc64le&lt;/arch&gt;
* &lt;/environment&gt;
* &lt;environment&gt;
* &lt;os&gt;linux&lt;/os&gt;
* &lt;ws&gt;gtk&lt;/ws&gt;
* &lt;arch&gt;aarch64&lt;/arch&gt;
* &lt;/environment&gt;
* &lt;environment&gt;
* &lt;os&gt;win32&lt;/os&gt;
* &lt;ws&gt;win32&lt;/ws&gt;
* &lt;arch&gt;x86_64&lt;/arch&gt;
* &lt;/environment&gt;
* &lt;environment&gt;
* &lt;os&gt;macosx&lt;/os&gt;
* &lt;ws&gt;cocoa&lt;/ws&gt;
* &lt;arch&gt;x86_64&lt;/arch&gt;
* &lt;/environment&gt;
* &lt;environment&gt;
* &lt;os&gt;macosx&lt;/os&gt;
* &lt;ws&gt;cocoa&lt;/ws&gt;
* &lt;arch&gt;aarch64&lt;/arch&gt;
* &lt;/environment&gt;
*&lt;/environments&gt;
* </pre>
*/
@Parameter(name = DefaultTargetPlatformConfigurationReader.ENVIRONMENTS)
private TargetEnvironment[] environments;
Expand Down Expand Up @@ -208,8 +246,9 @@ public class TargetPlatformConfigurationMojo extends AbstractMojo {
private IncludeSourceMode targetDefinionIncludeSource;

/**
* Configures if referenced repositories should be included when fetching repositories.
* The default is <code>ignore</code>. To specify to use referenced repositories, pass <code>include</code>.
* Configures if referenced repositories should be included when fetching repositories. The
* default is <code>ignore</code>. To specify to use referenced repositories, pass
* <code>include</code>.
*/
@Parameter(name = DefaultTargetPlatformConfigurationReader.REFERENCED_REPOSITORY_MODE)
private ReferencedRepositoryMode referencedRepositoryMode;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.equinox.internal.p2.director.QueryableArray;
import org.eclipse.equinox.internal.p2.director.Slicer;
import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.internal.p2.metadata.RequiredCapability;
import org.eclipse.equinox.internal.p2.metadata.RequiredPropertiesMatch;
Expand All @@ -48,6 +47,7 @@
import org.eclipse.tycho.core.shared.MavenLogger;
import org.eclipse.tycho.core.shared.StatusTool;
import org.eclipse.tycho.p2.resolver.ResolverException;
import org.eclipse.tycho.p2tools.copiedfromp2.Slicer;

abstract class AbstractSlicerResolutionStrategy extends AbstractResolutionStrategy {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@
import org.eclipse.tycho.p2.publisher.DownloadStatsAdvice;
import org.eclipse.tycho.p2.publisher.FeatureDependenciesAction;
import org.eclipse.tycho.p2.publisher.P2Artifact;
import org.eclipse.tycho.p2.publisher.ProductDependenciesAction;
import org.eclipse.tycho.p2.publisher.TransientArtifactRepository;
import org.eclipse.tycho.p2.publisher.rootfiles.FeatureRootAdvice;
import org.eclipse.tycho.p2.repository.ArtifactsIO;
import org.eclipse.tycho.p2.repository.MetadataIO;
import org.eclipse.tycho.p2maven.actions.CategoryDependenciesAction;
import org.eclipse.tycho.p2maven.actions.ProductDependenciesAction;
import org.eclipse.tycho.p2maven.actions.ProductFile2;
import org.osgi.framework.BundleException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.apache.felix.resolver.util.CopyOnWriteSet;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.internal.p2.director.QueryableArray;
import org.eclipse.equinox.internal.p2.director.Slicer;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IProvidedCapability;
Expand Down Expand Up @@ -76,6 +75,7 @@
import org.eclipse.tycho.p2.resolver.ResolverException;
import org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub;
import org.eclipse.tycho.p2.target.facade.TargetPlatformFactory;
import org.eclipse.tycho.p2tools.copiedfromp2.Slicer;
import org.eclipse.tycho.targetplatform.P2TargetPlatform;

public class P2ResolverImpl implements P2Resolver {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
Expand All @@ -31,13 +30,13 @@
import org.eclipse.equinox.internal.p2.director.Projector;
import org.eclipse.equinox.internal.p2.director.QueryableArray;
import org.eclipse.equinox.internal.p2.director.SimplePlanner;
import org.eclipse.equinox.internal.p2.director.Slicer;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.tycho.core.shared.MavenLogger;
import org.eclipse.tycho.core.shared.StatusTool;
import org.eclipse.tycho.p2.resolver.ResolverException;
import org.eclipse.tycho.p2tools.copiedfromp2.Slicer;

public class ProjectorResolutionStrategy extends AbstractSlicerResolutionStrategy {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.equinox.internal.p2.director.PermissiveSlicer;
import org.eclipse.equinox.internal.p2.director.Slicer;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.tycho.TargetEnvironment;
import org.eclipse.tycho.core.shared.MavenLogger;
import org.eclipse.tycho.p2.resolver.ResolverException;
import org.eclipse.tycho.p2tools.copiedfromp2.PermissiveSlicer;
import org.eclipse.tycho.p2tools.copiedfromp2.Slicer;

public class SlicerResolutionStrategy extends AbstractSlicerResolutionStrategy {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
###############################################################################
# Copyright (c) 2010, 2011 SAP AG and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# SAP AG - initial API and implementation
###############################################################################
bin.includes = feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.osgi.service.jaxrs.feature"
label="Example Feature"
version="1.0.0.qualifier">

<description url="http://www.example.com/description">
A description of an example feature
</description>

<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>

<license url="http://www.example.com/license">
[Enter License Description here.]
</license>

<!-- this should not lead to an NPE in the dependency-only publisher (TYCHO-556) -->
<url>
<discovery label="New discovery site" url="http://newsite"/>
</url>

<plugin
id="org.osgi.service.jaxrs"
download-size="0"
install-size="0"
version="0.0.0"/>

</feature>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>tycho-its</groupId>
<artifactId>missing.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>org.osgi.service.jaxrs.feature</artifactId>
<packaging>eclipse-feature</packaging>
<name>Example Feature</name>

<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.jaxrs</artifactId>
<version>1.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.spec</groupId>
<artifactId>org.apache.aries.javax.jax.rs-api</artifactId>
<version>1.0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>1.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.18.600</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>tycho-its</groupId>
<artifactId>missing.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<modules>
<module>feature</module>
<module>product</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>

<product uid="plugin.product" version="1.0.0.qualifier" useFeatures="true" includeLaunchers="false" autoIncludeRequirements="false">

<features>
<feature id="org.osgi.service.jaxrs.feature" />
</features>

</product>
Loading

0 comments on commit 5fe9ea7

Please sign in to comment.