Uploaded image for project: 'Jalview'
  1. Jalview
  2. JAL-3456

Gradle build of jalviewjs using Goomph plugin or ecj

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Dev and Dep, jalview-j2s
    • Labels:
      None

      Description

      Gradle build of jalviewjs using gradle.

      See branch Jalview-JS/gradle_with_goomph

      README:
      # TRANSPILING USING ECLIPSE AS AN EXTERNAL CLI TOOL:

      Download and install a clean eclipse-jee-2019-06 (or eclipse-jee-2019-09)

      In gradle.properties edit `jalviewjs_eclipse_root` to point to the root dir.
      If you're on a mac, DO NOT include the `Eclipse.app` folder in the path (use the path up to this point, but not the .app folder itself).
      You can use a '~' as the first character which will get replaced with `System.getProperty("user.home")`.

      Note that the gradle tasks (`jalviewjsEclipseCopyDropins`) will take care of copying `net.sf.j2s.core.jar` and the `com.seeq.eclipse.importprojects.jar` into the `dropins` and `plugins` dir (on either unix or mac -- not tested on windows yet).

      Note that the logs from the transpile go into `build/jalviewjs/` as `j2s-transpile.out` and `j2s-transpile.err`

      gradle tasks possibly of interest to you:



      ```
      gradle jalviewjs # (should build the build/jalviewjs/site dir)

      gradle jalviewjsSiteTar # will produce build/distribution/site.tar.gz

      gradle jalviewjsTranspile # should run a new eclipse compile+transpile

      gradle jalviewjsServerStart # will run a localhost http server to allow you to test the site in a browser. Just use the URL given in the output. To stop the server you have to do gradle --stop or you can just leave it running until the gradle daemon dies.
      ```

      If it's working okay, you just need to to

      ```
      gradle jalviewjs
      gradle jalviewjsServerStart
      ```

      and go to the localhost URL in the output.


      # TRANSPILING USING GOOMPH

      This does not work, but is pretty close!

      To use this, make sure the property `useGoomph=true` (either in the gradle.properties or start with `gradle ... -PuseGoomph=true` ).
      This is set to false so that the `useIde` flag set in `build.gradle` can determine whether to use the p2.asmaven plugin and then download a load of Eclipse p2 repo stuff (which can take some time, although it should be cached).

      We are not trying to use the IDE provisioning that Goomph provides, but rather use a stripped down eclipse in the form of just enough OSGi bits and pieces, along with the `net.sf.j2s.core.jar` plugin to run an eclipse build, which will also generate the JalviewJS website.

      The OSGI, and other Eclipse, dependencies are downloaded through a combination of `p2AsMaven` task, `eclipseMavenCentral` task, and within the `ideJalviewjsBuildSetup` task, because:
      * eclipseMavenCentral is easiest, but can only download eclipse modules that have been uploaded to mavencentral.
      * p2AsMaven and ideJalviewjsBuildSetup are both required to download, and then add to classpath the other Eclipse modules found in Eclipse P2 based repos.

      The tasks to try and run the transpiler are set up within the `equinoxLaunch` task, within the `ideJalviewjsBuildSetup` Setup task, which also defines `ideJalviewjsImport` (to import the jalview project) and `ideJalviewjsBuild` (to run the transpiler).

      Dependencies are set up so you should only need to run

      ```
      gradle ideJalviewjsBuild
      ```
      to build the site in `build/jalviewjs/site`.

      However, this is failing because currently the eclipse build classes (found in `bin/main/... have also all failed.

      ## TODO
      What appears to be the problem (judging by the errors found in the `bin/main/... .class` files) is that the Java specification parser and compiler isn't present. BOOM. I have tried importing as many as `org.eclipse.jdt.*` modules as seem necessary, but this hasn't appeared to help.
      I suspect that a setting (as found in the file `TODO/org.eclipse.jdt.launching.prefs` which should go in the eclipse workspace `/.metadata/.plugins/org.eclipse.core.runtime/.settings` folder) needs to be recognised before/when the build is run.

      URLs of interest:
      https://github.com/diffplug/goomph
      https://stackoverflow.com/questions/1773060/programmatically-configure-eclipse-installed-jres
      https://github.com/diffplug/goomph/blob/master/HOW_TO_AUTOMATE_IDE.md
      https://help.eclipse.org/2019-09/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html&anchor=osgiconfigurationarea

      https://github.com/stempler/bnd-platform
      https://github.com/diffplug/goomph/issues/81
      https://github.com/diffplug/goomph/blob/master/HOW_TO_AUTOMATE_IDE.md


      ### Other things to try (ECJ):
      Discard Goomph (!!) and try using the gradle ECJ compiler, and see if the transpiler plugin can be registered somehow to run too.
      See https://github.com/TwoStone/gradle-eclipse-compiler-plugin for the ecj plugin.
      See `org.eclipse.core.runtime.RegistryFactory.getRegistry`, `IRegistry.addContribution()` to try and add the `net.sf.j2s.core.jar` plugin as a `CompilationParticipant`.
      ...

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              soares Ben Soares
              Reporter:
              soares Ben Soares
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: