LUCENE-10192: Flatten the modules into a single jar folder to allow --module-path to be used. So much simpler.'

This commit is contained in:
Dawid Weiss 2021-10-23 22:32:17 +02:00
parent bcdfc4c8c9
commit fda47a24f8
3 changed files with 23 additions and 87 deletions

View File

@ -1,56 +0,0 @@
/*
* 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 binary distribution content defaults for each subproject.
configure(rootProject.ext.mavenProjects) {
plugins.withType(JavaPlugin) {
ext {
binaryArtifactsDir = file("${buildDir}/binaryArtifacts")
}
configurations {
// All of the module's "binary" artifacts that should go to the binary release.
binaryArtifacts
}
task assembleBinaryArtifacts(type: Sync) {
from(tasks.findByName("jar"))
from(projectDir, {
include "README.*"
})
into binaryArtifactsDir
}
artifacts {
binaryArtifacts binaryArtifactsDir, {
builtBy assembleBinaryArtifacts
}
}
}
}
// Add launch scripts for Luke.
configure(project(":lucene:luke")) {
tasks.matching { it.name == "assembleBinaryArtifacts" }.all {
from("${projectDir}/bin", {
})
}
}

View File

@ -22,33 +22,30 @@
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
// Create a separate configuration for each module that ends up in the binary
// because we want them in different output locations (prefixed with module name).
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
jars
}
dependencies {
dependencies { DependencyHandler handler ->
docs project(path: ':lucene:documentation', configuration: 'site')
// Maven-published submodule JARs are part of the binary distribution
// (with a few exceptions explicitly filtered below).
// We don't copy their transitive dependencies.
def binaryModules = rootProject.ext.mavenProjects.findAll { p -> !(p in [
// Will end up in a separate binary?
project(":lucene:luke"),
// NOCOMMIT: Currently breaks the module system so excluded for now.
project(":lucene:test-framework"),
]) }
for (Project module : binaryModules) {
jars(project(path: module.path), {
transitive = false
})
}
}
@ -91,14 +88,10 @@ configure(project(":lucene:distribution")) {
into 'docs'
})
// Each module's binary artifacts and their dependencies.
moduleArtifactConfigurations.each {
def toPath = it.module.path.replaceFirst("^:lucene:", "").replace(':', '/')
from(it.binaryArtifactsConfiguration, {
into toPath
// Binary artifacts from modules.
from(configurations.jars, {
into 'jars'
})
}
// Internal archive folder for all files.
into "lucene-${rootProject.version}/"

View File

@ -37,7 +37,6 @@ ext {
apply from: buildscript.sourceFile.toPath().resolveSibling("source-release.gradle")
// Prepare the "binary" distribution artifact.
apply from: buildscript.sourceFile.toPath().resolveSibling("binary-artifacts.gradle")
apply from: buildscript.sourceFile.toPath().resolveSibling("binary-release.gradle")
// Configure maven artifact collection to a local build folder (required to collect artifacts for the release).