From 5f3301530feeaddcbc90d85af438880e41a69d04 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Tue, 22 Oct 2019 10:57:55 +0100 Subject: [PATCH] JAL-3210 project name explicitly set. updated README_GRADLE_JALVIEWJS...md file. fixed eclipseRootDir detection for macos. --- README_GRADLE_JALVIEWJS-2019-10-15.md | 38 ------------------ README_GRADLE_JALVIEWJS-2019-10-22.md | 70 +++++++++++++++++++++++++++++++++ build.gradle | 8 +++- gradle.properties | 2 +- settings.gradle | 1 + 5 files changed, 79 insertions(+), 40 deletions(-) delete mode 100644 README_GRADLE_JALVIEWJS-2019-10-15.md create mode 100644 README_GRADLE_JALVIEWJS-2019-10-22.md create mode 100644 settings.gradle diff --git a/README_GRADLE_JALVIEWJS-2019-10-15.md b/README_GRADLE_JALVIEWJS-2019-10-15.md deleted file mode 100644 index 610ce9b..0000000 --- a/README_GRADLE_JALVIEWJS-2019-10-15.md +++ /dev/null @@ -1,38 +0,0 @@ -Last updated: 2019-10-09 - -# 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 jalviewjsServer -``` - -and go to the localhost URL in the output of the jalviewjsServer task in your web browser (on a mac, just right clicking on the URL in terminal window gives an "Open URL" option which is nice and easy). - - diff --git a/README_GRADLE_JALVIEWJS-2019-10-22.md b/README_GRADLE_JALVIEWJS-2019-10-22.md new file mode 100644 index 0000000..34e682b --- /dev/null +++ b/README_GRADLE_JALVIEWJS-2019-10-22.md @@ -0,0 +1,70 @@ +Last updated: 2019-10-22 + +# TRANSPILING USING ECLIPSE AS AN EXTERNAL CLI TOOL: + + +1) Download and install a clean eclipse jee-2019-09: + +RECOMMEND using the eclipse installer found at https://www.eclipse.org/downloads/packages/installer +and installing in ~/buildtools/eclipse/jee-2019-09 (which is what the gradle.properties property jalviewjs_eclipse_root is set to by default). + + +2) Check the `jalviewjs_eclipse_root` property in `gradle.properties`: + +If you have an eclipse 2019-06 or 2019-09 installed already elsewhere that you want to try and use then change the +``` +jalviewjs_eclipse_root +``` +property in gradle.properties to point to the folder that the application is installed in. If you are on macOS this is the folder _above_ Eclipse.app (i.e. the folder Eclipse.app is in). +If on Windows or Linux then this can be the folder that the eclipse installer says it is installing too (usually something like `.../jee-2019-09`) (even though it then installs it to a folder `eclipse` under that) or the folder the eclipse binary and plugins folders etc are in (`build.gradle` will check both the folder stated in `jalviewjs_eclipse_root` and `${jalviewjs_eclipse_root}/eclipse`). + +You can use a '~' as the first character which will get replaced with `System.getProperty("user.home")`. + + +3) That's it, but note the following: + +i) Note that the gradle task (`jalviewjsEclipseCopyDropins`) will take care of copying the appropriate `net.sf.j2s.core.jar` and the `com.seeq.eclipse.importprojects.jar` into the `dropins` dir (tested on both unix or mac -- not tested on windows yet). + +ii) Note that we have two versions of `net.sf.j2s.core.jar`, currently manifesting in two different `utils/jalviewjs/eclipse/dropins_4.1?` folders. This is because the behaviour of eclipse changed between 2019-06 (4.12) and 2019-09 (4.13) that meant the `src` and `test` BuildContexts are separated during the Eclipse build. This overwrites the list of classes to be transpiled with the set of classes from the last BuildContext to be compiled (which inevitablt seems to be tests). The way the file paths are represented must also have changed so that the exclusion from `j2s.ecluded.paths` in the `.j2s` file are not honoured. +I have made a fixed version of `net.sf.j2s.core_3.2.4-FOR_4.13.jar` that ought to be backward compatible, but for unknown reason doesn't work in eclipse 4.12. +Hopefully this is temporary and Bob can incorporate a properly backward compatible fix. + +iii) Note that the logs from the transpile go into `build/jalviewjs/j2s-transpile.out` which combines both stdout and stderr. + + +# CLI + +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 jalviewjsServer +``` +and go to the localhost URL in the output of the jalviewjsServer task in your web browser (on a mac, just right clicking on the URL in terminal window gives an "Open URL" option which is nice and easy). + + +# IN ECLIPSE + +If you are developing in Eclipse as IDE (which is the natural way to use Eclipse!) and have the plugin installed, then you will obviously not need to run the transpile as a gradle task -- it will be performed automatically. + +Some things to remember: +i) You will need the buildship plugin (part of the JEE package). +ii) If you haven't already, remember to run on the CLI +``` +gradle cleanEclipse eclipse jalviewjsCreateJ2sSettings +``` +to create clean jalview `.classpath, .project, .settings/org.eclipse.jdt.core.prefs, .j2s` files. +You should only need to do this once. +Be aware that manual changes to these files will likely be overwritten during some gradle tasks. + + diff --git a/build.gradle b/build.gradle index fc47cb6..d575f18 100644 --- a/build.gradle +++ b/build.gradle @@ -305,7 +305,7 @@ configurations { eclipse { project { - name = "Jalview with gradle build" + name = eclipse_project_name natures 'org.eclipse.jdt.core.javanature', 'org.eclipse.jdt.groovy.core.groovyNature', @@ -1353,10 +1353,16 @@ task jalviewjsEclipsePaths { eclipseBinary = eclipseRoot+"/Contents/MacOS/eclipse" eclipseProduct = eclipseRoot+"/Contents/Eclipse/.eclipseproduct" } else if (OperatingSystem.current().isWindows()) { // check these paths!! + if (file(eclipseRoot+"/eclipse").isDirectory() && file(eclipseRoot+"/eclipse/.eclipseproduct").exists()) { + eclipseRoot += "/eclipse" + } eclipseDropinsDir = eclipseRoot+"/dropins" eclipseBinary = eclipseRoot+"/eclipse" eclipseProduct = eclipseRoot+"/.eclipseproduct" } else { // linux or unix + if (file(eclipseRoot+"/eclipse").isDirectory() && file(eclipseRoot+"/eclipse/.eclipseproduct").exists()) { + eclipseRoot += "/eclipse" + } eclipseDropinsDir = eclipseRoot+"/dropins" eclipseBinary = eclipseRoot+"/eclipse" eclipseProduct = eclipseRoot+"/.eclipseproduct" diff --git a/gradle.properties b/gradle.properties index 85ee158..b0c4113 100644 --- a/gradle.properties +++ b/gradle.properties @@ -142,7 +142,7 @@ eclipse_extra_jdt_prefs_file = .settings/org.eclipse.jdt.core.jalview.prefs eclipse_project_name = jalview eclipse_bin_dir = bin -jalviewjs_eclipse_root = ~/buildtools/eclipse/eclipse-jee-2019-09/eclipse +jalviewjs_eclipse_root = ~/buildtools/eclipse/jee-2019-09 jalviewjs_utils_dir = utils/jalviewjs jalviewjs_eclipse_dropins_dir = eclipse/dropins diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..d284cee --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name="jalview" -- 1.7.10.2