#!/usr/bin/env python3 """Create a fresh editable development fixture and explicit local host setup.""" import argparse import json from pathlib import Path import shutil ROOT = Path(__file__).resolve().parent.parent parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--destination", type=Path, required=True) parser.add_argument("--target-java-home", type=Path, required=True) parser.add_argument("--mode", choices=["classpath", "modulepath"], default="classpath") args = parser.parse_args() destination = args.destination.resolve() shutil.copytree(ROOT / "integration-fixtures/preview" / args.mode, destination, ignore=shutil.ignore_patterns("target")) local = destination / ".neitzel-fx-designer" local.mkdir() (local / "runtimes.json").write_text(json.dumps({"schemaVersion":"1.0","runtimes":{"java21":{"build":str(args.target_java_home.resolve()),"target":str(args.target_java_home.resolve())}}})) tools = [ROOT / ("designer-" + name) / "target" / ("designer-" + name + "-0.1.0-SNAPSHOT.jar") for name in ("target-tools","contracts","preview-api")] # Properties separators in values do not need escaping; double backslashes do. def prop(value): return str(value).replace("\\", "\\\\") (local / "host.properties").write_text( "configuration=../neitzel-fx-designer.json\ncontext=fixture\nsettings=runtimes.json\n" + "maven=" + prop(ROOT / "mvnw") + "\ntools=" + ":".join(map(prop, tools)) + "\n") print(local / "host.properties") print(destination / "app/src/main/resources/fixture/components/Person.fxml")