Documentation
¶
Overview ¶
Package java provides Java specific functionality for librarian.
Index ¶
- Variables
- func Add(lib *config.Library) *config.Library
- func Clean(library *config.Library) error
- func DefaultLibraryName(api string) string
- func DistributionName(library *config.Library) string
- func Fill(library *config.Library) (*config.Library, error)
- func Format(ctx context.Context, library *config.Library) error
- func Generate(ctx context.Context, cfg *config.Config, library *config.Library, ...) error
- func IdentifyMissingModules(library *config.Library, libraryDir string, srcs *sources.Sources) ([]string, error)
- func Install(ctx context.Context, tools *config.Tools) error
- func PostGenerate(ctx context.Context, repoPath string, cfg *config.Config, ...) error
- func ResolveMixinDependencies(cfg *config.Config, lib *config.Library, srcs *sources.Sources) (*config.Config, error)
- func Tidy(library *config.Library) *config.Library
- func Validate(library *config.Library) error
- type APICoordinate
- type Coordinate
- type LibraryCoordinate
- type MissingArtifact
Constants ¶
This section is empty.
Variables ¶
var ( // ErrOmitCommonResourcesConflict is returned when OmitCommonResources is true // but common_resources.proto is also explicitly listed in AdditionalProtos. ErrOmitCommonResourcesConflict = fmt.Errorf("conflict: OmitCommonResources is true but google/cloud/common_resources.proto is explicitly listed in AdditionalProtos") )
Functions ¶
func Clean ¶
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 DefaultLibraryName ¶ added in v0.11.0
DefaultLibraryName derives a default library name from an API path by stripping known prefixes (e.g., "google/cloud/", "google/api/") and returning all segments except the last one, joined by dashes.
func DistributionName ¶ added in v0.15.0
DistributionName returns the Maven distribution name (GroupID:ArtifactID) for the library.
func Generate ¶
func Generate(ctx context.Context, cfg *config.Config, library *config.Library, srcs *sources.Sources) error
Generate generates a Java client library.
func IdentifyMissingModules ¶ added in v0.13.0
func IdentifyMissingModules(library *config.Library, libraryDir string, srcs *sources.Sources) ([]string, error)
IdentifyMissingModules identifies all expected proto-*, grpc-*, client, BOM and Parent modules for the given library based on its configuration and checks for pom.xml presence on the filesystem. It returns a list of artifact IDs for the missing modules.
func Install ¶ added in v0.15.0
Install installs Java tool dependencies. It creates two sibling directories: - bin/ ($HOME/java_tools/bin) stores the generated executable wrapper scripts. - lib/ ($HOME/java_tools/lib) isolates the downloaded compiled .jar/.exe files.
func PostGenerate ¶
func PostGenerate(ctx context.Context, repoPath string, cfg *config.Config, missingArtifacts []MissingArtifact) error
PostGenerate performs repository-level actions after all individual Java libraries have been generated.
func ResolveMixinDependencies ¶ added in v0.14.0
func ResolveMixinDependencies(cfg *config.Config, lib *config.Library, srcs *sources.Sources) (*config.Config, error)
ResolveMixinDependencies automatically resolves mixin dependencies for a Java library.
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, javaAPI *config.JavaAPI) 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.
type MissingArtifact ¶ added in v0.13.0
MissingArtifact pairs an artifact ID with the library it was generated from.