Skip to content

Build, CI: Add dependency checking tasks#15857

Closed
rdblue wants to merge 3 commits intoapache:mainfrom
rdblue:check-dependencies
Closed

Build, CI: Add dependency checking tasks#15857
rdblue wants to merge 3 commits intoapache:mainfrom
rdblue:check-dependencies

Conversation

@rdblue
Copy link
Copy Markdown
Contributor

@rdblue rdblue commented Apr 1, 2026

This adds tasks to validate dependency lists that are committed in git.

The new tasks are:

  • generateDependencyList: generates a sorted file containing a module's dependencies for a given configuration (runtimeClasspath by default). This keeps only the first two parts of a dependency's version to avoid failing patch release updates from dependabot.
  • checkDependencyList: validates that a module's current set of dependencies match the dependency file. If there is no dependency file for the given configuration, this does not fail.
  • checkAllDependencyLists: runs dependency list validation for all modules

This also adds a new CI validation, check-dependency-lists that calls checkAllDependencyLists.

These changes were generated with Claude code.

@rdblue rdblue force-pushed the check-dependencies branch from d05f881 to 02233c4 Compare April 1, 2026 20:52
@rdblue
Copy link
Copy Markdown
Contributor Author

rdblue commented Apr 1, 2026

Note that this does not currently check any modules because there are no dependency lists in this PR. I'll follow up in a new PR to add dependency lists for each runtime module.

Comment thread build.gradle
}

// Resolve actual dependencies
def actualDependencies = resolveDependencies(configuration)
Copy link
Copy Markdown
Member

@RussellSpitzer RussellSpitzer Apr 1, 2026

Choose a reason for hiding this comment

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

One thing I found that broke very quickly here is we may be using a Snapshot for Iceberg dependencies which breaks if you have an actual commit hash.

I think we should exclude org.apache.iceberg artifacts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree with removing the Iceberg artifacts. There's no need to update the files for every release.

Comment thread build.gradle
// Usage: ./gradlew :iceberg-core:checkDependencyList
// Usage with custom config: ./gradlew :iceberg-core:checkDependencyList -Pconfiguration=compileClasspath
// Fails if dependencies-<configuration>.txt exists but doesn't match actual dependencies
tasks.register('checkDependencyList') {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we want to run this for every config? Just wondering if we care about changes in dependencies for jars we aren't shipping

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This only runs for -Pconfiguration=<someConfig>. The default is runtimeClasspath, but we could have other configurations. I wanted to be more generic in case we want to be strict in other modules (like iceberg-api) in the future.

Comment thread build.gradle
// Task to generate a dependency list for this module
// Usage: ./gradlew :iceberg-core:generateDependencyList
// Usage with custom config: ./gradlew :iceberg-core:generateDependencyList -Pconfiguration=compileClasspath
// Generates a file at <module-root>/dependencies-<configuration>.txt
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We'll need a rat exclusion for these

java-version: ${{ matrix.jvm }}
- run: ./gradlew -Pquick=true javadoc

check-dependency-lists:
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.

good to see zizmor ci check triggered. https://github.com/apache/iceberg/actions/runs/23870316620/job/69600308344?pr=15857

could you rebase off main?

we now enforce all github actions to be pinned to hash commit.
heres a good example to follow

build-javadoc:
runs-on: ubuntu-24.04
strategy:
max-parallel: 15
matrix:
jvm: [17, 21]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
distribution: zulu
java-version: ${{ matrix.jvm }}
- uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5 # zizmor: ignore[cache-poisoning] -- cache writes are restricted to the default branch by setup-gradle
- run: ./gradlew -Pquick=true javadoc

Comment thread build.gradle
def version = id.version

// Truncate version to major.minor (remove patch and beyond)
def truncatedVersion = truncateVersion(version)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We are doing this on write here, it may be better to do this on read so the files are contain the full dependency list and we just ignore the patches when we compare.

RussellSpitzer added a commit to RussellSpitzer/iceberg that referenced this pull request Apr 1, 2026
Add a checkAllRuntimeDeps aggregation task in build.gradle that
collects checkRuntimeDeps from all subprojects, and a dedicated
check-runtime-deps CI job in java-ci.yml that runs it on every PR.

Incorporates ideas from rdblue's apache#15857 (top-level aggregation task
and dedicated CI job) into the runtime dependency guard approach.
@rdblue
Copy link
Copy Markdown
Contributor Author

rdblue commented Apr 1, 2026

Closing this in favor of #15855.

@rdblue rdblue closed this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants