Skip to content

Commit 23e81c6

Browse files
committed
Additional changes: - Standardized headings to ATX style (#, ##, ###). - Converted indented code blocks and inline code with complex content to triple-backtick fenced code blocks with language hints (xml, properties, text). - Fixed a broken/messy inline link within the Eclipse-SourceReferences example. - Removed unnecessary backslash escaping in XML comments. - Updated the manual Table of Contents to match the generated anchor IDs for the new headings.
1 parent 1aece37 commit 23e81c6

File tree

4 files changed

+103
-0
lines changed

4 files changed

+103
-0
lines changed

docs/SourceReferences.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# PDE/UI/SourceReferences
2+
3+
## Contents
4+
5+
* [1 Eclipse Source Reference Headers](#eclipse-source-reference-headers)
6+
* [2 Importing Projects from Git](#importing-projects-from-git)
7+
* [3 Extensibility: Generating and Importing Source Reference Headers](#extensibility-generating-and-importing-source-reference-headers)
8+
* [3.1 Generating Source Reference Headers with Tycho](#generating-source-reference-headers-with-tycho)
9+
10+
## Eclipse Source Reference Headers
11+
12+
PDE supports **Eclipse-SourceReferences** headers to bundle manifests. The header provides a list of [SCMURLs](http://maven.apache.org/scm/scm-url-format.html) that reference the source code associated with a binary bundle. PDE build has extensible support for generating source reference headers and the IDE supports importing projects into the workspace corresponding to headers. Usually a bundle has only one SCMURL associated with it. For example, following is a header included in the "org.eclipse.debug.ui" bundle from the Eclipse 4.19 release:
13+
14+
```text
15+
Eclipse-SourceReferences: scm:git:git://git.eclipse.org/gitroot/platform/eclipse.platform.debug.git;path="org.eclipse.debug.ui";tag="I20210222-1800";commitId=c239e1061cd3e02c6e3cb7f34b2be0be7fea7355
16+
```
17+
18+
Support to generate headers and import from different repositories is extensible. The Eclipse SDK provides support for Git via the eGit project.
19+
20+
## Importing Projects from Git
21+
22+
The SCMURLs generated in the Eclipse SDK refer to projects in the Eclipse GIT repository. To import projects from GIT use PDE's import wizard (use the **File > Import** action and select **Plug-in Development > Plug-ins and Fragments** on the first page of the import wizard). For this example, we'll import from the active target platform. Choose the **Projects from a repository** radio button at the bottom of the wizard page and press **Next**.
23+
24+
![Repo-import-1.png](https://raw.githubusercontent.com/eclipse-pde/eclipse.pde/master/docs/images/Repo-import-1.png)
25+
26+
All bundles with published SCMURLs will be available for importing. Select the bundles you want to import, and press **Next**. For this example, I have selected bundles related to the debug platform.
27+
28+
![Repo-import-2.png](https://raw.githubusercontent.com/eclipse-pde/eclipse.pde/master/docs/images/Repo-import-2.png)
29+
30+
The last page of the wizard allows you to import the specific versions of the projects that were used in the build or from latest version. Pressing **Finish** imports the projects into the workspace, connected to the GIt repository.
31+
32+
![Repo-import-3.png](https://raw.githubusercontent.com/eclipse-pde/eclipse.pde/master/docs/images/Repo-import-3.png)
33+
34+
## Extensibility: Generating and Importing Source Reference Headers
35+
36+
PDE build optionally generates source reference headers during a build. This feature is turned on by specifying the following property:
37+
38+
```properties
39+
generateSourceReferences = true
40+
```
41+
42+
The headers themselves are generated by **fetch factories**. PDE build uses fetch factories to fetch source code from repositories (there is an **org.eclipse.pde.build.fetchFactories** extension point). Each repository (CVS, etc.), provides a specific implementation of an **IFetchFactory**. To include source reference headers a fetch factory must provide a **KEY_SOURCE_REFERENCES** property when parsing a map file entry, in the implementation of **parseMapFileEntry(String, Properties, Map)**.
43+
44+
For example, the CVS fetch factory implementation sets a {key, value} pair in the map for each project being fetched, like:
45+
46+
```text
47+
{"sourceReferences", "Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/eclipse:org.eclipse.debug.core;tag=v20100427"}
48+
```
49+
50+
PDE provides two new **experimental / internal** extension points to support import operations in the SDK:
51+
52+
* _org.eclipse.pde.core.bundleImporters_ - A bundle importer is capable of creating a project in the workspace based on specific entries contained in a bundle manifest (implements **org.eclipse.pde.internal.core.importing.provisional.IBundleImporterDelegate**). A bundle importer is provided with the manifest (map of header value pairs) of each bundle. For each bundle that the importer supports, it creates and returns a bundle import description (org.eclipse.pde.internal.core.importing.provisional.BundleImportDescription).
53+
* _org.eclipse.pde.ui.bundleImportPages_ - A bundle import page provides a wizard page used in the Plug-in import wizard to configure settings for bundles to be imported by a bundle importer extension (implements **org.eclipse.pde.internal.ui.provisional.IBundeImportWizardPage**). The page is provided with any bundle import descriptions associated with bundles the user has selected for import. The page can then modify/annotate/further restrict the bundle import descriptions. The resulting importing descriptions are passed to the bundle importer when finish is pressed.
54+
55+
Since the extension points are experimental the interfaces implemented by the extensions are in the internal (non-API) namespace. The SDK provides implementations of all three extensions for CVS. For example, the CVS bundle import page adds information to bundle import descriptions if the user decides to import from HEAD. The eGit projects provides implementations for Git.
56+
57+
### Generating Source Reference Headers with Tycho
58+
59+
Source reference headers can also be generated with Tycho with [tycho-packaging:package-plugin](https://www.eclipse.org/tycho/sitedocs/tycho-packaging-plugin/package-plugin-mojo.html).
60+
61+
For example, if a project is located in Eclipse's Git repos add a property with the SCM URL like this:
62+
63+
```xml
64+
<properties>
65+
<tycho.scmUrl>scm:git:git://git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git</tycho.scmUrl>
66+
</properties>
67+
```
68+
69+
For a repository located on GitHub the equivalent property would look like:
70+
71+
```xml
72+
<properties>
73+
<tycho.scmUrl>scm:git:https://github.com/eclipse/january.git</tycho.scmUrl>
74+
</properties>
75+
```
76+
77+
Then add the packaging plug-in to the build:
78+
79+
```xml
80+
<build>
81+
<plugins>
82+
<plugin>
83+
<groupId>org.eclipse.tycho</groupId>
84+
<artifactId>tycho-packaging-plugin</artifactId>
85+
<version>${tycho-version}</version>
86+
<dependencies>
87+
<!-- Use jgit to resolve source references for git: type SCM -->
88+
<dependency>
89+
<groupId>org.eclipse.tycho.extras</groupId>
90+
<artifactId>tycho-sourceref-jgit</artifactId>
91+
<version>${tycho-extras-version}</version>
92+
</dependency>
93+
</dependencies>
94+
<configuration>
95+
<sourceReferences>
96+
<!-- Generate the source reference in the MANIFEST.MF -->
97+
<generate>true</generate>
98+
</sourceReferences>
99+
</configuration>
100+
</plugin>
101+
</plugins>
102+
</build>
103+
```

docs/images/Repo-import-1.png

36.9 KB
Loading

docs/images/Repo-import-2.png

58.3 KB
Loading

docs/images/Repo-import-3.png

26.8 KB
Loading

0 commit comments

Comments
 (0)