java

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package java provides Java specific functionality for librarian.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidDistributionName is returned when a distribution name override
	// is incorrectly formatted.
	ErrInvalidDistributionName = fmt.Errorf("invalid distribution name override")
)

Functions

func Clean

func Clean(library *config.Library) error

Clean removes files in the library's output directory that are not in the keep list. It targets patterns like proto-*, grpc-*, and the main GAPIC module.

func DeriveDistributionName added in v0.10.0

func DeriveDistributionName(library *config.Library) string

DeriveDistributionName returns the Maven distribution name (GroupID:ArtifactID) for the library, applying overrides and defaults as necessary.

func Fill

func Fill(library *config.Library) (*config.Library, error)

Fill populates Java-specific default values for the library.

func Format

func Format(ctx context.Context, library *config.Library) error

Format formats a Java client library using google-java-format.

func Generate

func Generate(ctx context.Context, cfg *config.Config, library *config.Library, srcs *sources.Sources) error

Generate generates a Java client library.

func PostGenerate

func PostGenerate(ctx context.Context, repoPath string, cfg *config.Config) error

PostGenerate performs repository-level actions after all individual Java libraries have been generated.

func Tidy

func Tidy(library *config.Library) *config.Library

Tidy tidies the Java-specific configuration for a library by removing default values.

func Validate added in v0.10.0

func Validate(library *config.Library) error

Validate checks that the Java-specific configuration for a library is correctly formatted. It ensures that the distribution name override contains exactly two parts separated by a colon.

Types

type APICoordinate added in v0.10.0

type APICoordinate struct {
	LibraryCoordinate
	// Proto is the Maven coordinate for the proto module.
	Proto Coordinate
	// GRPC is the Maven coordinate for the gRPC module.
	GRPC Coordinate
}

APICoordinate contains Maven coordinates for the library and its API-specific modules (proto and gRPC).

func DeriveAPICoordinates added in v0.10.0

func DeriveAPICoordinates(lc LibraryCoordinate, version string) APICoordinate

DeriveAPICoordinates returns the Maven coordinates for the proto and gRPC artifacts associated with a specific API version.

type Coordinate added in v0.10.0

type Coordinate struct {
	// GroupID is the Maven Group ID.
	GroupID string
	// ArtifactID is the Maven Artifact ID.
	ArtifactID string
	// Version is the Maven version.
	Version string
}

Coordinate represents a Maven Coordinate, uniquely identifies a project artifact using its GroupID, ArtifactID, and Version.

type LibraryCoordinate added in v0.10.0

type LibraryCoordinate struct {
	// GAPIC is the Maven coordinate for the GAPIC module.
	GAPIC Coordinate
	// Parent is the Maven coordinate for the parent module.
	Parent Coordinate
	// BOM is the Maven coordinate for the BOM module.
	BOM Coordinate
}

LibraryCoordinate contains Maven coordinates for the library modules (GAPIC, parent, and BOM).

func DeriveLibraryCoordinates added in v0.10.0

func DeriveLibraryCoordinates(library *config.Library) LibraryCoordinate

DeriveLibraryCoordinates calculates the Maven coordinates for the GAPIC library, its parent, and its BOM based on the library's configuration.

Jump to

Keyboard shortcuts

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