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

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

commit fff3ae5e862ecb1696561cab9ffa0da133537de8
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Fri Sep 15 15:25:06 2023 +0200

    Define Maven repositories for snapshots and release deployments.
---
 .../org/apache/sis/buildtools/gradle/BuildHelper.java   |  1 +
 .../org/apache/sis/buildtools/gradle/ModularJAR.java    | 11 ++++++++++-
 endorsed/build.gradle.kts                               | 17 +++++++++++++++++
 incubator/build.gradle.kts                              | 17 +++++++++++++++++
 optional/build.gradle.kts                               | 17 +++++++++++++++++
 settings.gradle.kts                                     |  1 +
 6 files changed, 63 insertions(+), 1 deletion(-)

diff --git 
a/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/BuildHelper.java
 
b/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/BuildHelper.java
index c17df41d9e..5b357d8ca9 100644
--- 
a/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/BuildHelper.java
+++ 
b/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/BuildHelper.java
@@ -165,6 +165,7 @@ public final class BuildHelper implements Plugin<Project> {
             task.setActions(List.of((t) -> {            // Replace the default 
action by our own.
                 ModularJAR.execute(BuildHelper.this, (Jar) t);
             }));
+            task.getOutputs().dir(ModularJAR.output(task.getProject()));
         });
         final Task assemble = tasks.getByPath("assemble");
         assemble.dependsOn("jar");
diff --git 
a/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/ModularJAR.java
 
b/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/ModularJAR.java
index d551997e0b..64fb2f8e53 100644
--- 
a/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/ModularJAR.java
+++ 
b/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/ModularJAR.java
@@ -70,6 +70,15 @@ final class ModularJAR extends ZipWriter.JDK {
         super(project, out);
     }
 
+    /**
+     * {@return the output directory where JAR files will be written}.
+     *
+     * @param  project  the sub-project being compiled.
+     */
+    static final File output(final Project project) {
+        return new File(project.getBuildDir(), LIBS_DIRECTORY);
+    }
+
     /**
      * Lists all compiled modules in the current Gradle sub-project.
      *
@@ -97,7 +106,7 @@ final class ModularJAR extends ZipWriter.JDK {
                 classnameAttributes.put(classname, path);
             }
         }
-        final File target = new File(project.getBuildDir(), LIBS_DIRECTORY);
+        final File target = output(project);
         for (final File module : listModules(project)) {
             for (final Iterator<Map.Entry<String,String>> it = 
classnameAttributes.entrySet().iterator(); it.hasNext();) {
                 final Map.Entry<String,String> entry = it.next();
diff --git a/endorsed/build.gradle.kts b/endorsed/build.gradle.kts
index d2399933a3..293b169713 100644
--- a/endorsed/build.gradle.kts
+++ b/endorsed/build.gradle.kts
@@ -392,4 +392,21 @@ publishing {
             }
         }
     }
+    /* Following block is currently repeated in all sub-projects. */
+    repositories {
+        maven {
+            name = "Apache"
+            url = uri(if (version.toString().endsWith("SNAPSHOT"))
+                      
"https://repository.apache.org/content/repositories/snapshots"; else
+                      
"https://repository.apache.org/service/local/staging/deploy/maven2";)
+            credentials {
+                val asfNexusUsername = System.getProperty("asfNexusUsername")
+                val asfNexusPassword = System.getProperty("asfNexusPassword")
+                if (asfNexusUsername != null && asfNexusPassword != null) {
+                    username = asfNexusUsername
+                    password = asfNexusPassword
+                }
+            }
+        }
+    }
 }
diff --git a/incubator/build.gradle.kts b/incubator/build.gradle.kts
index 797f762d10..7d1b756819 100644
--- a/incubator/build.gradle.kts
+++ b/incubator/build.gradle.kts
@@ -129,4 +129,21 @@ publishing {
             }
         }
     }
+    /* Following block is currently repeated in all sub-projects. */
+    repositories {
+        maven {
+            name = "Apache"
+            url = uri(if (version.toString().endsWith("SNAPSHOT"))
+                      
"https://repository.apache.org/content/repositories/snapshots"; else
+                      
"https://repository.apache.org/service/local/staging/deploy/maven2";)
+            credentials {
+                val asfNexusUsername = System.getProperty("asfNexusUsername")
+                val asfNexusPassword = System.getProperty("asfNexusPassword")
+                if (asfNexusUsername != null && asfNexusPassword != null) {
+                    username = asfNexusUsername
+                    password = asfNexusPassword
+                }
+            }
+        }
+    }
 }
diff --git a/optional/build.gradle.kts b/optional/build.gradle.kts
index eddd8473fa..599a179eef 100644
--- a/optional/build.gradle.kts
+++ b/optional/build.gradle.kts
@@ -165,4 +165,21 @@ publishing {
             }
         }
     }
+    /* Following block is currently repeated in all sub-projects. */
+    repositories {
+        maven {
+            name = "Apache"
+            url = uri(if (version.toString().endsWith("SNAPSHOT"))
+                      
"https://repository.apache.org/content/repositories/snapshots"; else
+                      
"https://repository.apache.org/service/local/staging/deploy/maven2";)
+            credentials {
+                val asfNexusUsername = System.getProperty("asfNexusUsername")
+                val asfNexusPassword = System.getProperty("asfNexusPassword")
+                if (asfNexusUsername != null && asfNexusPassword != null) {
+                    username = asfNexusUsername
+                    password = asfNexusPassword
+                }
+            }
+        }
+    }
 }
diff --git a/settings.gradle.kts b/settings.gradle.kts
index f0522902d4..a007dae0a1 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -39,6 +39,7 @@ dependencyResolutionManagement {
     repositories {
         mavenCentral()
         maven {
+            name = "UCAR"
             url = 
uri("https://artifacts.unidata.ucar.edu/repository/unidata-releases";)
             content {
                 includeGroup("edu.ucar")        // Restrict usage to those 
dependencies.

Reply via email to