Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document and show repo tags in the UI #6170

Merged
merged 6 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ public String tooltip(Object... target) throws Exception {
f.format("STATUS = %s", status);
else {
f.format("MavenBndRepository : %s\n", getName());
f.format("Tags : %s\n", getTags());
f.format("Revisions : %s\n", index.getArchives()
.size());
f.format("Storage : %s\n", localRepo);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package bndtools.model.repo;

import java.util.stream.Collectors;

import org.bndtools.core.ui.icons.Icons;
import org.bndtools.core.ui.icons.Icons.IconBuilder;
import org.bndtools.utils.jface.HyperlinkStyler;
Expand All @@ -12,6 +14,7 @@
import aQute.bnd.exceptions.Exceptions;
import aQute.bnd.service.Actionable;
import aQute.bnd.service.RepositoryPlugin;
import aQute.bnd.service.tags.Tags;

public class RepositoryTreeLabelProvider extends StyledCellLabelProvider
implements org.eclipse.jface.viewers.ILabelProvider {
Expand Down Expand Up @@ -47,6 +50,12 @@ public void update(ViewerCell cell) {
name = repo.getName();
label.append(name);

Tags tags = repo.getTags();
if (!tags.isEmpty()) {
label.append(" " + tags.stream()
.collect(Collectors.joining(",")), StyledString.QUALIFIER_STYLER);
}

IconBuilder ib = Icons.builder(repo.getIcon());
if (repo.canWrite()) {
ib.bottomLeft("writable_decorator");
Expand Down
2 changes: 1 addition & 1 deletion docs/_chapters/250-resolving.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ Notice that most instructions are [_merge properties_](820-instructions.html). T
* [-runblacklist](/instructions/runblacklist.html) – Requirements that select resources that should never be part of the resolution.
* [-runee](/instructions/runee.html) – The execution environment
* [-runpath](/instructions/runpath.html) – The JARs that should be on the classpath. Exports and provided capabilities defined in the manifests of these JARs are added to the system capabilities.
* [-runrepos](/instructions/runpath.html) – Optional list of ordered repo names. If this is not set, the current set of repo plugins is used.
* [-runrepos](/instructions/runrepos.html) – Optional list of ordered repo names. If this is not set, the current set of repo plugins is used.
* [-augment](/instructions/augment.html) – Adds virtual capabilities and requirements to resources in the repository.
* [-distro](/instructions/distro.html) – Directly provides the system capabilities in a JAR with Manifest. Is used when the resulotion is not used to create an executable JAR but to create a Java EE WAR or Karaf KAR where the application is running in a host environment.
* [-resolve](/instructions/resolve.html) – Controls when the resolver runs
Expand Down
7 changes: 7 additions & 0 deletions docs/_chapters/870-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ The following directive is defined for all plugin:

||`path:` ||A path to the jar file that contains the plugin. The directory/jar at that location is placed on your classpath for that plugin.||

## Tagging of repository plugins

Repository plugins are usually referenced in `cnf/build.bnd` and implement the [Tagged](https://github.com/bndtools/bnd/blob/master/biz.aQute.bndlib/src/aQute/bnd/service/tags/Tagged.java) interface.

The `tags` property of repositories' configuration allows to add a comma separated list of tags to a repository. These tags will be used for filtering a list of repositories.
For example the [-runrepos](/instructions/runrepos.html) instruction in `.bndrun` considers only those repositories for resolution which have either the `resolve` tag or no `tags` property defined. This allows including and excluding repositories based on their tags.

## Index

<div>
Expand Down
66 changes: 64 additions & 2 deletions docs/_instructions/runrepos.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,74 @@ title: -runrepos REPO-NAME ( ',' REPO-NAME )*
summary: Order and select the repository for resolving against. The default order is all repositories in their plugin creation order.
---

The `-runrepos` instruction is used to restrict or order the available repositories. A `bndrun` file can be based on a workspace or can be standalone. In the workspace case the, the repositories are defined in `build.bnd` or in a `*.bnd` file in the `cnf/ext` directory as bnd plugins. In the standalone case the repositories are either OSGi XML repositories listed in the `-standalone` instruction or they are also defined as plugins but now in the `bndrun` file.
The `-runrepos` instruction is used to restrict or order the available repositories. A `bndrun` file (see [Resolving](/chapters/250-resolving.html#resolving-in-bndtools)) can be based on a workspace or can be standalone. In the workspace case the, the repositories are defined in `build.bnd` or in a `*.bnd` file in the `cnf/ext` directory as bnd plugins. In the standalone case the repositories are either OSGi XML repositories listed in the `-standalone` instruction or they are also defined as plugins but now in the `bndrun` file.

In both cases there is an _ordered_ list of repositories. In the `-standalone` it is easy to change this order or exclude repositories. However, in the workspace case this is harder because the set of repositories is shared with many other projects. The `-runrepos` can then be used to exclude and reorder the list repositories. It simply lists the names of the repositories in the desired order. Each repository has its own name.

If `-runrepos` is ommited then all repositories having either no tags or the tag `resolve` will be included for resolution.
You can exclude certain repositories by assigning it a tag different than `resolve` (e.g. `<<EMTPY>>` or `foobar`). See [Tagging of repository plugins](/chapters/870-plugins.html#tagging-of-repository-plugins) for more details.


**Note** The name of a repository is not well defined. It is either the name of the repository or the `toString()` result. In the later case the name is sometimes a bit messy.

For example:
**Example 1: include specific repos**

-runrepos: Maven Central, Main, Distro

This includes exactly the three repositories.

**Example 2: include all repos**

- remove / ommit the `-runrepos` instruction
- give all repositories either no tag or the tag `resolve`

e.g. a `.bndrun` file without `-runrepos` would include the following repos in the resolution:


```
aQute.bnd.repository.maven.provider.MavenBndRepository;\
tags = "resolve"; \
name="Maven Central A";\
releaseUrl="${mavencentral}";\
snapshotUrl="${ossrh}";\
index="${.}/central.mvn";\
readOnly=true,\
```

because it has the `resolve` tag

and also


```
aQute.bnd.repository.maven.provider.MavenBndRepository;\
name="Maven Central B";\
releaseUrl="${mavencentral}";\
snapshotUrl="${ossrh}";\
index="${.}/central.mvn";\
readOnly=true,\
```

because there is no tags at all.

**Example 3: include all repos, except some**

- remove / ommit the `-runrepos` instruction
- give all repositories either no tag or the tag `resolve` which should be included
- give the repo which should be excluded the tag `<<EMTPY>>` or something else than `resolve` e.g. `foobar`

For example the following repository definition in `/cnf/build.bnd` would be excluded:

```
aQute.bnd.repository.maven.provider.MavenBndRepository;\
tags = "<<EMPTY>>"; \
name="Maven Central";\
releaseUrl="${mavencentral}";\
snapshotUrl="${ossrh}";\
index="${.}/central.mvn";\
readOnly=true,\
```

because it has a `<<EMPTY>>` tag (and thus no `resolve` tag).

An example use case is exclude the baseline-repository from resolution. In the case, you would not add the `resolve` tag to the baseline-repo, and then it won't be considered for resolution in a `.bndrun`.
8 changes: 7 additions & 1 deletion docs/_plugins/filerepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ The following properties are supported:
|`name` | Name for the repository. | No. |
|`location` | The local filesystem directory. | Yes. |
|`readonly` |Whether the repository should be read-only,| No. Default: false |
| |i.e. disabled for editing from Bndtools.| |
| |i.e. disabled for editing from Bndtools.| |
| `tags` | Comma separated list of tags. (e.g. resolve, baseline, release) Use the &lt;&lt;EMPTY&gt;&gt; placeholder for no tags. The `resolve` tag is picked up by the [-runrepos](/instructions/runrepos.html) instruction.| No


## Tagging

This plugin supports Tagging via the `tags` configuration property. See [Tagging of repository plugins](/chapters/870-plugins.html#tagging-of-repository-plugins) for more details.
5 changes: 5 additions & 0 deletions docs/_plugins/localindexrepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Merging the information from both tables into one, we get the following comprehe
| `timeout` | `integer` | | If there is a cached file, then just use it if the cached file is within the `timeout` period OR `online` is `false`. | |
| `online` | `BOOLEAN` | `true` | Specifies if this repository is online. If `false` then cached resources are used. | |
| `type` | `STRING` | `R5` | The type (format) of index to generate. See _Note 1_ below. | No. |
| `tags` | `STRING`| | Comma separated list of tags. (e.g. resolve, baseline, release) Use the &lt;&lt;EMPTY&gt;&gt; The `resolve` tag is picked up by the [-runrepos](/instructions/runrepos.html) instruction. | No

**Note 1**: The index is generated by default in R5 format. To request alternative format(s), specify a list of format names separated by the "|" (pipe) character.
For example, to generate both R5 and OBR formats specify `type=R5|OBR`.
Expand All @@ -41,3 +42,7 @@ For example, to generate both R5 and OBR formats specify `type=R5|OBR`.
pretty = true; \
local = ${build}/release
```

## Tagging

This plugin supports Tagging via the `tags` configuration property. See [Tagging of repository plugins](/chapters/870-plugins.html#tagging-of-repository-plugins) for more details.
5 changes: 5 additions & 0 deletions docs/_plugins/maven.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ The class name of the plugin is `aQute.bnd.repository.maven.provider.MavenBndRep
| `readOnly` | `true|false` | `false` | If set to _truthy_ then this repository is read only.|
| `name` | `NAME`| `Maven` | The name of the repository.|
| `index` | `PATH`| `cnf/<name>.mvn` | The path to the _index_ file. The index file is a list of Maven _coordinates_.|
| `tags` | `STRING`| | Comma separated list of tags. (e.g. resolve, baseline, release) Use the &lt;&lt;EMPTY&gt;&gt; placeholder for no tags. The `resolve` tag is picked up by the [-runrepos](/instructions/runrepos.html) instruction.|
| `source` | `STRING`| `org.osgi:org.osgi.service.log:1.3.0 org.osgi:org.osgi.service.log:1.2.0` | A space, comma, semicolon, or newline separated GAV string. |
| `noupdateOnRelease` | `true|false` | `false` | If set to _truthy_ then this repository will not update the `index` when a non-snapshot artifact is released.|
| `poll.time` | `integer` | 5 seconds | Number of seconds between checks for changes to the `index` file. If the value is negative or the workspace is in batch/CI mode, then no polling takes place.|
Expand Down Expand Up @@ -150,6 +151,10 @@ In Maven, revisions that end in `-SNAPSHOT` are treated special in many places.

The Maven Bnd Repository uses the bnd Http Client. See the [-connection-settings] instruction for how to set the proxy and authentication information.

## Tagging

This plugin supports Tagging via the `tags` configuration property. See [Tagging of repository plugins](/chapters/870-plugins.html#tagging-of-repository-plugins) for more details.

## IDEs

The repository view in the IDE will show detailed information when you hover the mouse over the the repository entry, the program entry, or the revision entry.
Expand Down
6 changes: 6 additions & 0 deletions docs/_plugins/osgirepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The class name of the plugin is `aQute.bnd.repository.osgi.OSGiRepository`. It c
| `cache` | `STRING`| The workspace cache folder | The location, the downloaded bundles are stored. |
| `max.stale` | `integer` | one year | Bnd has it's own download cache. `max.stale` configures for how many _seconds_ the downloaded index file stays in the internal download cache. Use _-1_ to always check if there is a newer file on the server. |
| `poll.time` | `integer` | 5 seconds | Number of seconds between checks for polls on the `index` file. If the value is negative or the workspace is in batch/CI mode, then no polling takes place. |
| `tags` | `STRING`| | Comma separated list of tags. (e.g. resolve, baseline, release) Use the &lt;&lt;EMPTY&gt;&gt; The `resolve` tag is picked up by the [-runrepos](/instructions/runrepos.html) instruction.

## Example

Expand All @@ -29,3 +30,8 @@ To set up the `OSGi Repository` use:
name=GeckoJaxRsWhiteboard;\
cache=${build}/cache/GeckoREST,\



## Tagging

This plugin supports Tagging via the `tags` configuration property. See [Tagging of repository plugins](/chapters/870-plugins.html#tagging-of-repository-plugins) for more details.
4 changes: 3 additions & 1 deletion docs/_plugins/p2repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ It can take the following configuration properties:
| `name` | `NAME` | p2 + `url` | The name of the repository. |
| `url` | `URI` | | The URL to either the P2 repository (a directory) or an Eclipse target platform definition file. |
| `location` | `STRING` | | The location to store the _index_ file and where bundles will be downloaded to. |
| `tags` | `STRING`| | Comma separated list of tags. (e.g. resolve, baseline, release) Use the &lt;&lt;EMPTY&gt;&gt; placeholder for no tags. The `resolve` tag is picked up by the [-runrepos](/instructions/runrepos.html) instruction.|

## Example

Expand All @@ -29,5 +30,6 @@ It can take the following configuration properties:
name = EMF
```

## Tagging


This plugin supports Tagging via the `tags` configuration property. See [Tagging of repository plugins](/chapters/870-plugins.html#tagging-of-repository-plugins) for more details.
5 changes: 5 additions & 0 deletions docs/_plugins/pomrepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ The query must return a JSON response.
| `transitive` | `true|false` | `true` | If set to _truthy_ then dependencies are transitive.|
| `poll.time` | `integer`| 5 minutes | Number of seconds between checks for changes to POM files referenced by `pom` or `revision`. If the value is negative or the workspace is in batch/CI mode, then no polling takes place.|
| `dependencyManagement` | `boolean`| false | If set to `true`, dependencies in the `dependencyManagement` section will be handled as actual dependencies.|
| `tags` | `STRING`| | Comma separated list of tags. (e.g. resolve, baseline, release) Use the &lt;&lt;EMPTY&gt;&gt; The `resolve` tag is picked up by the [-runrepos](/instructions/runrepos.html) instruction.


One, and only one, of the `pom`, `revision`, or `query` configurations can be set. If multiple are set then the first in `[pom, revision, query]` is used and the remainders are ignored.
Expand All @@ -95,6 +96,10 @@ If you use a remote repository then you must configure the credentials. This is

Notice that the id must match the scheme, the host, and the port if not the default port for the scheme.

## Tagging

This plugin supports Tagging via the `tags` configuration property. See [Tagging of repository plugins](/chapters/870-plugins.html#tagging-of-repository-plugins) for more details.

## IDEs

The repository view in the IDE will show detailed information when you hover the mouse over the the repository entry, the program entry, or the revision entry.
Expand Down