forked from eclipse-tycho/tycho
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
198 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<extensions> | ||
<extension> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-build</artifactId> | ||
<version>${tycho-version}</version> | ||
</extension> | ||
</extensions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-Dtycho-version=4.0.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Publish bundles and update-site to maven repository | ||
|
||
This Demo shows how to publish a set of bundles as a P2 Update-Site to a maven repository (simulated by a folder here), | ||
with this approach it is possible to deploy a whole project consumable by P2 and maven users with only using the maven repository as the backing store. | ||
|
||
As a result of building the project with `mvn clean deploy -DaltDeploymentRepository=snapshot-repo::default::file:maven-repository` you can inspect the following items: | ||
|
||
- find the produced site in `site/target/repository` | ||
- see the deployed artifacts in the file base maven repository under `maven-repository` | ||
- such a repository can be used in Eclipse for example by adding the following update-site with `Help` > `Install New Software`: `mvn:org.eclipse.tycho.demo:p2-maven-site:1.0.0:zip:p2site` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Bundle 1 | ||
Bundle-SymbolicName: bundle1;singleton:=true | ||
Bundle-Version: 1.0.0 | ||
Bundle-RequiredExecutionEnvironment: J2SE-1.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Bundle 2 | ||
Bundle-SymbolicName: bundle2;singleton:=true | ||
Bundle-Version: 1.0.0 | ||
Bundle-RequiredExecutionEnvironment: J2SE-1.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.eclipse.tycho.demo</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>1.0.0</version> | ||
<packaging>pom</packaging> | ||
<modules> | ||
<module>bundles</module> | ||
<module>site</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.eclipse.tycho.demo</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>1.0.0</version> | ||
</parent> | ||
|
||
<artifactId>p2-maven-site</artifactId> | ||
<packaging>p2-maven-repository</packaging> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/P2SiteProject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Christoph Läubrich and others. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.core.osgitools; | ||
|
||
import org.apache.maven.execution.MavenSession; | ||
import org.apache.maven.model.Dependency; | ||
import org.apache.maven.project.MavenProject; | ||
import org.codehaus.plexus.component.annotations.Component; | ||
import org.eclipse.tycho.ArtifactKey; | ||
import org.eclipse.tycho.ArtifactType; | ||
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 | ||
} | ||
}; | ||
} | ||
|
||
@Override | ||
public ArtifactKey getArtifactKey(ReactorProject project) { | ||
return new DefaultArtifactKey(org.eclipse.tycho.ArtifactType.TYPE_P2_MAVEN_REPOSITORY, project.getArtifactId(), | ||
getOsgiVersion(project)); | ||
} | ||
|
||
@Override | ||
public void setupProject(MavenSession session, MavenProject project) { | ||
for (MavenProject other : session.getProjects()) { | ||
if (isRequirement(other)) { | ||
Dependency dependency = new Dependency(); | ||
dependency.setGroupId(other.getGroupId()); | ||
dependency.setArtifactId(other.getArtifactId()); | ||
dependency.setVersion(other.getVersion()); | ||
project.getModel().addDependency(dependency); | ||
} | ||
} | ||
} | ||
|
||
private boolean isRequirement(MavenProject other) { | ||
String packaging = other.getPackaging(); | ||
return "jar".equalsIgnoreCase(packaging) || "bundle".equalsIgnoreCase(packaging) | ||
|| ArtifactType.TYPE_ECLIPSE_PLUGIN.equals(packaging) | ||
|| ArtifactType.TYPE_ECLIPSE_FEATURE.equals(packaging) | ||
|| ArtifactType.TYPE_BUNDLE_FRAGMENT.equals(packaging) | ||
|| ArtifactType.TYPE_ECLIPSE_TEST_PLUGIN.equals(packaging); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters