Replies: 3 comments
-
We don't know in advance if bundles do share lots of dependencies; and in the same reactor some bundles can be mutually exclusive. So that's not really something that can apply. We could maybe cache the results and reuse them across modules when suitable, but we can't have 1 resolver for all bundles in the general case.
I actually keep arguing here: the current approach, with OSGi resolver during build, ensures that for each module, the maintainer is able to declare at least 1 environment where it can be resolved at runtime. Although it's not necessary for compilation, this check is IMO vital in a good build system. A good build system is not only about compiling and packaging content (javac and zip can do that), it's also about ensuring the content deliver some quality at runtime. For an OSGi bundle, its ability to start in at least one pre-defined scenario is an important check and incapability to build an installable scenario is worth failing the build, rather than pretending success and letting developer publish artifacts that may never start.
The case of same package exposed with same content twice by different provide is solvable with OSGi.
How do you compute dependencies to resolve access-rules without using a resolver to ensure you look at the right packages? If you build a strategy that just looks at jars, then you may end up with exposing more content than necessary to the compiler and thus loose the package import restrictions. How would you also deal with things like "re-export" or "use"...?
That's utopic. p2 has some bugs open that are extremely complex and most likely won't be addressed (typically about its incapacity to expose OSGi |
Beta Was this translation helpful? Give feedback.
-
There are mainly two cases:
in both cases the computed access rules can be reused if different bundles import the same bundle/packages. Use or reexport clauses do not really matter much for class-path computations. There might even be some low-level code to compute these data without using the full resolver.
given that tycho relies in large parts on P2 (resolving dependencies, building sites+products) this does not makes much sense to me. Its only the classpath-computation that uses a different technique in all other parts we use P2. |
Beta Was this translation helpful? Give feedback.
-
Here is an example that shows a case where P2 resolves "too much" and thus the build fails even though for compile time it doesn't matter: #173 |
Beta Was this translation helpful? Give feedback.
-
Currently the resolving of the classpath of an eclipse-bundle packaging involves creating a Resolver to resolve the dependent bundles that are previously collected as part of the P2 resolution. This serves then two purposes:
even though this works good in most cases this has several drawbacks:
Thus I'd like to propose an alternative (e.g. using a configuration option for the compiler-mojo) approach that is a bit less restrictive:
It was argued in the past that wee need this additional check to make sure the bundle is 'installable' but I think this is not necessary here. In fact determine at build-time if a bundle later can be installed/resolved is simply an impossible task (as out lined above) and as on install time we completely rely on P2 it would make more sense to make P2 more aware about possible problems so this could be checked e.g. with the check-product-mojo or when building features/update-sites. Nerveless we can keep the configuration option so people have the choice if they like to have this additional resolve step.
Beta Was this translation helpful? Give feedback.
All reactions