diff options
Diffstat (limited to 'test/jetty-solr-dependency-guard.sh')
| -rwxr-xr-x | test/jetty-solr-dependency-guard.sh | 72 |
1 files changed, 69 insertions, 3 deletions
diff --git a/test/jetty-solr-dependency-guard.sh b/test/jetty-solr-dependency-guard.sh index 0f2fad8a2..21e208194 100755 --- a/test/jetty-solr-dependency-guard.sh +++ b/test/jetty-solr-dependency-guard.sh @@ -42,14 +42,72 @@ for artifact in http2-client http2-common http2-http-client-transport; do fail "$artifact must only be an input of the Solr 9 bridge" done +for artifact in slf4j-api slf4j-jdk14; do + grep -E "name=\"$artifact\" rev=\"1.7.36\" conf=\"solr9-bridge->master\"" ivy.xml >/dev/null 2>&1 || \ + fail "$artifact 1.7.36 must only be an input of the Solr 9 bridge" +done + +grep -E 'org="org.eclipse.jetty.toolchain" name="jetty-servlet-api" rev="4.0.9"' ivy.xml >/dev/null 2>&1 || \ + fail "Jetty's EE8 Servlet 4 API must be an explicit dependency" +grep -E 'exclude org="javax.servlet" module="javax.servlet-api"' ivy.xml >/dev/null 2>&1 || \ + fail "transitive javax.servlet-api artifacts must be excluded" + +expected_jetty_version=$(sed -n \ + 's/.*org="org.eclipse.jetty" name="jetty-server" rev="\([^"]*\)".*/\1/p' \ + ivy.xml) +[ -n "$expected_jetty_version" ] || \ + fail "could not determine the public Jetty version from jetty-server in ivy.xml" +[ "$(printf '%s\n' "$expected_jetty_version" | wc -l | tr -d ' ')" -eq 1 ] || \ + fail "jetty-server must declare exactly one public Jetty version" + if [ -d lib ]; then + public_jetty_count=0 + for artifact in lib/jetty-*.jar; do + [ -e "$artifact" ] || continue + case $(basename "$artifact") in + jetty-servlet-api-*.jar) + # Jetty's Servlet 4 toolchain has its own version line. + continue + ;; + esac + public_jetty_count=$((public_jetty_count + 1)) + case $(basename "$artifact") in + *-"$expected_jetty_version".jar) ;; + *) fail "public Jetty artifact is not on version $expected_jetty_version: $artifact" ;; + esac + done + [ "$public_jetty_count" -gt 0 ] || \ + fail "no public Jetty $expected_jetty_version artifacts found" + + case "$expected_jetty_version" in + 12.*) + for artifact in lib/jetty-continuation-*.jar; do + [ -e "$artifact" ] || continue + fail "Jetty 9-only artifact remains on the Jetty 12 classpath: $artifact" + done + ;; + esac + + servlet_api_count=0 + for artifact in lib/*servlet-api-*.jar; do + [ -e "$artifact" ] || continue + servlet_api_count=$((servlet_api_count + 1)) + [ "$(basename "$artifact")" = "jetty-servlet-api-4.0.9.jar" ] || \ + fail "unexpected Servlet API artifact: $artifact" + done + [ "$servlet_api_count" -eq 1 ] || \ + fail "expected exactly one public Servlet API artifact, found $servlet_api_count" + jar tf lib/jetty-servlet-api-4.0.9.jar | grep '^javax/servlet/resources/web-app_4_0.xsd$' >/dev/null 2>&1 || \ + fail "Jetty Servlet API is missing the EE8 web.xml schema" + for pattern in \ 'jetty-deploy-*.jar' \ 'jetty-jmx-*.jar' \ 'solr-core-*.jar' \ 'solr-solrj-*.jar' \ 'solr-scripting-*.jar' \ - 'http2-*.jar'; do + 'http2-*.jar' \ + 'slf4j-*-1.7.36.jar'; do for artifact in lib/$pattern; do [ -e "$artifact" ] || continue fail "forbidden resolved artifact: $artifact" @@ -66,7 +124,9 @@ if [ -d lib ]; then jetty-util-9.4.58.v20250814 \ http2-client-9.4.58.v20250814 \ http2-common-9.4.58.v20250814 \ - http2-http-client-transport-9.4.58.v20250814; do + http2-http-client-transport-9.4.58.v20250814 \ + slf4j-api-1.7.36 \ + slf4j-jdk14-1.7.36; do jar="lib/solr9-bridge-$artifact.jar" [ -f "$jar" ] || fail "missing generated bridge artifact: $jar" if jar tf "$jar" | grep '^org/eclipse/jetty/' >/dev/null 2>&1; then @@ -75,7 +135,13 @@ if [ -d lib ]; then if zipgrep -a -E 'org(/|\.)eclipse(/|\.)jetty' "$jar" >/dev/null 2>&1; then fail "unrelocated Jetty reference in $jar" fi + if jar tf "$jar" | grep '^org/slf4j/' >/dev/null 2>&1; then + fail "unrelocated SLF4J class in $jar" + fi + if zipgrep -a -E 'org(/|\.)slf4j' "$jar" >/dev/null 2>&1; then + fail "unrelocated SLF4J reference in $jar" + fi done fi -echo "PASS: Solr 9 uses only the relocated Jetty client island." +echo "PASS: Solr 9 uses only the relocated Jetty client and SLF4J 1.7 island." |
