Skip to content

Add config file parser for Java Gradle `build.gradle`

Leaminn Ma requested to merge add-java-gradle-build-config-file-class into master

What does this MR do and why?

Background

The Repository X-Ray is a tool that searches for dependency manager configuration files (aka "lock files") and then extracts a list of libraries from the content.

In #474306 (comment 2025085630), we decided to migrate the Repository X-Ray functionality into the GitLab Rails monolith. This gives us two main benefits: (i) it will eventually allow us to run the service outside of the CI pipeline, and (ii) we can maintain the parsing logic centrally so that other domains can utilize it.

Base MR

In !162313 (merged), we introduced the ConfigFiles::Base class where the intention is for each dependency manager config file type to be represented by a child class. The child class contains the parsing logic to extract a list of libraries and their versions from the file content.

This MR

In this MR, we introduce the JavaGradle config file class that parses build.gradle.

Also applied a minor change to config_file_shared_examples.rb to ignore array order for libs.

Resolves part of #476177.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #476177

Edited by Leaminn Ma

Merge request reports