javaloader

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 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 javaloader turns the Java code of a registered repository into semantic facts, through the SCIP index scip-java emits.

scip-java runs the project's own build -- Maven, Gradle, sbt or mill -- with the SemanticDB javac plugin attached, so its targets are resolved by the compiler that would compile the code. That is what makes the edges EXACT_TYPECHECKED rather than candidates, and it is also the cost: indexing a Java repository means building it.

And a build writes into the directory it builds. `--targetroot` moves the SemanticDB output out, but Maven's `target/` and Gradle's `build/` belong to the build tool, so the repository is never the directory handed to it: the loader materialises the working tree elsewhere with internal/scratchtree and throws it away afterwards. AGENTS.md states the rule without an exception and this is what keeps it true.

Index

Constants

View Source
const DefaultCommand = "scip-java"

DefaultCommand is the indexer this loader drives.

View Source
const DefaultMaximumIndexTime = 20 * time.Minute

DefaultMaximumIndexTime bounds a build that will not finish. It is generous because a cold Maven build resolves its dependencies over the network.

Variables

This section is empty.

Functions

func Convert

func Convert(index scipwire.Index, options Options, root string) (facts.SemanticPayload, error)

Convert turns a decoded index into a payload, reading the sources from root. It is separate from Run so a test can drive it from a recorded index without a JDK.

func Run

func Run(ctx context.Context, options Options) (facts.SemanticPayload, error)

Run indexes one repository and returns its semantic payload.

Types

type Options

type Options struct {
	// Command is the scip-java executable, with arguments.
	Command string
	// BuildTool names the build system explicitly. Empty lets scip-java
	// detect it, which is what it does well; naming it is for a repository
	// that carries two.
	BuildTool string
	// TargetDirectory is where the indexer writes. It is outside every
	// indexed repository on purpose -- see JavaTargetDirectory in the
	// indexer options.
	TargetDirectory string
	Repository      workspace.Repository
	IncludeTests    bool
	// IncludeGenerated keeps the files the build produced. They are excluded
	// by default: a graph whose symbols are mostly generated accessors
	// answers questions about code nobody wrote.
	IncludeGenerated bool
	// MaximumIndexTime bounds one repository's build. Zero is
	// DefaultMaximumIndexTime.
	MaximumIndexTime time.Duration
}

Options configures one Java facts producer.

Jump to

Keyboard shortcuts

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