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

add lombok extension #761

Closed
wants to merge 2 commits into from
Closed

add lombok extension #761

wants to merge 2 commits into from

Conversation

gattytto
Copy link
Contributor

Signed-off-by: Esteban Mañaricua emanaricua@gmail.com
@ericwill maybe better have che-theia-plugins.d/extension-name.yaml instead?
Closes: eclipse-che/che#17483
Signed-off-by: Esteban Mañaricua emanaricua@gmail.com

Signed-off-by: Esteban Mañaricua <emanaricua@gmail.com>
Signed-off-by: Esteban Mañaricua <emanaricua@gmail.com>
@gattytto
Copy link
Contributor Author

image

Copy link
Contributor

@sunix sunix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,
As mentionned in https://github.com/eclipse/che-devfile-registry/pull/316/files#r544386479, the plugin won't work out of the box if the lombok.jar is not copied to /tmp/vscode-unpacked. We cannot ask the user who would compose its devfile to magically know that something like that has to be copied from the devfile.
So first, does it means that we have something wrong in Che-theia ? why lombok.jar can't be found in the original location.
Then, would the workaround be to perform the lombok.jar copy from the plugin sidecar, by overriding the entrypoint ?

Last, I don't think it is a good idea to keep Java and Lombok into 2 seperate plugins: we would need to use mergePlugins (that was not working for me BTW) or share additional volumes like you did in your devfile. Again it is not straight forward for the user.

@sunix
Copy link
Contributor

sunix commented Dec 16, 2020

Tested with

metadata:
  generateName: java-maven-lombok-
attributes:
  mergePlugins: 'true'
projects:
  - name: lombok-project-example
    source:
      location: 'https://github.com/chuucks/LOMBOK-PROJECT-EXAMPLE'
      type: git
      branch: master
components:
  - id: cool2k/vscode-lombok/latest
    preferences:
      java.server.launchMode: Standard
    type: chePlugin
    registryUrl: 'https://sutan-che-plugin-registry-dev-2vqkx.surge.sh/v3/'
  - mountSources: true
    endpoints:
      - name: debug
        port: 5005
        attributes:
          public: 'false'
    memoryLimit: 512Mi
    type: dockerimage
    volumes:
      - name: m2
        containerPath: /home/user/.m2
    image: 'quay.io/eclipse/che-java11-maven:7.22.1'
    alias: maven
    env:
      - value: ''
        name: MAVEN_CONFIG
      - value: >-
          -XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
          -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
          -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
          -Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/user
        name: MAVEN_OPTS
      - value: >-
          -XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
          -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
          -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
          -Xms20m -Djava.security.egd=file:/dev/./urandom
        name: JAVA_OPTS
      - value: >-
          -XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
          -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
          -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
          -Xms20m -Djava.security.egd=file:/dev/./urandom
        name: JAVA_TOOL_OPTIONS
apiVersion: 1.0.0
commands:
  - name: maven build
    actions:
      - workdir: '${CHE_PROJECTS_ROOT}/lombok-project-example'
        type: exec
        command: mvn clean install
        component: maven

@sunix
Copy link
Contributor

sunix commented Dec 16, 2020

I created that issue eclipse-che/che#18632 to see if this is a bug or not. But the extension should not required to set/copy the lombok.jar manually. It should be provided.

@sunix
Copy link
Contributor

sunix commented Feb 23, 2021

The lombok extension is

  • providing lombok.jar (extracted and available in /tmp/vscode-unpacked/...)
  • updating the user settings java.jdt.ls.vmargs with the lombok.jar location

To me it is not an issue to add a volume /tmp/vscode-unpacked to all the java plugins containing the vscode-java extension (quarkus plugin, java plugin, java8 plugin, etc ..) + the lombok plugin.

      volumes:
        - name: java-vscode-unpacked
          mountPath: /tmp/vscode-unpacked

That way, the vscode-java extension would have access to the lombok.jar provided by the vscode-lombok extension.

Having said that, we have a blocker issue:

The lombok extension is

  • providing lombok.jar
  • updating the user settings java.jdt.ls.vmargs with the lombok.jar location

The problem is that the user settings are reused by any workspaces started by the same user. So if the user starts a new workspace with Java plugin without the lombok extension ... it would crash not finding the lombok.jar.
Looks like this is related to microsoft/vscode-lombok#49

Several proposals we could choose to solve that

  1. Propose a patch to the current lombok extension adding a preference option to use workspace settings instead of user settings. Requires Allow to define VS Code extensions preferences in Che plugin registry che#17975
  2. Create our own extension to be included in our all java plugins. This would have a preference option to activate lombok: in the workspace settings updating java.jdt.ls.vmargs with the lombok.jar location that would also be provided by the extension.
  3. Propose a patch to the current lombok extension adding a preference option to choose the location of jar. The extension should copy the jar in that location and update the user settings. But that would requires that we have a volume available in all the user workspaces. the same home folder available to the any workspaces of the same user. Could be advanced implementation of Persist plugin and editors home folder to keep configuration after workspace restart. che#15421. Also requires Allow to define VS Code extensions preferences in Che plugin registry che#17975.

@sunix
Copy link
Contributor

sunix commented Feb 24, 2021

@gattytto FYI, I am closing this PR in favor of #860

@sunix sunix closed this Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If there is no plug-in for Lombok, it can be provided.
3 participants