-Download and install a clean eclipse-jee-2019-06
+# 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).
-You can use a '~' as the first character which will get replaced with System.getProperty("user.home").
+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 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 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 of interest:
+gradle tasks possibly of interest to you:
-gradle jalviewjs # (should build the .../site dir)
+``
+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 jalviewjsServer # will run a localhost http server to allow you to test the site in a browser. Just use the URL given in the output.
+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`.
+...
-import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.internal.os.OperatingSystem
-import org.gradle.plugins.ide.eclipse.model.*
-import groovy.transform.ExternalizeMethods
+import org.gradle.plugins.ide.eclipse.model.Output
+import org.gradle.plugins.ide.eclipse.model.Library
+
import com.diffplug.gradle.GoomphCacheLocations
-/*
buildscript {
- repositories {
- mavenCentral()
- jcenter()
- mavenLocal()
- }
}
-*/
plugins {
id 'java'
id 'application'
id 'eclipse'
+
id 'com.diffplug.gradle.oomph.ide' version '3.18.1'
id 'com.diffplug.gradle.equinoxlaunch' version '3.18.1'
id 'com.diffplug.gradle.eclipse.mavencentral' version '3.18.1'
}
def jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath()
+def useIde = useGoomph.equals("true")
repositories {
jcenter()
jalviewjsIde
}
-p2AsMaven {
- group 'eclipseDeps', {
- repoEclipse goomph_eclipse_repo_version
- //slicingOption 'latestVersionOnly', 'true'
- iu 'org.eclipse.update.configurator'
- }
- group 'eclipseOrbit', {
- repo goomph_orbit_repo
- slicingOption 'latestVersionOnly', 'true'
- iu 'javax.el'
- iu 'javax.servlet'
- iu 'javax.servlet.jsp'
- iu 'org.apache.ant'
- iu 'org.apache.batik.constants'
- iu 'org.apache.batik.css'
- iu 'org.apache.batik.i18n'
- iu 'org.apache.batik.util'
- iu 'org.apache.commons.beanutils'
- iu 'org.apache.commons.collections'
- iu 'org.apache.commons.jxpath'
- iu 'org.apache.commons.io'
- iu 'org.apache.commons.logging'
- iu 'org.apache.xmlgraphics'
- iu 'org.jdom'
- iu 'org.w3c.dom.events'
- iu 'org.w3c.dom.smil'
- iu 'org.w3c.dom.svg'
+
+if (useIde) {
+
+ p2AsMaven {
+ group 'eclipseDeps', {
+ repoEclipse goomph_eclipse_repo_version
+ //slicingOption 'latestVersionOnly', 'true'
+ iu 'org.eclipse.update.configurator'
+
+
+ iu 'org.eclipse.jdt.apt.core'
+ iu 'org.eclipse.jdt.core'
+ iu 'org.eclipse.jdt.annotation'
+
+ }
+ group 'ecjDeps', {
+ repo 'https://download.eclipse.org/eclipse/updates/4.13/R-4.13-201909161045/'
+ iu 'org.eclipse.debug.core'
+ iu 'org.eclipse.jdt.apt.pluggable.core'
+ iu 'org.eclipse.jdt.apt.ui'
+ iu 'org.eclipse.jdt.compiler.apt'
+ iu 'org.eclipse.jdt.compiler.tool'
+ iu 'org.eclipse.jdt.core.manipulation'
+ iu 'org.eclipse.jdt.debug'
+ iu 'org.eclipse.jdt.debug.ui'
+ iu 'org.eclipse.jdt.doc.user'
+ iu 'org.eclipse.jdt.junit'
+ iu 'org.eclipse.jdt.junit.core'
+ iu 'org.eclipse.jdt.junit4.runtime'
+ iu 'org.eclipse.jdt.junit4.runtime'
+ iu 'org.eclipse.jdt.junit5.runtime'
+ iu 'org.eclipse.jdt.launching'
+ iu 'org.eclipse.jdt.ui'
+
+ iu 'org.eclipse.jdt.launching.macosx'
+ iu 'org.eclipse.jdt.launching.ui.macosx'
+ }
+ group 'eclipseOrbit', {
+ repo goomph_orbit_repo
+ slicingOption 'latestVersionOnly', 'true'
+ iu 'javax.el'
+ iu 'javax.servlet'
+ iu 'javax.servlet.jsp'
+ iu 'org.apache.ant'
+ iu 'org.apache.batik.constants'
+ iu 'org.apache.batik.css'
+ iu 'org.apache.batik.i18n'
+ iu 'org.apache.batik.util'
+ iu 'org.apache.commons.beanutils'
+ iu 'org.apache.commons.collections'
+ iu 'org.apache.commons.jxpath'
+ iu 'org.apache.commons.io'
+ iu 'org.apache.commons.logging'
+ iu 'org.apache.xmlgraphics'
+ iu 'org.jdom'
+ iu 'org.w3c.dom.events'
+ iu 'org.w3c.dom.smil'
+ iu 'org.w3c.dom.svg'
+ }
}
-}
+
+} // if (useIde) {}
dependencies {
/*
-eclipseMavenCentral {
-// How do I add these to the jalviewjsIde configuration and not the compile configuration?
- release goomph_eclipse_repo_version, {
-
- //def platformCode="cocoa.macosx.x86_64"
- //compile 'org.eclipse.swt.'+platformCode
- useNativesForRunningPlatform()
- compile 'org.eclipse.swt'
-
- compile 'org.eclipse.ant.core'
- compile 'org.eclipse.compare.core'
- compile 'org.eclipse.core.commands'
- compile 'org.eclipse.core.contenttype'
- compile 'org.eclipse.core.jobs'
- compile 'org.eclipse.core.expressions'
- compile 'org.eclipse.core.filesystem'
- compile 'org.eclipse.core.resources'
- compile 'org.eclipse.core.runtime'
- compile 'org.eclipse.core.variables'
- compile 'org.eclipse.equinox.common'
- compile 'org.eclipse.equinox.ds'
- compile 'org.eclipse.equinox.app'
- compile 'org.eclipse.equinox.registry'
- compile 'org.eclipse.equinox.preferences'
- compile 'org.eclipse.jface'
- compile 'org.eclipse.osgi'
- compile 'org.eclipse.osgi.services'
- compile 'org.eclipse.ui'
- compile 'org.eclipse.ui.workbench'
- compile 'org.eclipse.team.core'
- compile 'org.eclipse.text'
-
- compile 'org.eclipse.e4.core.commands'
- compile 'org.eclipse.e4.core.contexts'
- compile 'org.eclipse.e4.core.di'
- compile 'org.eclipse.e4.core.di.annotations'
- compile 'org.eclipse.e4.core.di.extensions.supplier'
- compile 'org.eclipse.e4.core.services'
- compile 'org.eclipse.e4.ui.bindings'
- compile 'org.eclipse.e4.ui.model.workbench'
- compile 'org.eclipse.e4.ui.workbench'
- compile 'org.eclipse.e4.ui.workbench.swt'
- compile 'org.eclipse.e4.ui.css.core'
- compile 'org.eclipse.e4.ui.css.swt'
- compile 'org.eclipse.e4.ui.css.swt.theme'
- compile 'org.eclipse.e4.ui.services'
- compile 'org.eclipse.e4.ui.di'
-
- //compile 'org.eclipse.e4.core.di.internal.extensions'
+if (useIde) {
- // org.eclipse.update.configurator deliberately kept at 3.3.400 see https://github.com/diffplug/goomph/issues/69
- //compile 'org.eclipse.update.configurator'
+ eclipseMavenCentral {
+ // TODO: How do I add these to the jalviewjsIde configuration and not the compile configuration?
+ release goomph_eclipse_repo_version, {
+
+ //def platformCode="cocoa.macosx.x86_64"
+ //compile 'org.eclipse.swt.'+platformCode
+ useNativesForRunningPlatform()
+ compile 'org.eclipse.swt'
+
+ compile 'org.eclipse.ant.core'
+ compile 'org.eclipse.compare.core'
+ compile 'org.eclipse.core.commands'
+ compile 'org.eclipse.core.contenttype'
+ compile 'org.eclipse.core.jobs'
+ compile 'org.eclipse.core.expressions'
+ compile 'org.eclipse.core.filesystem'
+ compile 'org.eclipse.core.resources'
+ compile 'org.eclipse.core.runtime'
+ compile 'org.eclipse.core.variables'
+ compile 'org.eclipse.equinox.common'
+ compile 'org.eclipse.equinox.ds'
+ compile 'org.eclipse.equinox.app'
+ compile 'org.eclipse.equinox.registry'
+ compile 'org.eclipse.equinox.preferences'
+ compile 'org.eclipse.jface'
+ compile 'org.eclipse.osgi'
+ compile 'org.eclipse.osgi.services'
+ compile 'org.eclipse.ui'
+ compile 'org.eclipse.ui.workbench'
+ compile 'org.eclipse.team.core'
+ compile 'org.eclipse.text'
+
+ compile 'org.eclipse.e4.core.commands'
+ compile 'org.eclipse.e4.core.contexts'
+ compile 'org.eclipse.e4.core.di'
+ compile 'org.eclipse.e4.core.di.annotations'
+ compile 'org.eclipse.e4.core.di.extensions.supplier'
+ compile 'org.eclipse.e4.core.services'
+ compile 'org.eclipse.e4.ui.bindings'
+ compile 'org.eclipse.e4.ui.model.workbench'
+ compile 'org.eclipse.e4.ui.workbench'
+ compile 'org.eclipse.e4.ui.workbench.swt'
+ compile 'org.eclipse.e4.ui.css.core'
+ compile 'org.eclipse.e4.ui.css.swt'
+ compile 'org.eclipse.e4.ui.css.swt.theme'
+ compile 'org.eclipse.e4.ui.services'
+ compile 'org.eclipse.e4.ui.di'
+ //compile 'org.eclipse.e4.core.di.internal.extensions'
+ // org.eclipse.update.configurator deliberately kept at 3.3.400 see https://github.com/diffplug/goomph/issues/69
+ // this module downloaded in equinoxLaunch configuration (to specify version)
+ //compile 'org.eclipse.update.configurator'
+
+
+ }
}
-}
+} // if (useIde) {}
-def useIde = useGoomph.equals("true")
def eclipseWorkspace
task jalviewjsSetEclipseWorkspace {
eclipseWorkspace = file("${buildDir}/tmp/eclipse-workspace")
//eclipseWorkspace.deleteOnExit()
} else if (useIde) {
- GoomphCacheLocations.override_workspaces = file(eclipseWorkspace.getAbsolutePath())
+ com.diffplug.gradle.GoomphCacheLocations.override_workspaces = file(eclipseWorkspace.getAbsolutePath())
eclipseWorkspace = oomphIde.workspaceRegistry.workspaceDir(project, file(oomphIde.ideDir))
}
println("ECLIPSE WORKSPACE: "+eclipseWorkspace.getPath())
}
+
+if (useIde) {
+
oomphIde {
repoEclipse goomph_eclipse_version
jdt {
}
+ workspaceProp '.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs', {
+ it.put('org.eclipse.jdt.launching.PREF_VM_XML', goomph_PREF_VM_XML)
+ }
// CLI ARGS HERE!
source.addMaven('eclipseOrbit:org.w3c.dom.svg:1.1.0.v201011041433')
source.addMaven('eclipseOrbit:org.w3c.dom.smil:1.0.1.v200903091627')
source.addMaven('eclipseOrbit:org.w3c.dom.events:3.0.0.draft20060413_v201105210656')
+
source.addMaven('org.eclipse.birt.runtime:com.ibm.icu:56.1.0.v201601250100')
source.addMaven('javax.inject:com.springsource.javax.inject:1.0.0')
source.addMaven('org.apache.felix:org.apache.felix.scr:2.1.16')
source.addMaven('org.osgi:org.osgi.service.event:1.4.0')
source.addMaven('org.osgi:org.osgi.util.promise:1.1.1')
source.addMaven('org.osgi:org.osgi.util.function:1.1.0')
- source.addMaven('org.eclipse.jdt:org.eclipse.jdt.apt.core:3.6.500')
- source.addMaven('org.eclipse.jdt:org.eclipse.jdt.core:3.19.0')
- source.addMaven('org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.300')
+ //source.addMaven('org.eclipse.jdt:org.eclipse.jdt.apt.core:3.6.500')
+ //source.addMaven('org.eclipse.jdt:org.eclipse.jdt.core:3.19.0')
+ //source.addMaven('org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.300')
+
+ source.addMaven('ecjDeps:org.eclipse.debug.core:3.14.0.v20190812-1404')
+ source.addMaven('ecjDeps:org.eclipse.jdt.annotation:2.2.300.v20190328-1431')
+ source.addMaven('ecjDeps:org.eclipse.jdt.apt.core:3.6.500.v20190703-0914')
+ source.addMaven('ecjDeps:org.eclipse.jdt.core:3.19.0.v20190903-0936')
+ source.addMaven('ecjDeps:org.eclipse.jdt.apt.pluggable.core:1.2.400.v20190626-1334')
+ //source.addMaven('ecjDeps:org.eclipse.jdt.apt.ui:3.6.300.v20190727-1243')
+ source.addMaven('ecjDeps:org.eclipse.jdt.compiler.apt:1.3.700.v20190704-1731')
+ source.addMaven('ecjDeps:org.eclipse.jdt.compiler.tool:1.2.600.v20190322-0450')
+ //source.addMaven('ecjDeps:org.eclipse.jdt.core.manipulation:1.12.100.v20190904-0645')
+ source.addMaven('ecjDeps:org.eclipse.jdt.debug:3.13.100.v20190902-1050')
+ //source.addMaven('ecjDeps:org.eclipse.jdt.debug.ui:3.10.400.v20190815-2202')
+ source.addMaven('ecjDeps:org.eclipse.jdt.doc.user:3.15.400.v20190904-0724')
+ //source.addMaven('ecjDeps:org.eclipse.jdt.junit:3.11.500.v20190809-1613')
+ //source.addMaven('ecjDeps:org.eclipse.jdt.junit.core:3.10.400.v20190625-1910')
+ //source.addMaven('ecjDeps:org.eclipse.jdt.junit4.runtime:1.1.1000.v20190510-0840')
+ //source.addMaven('ecjDeps:org.eclipse.jdt.junit4.runtime:1.1.1000.v20190510-0840')
+ //source.addMaven('ecjDeps:org.eclipse.jdt.junit5.runtime:1.0.600.v20190610-0439')
+ source.addMaven('ecjDeps:org.eclipse.jdt.launching:3.15.0.v20190826-1639')
+ //source.addMaven('ecjDeps:org.eclipse.jdt.ui:3.19.0.v20190827-1733')
+
+ //source.addMaven('ecjDeps:org.eclipse.jdt.launching.macosx:3.4.300.v20190510-0639')
+ //source.addMaven('ecjDeps:org.eclipse.jdt.launching.ui.macosx:1.2.300.v20190510-0639')
+
+ //source.addMaven('')
// org.eclipse.update.configurator deliberately kept at 3.3.400 see https://github.com/diffplug/goomph/issues/69
source.addMaven('org.eclipse.platform:org.eclipse.update.configurator:3.3.400')
+
launchTask 'ideJalviewjsImport', {
- it.args = ["-consoleLog", "--launcher.suppressErrors", "-application", "com.seeq.eclipse.importprojects.headlessimport", "-data", eclipseWorkspace.getPath(), "-import", jalviewDirAbsolutePath ]
+ it.args = ["-consoleLog", "-nosplash", "--launcher.suppressErrors", "-application", "com.seeq.eclipse.importprojects.headlessimport", "-data", eclipseWorkspace.getPath(), "-import", jalviewDirAbsolutePath ]
}
launchTask 'ideJalviewjsBuild', {
- it.args = ["-consoleLog", "--launcher.suppressErrors", "-application", "org.eclipse.jdt.apt.core.aptBuild", "-data", eclipseWorkspace.getPath(), "-"+jalviewjs_eclipseBuildArg, eclipse_project_name ]
+
+ oomphIde.workspaceProp '.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs', {
+ it.put('org.eclipse.jdt.launching.PREF_VM_XML', goomph_PREF_VM_XML)
+ }
+
+ def args = ["-consoleLog", "-nosplash", "--launcher.suppressErrors", "-application", "org.eclipse.jdt.apt.core.aptBuild", "-data", eclipseWorkspace.getPath(), "-"+jalviewjs_eclipseBuildArg, eclipse_project_name ]
+ println("ARGS="+args)
+
+ it.args = args
}
}
dependsOn ideSetupWorkspace
}
-
+} // if (useIde) {}
dependsOn jalviewjsUnzipFiles
dependsOn jalviewjsCopyResources
dependsOn jalviewjsCopySiteResources
- dependsOn ideSetup
- dependsOn ide
+ // see project.afterEvaluate
+ //dependsOn ideJalviewjsBuild
}
project.afterEvaluate {
- tasks.findByName('ideJalviewjsImport').dependsOn eclipseProject
- tasks.findByName('ideJalviewjsImport').dependsOn eclipseClasspath
- tasks.findByName('ideJalviewjsImport').dependsOn eclipseJdt
- tasks.findByName('ideJalviewjsImport').dependsOn jalviewjsSetEclipseWorkspace
- tasks.findByName('ideJalviewjsBuild').dependsOn tasks.findByName('ideJalviewjsImport')
+ if (useIde) {
+ tasks.findByName('ideJalviewjsImport').dependsOn eclipseProject
+ tasks.findByName('ideJalviewjsImport').dependsOn eclipseClasspath
+ tasks.findByName('ideJalviewjsImport').dependsOn eclipseJdt
+ tasks.findByName('ideJalviewjsImport').dependsOn jalviewjsSetEclipseWorkspace
+
+ tasks.findByName('ideJalviewjsBuild').dependsOn tasks.findByName('ideJalviewjsImport')
+ tasks.findByName('ideJalviewjsBuild').dependsOn tasks.findByName('jalviewjsCreateJ2sSettings')
+
+ tasks.findByName('ide').dependsOn eclipseProject
+ tasks.findByName('ide').dependsOn eclipseClasspath
+ tasks.findByName('ide').dependsOn eclipseJdt
+
+ ideBuildSite.dependsOn tasks.findByName('ideJalviewjsBuild')
+ }
- tasks.findByName('ide').dependsOn eclipseProject
- tasks.findByName('ide').dependsOn eclipseClasspath
- tasks.findByName('ide').dependsOn eclipseJdt
}