janhoy commented on a change in pull request #372:
URL: https://github.com/apache/lucene/pull/372#discussion_r727608870



##########
File path: lucene/distribution/binary-release.gradle
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+// Configure Lucene's binary release. This is a bit convoluted so is placed
+// in a separate script.
+
+configure(project(":lucene:distribution")) {
+  def packageBaseName = "${buildDir}/packages/lucene-${version}"
+
+  // All the maven-published projects are part of the binary distribution.
+  def includeInBinaries = rootProject.ext.mavenProjects
+
+  // Legacy binary distribution contains Lucene artifacts (JARs) and their 
dependencies
+  // under 'lib/'. We have to go through some hoops to split the artifact from 
all of its
+  // transitive dependencies and separate their output location.
+  def moduleArtifactConfigurations = []
+  for (Project module : includeInBinaries) {
+    def binaryArtifactsConfiguration = 
configurations.create("binary-artifacts" + module.path.replace(':', '-'))
+
+    dependencies { DependencyHandler handler ->
+      handler.add(binaryArtifactsConfiguration.name, project(path: 
module.path, configuration: "binaryArtifacts"))
+    }
+
+    moduleArtifactConfigurations += [
+        "module": module,
+        "binaryArtifactsConfiguration": binaryArtifactsConfiguration
+    ]
+  }
+
+
+  // Prepare site documentation dependency for inclusion.
+  configurations {
+    docs
+  }
+
+  dependencies {
+    docs project(path: ':lucene:documentation', configuration: 'site')
+  }
+
+
+  // Distribution package (zip/tgz) content is the same so use the same 
closure to configure both tasks.
+  Closure<Void> distributionContent = { AbstractCopyTask task ->
+    // Manually correct posix permissions (matters when assembling archives on 
Windows).
+    filesMatching(["**/*.sh", "**/*.bat"]) { copy ->
+      copy.setMode(0755)
+    }
+
+    // Cherry-picked root-level files.
+    from(project(':lucene').projectDir, {
+      include "CHANGES.txt"
+      include "JRE_VERSION_MIGRATION.md"
+      include "LICENSE.txt"
+      include "MIGRATE.md"
+      include "NOTICE.txt"
+      include "README.md"
+      include "SYSTEM_REQUIREMENTS.md"
+
+      include "licenses/*"
+    })
+
+    // Analysis container is not a submodule but include its readme file.
+    from(project(':lucene:analysis').projectDir) {
+      include "README.txt"
+      into 'analysis'
+    }
+
+    // The documentation.
+    from(configurations.docs, {
+      into 'docs'
+    })
+
+    // Each module's binary artifacts and their dependencies.
+    moduleArtifactConfigurations.each {
+      def toPath = it.module.path.replaceFirst("^:lucene:", "").replace(':', 
'/')
+
+      task.from(it.binaryArtifactsConfiguration, {
+        into toPath
+      })
+    }
+  }
+
+  // Assemble distribution archives
+  task assembleBinaryZip(type: Zip) {
+    description "Assemble binary Lucene artifact as a .zip file."
+
+    archiveFileName = packageBaseName + ".zip"
+    destinationDirectory = file(archiveFileName).parentFile
+
+    metadataCharset = "UTF-8"
+    reproducibleFileOrder = true
+  }
+
+  task assembleBinaryTgz(type: Tar) {
+    description "Assemble binary Lucene artifact as a .tgz file."
+
+    archiveFileName = packageBaseName + ".tgz"
+    destinationDirectory = file(archiveFileName).parentFile
+
+    reproducibleFileOrder = true
+    compression = Compression.GZIP
+  }

Review comment:
       After building the artifacts, the `.tgz` and `.zip` archives lacks the 
topmost `lucene-9.0.0` folder
   ```
   $ tar -tvzf lucene-9.0.0.tgz
   -rw-r--r--  0 0      0      799304 Oct 13 00:26 CHANGES.txt
   -rw-r--r--  0 0      0        2518 Sep 30 15:55 JRE_VERSION_MIGRATION.md
   ...
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to