gradle

package
v0.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gradle implements Gradle build tool support for Java projects.

It mirrors the Maven build tool's behavior: omnibump finds the best place to apply each requested bump across the mechanisms Gradle projects use to define dependency versions — version catalogs (gradle/libs.versions.toml and settings-script inline catalogs), version variables (gradle.properties, version.properties files, Groovy ext properties and version maps), and direct declarations in build scripts. Dependencies not declared anywhere are pinned through an omnibump-managed resolutionStrategy force block, the Gradle analog of Maven's DependencyManagement fallback for transitive dependencies.

File parsing and editing is delegated to pkg/gradlefile, which performs format-preserving edits on both Groovy and Kotlin DSL files.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoBuildFiles is returned when no build.gradle files are found.
	ErrNoBuildFiles = errors.New("no build.gradle or build.gradle.kts files found")

	// ErrValidationFailed is returned when dependency validation fails.
	ErrValidationFailed = errors.New("validation failed")

	// ErrUnknownFileType is returned when an unknown Gradle file type is encountered.
	ErrUnknownFileType = errors.New("unknown Gradle file type")

	// ErrManifestTooLarge is returned when a manifest file exceeds size limits.
	ErrManifestTooLarge = errors.New("manifest file too large")
)
View Source
var (
	// ErrVersionConflict is returned when two updates try to set different
	// versions for the same dependency, variable or catalog key.
	ErrVersionConflict = errors.New("conflicting version update detected")

	// ErrPropertyNotFound is returned when a requested property update does
	// not match any catalog version key, version variable or properties-file
	// entry in the project.
	ErrPropertyNotFound = errors.New("property not found")

	// ErrSymlinkTarget is returned when a build file omnibump would write
	// already exists as a symlink, which os.WriteFile would follow out of
	// the project root.
	ErrSymlinkTarget = errors.New("refusing to write through a symlink")
)

Functions

This section is empty.

Types

type Gradle

type Gradle struct{}

Gradle implements the BuildTool interface for Gradle projects.

func (*Gradle) Detect

func (g *Gradle) Detect(ctx context.Context, dir string) (bool, error)

Detect checks if Gradle manifest files exist in the directory.

func (*Gradle) GetAnalyzer

func (g *Gradle) GetAnalyzer() analyzer.Analyzer

GetAnalyzer returns the Gradle analyzer.

func (*Gradle) GetManifestFiles

func (g *Gradle) GetManifestFiles() []string

GetManifestFiles returns Gradle manifest files.

func (*Gradle) Name

func (g *Gradle) Name() string

Name returns the build tool identifier.

func (*Gradle) Update

func (g *Gradle) Update(ctx context.Context, cfg *languages.UpdateConfig) error

Update performs dependency updates on a Gradle project. It builds a model of every Gradle file that can define a version, routes each requested update to the mechanism that defines it (version catalog, version variable, direct declaration), pins dependencies found nowhere via a dependency constraint, and applies coordinate swaps via dependency substitution — both hosted in the managed block of the settings script so they apply before any configuration resolves.

func (*Gradle) Validate

func (g *Gradle) Validate(ctx context.Context, cfg *languages.UpdateConfig) error

Validate checks if the updates were applied successfully by re-scanning the project and verifying every dependency's effective version and every property's definition sites.

type GradleAnalyzer

type GradleAnalyzer struct{}

GradleAnalyzer implements dependency analysis for Gradle projects.

func (*GradleAnalyzer) Analyze

func (ga *GradleAnalyzer) Analyze(ctx context.Context, projectPath string) (*analyzer.AnalysisResult, error)

Analyze analyzes a Gradle project's dependencies. Version catalog keys and version variables are surfaced as properties (with their defining file in PropertySources); dependencies declared through a catalog reference or a variable interpolation report UsesProperty with the key they resolve through, mirroring how the Maven analyzer reports ${property} versions.

func (*GradleAnalyzer) AnalyzeRemote

func (ga *GradleAnalyzer) AnalyzeRemote(ctx context.Context, files map[string][]byte) (*analyzer.RemoteAnalysisResult, error)

AnalyzeRemote performs dependency analysis on remotely-fetched Gradle files. It mirrors Analyze, building the project model from the in-memory file contents instead of disk, and returns a single aggregated FileAnalysis the way the Maven analyzer aggregates all pom.xml files into one.

func (*GradleAnalyzer) RecommendStrategy

func (ga *GradleAnalyzer) RecommendStrategy(ctx context.Context, analysis *analyzer.AnalysisResult, deps []analyzer.Dependency) (*analyzer.Strategy, error)

RecommendStrategy recommends an update strategy for given dependencies.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL