Skip to content

Commit 26927ce

Browse files
committed
[skip ci] feature: do not require LICENSE, etc in javadoc.jar & ensure poms do not have SNAPSHOT versions
1 parent 4c5a6d5 commit 26927ce

File tree

1 file changed

+31
-12
lines changed

1 file changed

+31
-12
lines changed

etc/bin/verify-jar-artifacts.sh

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,39 @@ while IFS= read -r line; do
129129
exit 1
130130
fi
131131

132-
echo "... Verifying required files exist in jar..."
133-
required_jar_contents=(META-INF/LICENSE META-INF/DISCLAIMER META-INF/NOTICE)
134-
missing_jar_contents=()
135-
for entry in "${required_jar_contents[@]}"; do
136-
if ! jar tf "${JAR_FILE}" | grep -qF -- "${entry}"; then
137-
missing_jar_contents+=("${entry}")
138-
fi
139-
done
140-
141-
if ((${#missing_jar_contents[@]})); then
142-
printf '❌ %s missing from %s\n' "${missing_jar_contents[*]}" "${JAR_FILE}"
132+
if [[ $JAR_FILE != *-javadoc.jar ]]; then
133+
echo "... Verifying required files exist in non-javadoc jar..."
134+
required_jar_contents=(META-INF/LICENSE META-INF/DISCLAIMER META-INF/NOTICE)
135+
missing_jar_contents=()
136+
for entry in "${required_jar_contents[@]}"; do
137+
if ! jar tf "${JAR_FILE}" | grep -qF -- "${entry}"; then
138+
missing_jar_contents+=("${entry}")
139+
fi
140+
done
141+
142+
if ((${#missing_jar_contents[@]})); then
143+
printf '❌ %s missing from %s\n' "${missing_jar_contents[*]}" "${JAR_FILE}"
144+
exit 1
145+
else
146+
printf '✅ Required files %s are present in %s\n' "${required_jar_contents[*]}" "${JAR_FILE}"
147+
fi
148+
fi
149+
150+
POM_FILE="${ARTIFACT_ID}-${VERSION}.pom"
151+
POM_URL="${REPO_BASE_URL}/${GROUP_ID}/${ARTIFACT_ID}/${VERSION}/${POM_FILE}"
152+
echo "🔎 Checking pom for artifact: ${ARTIFACT_ID}-${VERSION}.pom"
153+
if [ ! -f "${POM_FILE}" ]; then
154+
echo "... Downloading: ${POM_URL} to ${POM_FILE}"
155+
curl -sSfL "${POM_URL}" -o ${POM_FILE}
156+
else
157+
echo "... Skipping download, already exists: ${POM_FILE}"
158+
fi
159+
160+
if grep -q 'SNAPSHOT' "${POM_FILE}"; then
161+
echo "${POM_FILE} must not reference SNAPSHOT artifacts"
143162
exit 1
144163
else
145-
printf '✅ Required files %s are present in %s\n' "${required_jar_contents[*]}" "${JAR_FILE}"
164+
echo "✅ Verified: ${POM_FILE} does not reference SNAPSHOT artifacts"
146165
fi
147166

148167
echo "✅ Verified: ${JAR_FILE}"

0 commit comments

Comments
 (0)