This is an automated email from the ASF dual-hosted git repository. dsmiley pushed a commit to branch branch_9x in repository https://gitbox.apache.org/repos/asf/solr.git
commit f1c54ac6cb1eeb3dc2f63a66289941c99614f685 Author: David Smiley <[email protected]> AuthorDate: Thu Jul 2 12:13:48 2026 -0400 build: fetch BATS test libs via HTTP instead of npm/node (#4587) motivation: architecturally simpler even though more lines. And removed unused gradle plugin "undercouch.download" (cherry picked from commit 3bd2ede5d1f5aec32d034760f7e58de0fb430ad2) (cherry picked from commit 19321739bc1372735f0e9ff1d2a120251b986613) --- build.gradle | 1 - gradle/node.gradle | 2 +- solr/packaging/build.gradle | 46 +++++++++++++++++++++++++++++++++------------ 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index f4503d6b5d5..2f2d7916020 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,6 @@ plugins { id 'org.owasp.dependencycheck' version '12.2.2' id 'ca.cutterslade.analyze' version '1.10.0' id 'de.thetaphi.forbiddenapis' version '3.10' apply false - id 'de.undercouch.download' version '5.7.0' apply false id 'net.ltgt.errorprone' version '5.1.0' apply false id 'com.diffplug.spotless' version '7.2.1' apply false id 'com.github.node-gradle.node' version '7.1.0' apply false diff --git a/gradle/node.gradle b/gradle/node.gradle index 81bb68e9c7c..489497e7d14 100644 --- a/gradle/node.gradle +++ b/gradle/node.gradle @@ -15,7 +15,7 @@ * limitations under the License. */ -configure([project(":solr:packaging"), project(":solr:solr-ref-guide"), project(":solr:webapp")]) { +configure([project(":solr:solr-ref-guide"), project(":solr:webapp")]) { apply plugin: "com.github.node-gradle.node" def npmRegistry = "${ -> propertyOrEnvOrDefault("solr.npm.registry", "SOLR_NPM_REGISTRY", '') }" diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradle index ad3d6501c0e..d37c2a8efcb 100644 --- a/solr/packaging/build.gradle +++ b/solr/packaging/build.gradle @@ -32,6 +32,7 @@ ext { slimDistDir = file("$buildDir/solr-${version}-slim") devDir = file("$buildDir/dev") slimDevDir = file("$buildDir/dev-slim") + batsLibsDir = file("$buildDir/bats-libs") } configurations { @@ -263,18 +264,39 @@ tasks.register('runDev', JavaExec) { args((project.findProperty('args') ?: '--module=http').split()) } -task downloadBats(type: NpmTask) { +tasks.register('downloadBats') { group = 'Build Dependency Download' - args = ["install", "https://github.com/bats-core/bats-core#v1.8.2", - "https://github.com/bats-core/bats-assert#v2.0.0", - "https://github.com/bats-core/bats-file#v0.3.0", + description = + 'Downloads BATS and its helper libraries (bats-support, bats-assert, bats-file) used by integrationTests' + + def batsLibs = [ + [org: 'bats-core', repo: 'bats-core', version: '1.8.2'], + [org: 'ztombol', repo: 'bats-support', version: '0.2.0'], + [org: 'bats-core', repo: 'bats-assert', version: '2.0.0'], + [org: 'bats-core', repo: 'bats-file', version: '0.3.0'], ] - - inputs.files("${project.ext.nodeProjectDir}/package.json") - outputs.dir("${project.ext.nodeProjectDir}/node_modules/bats") - outputs.dir("${project.ext.nodeProjectDir}/node_modules/bats-support") - outputs.dir("${project.ext.nodeProjectDir}/node_modules/bats-assert") - outputs.dir("${project.ext.nodeProjectDir}/node_modules/bats-file") + def downloadDir = file("$buildDir/bats-downloads") + + inputs.property('batsLibs', batsLibs) + outputs.dir(batsLibsDir) + + doLast { + delete batsLibsDir + mkdir downloadDir + batsLibs.each {lib -> + def archiveUrl = "https://github.com/${lib.org}/${lib.repo}/archive/refs/tags/v${lib.version}.tar.gz" + def archiveFile = new File(downloadDir, "${lib.repo}-${lib.version}.tar.gz") + ant.get(src: archiveUrl, dest: archiveFile, skipexisting: true) + copy { + from(tarTree(resources.gzip(archiveFile))) { + // Strip the leading "<repo>-<version>/" directory that GitHub's archive adds. + eachFile {details -> details.path = details.path.substring(details.path.indexOf('/') + 1)} + includeEmptyDirs = false + } + into "$batsLibsDir/${lib.repo}" + } + } + } } task integrationTests(type: BatsTask) { @@ -319,7 +341,7 @@ task integrationTests(type: BatsTask) { environment SOLR_LOGS_DIR: "$solrHome/logs" environment TEST_OUTPUT_DIR: integrationTestOutput environment TEST_FAILURE_DIR: solrTestFailuresDir - environment BATS_LIB_PREFIX: "$nodeProjectDir/node_modules" + environment BATS_LIB_PREFIX: batsLibsDir } class BatsTask extends Exec { @@ -338,7 +360,7 @@ class BatsTask extends Exec { @Override @TaskAction protected void exec() { - executable "$project.ext.nodeProjectDir/node_modules/bats/bin/bats" + executable "$project.ext.batsLibsDir/bats-core/bin/bats" // Note: tests to run must be listed after all other arguments // Additional debugging output: -x, --verbose-run
