Edit and exercise Archiver CommandBindings in the IntelliJ designer

This commit is contained in:
2026-11-24 14:42:35 +01:00
parent 54e202014e
commit 98d37c6c3d
38 changed files with 1304 additions and 190 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ def run(name, command):
with tempfile.TemporaryDirectory(prefix="designer-connected-") as temporary:
for host in ("standalone", "intellij"):
base = Path(temporary) / host
base = (Path(temporary) / host).resolve()
for mode in ("classpath", "modulepath"):
fixture = base / mode
shutil.copytree(ROOT / "integration-fixtures/preview" / mode, fixture,
+5 -4
View File
@@ -22,6 +22,7 @@ p.add_argument("--target-java-home", type=Path, required=True)
p.add_argument("--idea-home", type=Path, required=True)
p.add_argument("--mode", choices=["all", "classpath", "modulepath"], default="all")
p.add_argument("--repeat", type=int, default=1, help="Consecutive independent runs per mode")
p.add_argument("--archiver", type=Path, help="Qualify ArchiveWindow.fxml in a disposable project copy")
args = p.parse_args()
if args.repeat < 1:
p.error("--repeat must be positive")
@@ -29,11 +30,11 @@ output = ROOT / "target/ide-workflow"
output.mkdir(parents=True, exist_ok=True)
batch = Path(tempfile.mkdtemp(prefix="runs-", dir=output))
print("Host evidence: " + str(batch), flush=True)
modes = ("classpath", "modulepath") if args.mode == "all" else (args.mode,)
modes = ("classpath",) if args.archiver else (("classpath", "modulepath") if args.mode == "all" else (args.mode,))
for run_number, mode in ((n, mode) for n in range(1, args.repeat + 1) for mode in modes):
crashes = NativeCrashGuard(ROOT)
launch = subprocess.run([sys.executable, ROOT / "scripts/run-fixture-host.py", "intellij",
"--check", "--mode", mode, "--java-home", args.java_home,
"--check", *(["--archiver", str(args.archiver.resolve())] if args.archiver else []), "--mode", mode, "--java-home", args.java_home,
"--target-java-home", args.target_java_home, "--idea-home", args.idea_home],
cwd=ROOT, text=True, capture_output=True, check=True, timeout=60)
evidence = batch / f"{mode}-run-{run_number}"
@@ -43,7 +44,7 @@ for run_number, mode in ((n, mode) for n in range(1, args.repeat + 1) for mode i
base = Path(re.search(r"Disposable host: (.+)", launch.stdout)[1])
pid = int(re.search(r"Host PID: (\d+)", launch.stdout)[1])
try:
until = time.monotonic() + 240
until = time.monotonic() + (480 if args.archiver else 240)
while time.monotonic() < until:
if (base / "FAILURE.txt").exists():
raise RuntimeError((base / "FAILURE.txt").read_text())
@@ -73,7 +74,7 @@ for run_number, mode in ((n, mode) for n in range(1, args.repeat + 1) for mode i
shutil.copyfile(base / "intellij.png", output / (mode + ".png"))
(evidence / "proof.json").write_text(json.dumps(proof, indent=2) + "\n")
finally:
for name in ("SUCCESS.txt", "FAILURE.txt", "ui-state.txt", "launcher.log"):
for name in ("SUCCESS.txt", "FAILURE.txt", "ui-state.txt", "launcher.log", "steps.txt", "target-error.txt", "preview-restored.png"):
if (base / name).exists():
shutil.copyfile(base / name, evidence / name)
workers = descendant_workers(pid)
+1 -1
View File
@@ -21,5 +21,5 @@ for artifact in manifest["artifacts"]:
errors.append(f"Different build: {path}")
if errors:
print("\n".join(errors), file=sys.stderr)
sys.exit("Runtime identity mismatch. See docs/runtime/neitzellib-baseline.md; do not bypass this check merely because the version is 1.0-SNAPSHOT.")
sys.exit("Runtime identity mismatch. See docs/runtime/neitzellib-baseline.md.")
print(f"PASS {len(manifest['artifacts'])} runtime artifacts match tested source {manifest['sourceRevision']}; no corrected release version is claimed")
+1 -1
View File
@@ -64,7 +64,7 @@ with tempfile.TemporaryDirectory(prefix="designer-preview-") as temp:
first = None
for mode in ("discovery", "bindings", "standard", "async", "timeout", "cancel",
"readiness-failure", "wrong-model", "invalid-attribute",
"cleanup-failure", "factory-failure", "viewmodels", "generated", "full", "full-empty", "card", "unstable"):
"cleanup-failure", "factory-failure", "viewmodels", "generated", "full", "full-empty", "card", "command-card", "unstable"):
log = launch(path, arrangement, mode, arrangement + "-" + mode)
if mode == "standard":
first = re.search(r"SESSION (\S+) models=1", log)[1]
+8 -4
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Create ignored local launch settings for NeitzelLib's checked-in fx-example context."""
"""Create ignored local launch settings for a project with a checked-in Designer context."""
import argparse
import json
import os
@@ -7,7 +7,7 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--library", type=Path, required=True)
parser.add_argument("--library", "--project", type=Path, required=True)
parser.add_argument("--target-java-home", type=Path, required=True)
parser.add_argument("--maven", type=Path, default=ROOT / "mvnw")
args = parser.parse_args()
@@ -15,7 +15,11 @@ library = args.library.resolve()
java = args.target_java_home.resolve()
maven = args.maven.resolve()
if not (library / "neitzel-fx-designer.json").is_file():
parser.error("Library checkout has no designer configuration")
parser.error("Project has no designer configuration")
contexts = json.loads((library / "neitzel-fx-designer.json").read_text())["contexts"]
if len(contexts) != 1:
parser.error("Expected a single example context")
context = next(iter(contexts))
if not all((java / "bin" / name).is_file() for name in ("java", "javac")):
parser.error("Supply a full application JDK installation")
if not maven.is_file() or not os.access(maven, os.X_OK):
@@ -50,7 +54,7 @@ def prop(value):
with launch.open("x", encoding="ascii") as file:
file.write("configuration=../neitzel-fx-designer.json\ncontext=person-desk\n"
file.write(f"configuration=../neitzel-fx-designer.json\ncontext={context}\n"
"settings=runtimes.json\nmaven=" + prop(maven) + "\ntools="
+ os.pathsep.join(map(prop, tools)) + "\n")
print(settings)
+29 -5
View File
@@ -18,13 +18,22 @@ p.add_argument("--target-java-home", type=Path, required=True)
p.add_argument("--idea-home", type=Path)
p.add_argument("--check", action="store_true", help="Install the disposable IDE qualification companion")
p.add_argument("--mode", choices=["classpath","modulepath"], default="classpath")
p.add_argument("--archiver", type=Path, help="Use a disposable copy of the Archiver project")
args = p.parse_args()
base = Path(tempfile.mkdtemp(prefix="neitzel-designer-host-")).resolve()
project = base / "project"
subprocess.run([sys.executable, ROOT / "scripts/prepare-fixture-host.py", "--destination", project,
"--target-java-home", args.target_java_home, "--mode", args.mode], check=True)
if args.archiver:
if args.host != "intellij" or args.mode != "classpath":
p.error("Archiver requires the IntelliJ classpath configuration")
shutil.copytree(args.archiver, project, ignore=shutil.ignore_patterns(".git", ".idea", "target", ".neitzel-fx-designer"))
subprocess.run([sys.executable, ROOT / "scripts/configure-library-example.py", "--project", project,
"--target-java-home", args.target_java_home], check=True)
file = project / "src/main/resources/de/neitzel/archiver/ui/ArchiveWindow.fxml"
else:
subprocess.run([sys.executable, ROOT / "scripts/prepare-fixture-host.py", "--destination", project,
"--target-java-home", args.target_java_home, "--mode", args.mode], check=True)
file = project / "app/src/main/resources/fixture/components/Person.fxml"
settings = project / ".neitzel-fx-designer/host.properties"
file = project / "app/src/main/resources/fixture/components/Person.fxml"
env = dict(os.environ)
if args.host == "standalone":
cp = os.pathsep.join([str(ROOT / "designer-standalone/target/classes"),
@@ -44,11 +53,26 @@ else:
checks.parent.mkdir(parents=True)
shutil.copyfile(ROOT / "designer-kit-ui/target/designer-kit-ui-0.1.0-SNAPSHOT-tests.jar", checks)
jars = [*(args.idea_home / "lib").glob("*.jar"), *(base / "plugins").rglob("*.jar"), *(args.idea_home / "plugins/platform-problemView-plugin").rglob("*.jar")]
sources = ROOT / "integration-tests/idea"
probe = "ArchiveWorkflowProbe" if args.archiver else "WorkflowProbe"
files = [sources / "WorkflowProbe.java"]
if args.archiver:
files.append(sources / "ArchiveWorkflowProbe.java")
agent_classes = base / "agent-classes"
agent_classes.mkdir()
subprocess.run([args.java_home / "bin/javac", "-cp", os.pathsep.join(map(str,jars)), "-d", agent_classes,
sources / "ArchiveTargetProbe.java"], check=True)
agent = base / "archiver-ui-check.jar"
with zipfile.ZipFile(agent, "w") as archive:
archive.writestr("META-INF/MANIFEST.MF", "Manifest-Version: 1.0\nPremain-Class: qualification.ArchiveTargetProbe\n\n")
for item in agent_classes.rglob("*.class"):
archive.write(item, item.relative_to(agent_classes))
env["JAVA_TOOL_OPTIONS"] = env.get("JAVA_TOOL_OPTIONS", "") + f' "-javaagent:{agent}={base}"'
subprocess.run([str(args.java_home / "bin/javac"), "-cp", os.pathsep.join(map(str,jars)), "-d", str(classes),
str(ROOT / "integration-tests/idea/WorkflowProbe.java")], check=True)
*files], check=True)
meta = classes / "META-INF"
meta.mkdir()
(meta / "plugin.xml").write_text('<idea-plugin><id>de.neitzel.fxdesigner.qualification</id><name>Designer workflow qualification</name><version>1</version><vendor>Local tests</vendor><idea-version since-build="263" until-build="263.*"/><depends>com.intellij.modules.platform</depends><depends>de.neitzel.fxdesigner</depends><depends>com.intellij.problemsView</depends><extensions defaultExtensionNs="com.intellij"><postStartupActivity implementation="qualification.WorkflowProbe"/></extensions></idea-plugin>')
(meta / "plugin.xml").write_text('<idea-plugin><id>de.neitzel.fxdesigner.qualification</id><name>Designer workflow qualification</name><version>1</version><vendor>Local tests</vendor><idea-version since-build="263" until-build="263.*"/><depends>com.intellij.modules.platform</depends><depends>de.neitzel.fxdesigner</depends><depends>com.intellij.problemsView</depends><extensions defaultExtensionNs="com.intellij"><postStartupActivity implementation="qualification.'+probe+'"/></extensions></idea-plugin>')
jar = base / "plugins/qualification/lib/qualification.jar"
jar.parent.mkdir(parents=True, exist_ok=True)
subprocess.run([str(args.java_home / "bin/jar"), "cf", str(jar), "-C", str(classes), "."], check=True)