Class ScaffoldConventionReconciler

java.lang.Object
network.ike.plugin.ws.reconcile.ScaffoldConventionReconciler
All Implemented Interfaces:
Reconciler

public class ScaffoldConventionReconciler extends Object implements 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

  1. global-gitignore — ensure .ike/vcs-state and _git-init* are in the user's global gitignore.
  2. workspace-gitignore — sectioned whitelist enforcement for the workspace .gitignore.
  3. stignore-shared(?d) prefix on directory ignore patterns in Syncthing's stignore-shared.
  4. pom-root — Maven 4.1.0 root="true" on the workspace POM.
  5. maven-config — ensure .mvn/maven.config exists with -T 1C.
  6. gitattributes — line-ending policy at workspace root (ike-issues#189: Windows mvnw.cmd must be CRLF).
  7. mvnw — regenerate missing Maven wrapper files, and replace the legacy custom wrapper with the standard only-script Apache wrapper (ike-issues#405).
  8. ide-language-level — apply the ide: section from workspace.yaml to .idea/misc.xml.
  9. plugin-version — bump ike-tooling.version in the workspace POM (and migrate the legacy ike-maven-plugin.version property name).

Opt out with -DupdateScaffold=false.

  • Constructor Details

    • ScaffoldConventionReconciler

      public ScaffoldConventionReconciler()
  • Method Details

    • dimension

      public String dimension()
      Description copied from interface: Reconciler
      Human-readable name of the dimension this reconciler owns. Used as the heading in scaffold-draft output.
      Specified by:
      dimension in interface Reconciler
      Returns:
      the dimension label, e.g. "Denormalized YAML fields"
    • optOutFlag

      public String optOutFlag()
      Description copied from interface: Reconciler
      The Maven property name (without the -D prefix) that opts out of this reconciler's apply pass. Setting the property to "false" skips this dimension on a given scaffold-publish invocation.
      Specified by:
      optOutFlag in interface Reconciler
      Returns:
      the opt-out flag name, e.g. "updateFields"
    • detect

      public DriftReport detect(WorkspaceContext ctx)
      Description copied from interface: Reconciler
      Inspect the workspace and report any drift this reconciler would correct. Read-only — must not mutate the workspace.
      Specified by:
      detect in interface Reconciler
      Parameters:
      ctx - the workspace context
      Returns:
      drift report; DriftReport.noDrift(String) if nothing to do
    • apply

      public void apply(WorkspaceContext ctx)
      Description copied from interface: Reconciler
      Apply reconciliation. Caller is responsible for checking ReconcilerOptions.isOptedOut(String) before invoking; implementations may also re-check defensively.
      Specified by:
      apply in interface Reconciler
      Parameters:
      ctx - the workspace context
    • computeGitignoreAdditions

      public static String computeGitignoreAdditions(String content)
      Compute the additions needed to bring an existing .gitignore up to spec. Package-private for test access.
      Parameters:
      content - the current .gitignore content
      Returns:
      the text to append (empty string if already current)
    • computeGitattributesAdditions

      public static String computeGitattributesAdditions(String content)
      Compute additions needed to bring an existing .gitattributes up 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 .gitattributes content (empty string when the file does not exist)
      Returns:
      the text to append (empty when already current)
    • applyIdeSettings

      public static String applyIdeSettings(String content, network.ike.workspace.IdeSettings ide)
      Apply ide.languageLevel and ide.jdkName to the ProjectRootManager component in .idea/misc.xml content. Returns the updated content, or the original if no change is needed. Package-private for test access.
      Parameters:
      content - the current misc.xml content
      ide - the settings to enforce (null fields are no-ops)
      Returns:
      the updated content