-
Notifications
You must be signed in to change notification settings - Fork 8
Edburns/ghcp sp 115 java repackage #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6f142a1
Comparison aid
edburns d37974c
On branch edburns/ghcp-sp-115-java-repackage working toward https://g…
edburns 29df684
On branch edburns/ghcp-sp-115-java-repackage Complete the repackage
edburns 6972a89
Regenerate codegen output
github-actions[bot] d153817
Spotless
edburns 4c7a4e7
Fix additional codegen-check problem
edburns File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| #!/bin/sh | ||
| # compare-standalone-to-monorepo.sh | ||
| # | ||
| # Compare POM, Java source, and Java properties files between the | ||
| # standalone copilot-sdk-java repo and the monorepo's java/ directory. | ||
| # | ||
| # Usage: | ||
| # ./scripts/compare-standalone-to-monorepo.sh /path/to/standalone /path/to/monorepo [--diff] | ||
| # | ||
| # The standalone path should point to the root of copilot-sdk-java. | ||
| # The monorepo path should point to the root of copilot-sdk (the java/ subdir | ||
| # is appended automatically). | ||
| # | ||
| # Compatible with macOS zsh and POSIX sh/bash. | ||
|
|
||
| set -e | ||
|
|
||
| # ── Parse arguments ────────────────────────────────────────────────── | ||
| SHOW_DIFF=false | ||
| STANDALONE="" | ||
| MONOREPO="" | ||
|
|
||
| for arg in "$@"; do | ||
| case "$arg" in | ||
| --diff) | ||
| SHOW_DIFF=true | ||
| ;; | ||
| *) | ||
| if [ -z "$STANDALONE" ]; then | ||
| STANDALONE="$arg" | ||
| elif [ -z "$MONOREPO" ]; then | ||
| MONOREPO="$arg" | ||
| else | ||
| echo "Error: unexpected argument: $arg" >&2 | ||
| echo "Usage: $0 <standalone-path> <monorepo-path> [--diff]" >&2 | ||
| exit 1 | ||
| fi | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| if [ -z "$STANDALONE" ] || [ -z "$MONOREPO" ]; then | ||
| echo "Usage: $0 <standalone-path> <monorepo-path> [--diff]" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| MONO_JAVA="${MONOREPO}/java" | ||
|
|
||
| if [ ! -d "$STANDALONE" ]; then | ||
| echo "Error: standalone directory does not exist: $STANDALONE" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -d "$MONO_JAVA" ]; then | ||
| echo "Error: monorepo java directory does not exist: $MONO_JAVA" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # ── Collect comparable files from the standalone repo ──────────────── | ||
| # Excludes: target/, node_modules/, temporary-prompts/, scripts/codegen/ | ||
| # (these are build artifacts or standalone-only content) | ||
| TMPFILE=$(mktemp) | ||
| trap 'rm -f "$TMPFILE"' EXIT | ||
|
|
||
| (cd "$STANDALONE" && find . -type f \( -name "pom.xml" -o -name "*.java" -o -name "*.properties" \) \ | ||
| | grep -v '/target/' \ | ||
| | grep -v '/node_modules/' \ | ||
| | grep -v '^\./temporary-prompts/' \ | ||
| | grep -v '^\./scripts/codegen/' \ | ||
| | sed 's|^\./||' \ | ||
| | sort) > "$TMPFILE" | ||
|
|
||
| # ── Compare ────────────────────────────────────────────────────────── | ||
| DIFFER_COUNT=0 | ||
| MISSING_COUNT=0 | ||
| SAME_COUNT=0 | ||
| DIFFER_LIST="" | ||
| MISSING_LIST="" | ||
|
|
||
| while IFS= read -r relpath; do | ||
| standalone_file="${STANDALONE}/${relpath}" | ||
| mono_file="${MONO_JAVA}/${relpath}" | ||
|
|
||
| if [ ! -f "$mono_file" ]; then | ||
| MISSING_COUNT=$((MISSING_COUNT + 1)) | ||
| MISSING_LIST="${MISSING_LIST}${relpath} | ||
| " | ||
| elif ! diff -q "$standalone_file" "$mono_file" >/dev/null 2>&1; then | ||
| DIFFER_COUNT=$((DIFFER_COUNT + 1)) | ||
| DIFFER_LIST="${DIFFER_LIST}${relpath} | ||
| " | ||
| else | ||
| SAME_COUNT=$((SAME_COUNT + 1)) | ||
| fi | ||
| done < "$TMPFILE" | ||
|
|
||
| TOTAL_COUNT=$(wc -l < "$TMPFILE" | tr -d ' ') | ||
|
|
||
| # ── Output ─────────────────────────────────────────────────────────── | ||
| echo "Compared ${TOTAL_COUNT} files (pom.xml, *.java, *.properties)" | ||
| echo " Identical: ${SAME_COUNT}" | ||
| echo " Differ: ${DIFFER_COUNT}" | ||
| echo " Missing from monorepo: ${MISSING_COUNT}" | ||
| echo "" | ||
|
|
||
| if [ "$DIFFER_COUNT" -gt 0 ]; then | ||
| echo "The following files differ between the standalone and monorepo:" | ||
| echo "" | ||
| printf '%s' "$DIFFER_LIST" | while IFS= read -r f; do | ||
| [ -n "$f" ] && echo " $f" | ||
| done | ||
| echo "" | ||
| fi | ||
|
|
||
| if [ "$MISSING_COUNT" -gt 0 ]; then | ||
| echo "The following files exist in standalone but NOT in monorepo:" | ||
| echo "" | ||
| printf '%s' "$MISSING_LIST" | while IFS= read -r f; do | ||
| [ -n "$f" ] && echo " $f" | ||
| done | ||
| echo "" | ||
| fi | ||
|
|
||
| if [ "$DIFFER_COUNT" -eq 0 ] && [ "$MISSING_COUNT" -eq 0 ]; then | ||
| echo "All files are identical." | ||
| fi | ||
|
|
||
| # ── Optional unified diffs ─────────────────────────────────────────── | ||
| if [ "$SHOW_DIFF" = true ] && [ "$DIFFER_COUNT" -gt 0 ]; then | ||
| echo "================================================================================" | ||
| echo "Unified diffs for differing files:" | ||
| echo "================================================================================" | ||
| printf '%s' "$DIFFER_LIST" | while IFS= read -r f; do | ||
| if [ -n "$f" ]; then | ||
| echo "" | ||
| echo "--- standalone/$f" | ||
| echo "+++ monorepo/java/$f" | ||
| diff -u "${STANDALONE}/${f}" "${MONO_JAVA}/${f}" || true | ||
| fi | ||
| done | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.