You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2023/10/07 00:44:02 UTC

[sis] branch main updated (2596723a0b -> 27a4ac4fed)

This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/sis.git


    from 2596723a0b Merge branch 'geoapi-3.1'
     new a2820288ee Modify the structure of the binary bundle for avoiding to have undesired applications on the module-path.
     new 6008e5e18d Merge branch 'geoapi-4.0' into geoapi-3.1
     new 27a4ac4fed Merge branch 'geoapi-3.1'

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/sis/buildtools/gradle/Assembler.java    | 74 ++++++++++++++++------
 .../org.apache.sis.storage/main/module-info.java   |  1 +
 optional/src/org.apache.sis.gui/bundle/bin/sis     |  3 +-
 optional/src/org.apache.sis.gui/bundle/bin/sis.bat |  3 +-
 optional/src/org.apache.sis.gui/bundle/bin/sisfx   |  2 +-
 .../src/org.apache.sis.gui/bundle/bin/sisfx.bat    |  2 +-
 optional/src/org.apache.sis.gui/bundle/lib/README  | 10 ++-
 .../src/org.apache.sis.gui/bundle/lib/app/README   |  2 +
 8 files changed, 70 insertions(+), 27 deletions(-)
 create mode 100644 optional/src/org.apache.sis.gui/bundle/lib/app/README


[sis] 01/03: Modify the structure of the binary bundle for avoiding to have undesired applications on the module-path.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sis.git

commit a2820288eeda7922d479b6529c1c7fc4bd9d2baa
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Oct 6 20:47:43 2023 +0200

    Modify the structure of the binary bundle for avoiding to have undesired applications on the module-path.
---
 .../apache/sis/buildtools/gradle/Assembler.java    | 74 ++++++++++++++++------
 .../org.apache.sis.storage/main/module-info.java   |  1 +
 optional/src/org.apache.sis.gui/bundle/bin/sis     |  3 +-
 optional/src/org.apache.sis.gui/bundle/bin/sis.bat |  3 +-
 optional/src/org.apache.sis.gui/bundle/bin/sisfx   |  2 +-
 .../src/org.apache.sis.gui/bundle/bin/sisfx.bat    |  2 +-
 optional/src/org.apache.sis.gui/bundle/lib/README  | 10 ++-
 .../src/org.apache.sis.gui/bundle/lib/app/README   |  2 +
 8 files changed, 70 insertions(+), 27 deletions(-)

diff --git a/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/Assembler.java b/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/Assembler.java
index 70966519fb..55f5f2af8f 100644
--- a/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/Assembler.java
+++ b/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/Assembler.java
@@ -16,8 +16,9 @@
  */
 package org.apache.sis.buildtools.gradle;
 
+import java.util.Set;
 import java.io.File;
-import java.io.FilenameFilter;
+import java.io.FileFilter;
 import java.io.FileNotFoundException;
 import java.io.UncheckedIOException;
 import java.io.IOException;
@@ -35,13 +36,13 @@ import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
  *   <li>the content of the <code>endorsed/build/libs</code> and <code>optional/build/libs</code> directories.</li>
  * </ul>
  *
- * Assemblies are created only for module having an {@code bundle} sub-directory.
- * The module is hard-coded for now (a future version could perform a search if desired).
+ * Assemblies are created only for the module having a {@code bundle} sub-directory in source code.
+ * That module is hard-coded for now (a future version could perform a search if desired).
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Quentin Bialota (Geomatys)
  */
