Skip to content

Commit 6d7b0c8

Browse files
committed
chore(migration): support root centralized custom conformance migration
1 parent e0a10d8 commit 6d7b0c8

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

monorepo-migration/migrate.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,38 @@ EOF
241241
COMMIT_COUNT=$((COMMIT_COUNT + 1))
242242
fi
243243

244+
# 6.4c(2) Migrate custom conformance execution script if present
245+
if [ -f "$SOURCE_REPO_NAME/.kokoro/conformance.sh" ]; then
246+
echo "Migrating conformance.sh to monorepo root .kokoro/${SOURCE_REPO_NAME#java-}-conformance.sh..."
247+
mkdir -p .kokoro
248+
cp "$SOURCE_REPO_NAME/.kokoro/conformance.sh" ".kokoro/${SOURCE_REPO_NAME#java-}-conformance.sh"
249+
250+
echo "Adapting conformance script paths and build scopes for monorepo root..."
251+
PL_MODULES="${SOURCE_REPO_NAME}"
252+
if [ -n "${PRE_INSTALL_DEPS}" ]; then
253+
PL_MODULES="${PL_MODULES},${PRE_INSTALL_DEPS}"
254+
fi
255+
sed -i.bak "s|mvn install|mvn install -pl ${PL_MODULES} -am|" ".kokoro/${SOURCE_REPO_NAME#java-}-conformance.sh"
256+
sed -i.bak "s|cd test-proxy|cd ${SOURCE_REPO_NAME}/test-proxy|" ".kokoro/${SOURCE_REPO_NAME#java-}-conformance.sh"
257+
sed -i.bak "s|-jar test-proxy/target/|-jar ${SOURCE_REPO_NAME}/test-proxy/target/|" ".kokoro/${SOURCE_REPO_NAME#java-}-conformance.sh"
258+
sed -i.bak "s|kill \${proxyPID}|kill \${proxyPID} \&\& sleep 5|" ".kokoro/${SOURCE_REPO_NAME#java-}-conformance.sh"
259+
sed -i.bak "s|../../test-proxy/known_failures.txt|../../\${SOURCE_REPO_NAME}/test-proxy/known_failures.txt|" ".kokoro/${SOURCE_REPO_NAME#java-}-conformance.sh"
260+
rm -f ".kokoro/${SOURCE_REPO_NAME#java-}-conformance.sh.bak"
261+
262+
if [ -f "${SOURCE_REPO_NAME}/test-proxy/pom.xml" ]; then
263+
echo "Fixing protoc-gen-grpc-java version in test-proxy/pom.xml for Apple Silicon (osx-aarch_64) support..."
264+
sed -i.bak "s|1.24.0:exe:\${os.detected.classifier}|1.62.2:exe:\${os.detected.classifier}|" "${SOURCE_REPO_NAME}/test-proxy/pom.xml"
265+
rm -f "${SOURCE_REPO_NAME}/test-proxy/pom.xml.bak"
266+
git add "${SOURCE_REPO_NAME}/test-proxy/pom.xml"
267+
git commit -n --no-gpg-sign -m "chore($SOURCE_REPO_NAME): fix protoc-gen-grpc-java version for Apple Silicon support"
268+
COMMIT_COUNT=$((COMMIT_COUNT + 1))
269+
fi
270+
271+
git add ".kokoro/${SOURCE_REPO_NAME#java-}-conformance.sh"
272+
git commit -n --no-gpg-sign -m "chore($SOURCE_REPO_NAME): migrate and adapt conformance execution script"
273+
COMMIT_COUNT=$((COMMIT_COUNT + 1))
274+
fi
275+
244276
# 6.4d Update repo and repo_short in .repo-metadata.json
245277
REPO_METADATA="$SOURCE_REPO_NAME/.repo-metadata.json"
246278
if [ -f "$REPO_METADATA" ]; then

monorepo-migration/transform_workflow.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ def transform(content, lib_name):
128128
line = line.replace('" >> $GITHUB_ENV', ' -P !java17" >> $GITHUB_ENV')
129129
if 'build.bat' in line:
130130
line = line.replace('build.bat', 'build.sh')
131+
if '.kokoro/conformance.sh' in line:
132+
short_name = lib_name.replace('java-', '')
133+
line = line.replace('.kokoro/conformance.sh', f'.kokoro/{short_name}-conformance.sh')
131134

132135
new_lines.append(line)
133136
return "\n".join(new_lines)

0 commit comments

Comments
 (0)