From 1c0a609bc903f31315f3d40e2c43ee7851501ca2 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 28 Aug 2019 13:23:39 +0100 Subject: [PATCH] JAL-3210 Now includes creating the .project, .classpath and .settings as a depenedency --- .gitignore | 1 + README | 4 +- build.gradle | 105 ++++++++++++++++++++++++++++++++++++----------------- gradle.properties | 6 +-- 4 files changed, 75 insertions(+), 41 deletions(-) diff --git a/.gitignore b/.gitignore index 36b08a0..e450e6b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /bin /site /site2 +/template.html diff --git a/README b/README index a546b23..33f0319 100644 --- a/README +++ b/README @@ -1,10 +1,8 @@ Download and install a clean eclipse-jee-2019-06 -In gradle.properties edit `jalviewjs_eclipse_root` to point to the root dir. Include Eclipse.app if it's the macOS version. +In gradle.properties edit `jalviewjs_eclipse_root` to point to the root dir. Include up to the Eclipse.app folder if it's the macOS version. -Run `gradle eclipse` to produce the .project file. - gradle tasks of interest: `jalviewjs` (should do everything) diff --git a/build.gradle b/build.gradle index 62b4df5..fc183a5 100644 --- a/build.gradle +++ b/build.gradle @@ -195,6 +195,7 @@ eclipse { //autoBuildTasks eclipseClasspath } // eclipse +/* compileJava { doFirst { @@ -209,9 +210,9 @@ compileJava { clean { delete sourceSets.main.java.outputDir } +*/ - -task jalviewjs_unzipFiles { +task jalviewjsUnzipFiles { def zipFiles = fileTree(dir: jalviewjs_utils_dir+"/"+jalviewjs_libjs_dir).include("*.zip") zipFiles += jalviewjs_utils_dir+"/"+jalviewjs_swingjs_zip @@ -231,7 +232,7 @@ task jalviewjs_unzipFiles { def eclipseBinary def eclipseDropinsDir def eclipsePluginsDir -task jalviewjs_eclipsePaths { +task jalviewjsEclipsePaths { if (OperatingSystem.current().isMacOsX()) { eclipseDropinsDir = jalviewjs_eclipse_root+"/Contents/Eclipse/dropins" eclipsePluginsDir = jalviewjs_eclipse_root+"/Contents/Eclipse/plugins" @@ -247,72 +248,108 @@ task jalviewjs_eclipsePaths { } } -task jalviewjs_eclipse_copy_dropins (type: Copy) { - dependsOn jalviewjs_eclipsePaths +task jalviewjsEclipseCopyDropins (type: Copy) { + dependsOn jalviewjsEclipsePaths def inputFiles = fileTree(jalviewjs_utils_dir+"/"+jalviewjs_eclipse_dropins_dir) def outputDir = eclipseDropinsDir + from inputFiles into outputDir + def outputFiles = [] + rename { filename -> + outputFiles += outputDir+"/"+filename + null + } + outputs.files outputFiles inputs.files inputFiles - //outputs.dir outputDir } -task jalviewjs_eclipse_copy_plugins (type: Copy) { - dependsOn jalviewjs_eclipsePaths +task jalviewjsEclipseCopyPlugins (type: Copy) { + dependsOn jalviewjsEclipsePaths def inputFiles = fileTree(jalviewjs_utils_dir+"/"+jalviewjs_eclipse_plugins_dir) def outputDir = eclipsePluginsDir + from inputFiles into outputDir - //inputs.files inputFiles - //outputs.dir outputDir + def outputFiles = [] + rename { filename -> + outputFiles += outputDir+"/"+filename + null + } + outputs.files outputFiles + inputs.files inputFiles } def tempEclipseWorkspace = "" -task jalviewjs_setTempEclipseWorkspace { +task jalviewjsSetTempEclipseWorkspace { tempEclipseWorkspace = file(jalviewjs_eclipse_workspace) if (!tempEclipseWorkspace.exists()) { tempEclipseWorkspace = File.createTempDir() + print("ECLIPSE WORKSPACE: "+tempEclipseWorkspace.getPath()) //tempEclipseWorkspace.deleteOnExit() } } -task jalviewjs_eclipse_setup { - dependsOn jalviewjs_eclipse_copy_dropins - dependsOn jalviewjs_eclipse_copy_plugins - dependsOn jalviewjs_setTempEclipseWorkspace +task jalviewjsEclipseSetup { + dependsOn jalviewjsEclipseCopyDropins + dependsOn jalviewjsEclipseCopyPlugins + dependsOn jalviewjsSetTempEclipseWorkspace } -task jalviewjs_createJ2sSettings(type: WriteProperties) { + +task jalviewjsCreateJ2sSettings(type: WriteProperties) { outputFile (jalviewDir+"/"+jalviewjs_j2s_settings) def props = project.properties.sort { it.key } props.each { prop, val -> - if (prop.startsWith("j2s.") && val != null) { - property(prop,val) - } + if (prop.startsWith("j2s.") && val != null) { + property(prop,val) + } } outputs.file(outputFile) } -task jalviewjs_copyResources (type: Copy) { - from fileTree(dir: jalviewjs_resource_dir) - into jalviewjs_site_dir+"/"+jalviewjs_j2s_subdir +task jalviewjsCopyResources (type: Copy) { + def inputFiles = fileTree(dir: jalviewjs_resource_dir) + def outputDir = jalviewjs_site_dir+"/"+jalviewjs_j2s_subdir + + from inputFiles + into outputDir + def outputFiles = [] + rename { filename -> + outputFiles += outputDir+"/"+filename + null + } + outputs.files outputFiles + inputs.files inputFiles } -task jalviewjs_copySiteResources (type: Copy) { - from fileTree(dir: jalviewjs_utils_dir+"/"+jalviewjs_site_resource_dir) - into jalviewjs_site_dir +task jalviewjsCopySiteResources (type: Copy) { + def inputFiles = fileTree(dir: jalviewjs_utils_dir+"/"+jalviewjs_site_resource_dir) + def outputDir = jalviewjs_site_dir + + from inputFiles + into outputDir + def outputFiles = [] + rename { filename -> + outputFiles += outputDir+"/"+filename + null + } + outputs.files outputFiles + inputs.files inputFiles } task cleanJalviewjsSite { - //delete jalviewjs_site_dir + delete jalviewjs_site_dir } task jalviewjsProjectImport(type: Exec) { // work out how to do this! - //dependsOn eclipse - dependsOn jalviewjs_eclipsePaths - dependsOn jalviewjs_eclipse_setup + dependsOn eclipseProject + dependsOn eclipseClasspath + dependsOn eclipseJdt + dependsOn jalviewjsEclipsePaths + dependsOn jalviewjsEclipseSetup executable(eclipseBinary) args(["-nosplash", "--launcher.suppressErrors", "-application", "com.seeq.eclipse.importprojects.headlessimport", "-data", tempEclipseWorkspace.getPath(), "-import", jalviewDirAbsolutePath]) @@ -322,19 +359,19 @@ task jalviewjsProjectImport(type: Exec) { task jalviewjsTranspile(type: Exec) { dependsOn jalviewjsProjectImport - dependsOn jalviewjs_eclipsePaths + dependsOn jalviewjsEclipsePaths executable(eclipseBinary) args(["-nosplash", "--launcher.suppressErrors", "-application", "org.eclipse.jdt.apt.core.aptBuild", "-data", tempEclipseWorkspace, "-"+jalviewjs_eclipseBuildArg, eclipse_project_name ]) } task jalviewjsBuildSite { - dependsOn jalviewjs_unzipFiles - dependsOn jalviewjs_copyResources - dependsOn jalviewjs_copySiteResources + dependsOn jalviewjsUnzipFiles + dependsOn jalviewjsCopyResources + dependsOn jalviewjsCopySiteResources dependsOn jalviewjsTranspile } task jalviewjs { - dependsOn jalviewjs_createJ2sSettings + dependsOn jalviewjsCreateJ2sSettings dependsOn jalviewjsBuildSite } diff --git a/gradle.properties b/gradle.properties index 8d2b22f..3bc9e0a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -32,8 +32,6 @@ j11libDir = j11lib #j11modDir = j11mod #j11modules = com.sun.istack.runtime,com.sun.xml.bind,com.sun.xml.fastinfoset,com.sun.xml.streambuffer,com.sun.xml.txw2,com.sun.xml.ws.policy,java.activation,java.annotation,java.base,java.compiler,java.datatransfer,java.desktop,java.logging,java.management,java.management.rmi,java.naming,java.prefs,java.rmi,java.scripting,java.security.sasl,java.sql,java.xml,java.xml.bind,java.xml.soap,java.xml.ws,javax.jws,jdk.httpserver,jdk.jsobject,jdk.unsupported,jdk.xml.dom,org.jvnet.mimepull,org.jvnet.staxex,javax.servlet.api,java.ws.rs -#eclipse_extra_jdt_prefs_file = .settings/org.eclipse.jdt.core.jalview.prefs - dev = false jalviewjs_eclipse_root = /Users/bsoares/buildtools/eclipse/eclipse-jee-2019-06/Eclipse.app @@ -51,8 +49,8 @@ jalviewjs_j2s_subdir = swingjs/j2s jalviewjs_j2s_settings_file = dot_j2s jalviewjs_j2s_settings = .j2s jalviewjs_eclipse_workspace = /tmp/eclipse-workspace -#jalviewjs_eclipseBuildArg = build -jalviewjs_eclipseBuildArg = cleanBuild +jalviewjs_eclipseBuildArg = build +#jalviewjs_eclipseBuildArg = cleanBuild j2s.compiler.status = enable -- 1.7.10.2