diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index cee9d997e..fced759b0 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -12,110 +12,55 @@ jobs: build: strategy: matrix: - java: [11] + java: [21] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} - env: - gradle_version: 6.8.3 # use ``current`` to install the current stable release - gradle_commands: build # default is build steps: - - uses: actions/checkout@v4 - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v4 + - uses: actions/checkout@v6 + - uses: actions/setup-java@v5 with: java-version: ${{ matrix.java }} distribution: 'zulu' cache: 'gradle' java-package: 'jdk+fx' - - uses: gradle/actions/setup-gradle@v3 - with: - gradle-version: ${{ env.gradle_version }} - name: Run commands - run: gradle ${{ env.gradle_commands }} - - name: Prepare PATH - if: startsWith(matrix.os, 'windows') - shell: bash - run: echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" >> $GITHUB_PATH - - name: Re-install innosetup - if: startsWith(matrix.os, 'windows') && startsWith(github.ref, 'refs/tags') && startsWith(matrix.java, '11') - shell: cmd - run: | - choco uninstall innosetup - choco install innosetup --version=5.6.1 - - name: Build insight exe - if: startsWith(matrix.os, 'windows') && startsWith(github.ref, 'refs/tags') && startsWith(matrix.java, '11') - shell: cmd - run: | - gradle packageApplicationExe - - name: Build importer exe - if: startsWith(matrix.os, 'windows') && startsWith(github.ref, 'refs/tags') && startsWith(matrix.java, '11') - shell: cmd - run: | - gradle packageImporterApplicationExe - - name: Build insight msi - if: startsWith(matrix.os, 'windows') && startsWith(github.ref, 'refs/tags') && startsWith(matrix.java, '11') - shell: cmd - run: | - gradle packageApplicationMsi - - name: Build importer msi - if: startsWith(matrix.os, 'windows') && startsWith(github.ref, 'refs/tags') && startsWith(matrix.java, '11') - shell: cmd - run: | - gradle packageImporterApplicationMsi - - name: Check MSI - if: startsWith(matrix.os, 'windows') && startsWith(github.ref, 'refs/tags') && startsWith(matrix.java, '11') - run: | - msi=(`find build/packaged/installImporterDist/bundles -maxdepth 1 -name "*.msi"`) - if [ ${#msi[@]} == 0 ]; then - exit 1 - fi - msi=(`find build/packaged/main/bundles -maxdepth 1 -name "*.msi"`) - if [ ${#msi[@]} == 0 ]; then - exit 1 - fi - shell: bash - - name: Upload zip and jar - if: startsWith(matrix.os, 'ubuntu') && startsWith(github.ref, 'refs/tags') && startsWith(matrix.java, '11') - uses: actions/upload-artifact@v4 - with: - name: artifacts-${{ matrix.os }}-OMERO - path: build/distributions/OMERO* - if-no-files-found: error - - name: Upload jar - if: startsWith(matrix.os, 'ubuntu') && startsWith(github.ref, 'refs/tags') && startsWith(matrix.java, '11') - uses: actions/upload-artifact@v4 + run: ./gradlew build + - if: ${{ matrix.os != 'ubuntu-latest' }} + name: Run jpackage + run: ./gradlew jpackage + - name: Upload JAR and distribution + if: startsWith(matrix.os, 'ubuntu') + uses: actions/upload-artifact@v6 with: - name: artifacts-${{ matrix.os }}-omero_ - path: build/libs/omero_* + name: artifacts-${{ matrix.os }} + path: build/distributions/*.zip if-no-files-found: error - - name: Upload insight artifacts - if: startsWith(matrix.os, 'windows') && startsWith(github.ref, 'refs/tags') && startsWith(matrix.java, '11') - uses: actions/upload-artifact@v4 + - name: Upload Windows package + if: startsWith(matrix.os, 'windows') + uses: actions/upload-artifact@v6 with: - name: artifacts-${{ matrix.os }}-insight - path: build/packaged/main/bundles/* + name: artifacts-${{ matrix.os }} + path: build/jpackage/*.msi if-no-files-found: error - - name: Upload importer artifacts - if: startsWith(matrix.os, 'windows') && startsWith(github.ref, 'refs/tags') && startsWith(matrix.java, '11') - uses: actions/upload-artifact@v4 + - name: Upload OS X package + if: startsWith(matrix.os, 'macos') + uses: actions/upload-artifact@v6 with: - name: artifacts-${{ matrix.os }}-importer - path: build/packaged/installImporterDist/bundles/* + name: artifacts-${{ matrix.os }} + path: build/jpackage/*.dmg + if-no-files-found: error release: if: startsWith(github.ref, 'refs/tags') needs: build runs-on: ubuntu-latest steps: + - uses: actions/checkout@v6 - name: Download artifacts from build - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v6 - name: List artifacts - run: ls -R - - name: Upload binaries to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts*/* - tag: ${{ github.ref }} - overwrite: true - file_glob: true + run: ls -R artifacts* + - name: Create a GitHub release + run: gh release create --generate-notes "${GITHUB_REF#refs/tags/}" artifacts*/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 8eb3490aa..342478cf6 100644 --- a/README.md +++ b/README.md @@ -1,166 +1,92 @@ -OMERO.insight Project ---------------------- +# OMERO.insight [![Actions Status](https://github.com/ome/omero-insight/workflows/Build/badge.svg)](https://github.com/ome/omero-insight/actions) [![Documentation Status](https://readthedocs.org/projects/omero-insight/badge/?version=latest)](https://omero-insight.readthedocs.io/en/latest/) - The OMERO.insight Project is a sub-project of the Open Microscopy Environment - Project, [OME](https://www.openmicroscopy.org/) that focuses on delivering a - client for the visualization and manipulation of both image data and metadata - maintained at an OMERO server site. - OMERO.insight is completely written in Java. - Technical documentation can be found [here](https://omero-insight.readthedocs.io/en/latest/). +The OMERO.insight Project is a sub-project of the Open Microscopy Environment +Project, [OME](https://www.openmicroscopy.org/) that focuses on delivering a +client for the visualization and manipulation of both image data and metadata +maintained at an OMERO server site. +OMERO.insight is completely written in Java. +Technical documentation can be found [here](https://omero-insight.readthedocs.io/en/latest/). +## Directory Contents - Directory Contents - ------------------ +This directory is the repository of the software artifacts of the +OMERO.insight Project. Its contents are as follows: - This directory is the repository of the software artifacts of the - OMERO.insight Project. Its contents are as follows: + + build.gradle, settings.gradle: build for build system + + src: Contains the application source files, various configuration + files required by the application to run and the test code. + + README.md: This file. + + LICENSE.txt: The license covering this software. + + CHANGELOG.md: The release history + + FAQ.md: Commons questions - + build.gradle, settings.gradle: build for build system - + src: Contains the application source files, various configuration - files required by the application to run and the test code. - + buildSrc: source files to package the applications - + README: This file. - + LICENSE.txt: The license covering this software. - + CHANGELOG.md: The release history - + FAQ.md: Commons questions +## Building OMERO.insight - Building OMERO.insight - ---------------------- +The compilation, testing, launch, and delivery of the application are +automated by means of a [Gradle](https://gradle.org/) build file. +In order to perform a build, all you need is +a JDK -- version 17 or later. From the command line, enter: - The compilation, testing, launch, and delivery of the application are - automated by means of a [Gradle](https://gradle.org/) build file. - In order to perform a build, all you need is - a JDK -- version 1.8 or later. From the command line, enter: + ./gradlew build - gradle build +This will compile, build, test and create a distribution bundle. +To run OMERO.insight from the distribution bundle unzip +the zip under `build/distributions` then go to the unzipped +directory and from the command line enter, for example: - This will compile, build, test and create a distribution bundle. - To run OMERO.insight from the distribution bundle unzip - `omero-insight.zip` then go to the `omero-insight` directory and from - the command line enter, for example: + bin/OMERO.insight - bin/omero-insight +To run the OMERO.importer, enter: - To run the OMERO.importer, enter: + bin/OMERO.insight containerImporter.xml - bin/omero-insight containerImporter.xml +To run OMERO.insight, from the command line, enter: - To run OMERO.insight, from the command line, enter: + ./gradlew run - gradle run +To run OMERO.importer, from the command line, enter: - To run OMERO.importer, from the command line, enter: + ./gradlew runImporter - gradle runImporter +## Packaging OMERO.insight - Packaging OMERO.insight - ----------------------- +Packaging OMERO.insight requires version 21 or later of the JDK version. The +build system uses the [jpackage](https://docs.oracle.com/en/java/javase/21/docs/specs/man/jpackage.html) +command via the Gradle [org.beryx.runtime](https://plugins.gradle.org/plugin/org.beryx.runtime) plugin +to create an installer for the platform the deployment task is run on. - OMERO.insight uses the Gradle [java-packager-plugin](https://github.com/ome/omero-javapackager-plugin) - and is capable of creating an installer for the platform the deployment task is run on. +To run the application packager, from the command line enter: - __Note, a Java runtime is included with the bundled installer. It is recommended to use - [OpenJDK](https://openjdk.java.net) as the system's JRE to avoid potential licensing issues.__ + ./gradlew jpackage - In order to be able to successfully create an installer, a JDK with - [`javapackager`](https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javapackager.html) or - an [OpenJFX SDK](https://gluonhq.com/products/javafx/) matching the version of the system JDK - is required (particularly if you intend to build with JDK 11 or higher). +## Developing OMERO.insight - ### OSX + See https://omero.readthedocs.io/en/stable/developers/index.html#insight - If you are using [Homebrew](https://brew.sh/), you can install, for example, [OpenJDK 8](https://bell-sw.com/pages/downloads/) - which comes bundled with JavaFX. - To install run: +## OMERO.insight extension - brew tap bell-sw/liberica - brew install --cask liberica-jdk8-full +To use the metadata extension [OMERO.mde](mde-extension.md), +set the following entry in [container.xml](src/dist/config/container.xml) or in +[containerImporter.xml](src/dist/config/containerImporter.xml) to `true`: - ### Windows + + true - #### Scoop: +## FAQ - scoop bucket add java +See [FAQ.md](FAQ.md) - scoop install zulufx8 +## Licensing - #### Manually: +This software is licensed under the terms of the GNU General Public +License (GPL), the full text of which can be found in +the top level LICENSE.txt. See https://www.openmicroscopy.org/licensing/ +for further details. - To set up a build environment with Windows without using a package manager such as [Scoop](https://scoop.sh) or - [Chocolatey](https://chocolatey.org) perform the following: - **JDK:** +## Copyright - 1. Download [ojdkbuild](https://github.com/ojdkbuild/ojdkbuild/releases/download/1.8.0.191-1/java-1.8.0-openjdk-1.8.0.191-1.b12.ojdkbuild.windows.x86_64.msi). - 2. Run the installer. - 3. Once at the _custom setup_ page of the setup select the _OpenJDK Runtime_ drop-down and install the _JAVA_HOME_ - feature. - 4. Whilst on the _custom setup_ page, select to include the _OpenJFX Runtime_. - - **Inno Setup (required to create .exe installer):** - - 1. Download and install [Inno Setup](http://www.jrsoftware.org/isdl.php). - 2. Add the Inno Setup install directory (e.g. `C:\Program Files (x86)\Inno Setup 5`) to the PATH. - - You can install Inno Setup using Chocolatey: - - choco install innosetup - - Depending on the Windows version you are using, you might not be able to use the latest version of Inno Setup. - - - - **WiX (required to build .msi installer):** - - 1. Download and install [WiX 3.0 or greater](http://wixtoolset.org/). - 2. Add WiX to the PATH. - - ### Packaging - - To run the application packager, from the command line enter: - - **Windows** - - gradle packageApplicationExe - - **OSX** - - gradle packageApplicationDmg - - Developing OMERO.insight - ------------------------ - - See https://docs.openmicroscopy.org/latest/omero/developers/index.html#insight. - - OMERO.insight extension - ----------------------- - - 1. To use the metadata extension [OMERO.mde](mde-extension.md), - set the following entry in [container.xml](src/config/container.xml) or in - [containerImporter.xml](src/config/containerImporter.xml) to `true`: - ``` - false - ``` - - - FAQ - --- - - See [FAQ.md](FAQ.md) - - Licensing - --------- - - This software is licensed under the terms of the GNU General Public - License (GPL), the full text of which can be found in - the top level LICENSE.txt. See https://www.openmicroscopy.org/licensing/ - for further details. - - - Copyright - --------- - - Copyright (C) 2006-2024 University of Dundee. All rights reserved. +Copyright (C) 2006-2024 University of Dundee. All rights reserved. diff --git a/build.gradle b/build.gradle index 171aaec84..1fd231b5b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,35 +1,41 @@ plugins { - id "java" - id "org.openmicroscopy.insight" - id "org.openmicroscopy.publish" - id "org.openmicroscopy.distribute" - id "org.openmicroscopy.packager" - id "org.openmicroscopy.additional-repositories" version "5.7.2" + id 'application' + id 'org.beryx.runtime' version '2.0.1' } group = "org.openmicroscopy" -version = "5.8.7-SNAPSHOT" +version = "5.9.0-SNAPSHOT" repositories { mavenLocal() mavenCentral() + maven { + url = 'https://artifacts.glencoesoftware.com/artifactory/ome.releases/' + } + maven { + url = 'https://artifacts.unidata.ucar.edu/repository/unidata-releases/' + } + maven { + url = 'https://maven.scijava.org/repository/thirdparty/' + } + maven { + url = 'https://artifacts.openmicroscopy.org/artifactory/ome.external/' + } } -//java { -// sourceCompatibility = JavaVersion.VERSION_11 -// targetCompatibility = JavaVersion.VERSION_11 -//} +application { + mainClass = 'org.openmicroscopy.shoola.Main' + applicationName = 'OMERO.insight' +} compileJava { - options.release = 8 + options.release = 11 } dependencies { testImplementation("junit:junit:4.12") - if (JavaVersion.current().isJava9Compatible()) { - implementation('com.sun.activation:javax.activation:1.2.0') - } + implementation('com.sun.activation:javax.activation:1.2.0') implementation("com.mortennobel:java-image-scaling:0.8.6") implementation("com.google.code.gson:gson:2.8.5") implementation("com.zeroc:glacier2:3.6.5") @@ -55,6 +61,21 @@ dependencies { implementation("ch.qos.logback:logback-classic:1.3.16") } +jar { + manifest { + attributes( + "Created-By": "Gradle ${gradle.gradleVersion}", + "Build-Jdk": "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})", + "Built-By": System.properties['user.name'], + "Built-On": new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()), + "Implementation-Build": "git rev-parse --verify HEAD".execute().getText().trim(), + "Implementation-Title": "OMERO.insight", + "Implementation-Version": archiveVersion, + "Implementation-Vendor": "Open Microscopy Environment", + ) + } +} + test { testLogging.showStandardStreams = true systemProperties = System.getProperties() @@ -71,3 +92,27 @@ test { excludeTestsMatching "TestExecCommandStateTrans.testExecutingCancelled" } } + +runtime { + options = [ + '--strip-debug', + '--compress', 'zip-6', + '--no-header-files', + '--no-man-pages' + ] + jpackage { + def currentOs = org.gradle.internal.os.OperatingSystem.current() + def imgType = currentOs.windows ? 'ico' : currentOs.macOsX ? 'icns' : 'png' + + appVersion = version.replace("-SNAPSHOT", "") + args = ['container.xml', '$APPDIR/..'] + jvmArgs = ['-Xms256m', '-Xmx4096m'] + installerName = application.applicationName + installerOptions += ['--app-version', appVersion] + imageName = application.applicationName + imageOptions = [ + '--icon', "src/main/resources/icons/omeroInsight.$imgType", + '--app-content', 'src/dist/config' + ] + } +} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index 5f6fff1cf..000000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,36 +0,0 @@ -plugins { - id "groovy" - id "java-gradle-plugin" -} - -repositories { - mavenLocal() - mavenCentral() - maven { url 'https://artifacts.openmicroscopy.org/artifactory/maven/' } -} - -dependencies { - implementation "org.openmicroscopy:omero-javapackager-plugin:5.5.1" - implementation "com.github.jengelman.gradle.plugins:shadow:5.1.0" -} - -gradlePlugin { - plugins { - insight { - id = "org.openmicroscopy.insight" - implementationClass = "org.openmicroscopy.InsightPlugin" - } - distribute { - id = "org.openmicroscopy.distribute" - implementationClass = "org.openmicroscopy.DistributePlugin" - } - publish { - id = "org.openmicroscopy.publish" - implementationClass = "org.openmicroscopy.PublishPlugin" - } - packager { - id = "org.openmicroscopy.packager" - implementationClass = "org.openmicroscopy.PackagerPlugin" - } - } -} diff --git a/buildSrc/src/main/groovy/org/openmicroscopy/DistributePlugin.groovy b/buildSrc/src/main/groovy/org/openmicroscopy/DistributePlugin.groovy deleted file mode 100644 index a0a366f0f..000000000 --- a/buildSrc/src/main/groovy/org/openmicroscopy/DistributePlugin.groovy +++ /dev/null @@ -1,180 +0,0 @@ -/* - * ----------------------------------------------------------------------------- - * Copyright (C) 2019 University of Dundee & Open Microscopy Environment. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * ------------------------------------------------------------------------------ - */ -package org.openmicroscopy - -import groovy.transform.CompileStatic -import org.gradle.api.Action -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.Task -import org.gradle.api.distribution.Distribution -import org.gradle.api.distribution.DistributionContainer -import org.gradle.api.distribution.plugins.DistributionPlugin -import org.gradle.api.file.CopySpec -import org.gradle.api.plugins.ApplicationPlugin -import org.gradle.api.plugins.JavaPlugin -import org.gradle.api.tasks.TaskProvider -import org.gradle.api.tasks.application.CreateStartScripts -import org.gradle.api.tasks.bundling.Tar - -@CompileStatic -class DistributePlugin implements Plugin { - - public static final String DISTRIBUTION_NAME_INSIGHT = "OMERO.insight" - - public static final String DISTRIBUTION_NAME_IMPORTER = "OMERO.importer" - - public static final String DISTRIBUTION_NAME_IMAGEJ = "imagej" - - public static final String DISTRIBUTION_IMPORTER = "importer" - - public static final String DISTRIBUTION_IMAGEJ = "imagej" - - public static final String TASK_IMPORTER_START_SCRIPTS = "importerStartScripts" - - private Project project - - @Override - void apply(Project project) { - this.project = project - - project.pluginManager.apply(InsightPlugin) - - // Add CreateStartScripts task for importer, much like what the ApplicationPlugin does for "main" distribution - addImporterCreateScriptsTask() - - DistributionContainer distributionContainer = - project.extensions.getByName("distributions") as DistributionContainer - - // Copy files from src/config to install//config - CopySpec configSpec = project.copySpec { CopySpec s -> - s.from("src/config") - s.into("config") - } - - configureMainDistribution(distributionContainer, configSpec) - createImporterDistribution(distributionContainer, configSpec) - createImageJFatJarPluginDistribution(distributionContainer) - - // Skip tar tasks - project.tasks.withType(Tar).configureEach { - ((Task) it).setEnabled(false) - } - - } - - private TaskProvider addImporterCreateScriptsTask() { - project.tasks.register(TASK_IMPORTER_START_SCRIPTS, CreateStartScripts, new Action() { - CreateStartScripts insight_css = project.tasks.named(ApplicationPlugin.TASK_START_SCRIPTS_NAME, CreateStartScripts).get() - - @Override - void execute(CreateStartScripts css) { - //TODO review how to pass the argument. This approach is working but not ideal - css.mainClassName = InsightBasePlugin.MAIN_INSIGHT+" containerImporter.xml" - css.defaultJvmOpts = InsightBasePlugin.DEFAULT_JVM_ARGS - css.applicationName = "omero-importer" - css.outputDir = new File(project.getBuildDir(), "importerScripts") - css.executableDir = "bin" - css.classpath = insight_css.classpath - Utils.configureStartScripts(css) - } - }) - } - - private boolean isSupported() { - String[] version = project.getGradle().getGradleVersion().split("\\.") - return version[0].toInteger() >= 6 - } - - @groovy.transform.TypeChecked(groovy.transform.TypeCheckingMode.SKIP) - private void configureMainDistribution(DistributionContainer distributionContainer, CopySpec configSpec) { - // Configure "main" distribution to create OMERO.insight - Distribution main = distributionContainer.getByName(DistributionPlugin.MAIN_DISTRIBUTION_NAME) - if (isSupported()) { - main.getDistributionBaseName().set(DISTRIBUTION_NAME_INSIGHT) - } else { - main.baseName = DISTRIBUTION_NAME_INSIGHT - } - main.contents.with(configSpec) - } - - @groovy.transform.TypeChecked(groovy.transform.TypeCheckingMode.SKIP) - private void createImporterDistribution(DistributionContainer distributionContainer, CopySpec configSpec) { - // Create and configure importer distribution - distributionContainer.create(DISTRIBUTION_IMPORTER) { Distribution importer -> - if (isSupported()) { - importer.getDistributionBaseName().set(DISTRIBUTION_NAME_IMPORTER) - } else { - importer.baseName = DISTRIBUTION_NAME_IMPORTER - } - importer.contents.with(configSpec) - - CopySpec libChildSpec = - createLibSpec(project.tasks.named(JavaPlugin.JAR_TASK_NAME)) - - CopySpec binChildSpec = - createBinSpec(project.tasks.named(TASK_IMPORTER_START_SCRIPTS)) - - CopySpec childSpec = project.copySpec() - childSpec.with(libChildSpec) - childSpec.with(binChildSpec) - - importer.contents.with(childSpec) - } - } - - @groovy.transform.TypeChecked(groovy.transform.TypeCheckingMode.SKIP) - private void createImageJFatJarPluginDistribution(DistributionContainer distributionContainer) { - // Create and configure imageJ distribution - - distributionContainer.create(DISTRIBUTION_IMAGEJ) { Distribution imageJ -> - if (isSupported()) { - imageJ.getDistributionBaseName().set(DISTRIBUTION_NAME_IMAGEJ) - } else { - imageJ.baseName = DISTRIBUTION_NAME_IMAGEJ - } - CopySpec mainSpec = project.copySpec() - mainSpec.into("") - mainSpec.from(project.tasks.named(InsightBasePlugin.TASK_OMERO_IMAGEJ_FAT_JAR)) - - imageJ.contents.with(mainSpec) - } - } - - private CopySpec createBinSpec(TaskProvider startScriptTask) { - CopySpec binSpec = project.copySpec() - binSpec.into("bin") - binSpec.from(startScriptTask) - binSpec.setFileMode(0755) - return binSpec - } - - private CopySpec createLibSpec(TaskProvider jarTask) { - CopySpec libSpec = project.copySpec() - libSpec.into("lib") - if (jarTask != null) { - libSpec.from(jarTask) - } - libSpec.from(Utils.getRuntimeClasspathConfiguration(project)) - return libSpec - } - -} diff --git a/buildSrc/src/main/groovy/org/openmicroscopy/InsightBasePlugin.groovy b/buildSrc/src/main/groovy/org/openmicroscopy/InsightBasePlugin.groovy deleted file mode 100644 index fe3baf000..000000000 --- a/buildSrc/src/main/groovy/org/openmicroscopy/InsightBasePlugin.groovy +++ /dev/null @@ -1,180 +0,0 @@ -/* - * ----------------------------------------------------------------------------- - * Copyright (C) 2019-2022 University of Dundee & Open Microscopy Environment. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * ------------------------------------------------------------------------------ - */ -package org.openmicroscopy - -import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import groovy.transform.CompileStatic -import org.gradle.api.Action -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.Task -import org.gradle.api.artifacts.Configuration -import org.gradle.api.plugins.BasePlugin -import org.gradle.api.plugins.JavaPlugin -import org.gradle.api.plugins.JavaPluginConvention -import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.Sync -import org.gradle.api.tasks.TaskProvider -import org.gradle.jvm.tasks.Jar - -import java.text.SimpleDateFormat - -@CompileStatic -class InsightBasePlugin implements Plugin { - - public static final String TASK_PROCESS_CONFIGS = "processConfigs" - - public static final String TASK_OMERO_IMAGEJ_JAR = "imageJJar" - - public static final String TASK_OMERO_IMAGEJ_FAT_JAR = TASK_OMERO_IMAGEJ_JAR//"imageJFatJar" - - public static final String MAIN_INSIGHT = "org.openmicroscopy.shoola.Main" - - public static final String MAIN_IMAGEJ = "org.openmicroscopy.shoola.MainIJPlugin" - - public static final String GROUP_BUILD = BasePlugin.BUILD_GROUP - - public static final List DEFAULT_JVM_ARGS = ["-Xms256m", "-Xmx4096m"] - - private Project project - - @Override - void apply(Project project) { - this.project = project - - project.pluginManager.apply(JavaPlugin) - project.pluginManager.apply(ShadowBasePlugin) - - configureJarTask() - addProcessConfigs() - addCreateImageJFatJar() - } - - /** - * Modifies the manifest of the default jar task from the Gradle JavaPlugin - */ - private void configureJarTask() { - project.tasks.named(JavaPlugin.JAR_TASK_NAME, Jar).configure { Jar jar -> - - jar.doFirst(addManifest(MAIN_INSIGHT)) - } - } - - /** - * Creates a jar similar to processResources in that it - * copies config files from src dir to build dir. - */ - private TaskProvider addProcessConfigs() { - TaskProvider processConfigs = project.tasks.register(TASK_PROCESS_CONFIGS, Sync, new Action() { - @Override - void execute(Sync sync) { - sync.setDescription("Copies xml config files from src to build directory") - sync.from("${project.projectDir}/src/config") - sync.into("${project.buildDir}/config") - } - }) - - project.tasks.named(JavaPlugin.CLASSES_TASK_NAME).configure { Task task -> - task.dependsOn(processConfigs) - } - - processConfigs - } - - private TaskProvider addCreateImageJFatJar() { - JavaPluginConvention convention = project.convention.getPlugin(JavaPluginConvention) - - SourceSet main = - convention.sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME) - - project.tasks.register(TASK_OMERO_IMAGEJ_FAT_JAR, ShadowJar, new Action() { - @Override - void execute(ShadowJar shadow) { - // Rename omero-insight to omero_ij - Jar jarTask = project.tasks.getByName(JavaPlugin.JAR_TASK_NAME) as Jar - - shadow.archiveBaseName.set(createImageJName(jarTask, "ij")) - shadow.archiveClassifier.set("all") - shadow.description = "Create a combined JAR of project and runtime dependencies" - shadow.conventionMapping.with { - map('classifier') { - 'all' - } - } - - shadow.manifest.inheritFrom jarTask.manifest - shadow.configurations = [Utils.getRuntimeClasspathConfiguration(project)] - shadow.exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', - 'META-INF/*.RSA', 'module-info.class') - shadow.from(main.output) - shadow.from("src/config") - shadow.doFirst(addShadowConfigToClassPath()) - } - }) - } - - private String createImageJName(Jar jarTask, String replacement) { - // Rename omero-insight to omero_ij - String imageJName = jarTask.archiveBaseName.get().replace("insight", replacement) - return imageJName.replace("-", "_") - } - - private Action addShadowConfigToClassPath() { - return new Action() { - @Override - void execute(ShadowJar shadow) { - Configuration shadowConfig = - project.configurations.findByName(ShadowBasePlugin.CONFIGURATION_NAME) - - if (shadowConfig) { - if (shadowConfig.files) { - Jar jarTask = project.tasks.getByName(JavaPlugin.JAR_TASK_NAME) as Jar - def libs = [jarTask.manifest.attributes.get('Class-Path')] - libs.addAll shadowConfig.files.collect { "${it.name}" } - shadow.manifest.attributes['Class-Path'] = libs.findAll { it }.join(' ') - } - } - } - } - } - - private Action addManifest(String mainClass, String classPathDir = "") { - - return new Action() { - @Override - void execute(Jar jar) { - jar.manifest.attributes(createBasicManifest(mainClass, classPathDir)) - } - } - } - - private Map createBasicManifest(String mainClass, String classPathDir) { - return ["Implementation-Title" : project.name.replace("[^A-Za-z0-9]", ""), - "Implementation-Version": project.version, - "Built-Date" : new SimpleDateFormat("dd/MM/yyyy").format(new Date()), - "Built-JDK" : System.getProperty("java.version"), - "Built-Gradle" : project.gradle.gradleVersion, - "Main-Class" : mainClass, - "Class-Path" : Utils.createClassPath(project, classPathDir)] - } - -} diff --git a/buildSrc/src/main/groovy/org/openmicroscopy/InsightPlugin.groovy b/buildSrc/src/main/groovy/org/openmicroscopy/InsightPlugin.groovy deleted file mode 100644 index 0e2a6da65..000000000 --- a/buildSrc/src/main/groovy/org/openmicroscopy/InsightPlugin.groovy +++ /dev/null @@ -1,97 +0,0 @@ -/* - * ----------------------------------------------------------------------------- - * Copyright (C) 2019 University of Dundee & Open Microscopy Environment. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * ------------------------------------------------------------------------------ - */ -package org.openmicroscopy - -import groovy.transform.CompileStatic -import org.gradle.api.Action -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.plugins.ApplicationPlugin -import org.gradle.api.plugins.JavaApplication -import org.gradle.api.plugins.JavaPluginConvention -import org.gradle.api.tasks.JavaExec -import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.TaskProvider -import org.gradle.api.tasks.application.CreateStartScripts - -@CompileStatic -class InsightPlugin implements Plugin { - - public static final String GROUP_APPLICATION = ApplicationPlugin.APPLICATION_GROUP - - public static final String TASK_RUN_IMPORTER = "runImporter" - - public static final String MAIN_INSIGHT = "org.openmicroscopy.shoola.Main" - - private Project project - - @Override - void apply(Project project) { - this.project = project - - // We want these applied first - project.pluginManager.apply(InsightBasePlugin) - project.pluginManager.apply(ApplicationPlugin) - - // Configure importer tasks - addRunImporter() - - // Configure java tasks - configureApplicationPlugin() - } - - private TaskProvider addRunImporter() { - JavaPluginConvention javaPluginConvention = - project.convention.getPlugin(JavaPluginConvention) - - SourceSet main = - javaPluginConvention.sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME) - - project.tasks.register(TASK_RUN_IMPORTER, JavaExec, new Action() { - @Override - void execute(JavaExec run) { - run.setDescription("Runs this project as the OMERO.importer application") - run.setGroup(GROUP_APPLICATION) - run.setClasspath(main.runtimeClasspath) - run.setJvmArgs(InsightBasePlugin.DEFAULT_JVM_ARGS) - run.setArgs(["containerImporter.xml", String.valueOf(project.buildDir)]) - run.setMain(MAIN_INSIGHT) - } - }) - } - - private void configureApplicationPlugin() { - JavaApplication javaApplication = - project.extensions.getByName("application") as JavaApplication - - javaApplication.mainClassName = MAIN_INSIGHT - javaApplication.applicationDefaultJvmArgs = InsightBasePlugin.DEFAULT_JVM_ARGS - - project.tasks.named(ApplicationPlugin.TASK_RUN_NAME, JavaExec).configure { - it.setArgs(["container.xml", String.valueOf(project.buildDir)]) - } - - project.tasks.named(ApplicationPlugin.TASK_START_SCRIPTS_NAME, CreateStartScripts).configure { - Utils.configureStartScripts(it) - } - } - -} diff --git a/buildSrc/src/main/groovy/org/openmicroscopy/PackagerPlugin.groovy b/buildSrc/src/main/groovy/org/openmicroscopy/PackagerPlugin.groovy deleted file mode 100644 index 39df628d0..000000000 --- a/buildSrc/src/main/groovy/org/openmicroscopy/PackagerPlugin.groovy +++ /dev/null @@ -1,104 +0,0 @@ -/* - * ----------------------------------------------------------------------------- - * Copyright (C) 2019 University of Dundee & Open Microscopy Environment. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * ------------------------------------------------------------------------------ - */ -package org.openmicroscopy - -import groovy.transform.CompileStatic -import org.gradle.api.Action -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.Task -import org.gradle.api.plugins.JavaPlugin -import org.gradle.api.tasks.JavaExec -import org.gradle.api.tasks.Sync -import org.gradle.jvm.tasks.Jar -import org.openmicroscopy.extensions.InstallOptions -import org.openmicroscopy.extensions.InstallOptionsContainer -import org.openmicroscopy.extensions.implementation.WinOptions - -@CompileStatic -class PackagerPlugin implements Plugin { - - private Project project - - @Override - void apply(Project project) { - this.project = project - - project.pluginManager.apply(DistributePlugin) - project.pluginManager.apply(JavaPackagerPlugin) - - InstallOptionsContainer installOptionsContainer = - project.extensions.getByName("deploy") as InstallOptionsContainer - - // Configure main install options (insight) - InstallOptions main = installOptionsContainer.getByName(JavaPackagerPlugin.MAIN_DEPLOY_NAME) - main.icon = "${project.projectDir}/icons/omeroInsight" - main.arguments = ["container.xml"] - main.exe(winOptions) - main.msi(winOptions) - - createImporterInstaller(installOptionsContainer) - } - - private void createImporterInstaller(InstallOptionsContainer container) { - JavaExec exec = project.tasks.getByName(InsightPlugin.TASK_RUN_IMPORTER) as JavaExec - Jar jar = project.tasks.getByName(JavaPlugin.JAR_TASK_NAME) as Jar - Sync distTask = project.tasks.getByName( - "install${DistributePlugin.DISTRIBUTION_IMPORTER.capitalize()}Dist") as Sync - - // Create install option for importer - container.create("importer", new Action() { - @Override - void execute(InstallOptions importer) { - importer.icon = "${project.projectDir}/icons/omeroImporter.ico" - importer.arguments = ["containerImporter.xml"] - importer.mainClassName = exec.main - importer.javaOptions = exec.jvmArgs - importer.mainJar = jar.archiveFileName - importer.applicationVersion = jar.archiveVersion - importer.outputFile = "${project.buildDir}/packaged/${distTask.name}/${distTask.destinationDir.name}" - importer.applicationName = distTask.destinationDir.name - importer.sourceDir = distTask.destinationDir - importer.sourceFiles.from(project.fileTree(distTask.destinationDir).include("**/*.*")) - importer.exe(winOptions) - importer.msi(winOptions) - } - }) - - Platform.installerTypesAsString.each { String type -> - String name = JavaPackagerPlugin.makeTaskName("importer", type) - project.tasks.named(name).configure { Task task -> - task.dependsOn(distTask) - } - } - } - - static Action getWinOptions() { - return new Action() { - @Override - void execute(WinOptions opts) { - opts.startMenuGroup = "OMERO insight" - opts.registryVendor = "The OME team, University of Dundee" - } - } - } - -} diff --git a/buildSrc/src/main/groovy/org/openmicroscopy/PublishPlugin.groovy b/buildSrc/src/main/groovy/org/openmicroscopy/PublishPlugin.groovy deleted file mode 100644 index 7bda14567..000000000 --- a/buildSrc/src/main/groovy/org/openmicroscopy/PublishPlugin.groovy +++ /dev/null @@ -1,80 +0,0 @@ -/* - * ----------------------------------------------------------------------------- - * Copyright (C) 2019 University of Dundee & Open Microscopy Environment. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * ------------------------------------------------------------------------------ - */ -package org.openmicroscopy - -import groovy.transform.CompileStatic -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.XmlProvider -import org.gradle.api.artifacts.repositories.ArtifactRepository -import org.gradle.api.artifacts.repositories.MavenArtifactRepository -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.maven.MavenPom -import org.gradle.api.publish.maven.MavenPomLicenseSpec -import org.gradle.api.publish.maven.MavenPublication -import org.gradle.api.publish.maven.plugins.MavenPublishPlugin - -@CompileStatic -class PublishPlugin implements Plugin { - - private Project project - - @Override - void apply(Project project) { - this.project = project - project.pluginManager.apply(MavenPublishPlugin) - project.pluginManager.apply(InsightBasePlugin) - - addPublishImageJJar() - } - - private void addPublishImageJJar() { - PublishingExtension publishing = - project.extensions.getByName(PublishingExtension.NAME) as PublishingExtension - - publishing.publications.create("imageJPlugin", MavenPublication) { MavenPublication pub -> - pub.artifact(project.tasks.getByName(InsightBasePlugin.TASK_OMERO_IMAGEJ_JAR)) - pub.setArtifactId("omero-imagej") - pub.pom { MavenPom p -> - p.licenses { MavenPomLicenseSpec spec -> - spec.license { - it.name.set("GNU General Public License, Version 2") - it.url.set("https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html") - it.distribution.set("repo") - it.comments.set("An omero plugin for ImageJ") - } - } - p.withXml { XmlProvider xp -> - Node repositoriesNode = xp.asNode().appendNode("repositories") - project.repositories.each { ArtifactRepository repo -> - if (repo instanceof MavenArtifactRepository) { - Node repositoryNode = repositoriesNode.appendNode("repository") - repositoryNode.appendNode("id", repo.name) - repositoryNode.appendNode("name", repo.name) - repositoryNode.appendNode("url", repo.url) - } - } - } - } - } - } - -} diff --git a/buildSrc/src/main/groovy/org/openmicroscopy/Utils.groovy b/buildSrc/src/main/groovy/org/openmicroscopy/Utils.groovy deleted file mode 100644 index 32417fb6f..000000000 --- a/buildSrc/src/main/groovy/org/openmicroscopy/Utils.groovy +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ----------------------------------------------------------------------------- - * Copyright (C) 2019 University of Dundee & Open Microscopy Environment. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * ------------------------------------------------------------------------------ - */ -package org.openmicroscopy - -import groovy.transform.CompileStatic -import org.gradle.api.Project -import org.gradle.api.artifacts.Configuration -import org.gradle.api.plugins.JavaPlugin -import org.gradle.api.tasks.application.CreateStartScripts - -import java.nio.file.Paths - -@CompileStatic -class Utils { - - static Configuration getRuntimeClasspathConfiguration(Project project) { - project.configurations.findByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME) - } - - static String createClassPath(Project project, String libsDir) { - getRuntimeClasspathConfiguration(project).collect { Paths.get(libsDir, it.name) }.join(" ") - } - - /** - * Adds default start script settings applicable to insight and derivative distributions. - * @param css CreateStartScripts to configure - */ - static void configureStartScripts(CreateStartScripts css) { - css.defaultJvmOpts += ["-Duser.dir=MY_APP_HOME/"] - css.doLast { CreateStartScripts last -> - last.unixScript.text = last.unixScript.text.replace("MY_APP_HOME", "\$APP_HOME") - last.windowsScript.text = last.windowsScript.text.replace("MY_APP_HOME", "%~dp0..") - // Fix for https://github.com/gradle/gradle/issues/1989 - last.windowsScript.text = last.windowsScript.text.replaceAll('set CLASSPATH=.*', 'set CLASSPATH=.;%APP_HOME%/lib/*') - } - } -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c02..61285a659 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index da9702f9e..37f78a6af 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0c8..adff685a0 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,81 +15,114 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,88 +131,118 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 107acd32c..e509b2dd8 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,93 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle index 5fb4f3b5d..53d38e029 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,7 +2,7 @@ pluginManagement { repositories { mavenLocal() mavenCentral() - maven { url 'https://artifacts.openmicroscopy.org/artifactory/maven/' } + maven { url = 'https://artifacts.openmicroscopy.org/artifactory/maven/' } } } diff --git a/src/config/about.xml b/src/dist/config/about.xml similarity index 100% rename from src/config/about.xml rename to src/dist/config/about.xml diff --git a/src/config/container.xml b/src/dist/config/container.xml similarity index 100% rename from src/config/container.xml rename to src/dist/config/container.xml diff --git a/src/config/containerImporter.xml b/src/dist/config/containerImporter.xml similarity index 100% rename from src/config/containerImporter.xml rename to src/dist/config/containerImporter.xml diff --git a/src/config/dataBrowser.xml b/src/dist/config/dataBrowser.xml similarity index 100% rename from src/config/dataBrowser.xml rename to src/dist/config/dataBrowser.xml diff --git a/src/config/importer.xml b/src/dist/config/importer.xml similarity index 100% rename from src/config/importer.xml rename to src/dist/config/importer.xml diff --git a/src/config/imviewer.xml b/src/dist/config/imviewer.xml similarity index 100% rename from src/config/imviewer.xml rename to src/dist/config/imviewer.xml diff --git a/src/config/logback-spring.xml b/src/dist/config/logback-spring.xml similarity index 100% rename from src/config/logback-spring.xml rename to src/dist/config/logback-spring.xml diff --git a/src/config/mdeConfiguration.xml b/src/dist/config/mdeConfiguration.xml similarity index 100% rename from src/config/mdeConfiguration.xml rename to src/dist/config/mdeConfiguration.xml diff --git a/src/config/measurement.xml b/src/dist/config/measurement.xml similarity index 100% rename from src/config/measurement.xml rename to src/dist/config/measurement.xml diff --git a/src/config/metadataViewer.xml b/src/dist/config/metadataViewer.xml similarity index 100% rename from src/config/metadataViewer.xml rename to src/dist/config/metadataViewer.xml diff --git a/src/config/treeviewer.xml b/src/dist/config/treeviewer.xml similarity index 100% rename from src/config/treeviewer.xml rename to src/dist/config/treeviewer.xml diff --git a/icons/omeroImporter.icns b/src/main/resources/icons/omeroImporter.icns similarity index 100% rename from icons/omeroImporter.icns rename to src/main/resources/icons/omeroImporter.icns diff --git a/icons/omeroImporter.ico b/src/main/resources/icons/omeroImporter.ico similarity index 100% rename from icons/omeroImporter.ico rename to src/main/resources/icons/omeroImporter.ico diff --git a/icons/omeroInsight.icns b/src/main/resources/icons/omeroInsight.icns similarity index 100% rename from icons/omeroInsight.icns rename to src/main/resources/icons/omeroInsight.icns diff --git a/icons/omeroInsight.ico b/src/main/resources/icons/omeroInsight.ico similarity index 100% rename from icons/omeroInsight.ico rename to src/main/resources/icons/omeroInsight.ico