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

Fix #1996: Added module-info.java files for different modules in project #2110

Closed
wants to merge 1 commit into from

Conversation

rohanKanojia
Copy link
Member

Fix #1996

@manusa
Copy link
Member

manusa commented Apr 7, 2020

Problem with ResourceSelector

There is a package name collision in sundr.io modules sundr.codegenand builder.annotations as transitive package io.sundr.builder is available/can be read from both.

This is a problem as the conflicting annotation (io.sundr.codegen.annotations.ResourceSelector) can't be read as it's not exported in the transform.annotations package so it needs a require from sundr.codegen (or at least this is my guess). As stated in the previous paragraph, if we require both modules we get the conflict.

In order to fix this, I moved ResourceSelector, AnnotationSelector and PackageSelector in sundr.io library from module sundr-codegen to module transform-annotations.

Now I can get past the IncompleteAnnotationException problem.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project kubernetes-client: Fatal error compiling: java.lang.RuntimeException: java.io.FileNotFoundException: kubernetes.properties -> [Help 1]

But we reach a new issue as kubernetes.properties file is missing (it's not being generated) file is generated in kubernetes-model/target/kubernetes.properties but it's not accessible by the module.

Problem with reflective access to resources

In order to fix the reflective access to the kubernetes.properties resource, we need to set the kubernetes-model module to open:

open module io.fabric8.kubernetes.model {

And also a few tweaks in sundr.io library to customize the way resources are retrieved from the modules:
VelocityTransformationProcessor#selectFromResource:

FileObject fileObject = filer.getResource(StandardLocation.locationFor(selector.location()), selector.moduleAndPkg(), selector.value());

Then in kubernetes-client io/fabric8/kubernetes/client/CodgeGen (sic):

@ResourceSelector(
  location = "MODULE_PATH",
  moduleAndPkg = "io.fabric8.kubernetes.model/io.fabric8.kubernetes.api.model",
  value = "kubernetes.properties")

With these changes applied and proper module exports/imports kubernetes-client compiles.

Problem with openshift-client

Open shift client has a module collision with kubernetes-client.
The OpenShiftConfig generated classes (processed annotation @Buildable(...@BuildableReference(Config.class)) include duplicate versions of io.fabric8.kubernetes.client.Config* classes (they are not reused from kubernetes-client package).

This means that openshift-client will also expose io.fabric8.kubernetes.client causing a module collision.

In order to fix this, BuildableReferenceannotation has been removed and OpenShiftConfigFluent* have been manually generated > TODO: Some fix should be implemented in sundr.io (maybe try to generate the fluent builders based in constructor parameters instead of using class fields)

Working Branches

Current status

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Fabric8 :: Kubernetes :: Project 4.9-SNAPSHOT:
[INFO] 
[INFO] Fabric8 :: Kubernetes :: Project ................... SUCCESS [  4.548 s]
[INFO] Fabric8 :: Kubernetes Model Parent ................. SUCCESS [  0.412 s]
[INFO] Fabric8 :: Kubernetes Model :: Common .............. SUCCESS [  1.805 s]
[INFO] Fabric8 :: Kubernetes Model Annotator .............. SUCCESS [  1.407 s]
[INFO] Fabric8 :: Kubernetes Model ........................ SUCCESS [02:52 min]
[INFO] Fabric8 :: Kubernetes :: Java Client ............... SUCCESS [ 12.963 s]
[INFO] Fabric8 :: Kubernetes :: Server Mock ............... SUCCESS [  1.081 s]
[INFO] Fabric8 :: Openshift :: Java Client ................ SUCCESS [  5.767 s]
[INFO] Fabric8 :: Kubernetes :: Extensions ................ SUCCESS [  0.016 s]
[INFO] Fabric8 :: Knative :: Extension .................... SUCCESS [  0.014 s]
[INFO] Fabric8 :: Knative :: Model :: Annotator ........... SUCCESS [  0.281 s]
[INFO] Fabric8 :: Knative :: Model ........................ FAILURE [ 35.881 s]
[INFO] Fabric8 :: Knative :: Client ....................... SKIPPED
[INFO] Fabric8 :: Knative :: Server Mock .................. SKIPPED
[INFO] Fabric8 :: Knative :: Examples ..................... SKIPPED
[INFO] Fabric8 :: Knative :: Tests ........................ SKIPPED
[INFO] Fabric8 :: Tekton :: Extension ..................... SKIPPED
[INFO] Fabric8 :: Tekton :: Model :: Annotator ............ SKIPPED
[INFO] Fabric8 :: Tekton :: Model ......................... SKIPPED
[INFO] Fabric8 :: Tekton :: Client ........................ SKIPPED
[INFO] Fabric8 :: Tekton :: Server Mock ................... SKIPPED
[INFO] Fabric8 :: Tekton :: Examples ...................... SKIPPED
[INFO] Fabric8 :: Tekton :: Tests ......................... SKIPPED
[INFO] Fabric8 :: Service Catalog :: Extension ............ SKIPPED
[INFO] Fabric8 :: Service Catalog Model Parent ............ SKIPPED
[INFO] Fabric8 :: Service Catalog :: Model :: Annotator ... SKIPPED
[INFO] Fabric8 :: Service Catalog :: Model ................ SKIPPED
[INFO] Fabric8 :: Service Catalog :: Client ............... SKIPPED
[INFO] Fabric8 :: Service Catalog :: Server Mock .......... SKIPPED
[INFO] Fabric8 :: Service Catalog :: Examples ............. SKIPPED
[INFO] Fabric8 :: Service Catalog :: Tests ................ SKIPPED
[INFO] Fabric8 :: Openshift :: Server Mock ................ SKIPPED
[INFO] Fabric8 :: Kubernetes :: Client Examples ........... SKIPPED
[INFO] Fabric8 :: Kubernetes :: Platforms ................. SKIPPED
[INFO] Fabric8 :: Kubernetes :: Platforms :: Karaf ........ SKIPPED
[INFO] Fabric8 :: Kubernetes :: Platforms :: Karaf :: Features SKIPPED
[INFO] Fabric8 :: Kubernetes :: Platforms :: Karaf :: Tests SKIPPED
[INFO] Fabric8 :: Kubernetes :: Tests ..................... SKIPPED
[INFO] Fabric8 :: Kubernetes and Openshift :: UberJar ..... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:58 min
[INFO] Finished at: 2020-04-08T12:39:44+02:00
[INFO] ------------------------------------------------------------------------

@manusa
Copy link
Member

manusa commented Apr 9, 2020

Stopper

When fixing knative-model I realized that unless we do some major refactor on sundr.io it will be impossible to create modules for the split model as they all generate builders in the same package hence all modules will export a same package (something forbidden in java modules).

So I'm halting the work on this.

@rohanKanojia rohanKanojia added the pr/on-hold Pull Request on Hold label Apr 9, 2020
@fransguelinckx
Copy link

Hi, I was wondering if there is any news about further steps on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/on-hold Pull Request on Hold wip
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module based library ( support for Java 9+ )
4 participants