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

introduces resolve never option for bnd(run) #6209

Merged
merged 1 commit into from
Aug 16, 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 @@ -83,6 +83,12 @@ enum ResolveMode {
*/
@SyntaxAnnotation(lead = "Resolve when the runbundles are needed unless there is a cache file that is newer than the bndrun/project & workspace. The cache file has the same name as the project/bndrun file but starts with a '.'")
cache,

/**
* Never resolve
*/
@SyntaxAnnotation(lead = "A Resolve will never take place. Manually resolve will result in error.")
never
}

@SyntaxAnnotation(lead = "Resolve mode defines when resolving takes place. The default, manual, requires a manual step in bndtools. Auto will resolve on save, and beforelaunch runs the resolver before being launched, batchlaunch is like beforelaunch but only in batch mode", example = "'-resolve manual", pattern = "(manual|auto|beforelaunch|batch)")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@org.osgi.annotation.versioning.Version("1.7.0")
@org.osgi.annotation.versioning.Version("1.8.0")
package aQute.bnd.help.instructions;
1 change: 1 addition & 0 deletions biz.aQute.resolve/src/biz/aQute/resolve/Bndrun.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public Collection<Container> getRunbundles() throws Exception {
switch (resolve) {
case auto :
case manual :
case never :
default :
break;

Expand Down
8 changes: 8 additions & 0 deletions biz.aQute.resolve/src/biz/aQute/resolve/RunResolution.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import aQute.bnd.exceptions.Exceptions;
import aQute.bnd.help.Syntax;
import aQute.bnd.help.instructions.ResolutionInstructions;
import aQute.bnd.help.instructions.ResolutionInstructions.ResolveMode;
import aQute.bnd.help.instructions.ResolutionInstructions.RunStartLevel;
import aQute.bnd.help.instructions.ResolutionInstructions.Runorder;
import aQute.bnd.osgi.BundleId;
Expand Down Expand Up @@ -96,6 +97,13 @@ public static RunResolution resolve(Project project, Processor actualProperties,
*/
public static RunResolution resolve(Project project, Processor actualProperties,
Collection<ResolutionCallback> callbacks, ResolverLogger resolverLogger) {
if (ResolveMode.never.toString()
.equals(project.get(Constants.RESOLVE))) {
return new RunResolution(project, actualProperties, new UnsupportedOperationException(String
.format("Resolve is forbidden here, as %s is set to %s", Constants.RESOLVE,
ResolveMode.never.toString())),
null);
}
if (callbacks == null)
callbacks = Collections.emptyList();
ResolverLogger logger = resolverLogger == null ? ResolverLogger.newLogger(actualProperties, false)
Expand Down
3 changes: 2 additions & 1 deletion docs/_instructions/resolve.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ The values are:
* `beforelaunch` – Calculate the `-runbundles` on demand. This ignores the value of the `-runbundles` and runs the resolver. The results of the resolver are cached. This cache works by creating a checksum over all the properties of the project.
* `batch` – When running in batch mode, the run bundles will be resolved. In all other modes this will only resolve when the `-runbundles` are empty.
* `cache` – Will use a cache file in the workspace cache. If that file is stale relative to the workspace or project or it does not exist, then the bnd(run) file will be resolved and the result is stored in the cache file.
* `never` – If anybody tries to resolve , the process will throw an `UnsupportedOperationException`. This is intended for manually curated runbundles or where a base file is resolved and other files include them an add some additional instructions. The Excepetion is meant as a clear warning to any developer accidentally resolving the `-runbundles`.



## Example

-resolve beforelaunch
Expand Down