| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 91038f2 commit 9dd4e7b
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,6 +14,13 @@ | |||
| 14 | 14 | # limitations under the License. | |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| 18 | + REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" | ||
| 19 | + ADK_REAL_ROOT=$(dirname "$(realpath "$REPO_ROOT/src/google/adk/__init__.py")") | ||
| 20 | + EXCLUDE_TESTS="$ADK_REAL_ROOT/tests" | ||
| 21 | + EXCLUDE_WORKSPACE="$ADK_REAL_ROOT/open_source_workspace" | ||
| 22 | + EXCLUDE_CONTRIBUTING="$ADK_REAL_ROOT/contributing" | ||
| 23 | + | ||
| 17 | 24 | exit_code=0 | |
| 18 | 25 | ||
| 19 | 26 | get_added_files() { | |
@@ -33,11 +40,17 @@ get_added_files() { | |||
| 33 | 40 | while read -r file; do | |
| 34 | 41 | # Check if file is not empty (happens if no new files) | |
| 35 | 42 | if [[ -n "$file" ]]; then | |
| 36 | - # Match only files in the package source (src/google/adk/) to avoid false | ||
| 37 | - # positives in environments (e.g., monorepos) where the entire repository | ||
| 38 | - # root is nested under a 'google/adk/' directory structure. | ||
| 39 | - if [[ "$file" == */src/google/adk/*.py ]] || [[ "$file" == src/google/adk/*.py ]]; then | ||
| 40 | - filename=$(basename "$file") | ||
| 43 | + # Match only files in the package source (resolving symlinks to support both | ||
| 44 | + # open-source and internal layouts) and exclude tests/workspace to avoid | ||
| 45 | + # false positives. | ||
| 46 | + abs_file=$(realpath "$file" 2>/dev/null || echo "") | ||
| 47 | + if [[ -n "$abs_file" ]] && \ | ||
| 48 | + [[ "$abs_file" == "$ADK_REAL_ROOT"/* ]] && \ | ||
| 49 | + [[ "$abs_file" != "$EXCLUDE_TESTS"/* ]] && \ | ||
| 50 | + [[ "$abs_file" != "$EXCLUDE_WORKSPACE"/* ]] && \ | ||
| 51 | + [[ "$abs_file" != "$EXCLUDE_CONTRIBUTING"/* ]] && \ | ||
| 52 | + [[ "$abs_file" == *.py ]]; then | ||
| 53 | + filename=$(basename "$abs_file") | ||
| 41 | 54 | if [[ ! "$filename" == _* ]]; then | |
| 42 | 55 | echo "Error: New Python file '$file' must have a '_' prefix." | |
| 43 | 56 | echo "All new Python files in src/google/adk/ must be private by default." | |
| Back | FazBrowse Home | New Git URL |
0 commit comments