Class ScaffoldConventionReconciler
java.lang.Object
network.ike.plugin.ws.reconcile.ScaffoldConventionReconciler
- All Implemented Interfaces:
Reconciler
Reconciler that upgrades workspace scaffold conventions to the
current plugin version (IKE-Network/ike-issues#393). Subsumes the
retired
ws:scaffold-upgrade-{draft,publish} goals.
This reconciler owns the cross-cutting "scaffold layer" of a
workspace: gitignore, gitattributes, Syncthing ignore flags, Maven
wrapper, IntelliJ language level, POM root="true",
.mvn/maven.config, and the ike-tooling.version
property. It does not touch Maven dependency versions or workspace
alignment state.
Each upgrade step is idempotent — running the reconciler twice
produces the same result. detect reports the steps that
would change state; apply performs the mutations.
Upgrade steps
- global-gitignore — ensure
.ike/vcs-stateand_git-init*are in the user's global gitignore. - workspace-gitignore — sectioned whitelist enforcement
for the workspace
.gitignore. - stignore-shared —
(?d)prefix on directory ignore patterns in Syncthing'sstignore-shared. - pom-root — Maven 4.1.0
root="true"on the workspace POM. - maven-config — ensure
.mvn/maven.configexists with-T 1C. - gitattributes — line-ending policy at workspace root
(ike-issues#189: Windows
mvnw.cmdmust be CRLF). - mvnw — regenerate missing Maven wrapper files, and
replace the legacy custom wrapper with the standard
only-scriptApache wrapper (ike-issues#405). - ide-language-level — apply the
ide:section fromworkspace.yamlto.idea/misc.xml. - plugin-version — bump
ike-tooling.versionin the workspace POM (and migrate the legacyike-maven-plugin.versionproperty name).
Opt out with -DupdateScaffold=false.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(WorkspaceContext ctx) Apply reconciliation.static StringapplyIdeSettings(String content, network.ike.workspace.IdeSettings ide) Applyide.languageLevelandide.jdkNameto theProjectRootManagercomponent in.idea/misc.xmlcontent.static StringcomputeGitattributesAdditions(String content) Compute additions needed to bring an existing.gitattributesup to spec.static StringcomputeGitignoreAdditions(String content) Compute the additions needed to bring an existing.gitignoreup to spec.detect(WorkspaceContext ctx) Inspect the workspace and report any drift this reconciler would correct.Human-readable name of the dimension this reconciler owns.The Maven property name (without the-Dprefix) that opts out of this reconciler's apply pass.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Reconciler
pinFlag
-
Constructor Details
-
ScaffoldConventionReconciler
public ScaffoldConventionReconciler()
-
-
Method Details
-
dimension
Description copied from interface:ReconcilerHuman-readable name of the dimension this reconciler owns. Used as the heading inscaffold-draftoutput.- Specified by:
dimensionin interfaceReconciler- Returns:
- the dimension label, e.g. "Denormalized YAML fields"
-
optOutFlag
Description copied from interface:ReconcilerThe Maven property name (without the-Dprefix) that opts out of this reconciler's apply pass. Setting the property to"false"skips this dimension on a givenscaffold-publishinvocation.- Specified by:
optOutFlagin interfaceReconciler- Returns:
- the opt-out flag name, e.g.
"updateFields"
-
detect
Description copied from interface:ReconcilerInspect the workspace and report any drift this reconciler would correct. Read-only — must not mutate the workspace.- Specified by:
detectin interfaceReconciler- Parameters:
ctx- the workspace context- Returns:
- drift report;
DriftReport.noDrift(String)if nothing to do
-
apply
Description copied from interface:ReconcilerApply reconciliation. Caller is responsible for checkingReconcilerOptions.isOptedOut(String)before invoking; implementations may also re-check defensively.- Specified by:
applyin interfaceReconciler- Parameters:
ctx- the workspace context
-
computeGitignoreAdditions
-
computeGitattributesAdditions
Compute additions needed to bring an existing.gitattributesup to spec. Detects each required rule by its leading whitespace- separated pattern token. Returns the empty string when the file is already current. Package-private for test access.- Parameters:
content- the current.gitattributescontent (empty string when the file does not exist)- Returns:
- the text to append (empty when already current)
-
applyIdeSettings
Applyide.languageLevelandide.jdkNameto theProjectRootManagercomponent in.idea/misc.xmlcontent. Returns the updated content, or the original if no change is needed. Package-private for test access.- Parameters:
content- the currentmisc.xmlcontentide- the settings to enforce (null fields are no-ops)- Returns:
- the updated content
-