Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
[rfp-190] Initial commit (Resolve Java Modules)
Browse files Browse the repository at this point in the history
  • Loading branch information
Todor Boev committed Apr 18, 2018
1 parent 9c3ced5 commit abaf43f
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions rfps/rfp-0190-Resolve-Java-Modules.md
@@ -0,0 +1,78 @@
# Resolve Java modules

# Abstract
Use the OSGi Resolver to assemble a self-contained OSGi application: JRE + Framework + Bundles
- A build/agent can call `jlink` on the resolved modules to make the JRE
- A build/agent can setup an OSGi framework to boot with the resolved bundles

# Use Case

## Build a compact docker image

## Build a compact self-contained command line tool
- The users don't have to know it's java and maintain a compatible JRE

## Build a compact JRE

- JPMS specifies that an external party has to select a consistent set of modules before calling it.
- The OSGi Resolver can handle multiple versions and runtime requirements similar to a build.

# Requirements

## Req-1
Must resolve OSGi bundles against Java modules without using the Java module identity
- At least the Java module packages must be published under the `osgi.wiring.package` namespace

## Req-2

Must resolve Java modules against other Java modules and produce a valid set according to the JPMS restrictions

- Module requires other module by ID
- Modules may expose packages to a select set of friend modules
- No two modules expose the same package
- No cycles

Or at least as many of these as possible

## Req-3

Should support version ranges on Java module requirements

- Publish the module version set at compile time
- Read the compile time versions of the module dependencies
- Use heuristics to build a version range (possibly externally configurable)
- E.g. requirements for JDK modules have an open-ended version range: `[9, infinity)`
- E.g. requirements for use

## Req-4

Should use as many of the existing namespaces as possible

- Service Loader specification namespaces for the Java module services
- `osgi.wiring.bundle` for Java module requirements
- Prefer additional attributes on existing capabilities/requirements rather than new namespaces

## Req-5
May use bundle annotations on Java modules to handle dependencies that can not be captured by `module-info.java`

`@Target(ElementType.MODULE)`

```
@Requirement("(framework=jpa)(jpa.version >= 1)(!(jpa.version < 2))")
module org.example.foo {
uses org.example.hello.Hello;
}
@Capability("framework=jpa", "version=1.0")
module com.bar.jpa {
}
```
## Req-6

Must be able to resolve third party Java modules and expose their packages within the OSGi framework

- At lest specify how `org.osgi.framework.packages.extra` should work

## Req-7

May specify runtime representation for the Java modules

0 comments on commit abaf43f

Please sign in to comment.