-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for API Tools Annotations to Tycho
This adds a similar feature like PDE will offer soon see eclipse-pde/eclipse.pde#912
- Loading branch information
Showing
11 changed files
with
187 additions
and
9 deletions.
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
60 changes: 60 additions & 0 deletions
60
...s-plugin/src/main/java/org/eclipse/tycho/apitools/ApiAnnotationsClasspathContributor.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,60 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 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.apitools; | ||
|
||
import java.util.Optional; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.apache.maven.SessionScoped; | ||
import org.apache.maven.execution.MavenSession; | ||
import org.apache.maven.project.MavenProject; | ||
import org.codehaus.plexus.component.annotations.Component; | ||
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin; | ||
import org.eclipse.tycho.classpath.ClasspathContributor; | ||
import org.eclipse.tycho.core.TychoProjectManager; | ||
import org.eclipse.tycho.core.osgitools.AbstractSpecificationClasspathContributor; | ||
import org.eclipse.tycho.model.project.EclipseProject; | ||
import org.osgi.framework.VersionRange; | ||
|
||
@Component(role = ClasspathContributor.class, hint = "apitools-annotations") | ||
@SessionScoped | ||
public class ApiAnnotationsClasspathContributor extends AbstractSpecificationClasspathContributor { | ||
|
||
private static final String PACKAGE_NAME = "org.eclipse.pde.api.tools.annotations"; | ||
private static final String GROUP_ID = "org.eclipse.pde"; | ||
private static final String ARTIFACT_ID = "org.eclipse.pde.api.tools.annotations"; | ||
private static final VersionRange VERSION = new VersionRange("[1,2)"); | ||
private TychoProjectManager projectManager; | ||
|
||
@Inject | ||
public ApiAnnotationsClasspathContributor(MavenSession session, TychoProjectManager projectManager) { | ||
super(session, PACKAGE_NAME, GROUP_ID, ARTIFACT_ID); | ||
this.projectManager = projectManager; | ||
} | ||
|
||
@Override | ||
protected VersionRange getSpecificationVersion(MavenProject project) { | ||
return VERSION; | ||
} | ||
|
||
@Override | ||
protected boolean isValidProject(MavenProject project) { | ||
Optional<EclipseProject> eclipseProject = projectManager.getEclipseProject(project); | ||
if (eclipseProject.isPresent()) { | ||
return eclipseProject.get().hasNature(ApiPlugin.NATURE_ID); | ||
} | ||
return false; | ||
} | ||
|
||
} |
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,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src/"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
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,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>api-bundle-2</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> | ||
</natures> | ||
</projectDescription> |
8 changes: 8 additions & 0 deletions
8
tycho-its/projects/api-tools/annotations/META-INF/MANIFEST.MF
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 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Plugin with API | ||
Bundle-SymbolicName: api-bundle-2 | ||
Bundle-Version: 0.0.1.qualifier | ||
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=11))" | ||
Export-Package: bundle | ||
Automatic-Module-Name: bundle |
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,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.eclipse.tycho.tycho-its</groupId> | ||
<artifactId>api-bundle-2</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>eclipse-plugin</packaging> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-maven-plugin</artifactId> | ||
<version>${tycho-version}</version> | ||
<extensions>true</extensions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-apitools-plugin</artifactId> | ||
<version>${tycho-version}</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
10 changes: 10 additions & 0 deletions
10
tycho-its/projects/api-tools/annotations/src/bundle/ApiInterface2.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,10 @@ | ||
package bundle; | ||
|
||
import org.eclipse.pde.api.tools.annotations.NoExtend; | ||
|
||
@NoExtend | ||
public interface ApiInterface2 { | ||
|
||
void sayHello(); | ||
|
||
} |
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