Skip to content

chore(bigtable): correct sparse-bootstrap dep discovery and install ordering#13523

Merged
igorbernstein2 merged 1 commit into
googleapis:mainfrom
igorbernstein2:sparse-fix
Jun 22, 2026
Merged

chore(bigtable): correct sparse-bootstrap dep discovery and install ordering#13523
igorbernstein2 merged 1 commit into
googleapis:mainfrom
igorbernstein2:sparse-fix

Conversation

@igorbernstein2

Copy link
Copy Markdown
Contributor

The previous script missed cross-project SNAPSHOT deps and could fail on clean-m2 runs. Fixes:

  • Walk regular edges (not just parent + BOM imports) so monorepo SNAPSHOTs like api-common-java are discovered.
  • Version-aware edge following: skip edges whose declared version doesn't match the local pom, so pinned released BOM imports (e.g. google-cloud-pubsub-bom:1.140.0 from google-cloud-jar-parent) aren't mistakenly followed to the local SNAPSHOT, which created cycles and phantom projects in the install list.
  • Verify the local pom's coord+version matches before accepting the shortcut; the Maven default '../pom.xml' otherwise resolves to the unrelated repo-root pom.
  • Enqueue each project's aggregator /pom.xml when any pom under it is visited, since 'cd && mvn' forces Maven to load the aggregator regardless of -pl.
  • Flush the install batch on every top-level project change so interleaved topo orders (A1, A2, B1, A3 when A3 depends on B1) install in dep order instead of being collapsed per project.
  • Match pom filenames by exact basename so test resources like src/test/resources/gax-example-pom.xml aren't picked up as modules.

…rdering

The previous script missed cross-project SNAPSHOT deps and could fail on
clean-m2 runs. Fixes:

- Walk regular <dependency> edges (not just parent + BOM imports) so
  monorepo SNAPSHOTs like api-common-java are discovered.
- Version-aware edge following: skip edges whose declared version
  doesn't match the local pom, so pinned released BOM imports (e.g.
  google-cloud-pubsub-bom:1.140.0 from google-cloud-jar-parent) aren't
  mistakenly followed to the local SNAPSHOT, which created cycles and
  phantom projects in the install list.
- Verify the local pom's coord+version matches <parent> before
  accepting the <relativePath> shortcut; the Maven default
  '../pom.xml' otherwise resolves to the unrelated repo-root pom.
- Enqueue each project's aggregator <project>/pom.xml when any pom
  under it is visited, since 'cd <project> && mvn' forces Maven to
  load the aggregator regardless of -pl.
- Flush the install batch on every top-level project change so
  interleaved topo orders (A1, A2, B1, A3 when A3 depends on B1)
  install in dep order instead of being collapsed per project.
- Match pom filenames by exact basename so test resources like
  src/test/resources/gax-example-pom.xml aren't picked up as modules.
@igorbernstein2 igorbernstein2 requested review from a team as code owners June 18, 2026 21:21

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the sparse-bootstrap.py script to resolve and traverse regular <dependency> edges within the monorepo, and updates the install command generation to preserve topological order by grouping consecutive POMs of the same project. The review feedback highlights three key improvements: resolving a namespace issue in get_version that prevents inheriting versions from parent POMs, adding the -N flag to mvn install when no sub-modules are present to prevent recursive builds in sparse checkouts, and caching parsed XML roots to avoid redundant parsing during dependency resolution.

Comment thread java-bigtable/scripts/sparse-bootstrap.py
Comment thread java-bigtable/scripts/sparse-bootstrap.py
Comment thread java-bigtable/scripts/sparse-bootstrap.py
@igorbernstein2 igorbernstein2 merged commit 75eae36 into googleapis:main Jun 22, 2026
185 of 186 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants