From f57f11bc3612c33f20e15cc38b8307e1dcc02da8 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Sun, 30 Jun 2024 21:06:04 +0200 Subject: [PATCH 1/6] document repo tags for -runrepos Signed-off-by: Christoph Rueger --- docs/_chapters/250-resolving.md | 2 +- docs/_instructions/runrepos.md | 21 +++++++++++++++++++-- docs/_plugins/filerepo.md | 3 ++- docs/_plugins/localindexrepo.md | 1 + docs/_plugins/maven.md | 1 + docs/_plugins/osgirepo.md | 1 + docs/_plugins/p2repo.md | 1 + docs/_plugins/pomrepo.md | 1 + 8 files changed, 27 insertions(+), 4 deletions(-) diff --git a/docs/_chapters/250-resolving.md b/docs/_chapters/250-resolving.md index e8f9a87653..0ff8ea769d 100644 --- a/docs/_chapters/250-resolving.md +++ b/docs/_chapters/250-resolving.md @@ -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 diff --git a/docs/_instructions/runrepos.md b/docs/_instructions/runrepos.md index 406ef6c736..e8caca072d 100644 --- a/docs/_instructions/runrepos.md +++ b/docs/_instructions/runrepos.md @@ -5,12 +5,29 @@ 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. `<>` or `foobar`). + + **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` + +**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 `<>` or something else than `resolve` e.g. `foobar` diff --git a/docs/_plugins/filerepo.md b/docs/_plugins/filerepo.md index e38c453d43..9b2c6ea2cb 100644 --- a/docs/_plugins/filerepo.md +++ b/docs/_plugins/filerepo.md @@ -13,4 +13,5 @@ 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.| | \ No newline at end of file +| |i.e. disabled for editing from Bndtools.| | +| `tags` | Comma separated list of tags. (e.g. resolve, baseline, release) Use the <<EMPTY>> placeholder for no tags. The `resolve` tag is picked up by the [-runrepos](/instructions/runrepos.html) instruction.| No \ No newline at end of file diff --git a/docs/_plugins/localindexrepo.md b/docs/_plugins/localindexrepo.md index e5dc48ee96..dbf17d6f1f 100644 --- a/docs/_plugins/localindexrepo.md +++ b/docs/_plugins/localindexrepo.md @@ -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 <<EMPTY>> 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`. diff --git a/docs/_plugins/maven.md b/docs/_plugins/maven.md index 36c99fd8f8..b4cc5f7bbc 100644 --- a/docs/_plugins/maven.md +++ b/docs/_plugins/maven.md @@ -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/.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 <<EMPTY>> 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.| diff --git a/docs/_plugins/osgirepo.md b/docs/_plugins/osgirepo.md index d97466f9e9..9359a8fa16 100644 --- a/docs/_plugins/osgirepo.md +++ b/docs/_plugins/osgirepo.md @@ -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 <<EMPTY>> The `resolve` tag is picked up by the [-runrepos](/instructions/runrepos.html) instruction. ## Example diff --git a/docs/_plugins/p2repo.md b/docs/_plugins/p2repo.md index 0b58c43f61..ed47abe1f9 100644 --- a/docs/_plugins/p2repo.md +++ b/docs/_plugins/p2repo.md @@ -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 <<EMPTY>> placeholder for no tags. The `resolve` tag is picked up by the [-runrepos](/instructions/runrepos.html) instruction.| ## Example diff --git a/docs/_plugins/pomrepo.md b/docs/_plugins/pomrepo.md index 9a4ef3bfa4..aed676ff1e 100644 --- a/docs/_plugins/pomrepo.md +++ b/docs/_plugins/pomrepo.md @@ -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 <<EMPTY>> 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. From 44f45801e62a93aaaab8e9872d3e98e475c03e44 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Sun, 30 Jun 2024 21:06:24 +0200 Subject: [PATCH 2/6] show repo tags in repo browser Signed-off-by: Christoph Rueger --- .../bndtools/model/repo/RepositoryTreeLabelProvider.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bndtools.core/src/bndtools/model/repo/RepositoryTreeLabelProvider.java b/bndtools.core/src/bndtools/model/repo/RepositoryTreeLabelProvider.java index 93710b560e..69f1a5bf3d 100644 --- a/bndtools.core/src/bndtools/model/repo/RepositoryTreeLabelProvider.java +++ b/bndtools.core/src/bndtools/model/repo/RepositoryTreeLabelProvider.java @@ -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; @@ -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 { @@ -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"); From 68b53c0f5e3b8086a1e8d92009c8f729efd05690 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Sun, 30 Jun 2024 21:06:36 +0200 Subject: [PATCH 3/6] show tags in MavenBndRepo tooltip Signed-off-by: Christoph Rueger --- .../aQute/bnd/repository/maven/provider/MavenBndRepository.java | 1 + 1 file changed, 1 insertion(+) diff --git a/biz.aQute.repository/src/aQute/bnd/repository/maven/provider/MavenBndRepository.java b/biz.aQute.repository/src/aQute/bnd/repository/maven/provider/MavenBndRepository.java index 84b9c462a3..2ea1430d8a 100644 --- a/biz.aQute.repository/src/aQute/bnd/repository/maven/provider/MavenBndRepository.java +++ b/biz.aQute.repository/src/aQute/bnd/repository/maven/provider/MavenBndRepository.java @@ -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); From d92bfc3f5cb42d6299505412312f1be706372c17 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Sun, 30 Jun 2024 21:47:47 +0200 Subject: [PATCH 4/6] add Tagging of repository plugins and tags prop Signed-off-by: Christoph Rueger --- docs/_chapters/870-plugins.md | 7 +++++++ docs/_plugins/filerepo.md | 7 ++++++- docs/_plugins/localindexrepo.md | 4 ++++ docs/_plugins/maven.md | 4 ++++ docs/_plugins/osgirepo.md | 5 +++++ docs/_plugins/p2repo.md | 3 ++- docs/_plugins/pomrepo.md | 4 ++++ 7 files changed, 32 insertions(+), 2 deletions(-) diff --git a/docs/_chapters/870-plugins.md b/docs/_chapters/870-plugins.md index b6a1dd3bbb..f4304f07b7 100644 --- a/docs/_chapters/870-plugins.md +++ b/docs/_chapters/870-plugins.md @@ -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
diff --git a/docs/_plugins/filerepo.md b/docs/_plugins/filerepo.md index 9b2c6ea2cb..1eed6401c0 100644 --- a/docs/_plugins/filerepo.md +++ b/docs/_plugins/filerepo.md @@ -14,4 +14,9 @@ The following properties are supported: |`location` | The local filesystem directory. | Yes. | |`readonly` |Whether the repository should be read-only,| No. Default: false | | |i.e. disabled for editing from Bndtools.| | -| `tags` | Comma separated list of tags. (e.g. resolve, baseline, release) Use the <<EMPTY>> placeholder for no tags. The `resolve` tag is picked up by the [-runrepos](/instructions/runrepos.html) instruction.| No \ No newline at end of file +| `tags` | Comma separated list of tags. (e.g. resolve, baseline, release) Use the <<EMPTY>> 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. \ No newline at end of file diff --git a/docs/_plugins/localindexrepo.md b/docs/_plugins/localindexrepo.md index dbf17d6f1f..360dd52668 100644 --- a/docs/_plugins/localindexrepo.md +++ b/docs/_plugins/localindexrepo.md @@ -42,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. \ No newline at end of file diff --git a/docs/_plugins/maven.md b/docs/_plugins/maven.md index b4cc5f7bbc..fab12313a6 100644 --- a/docs/_plugins/maven.md +++ b/docs/_plugins/maven.md @@ -151,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. diff --git a/docs/_plugins/osgirepo.md b/docs/_plugins/osgirepo.md index 9359a8fa16..2e788d3857 100644 --- a/docs/_plugins/osgirepo.md +++ b/docs/_plugins/osgirepo.md @@ -30,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. \ No newline at end of file diff --git a/docs/_plugins/p2repo.md b/docs/_plugins/p2repo.md index ed47abe1f9..b6f50f8a04 100644 --- a/docs/_plugins/p2repo.md +++ b/docs/_plugins/p2repo.md @@ -30,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. \ No newline at end of file diff --git a/docs/_plugins/pomrepo.md b/docs/_plugins/pomrepo.md index aed676ff1e..4d5e5b3714 100644 --- a/docs/_plugins/pomrepo.md +++ b/docs/_plugins/pomrepo.md @@ -96,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. From 60483eab6456effc1707591b66d27bd222d7e1e5 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Sun, 30 Jun 2024 21:47:56 +0200 Subject: [PATCH 5/6] improve runrepos example Signed-off-by: Christoph Rueger --- docs/_instructions/runrepos.md | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/docs/_instructions/runrepos.md b/docs/_instructions/runrepos.md index e8caca072d..bb210e9f20 100644 --- a/docs/_instructions/runrepos.md +++ b/docs/_instructions/runrepos.md @@ -26,8 +26,53 @@ This includes exactly the three repositories. - 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 `<>` 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 = "<>"; \ + name="Maven Central";\ + releaseUrl="${mavencentral}";\ + snapshotUrl="${ossrh}";\ + index="${.}/central.mvn";\ + readOnly=true,\ +``` + +because it has a `<>` 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`. \ No newline at end of file From 647a9ff81e9b1daa5b7b5fc79aa15f8775829677 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Sun, 30 Jun 2024 21:49:49 +0200 Subject: [PATCH 6/6] add link to Tagging section Signed-off-by: Christoph Rueger --- docs/_instructions/runrepos.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_instructions/runrepos.md b/docs/_instructions/runrepos.md index bb210e9f20..38fc8930e6 100644 --- a/docs/_instructions/runrepos.md +++ b/docs/_instructions/runrepos.md @@ -10,7 +10,7 @@ The `-runrepos` instruction is used to restrict or order the available repositor 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. `<>` or `foobar`). +You can exclude certain repositories by assigning it a tag different than `resolve` (e.g. `<>` 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.