+ into project.name
+
+ def EXCLUDE_FILES=["build/*","bin/*","test-output/","test-reports","tests","clover*/*"
+ ,".*"
+ ,"benchmarking/*"
+ ,"**/.*"
+ ,"*.class"
+ ,"**/*.class","$j11modDir/**/*.jar","appletlib","**/*locales"
+ ,"*locales/**",
+ ,"utils/InstallAnywhere"]
+ def PROCESS_FILES=[ "AUTHORS",
+ "CITATION",
+ "FEATURETODO",
+ "JAVA-11-README",
+ "FEATURETODO",
+ "LICENSE",
+ "**/README",
+ "RELEASE",
+ "THIRDPARTYLIBS","TESTNG",
+ "build.gradle",
+ "gradle.properties",
+ "**/*.java",
+ "**/*.html",
+ "**/*.xml",
+ "**/*.gradle",
+ "**/*.groovy",
+ "**/*.properties",
+ "**/*.perl",
+ "**/*.sh"]
+
+ from(jalviewDir) {
+ exclude (EXCLUDE_FILES)
+ include (PROCESS_FILES)
+ filter(ReplaceTokens, beginToken: '$$', endToken: '$$', tokens: ['Version-Rel': JALVIEW_VERSION,'Year-Rel': getDate("yyyy")])
+ }
+ from(jalviewDir) {
+ exclude (EXCLUDE_FILES)
+ exclude (PROCESS_FILES)
+ exclude ("appletlib")
+ exclude ("**/*locales")
+ exclude ("*locales/**")
+ exclude ("utils/InstallAnywhere")
+
+ exclude (getdown_files_dir)
+ exclude (getdown_website_dir)
+
+ // exluding these as not using jars as modules yet
+ exclude ("$j11modDir/**/*.jar")
+}
+// from (jalviewDir) {
+// // explicit includes for stuff that seemed to not get included
+// include(fileTree("test/**/*."))
+// exclude(EXCLUDE_FILES)
+// exclude(PROCESS_FILES)
+// }
+}
+
+task helppages {
+ dependsOn copyHelp
+ dependsOn pubhtmlhelp
+
+ inputs.dir("$classes/$helpDir")
+ outputs.dir("$helpOutputDir")
+}
+
+def eclipseWorkspace
+task jalviewjsSetEclipseWorkspace {
+ def eclipseWsDir = jalviewjs_eclipse_workspace
+ eclipseWorkspace = file(eclipseWsDir)
+ if (!eclipseWorkspace.exists()) {
+ eclipseWorkspace = file("${buildDir}/../tmp/eclipse-workspace")
+ //eclipseWorkspace.deleteOnExit()
+ }
+ println("ECLIPSE WORKSPACE: "+eclipseWorkspace.getPath())
+}
+
+def jalviewjsBuildDir
+def jalviewjsSiteDir
+task jalviewjsSitePath {
+ if (jalviewjs_site_dir.startsWith("/")) {
+ jalviewjsSiteDir = jalviewjs_site_dir
+ } else {
+ def relativeBuildDir = file(jalviewDirAbsolutePath).toPath().relativize(buildDir.toPath())
+ jalviewjsBuildDir = "${relativeBuildDir}/jalviewjs"
+ jalviewjsSiteDir = jalviewjsBuildDir + "/" + jalviewjs_site_dir
+ }
+}
+
+
+
+task jalviewjsUnzipFiles {
+ dependsOn jalviewjsSitePath
+
+ def zipFiles = fileTree(dir: jalviewjs_utils_dir+"/"+jalviewjs_libjs_dir).include("*.zip")
+ zipFiles += jalviewjs_utils_dir+"/"+jalviewjs_swingjs_zip
+
+ doLast {
+ zipFiles.each { file_zip ->
+ copy {
+ from zipTree(file_zip)
+ into jalviewjsSiteDir
+ }
+ }
+ }
+
+ inputs.files zipFiles
+ outputs.dir jalviewjsSiteDir
+}
+
+def eclipseDropinsDir
+def eclipseBinary
+task jalviewjsEclipsePaths {
+ def eclipseRoot
+ eclipseRoot = jalviewjs_eclipse_root
+ if (eclipseRoot.startsWith("~")) {
+ eclipseRoot = System.getProperty("user.home") + eclipseRoot.substring(1)
+ }
+ if (OperatingSystem.current().isMacOsX()) {
+ eclipseRoot += "/Eclipse.app"
+ eclipseDropinsDir = eclipseRoot+"/Contents/Eclipse/dropins"
+ eclipseBinary = eclipseRoot+"/Contents/MacOS/eclipse"
+ } else if (OperatingSystem.current().isWindows()) { // check these paths!!
+ eclipseDropinsDir = eclipseRoot+"/dropins"
+ eclipseBinary = eclipseRoot+"/eclipse"
+ } else { // linux or unix
+ eclipseDropinsDir = eclipseRoot+"/dropins"
+ eclipseBinary = eclipseRoot+"/eclipse"
+ }
+}
+
+task jalviewjsEclipseCopyDropins {
+ dependsOn jalviewjsEclipsePaths
+ def inputFiles = fileTree(dir: jalviewjs_utils_dir+"/"+jalviewjs_eclipse_dropins_dir, include: "*.jar")
+ def outputDir = eclipseDropinsDir
+
+ inputs.files inputFiles
+ inputFiles.each { file ->
+ outputs.file(outputDir+"/"+file.name)
+ }
+
+ doLast {
+ def outputFiles = []
+ inputFiles.each { file ->
+ copy {
+ from file
+ into outputDir
+ }
+ }
+ }
+}
+
+task jalviewjsCreateJ2sSettings(type: WriteProperties) {
+ dependsOn jalviewjsSitePath
+ outputFile (jalviewDir+"/"+jalviewjs_j2s_settings)
+ def props = project.properties.sort { it.key }
+ def siteDirProperty = "j2s.site.directory"
+ def setSiteDir = false
+ props.each { prop, val ->
+ if (prop.startsWith("j2s.") && val != null) {
+ if (prop == siteDirProperty) {
+ if (!(val.startsWith("/") || val.startsWith("file://") )) {
+ val = jalviewjsSiteDir+"/"+val
+ }
+ setSiteDir = true
+ }
+ property(prop,val)
+ }
+ if (!setSiteDir) {
+ property(siteDirProperty,"${jalviewjsSiteDir}")
+ }
+ }
+ outputs.file(outputFile)
+}
+
+task jalviewjsEclipseSetup {
+ dependsOn jalviewjsEclipseCopyDropins
+ dependsOn jalviewjsSetEclipseWorkspace
+ dependsOn jalviewjsCreateJ2sSettings
+}
+
+task jalviewjsCopyResources (type: Copy) {
+ dependsOn jalviewjsSitePath
+ def inputFiles = fileTree(dir: jalviewjs_resource_dir)
+ def outputDir = jalviewjsSiteDir+"/"+jalviewjs_j2s_subdir
+
+ from inputFiles
+ into outputDir
+ def outputFiles = []
+ rename { filename ->
+ outputFiles += outputDir+"/"+filename
+ null
+ }
+ outputs.files outputFiles
+ inputs.files inputFiles
+}
+
+task jalviewjsCopySiteResources (type: Copy) {
+ dependsOn jalviewjsSitePath
+ def inputFiles = fileTree(dir: jalviewjs_utils_dir+"/"+jalviewjs_site_resource_dir)
+ def outputDir = jalviewjsSiteDir
+
+ from inputFiles
+ into outputDir
+ def outputFiles = []
+ rename { filename ->
+ outputFiles += outputDir+"/"+filename
+ null
+ }
+ outputs.files outputFiles
+ inputs.files inputFiles
+}
+
+task cleanJalviewjs {
+ //delete jalviewjsBuildDir
+ //delete jalviewDir+"/"+eclipse_bin_dir
+ //delete file(eclipseWorkspace.getAbsolutePath()+"/.metadata")
+ //delete jalviewDir+"/"+jalviewjs_j2s_settings