Skip to content
7 changes: 4 additions & 3 deletions docs/flpath-5002-java-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ policy, controller, runtime validation, or durable repository-profile wiring.
## Manual VPE integration

The VPE `AnalysisContext` JSON handoff is loaded by
`AnalysisContextLoader`. The manual command preserves source/build/provenance
fingerprints and emits normalized facts with separate provider and framework
sets:
`AnalysisContextLoader`. The manual command preserves the selected profile,
production/test scope, generated-root declarations, source/build/provenance
fingerprints, and handoff limitations. It emits normalized facts with separate
provider and framework sets:

```sh
spike/scripts/run-manual-integration.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,19 @@ public record SourceRoot(
Scope scope,
boolean generated,
boolean included,
boolean required) {
boolean required,
String fingerprint) {
/** Compatibility constructor for callers that do not provide a root fingerprint. */
public SourceRoot(
String declaredPath,
Path path,
Scope scope,
boolean generated,
boolean included,
boolean required) {
this(declaredPath, path, scope, generated, included, required, null);
}

/** Validates and normalizes one source root declaration. */
public SourceRoot {
if (declaredPath == null || declaredPath.isBlank()) {
Expand All @@ -70,12 +82,27 @@ public record SourceRoot(

/** Creates an included application source root. */
public static SourceRoot source(String declaredPath, Path path, Scope scope, boolean required) {
return new SourceRoot(declaredPath, path, scope, false, true, required);
return source(declaredPath, path, scope, required, null);
}

public static SourceRoot source(
String declaredPath, Path path, Scope scope, boolean required, String fingerprint) {
return new SourceRoot(declaredPath, path, scope, false, true, required, fingerprint);
}

public static SourceRoot generated(
String declaredPath, Path path, Scope scope, boolean included, boolean required) {
return new SourceRoot(declaredPath, path, scope, true, included, required);
return generated(declaredPath, path, scope, included, required, null);
}

public static SourceRoot generated(
String declaredPath,
Path path,
Scope scope,
boolean included,
boolean required,
String fingerprint) {
return new SourceRoot(declaredPath, path, scope, true, included, required, fingerprint);
}
}

Expand Down Expand Up @@ -616,14 +643,32 @@ public Builder analysisScope(Scope value) {

/** Adds an included application source root. */
public Builder sourceRoot(String declaredPath, Path path, Scope scope, boolean required) {
sourceRoots.add(SourceRoot.source(declaredPath, path, scope, required));
return sourceRoot(declaredPath, path, scope, required, null);
}

/** Adds an included application source root with its handoff fingerprint. */
public Builder sourceRoot(
String declaredPath, Path path, Scope scope, boolean required, String fingerprint) {
sourceRoots.add(SourceRoot.source(declaredPath, path, scope, required, fingerprint));
return this;
}

/** Adds an included or excluded generated source root. */
public Builder generatedSourceRoot(
String declaredPath, Path path, Scope scope, boolean included, boolean required) {
generatedSourceRoots.add(SourceRoot.generated(declaredPath, path, scope, included, required));
return generatedSourceRoot(declaredPath, path, scope, included, required, null);
}

/** Adds an included or excluded generated source root with its handoff fingerprint. */
public Builder generatedSourceRoot(
String declaredPath,
Path path,
Scope scope,
boolean included,
boolean required,
String fingerprint) {
generatedSourceRoots.add(
SourceRoot.generated(declaredPath, path, scope, included, required, fingerprint));
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,13 @@ private static void addRoot(
AnalysisContext.Scope scope = parseScope(root.scope());
boolean generated = generatedCollection || root.generated();
if (generated) {
builder.generatedSourceRoot(declaredPath, resolved, scope, root.included(), root.required());
builder.generatedSourceRoot(
declaredPath, resolved, scope, root.included(), root.required(), root.fingerprint());
} else {
if (root.required() && !root.included()) {
throw new IllegalArgumentException("required source root must be included: " + declaredPath);
}
builder.sourceRoot(declaredPath, resolved, scope, root.required());
builder.sourceRoot(declaredPath, resolved, scope, root.required(), root.fingerprint());
}
}

Expand Down
Loading
Loading