Skip to content

Commit

Permalink
Update to 2024-06 release
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed Jun 16, 2024
1 parent 7400a7e commit 2474b6a
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 50 deletions.
26 changes: 13 additions & 13 deletions p2-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.publisher</artifactId>
<version>1.9.100</version>
<version>1.9.200</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
Expand All @@ -47,7 +47,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.engine</artifactId>
<version>2.10.0</version>
<version>2.10.200</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
Expand All @@ -70,12 +70,12 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.frameworkadmin</artifactId>
<version>2.3.100</version>
<version>2.3.200</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.preferences</artifactId>
<version>3.11.0</version>
<version>3.11.100</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Expand All @@ -96,7 +96,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.metadata.repository</artifactId>
<version>1.5.300</version>
<version>1.5.400</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
Expand All @@ -123,27 +123,27 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.jarprocessor</artifactId>
<version>1.3.300</version>
<version>1.3.400</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.touchpoint.natives</artifactId>
<version>1.5.200</version>
<version>1.5.300</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.touchpoint.eclipse</artifactId>
<version>2.4.200</version>
<version>2.4.300</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.garbagecollector</artifactId>
<version>1.3.200</version>
<version>1.3.300</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.director.app</artifactId>
<version>1.3.300</version>
<version>1.3.400</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
Expand All @@ -154,12 +154,12 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.concurrent</artifactId>
<version>1.3.0</version>
<version>1.3.100</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.simpleconfigurator</artifactId>
<version>1.5.200</version>
<version>1.5.300</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
Expand All @@ -169,7 +169,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.frameworkadmin.equinox</artifactId>
<version>1.3.100</version>
<version>1.3.200</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.publisher.eclipse</artifactId>
<version>1.6.0</version>
<version>1.6.100</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
Expand Down
2 changes: 1 addition & 1 deletion tycho-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.publisher</artifactId>
<version>1.9.100</version>
<version>1.9.200</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 1 addition & 1 deletion tycho-apitools-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<dependency>
<groupId>org.eclipse.pde</groupId>
<artifactId>org.eclipse.pde.core</artifactId>
<version>3.18.0</version>
<version>3.18.100</version>
<type>jar</type>
<exclusions>
<exclusion>
Expand Down
6 changes: 3 additions & 3 deletions tycho-build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.publisher</artifactId>
<version>1.9.100</version>
<version>1.9.200</version>
</dependency>

<dependency>
Expand All @@ -71,7 +71,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.engine</artifactId>
<version>2.10.0</version>
<version>2.10.200</version>
</dependency>


Expand Down Expand Up @@ -123,7 +123,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.metadata.repository</artifactId>
<version>1.5.300</version>
<version>1.5.400</version>
</dependency>
<dependency>
<groupId>org.eclipse.tycho</groupId>
Expand Down
2 changes: 1 addition & 1 deletion tycho-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
<dependency>
<groupId>org.eclipse.pde</groupId>
<artifactId>org.eclipse.pde.core</artifactId>
<version>3.18.0</version>
<version>3.18.100</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public MavenTargetDefinitionContent(MavenGAVLocation location, MavenDependencies
throw new TargetDefinitionResolutionException("feature generation failed!", e);
}
}
FeaturePublisher.publishFeatures(features, repositoryContent::put, logger);
FeaturePublisher.publishFeatures(features, repositoryContent::put, artifactRepository, logger);
}
}

Expand Down Expand Up @@ -396,7 +396,7 @@ private IInstallableUnit publish(BundleDescription bundleDescription, File bundl
private IInstallableUnit publish(BundleDescription bundleDescription, File bundleLocation, IPropertyAdvice advice) {
IArtifactKey key = BundlesAction.createBundleArtifactKey(bundleDescription.getSymbolicName(),
bundleDescription.getVersion().toString());
IArtifactDescriptor descriptor = FileArtifactRepository.forFile(bundleLocation, key);
IArtifactDescriptor descriptor = FileArtifactRepository.forFile(bundleLocation, key, artifactRepository);
PublisherInfo publisherInfo = new PublisherInfo();
publisherInfo.addAdvice(advice);
publisherInfo.addAdvice(new MavenChecksumAdvice(bundleLocation));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest;
import org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository;
import org.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository;
Expand Down Expand Up @@ -222,17 +223,18 @@ private static boolean matches(IArtifactKey key, IArtifactDescriptor descriptor)
&& key.getVersion().equals(descriptorKey.getVersion()));
}