-final class Assembler extends ZipWriter.Apache implements FilenameFilter {
+final class Assembler extends ZipWriter.Apache implements FileFilter {
     /**
      * The module on which to apply this task.
      */
@@ -54,6 +55,40 @@ final class Assembler extends ZipWriter.Apache implements FilenameFilter {
      */
     private static final String LIB_DIRECTORY = "lib/";
 
+    /**
+     * Subdirectory of {@link #LIB_DIRECTORY} where to put applications.
+     * We keep them in a separated directory because we need to put only
+     * one of them in the module-path.
+     */
+    private static final String APP_DIRECTORY = "app/";
+
+    /**
+     * Modules to put in the {@link #APP_DIRECTORY} directory.
+     */
+    private static final Set<String> APPLICATIONS = Set.of(MODULE, "org.apache.sis.console");
+
+    /**
+     * Modules to exclude from the {@link #LIB_DIRECTORY}, not counting applications.
+     */
+    private static final Set<String> EXCLUDES = Set.of(
+            "org.apache.sis.profile.japan",             // For avoiding UCAR dependencies.
+            "org.apache.sis.cloud.aws");                // For avoiding UCAR dependencies.
+
+    /**
+     * Suffix of JAR files. This is the part to remove from filenames for getting the module names.
+     */
+    private static final String JAR_SUFFIX = ".jar";
+
+    /**
+     * Whether this task is in the process of copying the application JAR files.
+     */
+    private boolean isCopyingApplication;
+
+    /**
+     * Whether the copy operation shall include dependencies.
+     */
+    private boolean includeDependencies;
+
     /**
      * Creates an helper object for creating the assembly.
      *
@@ -78,10 +113,14 @@ final class Assembler extends ZipWriter.Apache implements FilenameFilter {
             String filename = FINALNAME_PREFIX + project.getVersion();
             target = new File(target, filename + ".zip");
             filename += '/';
+            final String libDir = filename + LIB_DIRECTORY;
             try (ZipArchiveOutputStream out = new ZipArchiveOutputStream(target)) {
                 final var c = new Assembler(project, out);
                 c.writeDirectory(sourceDirectory, null, filename);
-                c.copyCompiledJARs(filename + LIB_DIRECTORY);
+                c.isCopyingApplication = false;
+                c.copyCompiledJARs(libDir);
+                c.isCopyingApplication = true;
+                c.copyCompiledJARs(libDir + APP_DIRECTORY);
             }
         } catch (IOException e) {
             throw new UncheckedIOException(e);
@@ -95,7 +134,9 @@ final class Assembler extends ZipWriter.Apache implements FilenameFilter {
      * @throws IOException if an error occurred while copying a file.
      */
     private void copyCompiledJARs(final String libDir) throws IOException {
-        writeDirectory(fileRelativeToBuild(LIBS_DIRECTORY), null, libDir);
+        includeDependencies = true;
+        writeDirectory(fileRelativeToBuild(LIBS_DIRECTORY), this, libDir);
+        includeDependencies = false;
         final File endorsed = new File(new File(new File(project.getRootDir(), ENDORSED_SUBPROJECT), BUILD_DIRECTORY), LIBS_DIRECTORY);
         final File[] deps = endorsed.listFiles(this);
         if (deps == null) {
@@ -109,21 +150,18 @@ final class Assembler extends ZipWriter.Apache implements FilenameFilter {
     /**
      * Whether to include the given file in the ZIP file.
      *
-     * @param  dir   directory of the file.
-     * @param  name  name of the file.
+     * @param  path  the file or directory to test.
      * @return whether to include the file.
      */
     @Override
-    public boolean accept(final File dir, final String name) {
-        if (!name.endsWith(".jar")) {
-            return false;
-        }
-        if (name.startsWith("org.apache.sis.cloud.aws")) {
-            return false;       // Excluded for avoiding AWS dependencies.
-        }
-        if (name.startsWith("org.apache.sis.profile.japan")) {
-            return false;       // Excluded for avoiding UCAR dependencies.
+    public boolean accept(final File path) {
+        String name = path.getName();
+        if (name.endsWith(JAR_SUFFIX) && (includeDependencies || name.startsWith("org.apache.sis."))) {
+            name = name.substring(0, name.length() - JAR_SUFFIX.length());
+            if (!EXCLUDES.contains(name)) {
+                return APPLICATIONS.contains(name) == isCopyingApplication;
+            }
         }
-        return name.startsWith("org.apache.sis.");
+        return false;
     }
 }
diff --git a/endorsed/src/org.apache.sis.storage/main/module-info.java b/endorsed/src/org.apache.sis.storage/main/module-info.java
index ecfc4329a5..cc057573be 100644
--- a/endorsed/src/org.apache.sis.storage/main/module-info.java
+++ b/endorsed/src/org.apache.sis.storage/main/module-info.java
@@ -53,6 +53,7 @@ module org.apache.sis.storage {
             org.apache.sis.storage.netcdf,
             org.apache.sis.storage.geotiff,
             org.apache.sis.storage.earthobservation,
+            org.apache.sis.util,                        // For the "About" command.
             org.apache.sis.console,
             org.apache.sis.openoffice,
             org.apache.sis.gui;                         // In the "optional" sub-project.
diff --git a/optional/src/org.apache.sis.gui/bundle/bin/sis b/optional/src/org.apache.sis.gui/bundle/bin/sis
index 9e5dcc44fd..3843ebf533 100755
--- a/optional/src/org.apache.sis.gui/bundle/bin/sis
+++ b/optional/src/org.apache.sis.gui/bundle/bin/sis
@@ -23,8 +23,7 @@ SIS_DATA="${SIS_DATA:-$BASE_DIR/data}"
 export SIS_DATA
 
 # Execute SIS with any optional JAR that the user may put in the 'lib' directory.
-java --module-path "$BASE_DIR/lib" \
-     --limit-modules org.apache.sis.console \
+java --module-path "$BASE_DIR/lib:$BASE_DIR/lib/app/org.apache.sis.console.jar" \
      -Djava.util.logging.config.class="org.apache.sis.util.logging.Initializer" \
      -Djava.util.logging.config.file="$BASE_DIR/conf/logging.properties" \
      -Dderby.stream.error.file="$BASE_DIR/log/derby.log" \
diff --git a/optional/src/org.apache.sis.gui/bundle/bin/sis.bat b/optional/src/org.apache.sis.gui/bundle/bin/sis.bat
index 07694b82a4..2e8bb0af9e 100644
--- a/optional/src/org.apache.sis.gui/bundle/bin/sis.bat
+++ b/optional/src/org.apache.sis.gui/bundle/bin/sis.bat
@@ -20,8 +20,7 @@ SET BASE_DIR=%~dp0\..
 SET SIS_DATA=%BASE_DIR%\data
 
 REM Execute SIS with any optional JAR that the user may put in the 'lib' directory.
-java --module-path "%BASE_DIR%\lib"^
-     --limit-modules org.apache.sis.console^
+java --module-path "%BASE_DIR%\lib;%BASE_DIR%\lib\app\org.apache.sis.console.jar"^
      -Djava.util.logging.config.class=org.apache.sis.util.logging.Initializer^
      -Djava.util.logging.config.file="%BASE_DIR%\conf\logging.properties"^
      -Dderby.stream.error.file="%BASE_DIR%\log\derby.log"^
diff --git a/optional/src/org.apache.sis.gui/bundle/bin/sisfx b/optional/src/org.apache.sis.gui/bundle/bin/sisfx
index 6729e5f211..8286d0505c 100755
--- a/optional/src/org.apache.sis.gui/bundle/bin/sisfx
+++ b/optional/src/org.apache.sis.gui/bundle/bin/sisfx
@@ -36,7 +36,7 @@ fi
 
 # Execute SIS with any optional JAR that the user may put in the `lib` directory.
 java -splash:"$BASE_DIR/lib/logo.jpg" \
-     --module-path "$PATH_TO_FX:$BASE_DIR/lib" \
+     --module-path "$PATH_TO_FX:$BASE_DIR/lib:$BASE_DIR/lib/app/org.apache.sis.gui.jar" \
      -Djava.util.logging.config.class="org.apache.sis.util.logging.Initializer" \
      -Djava.util.logging.config.file="$BASE_DIR/conf/logging.properties" \
      -Dderby.stream.error.file="$BASE_DIR/log/derby.log" \
diff --git a/optional/src/org.apache.sis.gui/bundle/bin/sisfx.bat b/optional/src/org.apache.sis.gui/bundle/bin/sisfx.bat
index 999bc5ed4a..5dc74c24e2 100644
--- a/optional/src/org.apache.sis.gui/bundle/bin/sisfx.bat
+++ b/optional/src/org.apache.sis.gui/bundle/bin/sisfx.bat
@@ -27,7 +27,7 @@ IF "%PATH_TO_FX%"=="" (
 )
 
 java -splash:"%BASE_DIR%\lib\logo.jpg"^
- --module-path "%PATH_TO_FX%;%BASE_DIR%\lib"^
+ --module-path "%PATH_TO_FX%;%BASE_DIR%\lib;%BASE_DIR%\lib\app\org.apache.sis.gui.jar"^
  -Djava.util.logging.config.class=org.apache.sis.util.logging.Initializer^
  -Djava.util.logging.config.file="%BASE_DIR%\conf\logging.properties"^
  -Dderby.stream.error.file="%BASE_DIR%\log\derby.log"^
diff --git a/optional/src/org.apache.sis.gui/bundle/lib/README b/optional/src/org.apache.sis.gui/bundle/lib/README
index 06f10db15d..5eec4daeb4 100644
--- a/optional/src/org.apache.sis.gui/bundle/lib/README
+++ b/optional/src/org.apache.sis.gui/bundle/lib/README
@@ -1,9 +1,13 @@
-This directory contains Apache SIS files together with dependencies.
-Some optional dependencies need to be added by users if desired.
+This directory contains Apache SIS modules
+together with the following dependencies:
 
-  - Derby database
   - JAXB API
   - JAXB implementation  (optional)
+  - Derby database       (optional)
+
+The following dependencies are not included
+but will be used if they are added by users:
+
   - UCAR netCDF library  (optional)
   - ESRI Geometry API    (optional)
   - Java Topology Suite  (optional)
diff --git a/optional/src/org.apache.sis.gui/bundle/lib/app/README b/optional/src/org.apache.sis.gui/bundle/lib/app/README
new file mode 100644
index 0000000000..6cadd3b881
--- /dev/null
+++ b/optional/src/org.apache.sis.gui/bundle/lib/app/README
@@ -0,0 +1,2 @@
+This directory contains Apache SIS modules for interactive applications.
+They should generally not be on the module-path for other applications.


[sis] 02/03: Merge branch 'geoapi-4.0' into geoapi-3.1

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 6008e5e18d484c93b2ee7b32a79aa23a4fca3719
Merge: d4fc457a24 a2820288ee
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Oct 6 20:49:00 2023 +0200

    Merge branch 'geoapi-4.0' into geoapi-3.1

 .../apache/sis/buildtools/gradle/Assembler.java    | 74 ++++++++++++++++------
 .../org.apache.sis.storage/main/module-info.java   |  1 +
 optional/src/org.apache.sis.gui/bundle/bin/sis     |  3 +-
 optional/src/org.apache.sis.gui/bundle/bin/sis.bat |  3 +-
 optional/src/org.apache.sis.gui/bundle/bin/sisfx   |  2 +-
 .../src/org.apache.sis.gui/bundle/bin/sisfx.bat    |  2 +-
 optional/src/org.apache.sis.gui/bundle/lib/README  | 10 ++-
 .../src/org.apache.sis.gui/bundle/lib/app/README   |  2 +
 8 files changed, 70 insertions(+), 27 deletions(-)


[sis] 03/03: Merge branch 'geoapi-3.1'

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 27a4ac4fede2909b96eee4e6973d6beaac8a179f
Merge: 2596723a0b 6008e5e18d
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Oct 6 20:50:51 2023 +0200

    Merge branch 'geoapi-3.1'

 .../apache/sis/buildtools/gradle/Assembler.java    | 74 ++++++++++++++++------
 .../org.apache.sis.storage/main/module-info.java   |  1 +
 optional/src/org.apache.sis.gui/bundle/bin/sis     |  3 +-
 optional/src/org.apache.sis.gui/bundle/bin/sis.bat |  3 +-
 optional/src/org.apache.sis.gui/bundle/bin/sisfx   |  2 +-
 .../src/org.apache.sis.gui/bundle/bin/sisfx.bat    |  2 +-
 optional/src/org.apache.sis.gui/bundle/lib/README  | 10 ++-
 .../src/org.apache.sis.gui/bundle/lib/app/README   |  2 +
 8 files changed, 70 insertions(+), 27 deletions(-)