Skip to content

Commit

Permalink
Add repo2runnable as a mojo
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed Jan 24, 2024
1 parent 51596d2 commit 44e4f58
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 127 deletions.
27 changes: 26 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,31 @@ If you are reading this in the browser, then you can quickly jump to specific ve

## 5.0.0 (under development)

### new `repo-to-runnable` mojo

This is a replacement for the [Repo2Runnable ant task](https://wiki.eclipse.org/Equinox/p2/Ant_Tasks#Repo2Runnable), example:

```xml
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>repo-to-runnable</id>
<goals>
<goal>repo-to-runnable</goal>
</goals>
<phase>pre-integration-test</phase>
<configuration>
<source>...</source>
<destination>...</destination>
</configuration>
</execution>
</executions>
</plugin>
```

### support for embedded target locations

You can already define target definition files in various ways, e.g. as maven artifact or file reference,
Expand Down Expand Up @@ -56,7 +81,7 @@ You can now use `javac` as the compiler backend for Tycho by adding the followin
```


### new `mirror-target-platform`
### new `mirror-target-platform` mojo

There is a new `mirror-target-platform` that allows to mirror the current target platform of a project into a P2 update site, this can b enabled for a project like this:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import org.eclipse.equinox.p2.internal.repository.mirroring.Mirroring;
import org.eclipse.equinox.p2.internal.repository.tools.Activator;
import org.eclipse.equinox.p2.internal.repository.tools.Messages;
import org.eclipse.equinox.p2.internal.repository.tools.RepositoryDescriptor;
import org.eclipse.equinox.p2.internal.repository.tools.SlicingOptions;
import org.eclipse.equinox.p2.internal.repository.tools.XZCompressor;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
Expand Down Expand Up @@ -82,6 +81,7 @@
import org.eclipse.tycho.p2.tools.mirroring.facade.MirrorApplicationService;
import org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions;
import org.eclipse.tycho.p2tools.copiedfromp2.RecreateRepositoryApplication;
import org.eclipse.tycho.p2tools.copiedfromp2.RepositoryDescriptor;

@Component(role = MirrorApplicationService.class)
public class MirrorApplicationServiceImpl implements MirrorApplicationService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.eclipse.equinox.internal.p2.metadata.RequiredCapability;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.internal.repository.tools.RepositoryDescriptor;
import org.eclipse.equinox.p2.internal.repository.tools.SlicingOptions;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
Expand All @@ -60,6 +59,7 @@
import org.eclipse.tycho.p2.tools.RepositoryReference;
import org.eclipse.tycho.p2maven.ListCompositeArtifactRepository;
import org.eclipse.tycho.p2tools.copiedfromp2.PermissiveSlicer;
import org.eclipse.tycho.p2tools.copiedfromp2.RepositoryDescriptor;
import org.eclipse.tycho.p2tools.copiedfromp2.Slicer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.internal.repository.tools.Messages;
import org.eclipse.equinox.p2.internal.repository.tools.RepositoryDescriptor;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.repository.ICompositeRepository;
import org.eclipse.equinox.p2.repository.IRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.eclipse.equinox.p2.internal.repository.mirroring.Mirroring;
import org.eclipse.equinox.p2.internal.repository.mirroring.XMLMirrorLog;
import org.eclipse.equinox.p2.internal.repository.tools.Messages;
import org.eclipse.equinox.p2.internal.repository.tools.RepositoryDescriptor;
import org.eclipse.equinox.p2.internal.repository.tools.SlicingOptions;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Sonatype, Inc. - ongoing development
* Red Hat, Inc. - fragment creation, Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.internal.repository.tools;
package org.eclipse.tycho.p2tools.copiedfromp2;

import java.io.File;
import java.io.FileNotFoundException;
Expand All @@ -39,16 +39,15 @@
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.equinox.frameworkadmin.BundleInfo;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.engine.DownloadManager;
import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand;
import org.eclipse.equinox.internal.p2.engine.InstallableUnitPhase;
import org.eclipse.equinox.internal.p2.engine.Messages;
import org.eclipse.equinox.internal.p2.engine.Phase;
import org.eclipse.equinox.internal.p2.engine.PhaseSet;
import org.eclipse.equinox.internal.p2.engine.ProfileWriter;
import org.eclipse.equinox.internal.p2.engine.ProfileXMLConstants;
import org.eclipse.equinox.internal.p2.engine.phases.Collect;
import org.eclipse.equinox.internal.simpleconfigurator.manipulator.SimpleConfiguratorManipulatorImpl;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.engine.IEngine;
Expand All @@ -57,7 +56,7 @@
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
import org.eclipse.equinox.p2.internal.repository.tools.RepositoryDescriptor;
import org.eclipse.equinox.p2.internal.repository.tools.Messages;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IProvidedCapability;
Expand All @@ -79,6 +78,11 @@
*/
@SuppressWarnings("nls")
public class Repo2Runnable extends AbstractApplication implements IApplication {

public Repo2Runnable(IProvisioningAgent agent) {
super(agent);
}

private static final String NATIVE_ARTIFACTS = "nativeArtifacts"; //$NON-NLS-1$
private static final String NATIVE_TYPE = "org.eclipse.equinox.p2.native"; //$NON-NLS-1$
private static final String PARM_OPERAND = "operand"; //$NON-NLS-1$
Expand Down Expand Up @@ -226,8 +230,7 @@ public IStatus run(IProgressMonitor monitor) throws ProvisionException {
}
}
}
SimpleConfiguratorManipulator simpleManipulator = ServiceHelper
.getService(Activator.getBundleContext(), SimpleConfiguratorManipulator.class);
SimpleConfiguratorManipulator simpleManipulator = new SimpleConfiguratorManipulatorImpl();
simpleManipulator.saveConfiguration(bundles.toArray(new BundleInfo[0]), fragmentInfo,
parentDir.toURI());
} catch (FileNotFoundException e) {
Expand Down Expand Up @@ -326,7 +329,7 @@ private IQueryResult<IInstallableUnit> getAllIUs(IMetadataRepository repository,
* Remove the given profile from the profile registry.
*/
private void removeProfile(IProfile profile) throws ProvisionException {
IProfileRegistry registry = Activator.getProfileRegistry();
IProfileRegistry registry = agent.getService(IProfileRegistry.class);
registry.removeProfile(profile.getProfileId());
}

Expand All @@ -339,7 +342,7 @@ private IProfile createProfile() throws ProvisionException {
URIUtil.toFile(destinationArtifactRepository.getLocation()).getAbsolutePath());
properties.put(IProfile.PROP_INSTALL_FOLDER,
URIUtil.toFile(destinationArtifactRepository.getLocation()).getAbsolutePath());
IProfileRegistry registry = Activator.getProfileRegistry();
IProfileRegistry registry = agent.getService(IProfileRegistry.class);
return registry.addProfile(System.currentTimeMillis() + "-" + Math.random(), properties); //$NON-NLS-1$
}

Expand Down
Loading

0 comments on commit 44e4f58

Please sign in to comment.