public static IArtifactDescriptor forFile(File file, IArtifactKey key) {
return new FileArtifactDescriptor(file, key);
public static IArtifactDescriptor forFile(File file, IArtifactKey key, IArtifactRepository repository) {
return new FileArtifactDescriptor(file, key, repository);
}

private static final class FileArtifactDescriptor extends ArtifactDescriptor {

private File file;

private FileArtifactDescriptor(File file, IArtifactKey key) {
private FileArtifactDescriptor(File file, IArtifactKey key, IArtifactRepository repository) {
super(key);
this.file = file;
setRepository(repository);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
import org.eclipse.equinox.p2.publisher.Publisher;
import org.eclipse.equinox.p2.publisher.PublisherInfo;
import org.eclipse.equinox.p2.publisher.actions.IPropertyAdvice;
import org.eclipse.tycho.p2maven.tmp.BundlesAction;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.tycho.core.resolver.target.FileArtifactRepository;
import org.eclipse.tycho.p2maven.tmp.BundlesAction;
import org.osgi.framework.BundleException;

public class BundlePublisher extends BundlesAction {
Expand All @@ -47,8 +47,8 @@ private BundlePublisher(BundleDescription bundleDescription) {
super(new BundleDescription[] { bundleDescription });
}

public static Optional<IInstallableUnit> getBundleIU(File bundleLocation, IPublisherAdvice... advices)
throws IOException, BundleException {
public static Optional<IInstallableUnit> getBundleIU(File bundleLocation, IArtifactRepository repository,
IPublisherAdvice... advices) throws IOException, BundleException {
BundleDescription bundleDescription = BundlesAction.createBundleDescription(bundleLocation);
if (bundleDescription == null) {
//seems it is not a bundle
Expand All @@ -65,7 +65,7 @@ public static Optional<IInstallableUnit> getBundleIU(File bundleLocation, IPubli
}
IArtifactKey key = BundlesAction.createBundleArtifactKey(symbolicName,
bundleDescription.getVersion().toString());
IArtifactDescriptor descriptor = FileArtifactRepository.forFile(bundleLocation, key);
IArtifactDescriptor descriptor = FileArtifactRepository.forFile(bundleLocation, key, repository);
return Optional.ofNullable(publishBundle(bundleDescription, descriptor, publisherInfo));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
public class FeaturePublisher {

public static void publishFeatures(List<Feature> features,
BiConsumer<IArtifactDescriptor, IInstallableUnit> consumer, MavenLogger logger) {
BiConsumer<IArtifactDescriptor, IInstallableUnit> consumer, IArtifactRepository artifactRepository,
MavenLogger logger) {
if (features.isEmpty()) {
return;
}
Expand Down Expand Up @@ -85,7 +86,7 @@ protected IInstallableUnit generateFeatureJarIU(Feature feature, IPublisherInfo
//The actual published feature...
for (IArtifactKey key : artifacts) {
IArtifactDescriptor fileDescriptor = FileArtifactRepository
.forFile(new File(publishedFeature.getLocation()), key);
.forFile(new File(publishedFeature.getLocation()), key, artifactRepository);
consumer.accept(fileDescriptor, unit);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.publisher.IPublisherInfo;
import org.eclipse.equinox.p2.publisher.PublisherInfo;
import org.eclipse.tycho.p2maven.tmp.BundlesAction;
import org.eclipse.equinox.p2.publisher.eclipse.Feature;
import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.IQueryResult;
Expand All @@ -37,6 +36,7 @@
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.tycho.core.resolver.target.FileArtifactRepository;
import org.eclipse.tycho.core.resolver.target.SupplierMetadataRepository;
import org.eclipse.tycho.p2maven.tmp.BundlesAction;
import org.eclipse.tycho.targetplatform.TargetDefinitionContent;
import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException;
import org.osgi.framework.BundleException;
Expand Down Expand Up @@ -85,14 +85,16 @@ public synchronized void preload(IProgressMonitor monitor) {
boolean hasPlugins = pluginsPath.isDirectory();
boolean hasFeatures = featurePath.isDirectory();
if (hasPlugins) {
readBundles(pluginsPath, repositoryContent::put, hasFeatures ? subMonitor.split(100) : subMonitor);
readBundles(pluginsPath, repositoryContent::put, hasFeatures ? subMonitor.split(100) : subMonitor,
artifactRepository);
}
if (hasFeatures) {
readFeatures(featurePath, repositoryContent::put, hasPlugins ? subMonitor.split(100) : subMonitor);
readFeatures(featurePath, repositoryContent::put, artifactRepository,
hasPlugins ? subMonitor.split(100) : subMonitor);
}
if (!hasFeatures && !hasPlugins) {
readBundles(location, repositoryContent::put, subMonitor.split(100));
readFeatures(location, repositoryContent::put, subMonitor.split(100));
readBundles(location, repositoryContent::put, subMonitor.split(100), artifactRepository);
readFeatures(location, repositoryContent::put, artifactRepository, subMonitor.split(100));
}
} catch (ResolverException e) {
throw new TargetDefinitionResolutionException("resolving location " + location + " failed", e);
Expand All @@ -112,7 +114,7 @@ private Map<IArtifactDescriptor, IInstallableUnit> getRepositoryContent() {
}

private static void readFeatures(File path, BiConsumer<IArtifactDescriptor, IInstallableUnit> consumer,
IProgressMonitor monitor) {
IArtifactRepository artifactRepository, IProgressMonitor monitor) {
PublisherInfo publisherInfo = new PublisherInfo();
publisherInfo.setArtifactOptions(IPublisherInfo.A_INDEX);
if (path.isDirectory()) {
Expand All @@ -132,7 +134,7 @@ private static void readFeatures(File path, BiConsumer<IArtifactDescriptor, IIns
Feature feature = new FeatureParser().parse(featureLocation);
if (feature != null) {
feature.setLocation(featureLocation.getAbsolutePath());
FeaturePublisher.publishFeatures(List.of(feature), consumer, null);
FeaturePublisher.publishFeatures(List.of(feature), consumer, artifactRepository, null);
}
subMonitor.worked(1);
}
Expand All @@ -141,7 +143,7 @@ private static void readFeatures(File path, BiConsumer<IArtifactDescriptor, IIns
}

private static void readBundles(File path, BiConsumer<IArtifactDescriptor, IInstallableUnit> consumer,
IProgressMonitor monitor) throws ResolverException {
IProgressMonitor monitor, IArtifactRepository artifactRepository) throws ResolverException {
PublisherInfo publisherInfo = new PublisherInfo();
publisherInfo.setArtifactOptions(IPublisherInfo.A_INDEX);
if (path.isDirectory()) {
Expand All @@ -163,7 +165,7 @@ private static void readBundles(File path, BiConsumer<IArtifactDescriptor, IInst
if (bundleDescription != null) {
IArtifactKey key = BundlesAction.createBundleArtifactKey(
bundleDescription.getSymbolicName(), bundleDescription.getVersion().toString());
consumer.accept(FileArtifactRepository.forFile(bundleLocation, key),
consumer.accept(FileArtifactRepository.forFile(bundleLocation, key, artifactRepository),
BundlesAction.createBundleIU(bundleDescription, key, publisherInfo));
}
} catch (BundleException | IOException | RuntimeException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ public class PomDependencyCollectorImpl implements PomDependencyCollector {
private final List<IArtifactDescriptor> fileDescriptors = new ArrayList<>();
private FileRepositoryArtifactProvider fileRepositoryArtifactProvider;

private FileArtifactRepository artifactRepository;

public PomDependencyCollectorImpl(Logger logger, ReactorProject project, IProvisioningAgent agent) {
this.logger = logger;
this.project = project;
artifactRepository = new FileArtifactRepository(agent, fileDescriptors::iterator);
fileRepositoryArtifactProvider = new FileRepositoryArtifactProvider(
Collections.singletonList(new FileArtifactRepository(agent, fileDescriptors::iterator)),
ArtifactTransferPolicies.forLocalArtifacts());
Collections.singletonList(artifactRepository), ArtifactTransferPolicies.forLocalArtifacts());
}

public File getProjectLocation() {
Expand All @@ -85,7 +87,8 @@ public Entry<ArtifactKey, IArtifactDescriptor> addMavenArtifact(IArtifactFacade
for (IArtifactKey key : unit.getArtifacts()) {
ArtifactKey artifactKey = ArtifactTypeHelper.toTychoArtifactKey(unit, key);
if (artifactKey != null) {
IArtifactDescriptor descriptor = FileArtifactRepository.forFile(artifact.getLocation(), key);
IArtifactDescriptor descriptor = FileArtifactRepository.forFile(artifact.getLocation(), key,
artifactRepository);
fileDescriptors.add(descriptor);
descriptorMap.put(artifact, descriptor);
resultArtifactKey = new SimpleEntry<>(artifactKey, descriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.publisher.IPublisherInfo;
import org.eclipse.equinox.p2.publisher.PublisherInfo;
import org.eclipse.tycho.p2maven.tmp.BundlesAction;
import org.eclipse.equinox.p2.publisher.eclipse.Feature;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
Expand All @@ -43,6 +42,7 @@
import org.eclipse.tycho.core.shared.MavenLogger;
import org.eclipse.tycho.p2.resolver.BundlePublisher;
import org.eclipse.tycho.p2.resolver.FeaturePublisher;
import org.eclipse.tycho.p2maven.tmp.BundlesAction;
import org.eclipse.tycho.p2maven.transport.TychoRepositoryTransport;
import org.eclipse.tycho.targetplatform.TargetDefinitionContent;
import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException;
Expand Down Expand Up @@ -106,13 +106,13 @@ public RepositoryLocationContent(URI uri, Collection<Requirement> requirements,
throw new TargetDefinitionResolutionException("Can't fetch resource from " + url, e);
}
}
FeaturePublisher.publishFeatures(features, repositoryContent::put, logger);
FeaturePublisher.publishFeatures(features, repositoryContent::put, artifactRepository, logger);
}

private void publish(BundleDescription bundleDescription, File bundleLocation) {
IArtifactKey key = BundlesAction.createBundleArtifactKey(bundleDescription.getSymbolicName(),
bundleDescription.getVersion().toString());
IArtifactDescriptor descriptor = FileArtifactRepository.forFile(bundleLocation, key);
IArtifactDescriptor descriptor = FileArtifactRepository.forFile(bundleLocation, key, artifactRepository);
PublisherInfo publisherInfo = new PublisherInfo();
publisherInfo.setArtifactOptions(IPublisherInfo.A_INDEX);
IInstallableUnit iu = BundlePublisher.publishBundle(bundleDescription, descriptor, publisherInfo);
Expand Down
Loading

0 comments on commit 2474b6a

Please sign in to comment.