cyclops-clientdevbridge-cli 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/LICENSE +21 -0
  3. package/README.md +218 -0
  4. package/dist/artifacts.d.ts +56 -0
  5. package/dist/artifacts.d.ts.map +1 -0
  6. package/dist/artifacts.js +58 -0
  7. package/dist/artifacts.js.map +1 -0
  8. package/dist/cli.d.ts +3 -0
  9. package/dist/cli.d.ts.map +1 -0
  10. package/dist/cli.js +348 -0
  11. package/dist/cli.js.map +1 -0
  12. package/dist/commands/compare.d.ts +27 -0
  13. package/dist/commands/compare.d.ts.map +1 -0
  14. package/dist/commands/compare.js +209 -0
  15. package/dist/commands/compare.js.map +1 -0
  16. package/dist/commands/context.d.ts +25 -0
  17. package/dist/commands/context.d.ts.map +1 -0
  18. package/dist/commands/context.js +36 -0
  19. package/dist/commands/context.js.map +1 -0
  20. package/dist/commands/doctor.d.ts +31 -0
  21. package/dist/commands/doctor.d.ts.map +1 -0
  22. package/dist/commands/doctor.js +234 -0
  23. package/dist/commands/doctor.js.map +1 -0
  24. package/dist/commands/hotswap.d.ts +7 -0
  25. package/dist/commands/hotswap.d.ts.map +1 -0
  26. package/dist/commands/hotswap.js +76 -0
  27. package/dist/commands/hotswap.js.map +1 -0
  28. package/dist/commands/input.d.ts +53 -0
  29. package/dist/commands/input.d.ts.map +1 -0
  30. package/dist/commands/input.js +204 -0
  31. package/dist/commands/input.js.map +1 -0
  32. package/dist/commands/inspect.d.ts +19 -0
  33. package/dist/commands/inspect.d.ts.map +1 -0
  34. package/dist/commands/inspect.js +90 -0
  35. package/dist/commands/inspect.js.map +1 -0
  36. package/dist/commands/lifecycle.d.ts +29 -0
  37. package/dist/commands/lifecycle.d.ts.map +1 -0
  38. package/dist/commands/lifecycle.js +201 -0
  39. package/dist/commands/lifecycle.js.map +1 -0
  40. package/dist/commands/snapshot.d.ts +37 -0
  41. package/dist/commands/snapshot.d.ts.map +1 -0
  42. package/dist/commands/snapshot.js +133 -0
  43. package/dist/commands/snapshot.js.map +1 -0
  44. package/dist/commands/world.d.ts +27 -0
  45. package/dist/commands/world.d.ts.map +1 -0
  46. package/dist/commands/world.js +203 -0
  47. package/dist/commands/world.js.map +1 -0
  48. package/dist/detect.d.ts +58 -0
  49. package/dist/detect.d.ts.map +1 -0
  50. package/dist/detect.js +185 -0
  51. package/dist/detect.js.map +1 -0
  52. package/dist/errors.d.ts +24 -0
  53. package/dist/errors.d.ts.map +1 -0
  54. package/dist/errors.js +37 -0
  55. package/dist/errors.js.map +1 -0
  56. package/dist/hotswap.d.ts +58 -0
  57. package/dist/hotswap.d.ts.map +1 -0
  58. package/dist/hotswap.js +284 -0
  59. package/dist/hotswap.js.map +1 -0
  60. package/dist/index.d.ts +11 -0
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/index.js +11 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/initscript.d.ts +49 -0
  65. package/dist/initscript.d.ts.map +1 -0
  66. package/dist/initscript.js +202 -0
  67. package/dist/initscript.js.map +1 -0
  68. package/dist/java.d.ts +47 -0
  69. package/dist/java.d.ts.map +1 -0
  70. package/dist/java.js +114 -0
  71. package/dist/java.js.map +1 -0
  72. package/dist/launcher.d.ts +104 -0
  73. package/dist/launcher.d.ts.map +1 -0
  74. package/dist/launcher.js +609 -0
  75. package/dist/launcher.js.map +1 -0
  76. package/dist/loopback.d.ts +17 -0
  77. package/dist/loopback.d.ts.map +1 -0
  78. package/dist/loopback.js +19 -0
  79. package/dist/loopback.js.map +1 -0
  80. package/dist/output.d.ts +21 -0
  81. package/dist/output.d.ts.map +1 -0
  82. package/dist/output.js +41 -0
  83. package/dist/output.js.map +1 -0
  84. package/dist/paths.d.ts +23 -0
  85. package/dist/paths.d.ts.map +1 -0
  86. package/dist/paths.js +47 -0
  87. package/dist/paths.js.map +1 -0
  88. package/dist/protocol/client.d.ts +35 -0
  89. package/dist/protocol/client.d.ts.map +1 -0
  90. package/dist/protocol/client.js +170 -0
  91. package/dist/protocol/client.js.map +1 -0
  92. package/dist/protocol/types.d.ts +114 -0
  93. package/dist/protocol/types.d.ts.map +1 -0
  94. package/dist/protocol/types.js +38 -0
  95. package/dist/protocol/types.js.map +1 -0
  96. package/dist/session.d.ts +77 -0
  97. package/dist/session.d.ts.map +1 -0
  98. package/dist/session.js +79 -0
  99. package/dist/session.js.map +1 -0
  100. package/dist/snapshot/model.d.ts +327 -0
  101. package/dist/snapshot/model.d.ts.map +1 -0
  102. package/dist/snapshot/model.js +91 -0
  103. package/dist/snapshot/model.js.map +1 -0
  104. package/dist/snapshot/outline.d.ts +35 -0
  105. package/dist/snapshot/outline.d.ts.map +1 -0
  106. package/dist/snapshot/outline.js +135 -0
  107. package/dist/snapshot/outline.js.map +1 -0
  108. package/dist/xvfb.d.ts +30 -0
  109. package/dist/xvfb.d.ts.map +1 -0
  110. package/dist/xvfb.js +66 -0
  111. package/dist/xvfb.js.map +1 -0
  112. package/package.json +66 -0
@@ -0,0 +1,202 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ import { coordinate, GROOVY_DEPENDENCY, GROUP, releasesMavenUrl } from './artifacts.js';
4
+ function groovyString(value) {
5
+ return `'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`;
6
+ }
7
+ /**
8
+ * Generates the init script the CLI injects at launch, so that a consumer repository never has to
9
+ * be edited to be driveable (plan §4).
10
+ *
11
+ * The run task is configured through `JavaExec` rather than through Loom's or NeoGradle's own run
12
+ * DSL: both plugins' `runClient` tasks are `JavaExec` subclasses, so one code path covers both
13
+ * loaders and does not break when either plugin reshuffles its extensions.
14
+ */
15
+ export function renderInitScript(options) {
16
+ const dependency = coordinate(options.minecraftVersion, options.loader, options.bridgeVersion);
17
+ const jvmArgs = [
18
+ '-Dclientdevbridge.enabled=true',
19
+ `-Dclientdevbridge.port=${options.port}`,
20
+ `-Dclientdevbridge.projectDir=${options.projectDir}`,
21
+ ...(options.evalEnabled ? ['-Dclientdevbridge.eval=true'] : []),
22
+ ...(options.jdwpPort === null
23
+ ? []
24
+ : [`-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:${options.jdwpPort}`]),
25
+ ...(options.extraJvmArgs ?? []),
26
+ ];
27
+ const programArgs = [
28
+ '--username',
29
+ options.username,
30
+ '--width',
31
+ String(options.width),
32
+ '--height',
33
+ String(options.height),
34
+ ...(options.world === null ? [] : ['--quickPlaySingleplayer', options.world]),
35
+ ];
36
+ return `// Generated by clientdevbridge-cli. Regenerated on every 'clientdevbridge start'; do not edit.
37
+ // It injects the ClientDevBridge mod into an unmodified consumer checkout and pins the
38
+ // determinism settings the screenshot comparisons depend on.
39
+
40
+ def clientDevBridgeDependency = ${groovyString(dependency)}
41
+ // The eval escape hatch reaches Groovy through javax.script. It is added here rather than left to
42
+ // transitive resolution because the Cyclops publishing convention emits artifact-only POMs, so the
43
+ // published module carries no dependency metadata for a consumer to resolve.
44
+ def clientDevBridgeGroovy = ${groovyString(GROOVY_DEPENDENCY)}
45
+ // Only the module being launched is touched. A multiloader repo configures every loader module in
46
+ // the same build, and injecting into the ones that are not being run is at best pointless: on the
47
+ // Minecraft 26 toolchain, adding a dependency to Loom's project makes it set Minecraft up before
48
+ // its own mappings configuration is populated, which fails the whole build with an error that
49
+ // names neither this script nor the module it came from.
50
+ def clientDevBridgeTarget = ${groovyString(options.targetProjectPath)}
51
+ def clientDevBridgeJvmArgs = [
52
+ ${jvmArgs.map((arg) => ` ${groovyString(arg)}`).join(',\n')}
53
+ ]
54
+ def clientDevBridgeProgramArgs = [
55
+ ${programArgs.map((arg) => ` ${groovyString(arg)}`).join(',\n')}
56
+ ]
57
+
58
+ allprojects { project ->
59
+ // Nothing at all is done to the modules that are not being launched. Adding even a repository
60
+ // to Loom's project is enough to change how it resolves its own mappings.
61
+ if (project.path != clientDevBridgeTarget) {
62
+ return
63
+ }
64
+
65
+ // Both repositories are restricted to ClientDevBridge's own group. Adding an unfiltered
66
+ // repository to somebody else's build is a real hazard -- mavenLocal in particular will shadow
67
+ // any dependency a stale local build happens to have -- and this script has no business
68
+ // affecting how the project resolves anything but the bridge.
69
+ project.repositories {
70
+ // mavenLocal first, so that a developer working on ClientDevBridge itself picks up
71
+ // their own './gradlew publishToMavenLocal' build ahead of any released one.
72
+ mavenLocal {
73
+ content { includeGroup ${groovyString(GROUP)} }
74
+ }
75
+ maven {
76
+ name = 'ClientDevBridge releases'
77
+ // A static Maven repository served by GitHub Pages. No credentials block, and that is
78
+ // the point: the CyclopsMC GitHub Packages Maven needs a token even for public
79
+ // packages, so a consumer would have to set one up before they could launch a client.
80
+ url = ${groovyString(releasesMavenUrl())}
81
+ content { includeGroup ${groovyString(GROUP)} }
82
+ }
83
+ }
84
+
85
+ ${options.loader === 'fabric'
86
+ ? ` // Which configuration a runtime mod belongs in differs between Loom generations -- 1.15
87
+ // dropped modLocalRuntime -- so the name is looked up rather than assumed. That keeps this
88
+ // working across Minecraft versions without the CLI tracking each toolchain's configuration
89
+ // names on top of everything else it already has to know.
90
+ def firstExisting = { String... names ->
91
+ for (String candidate : names) {
92
+ if (project.configurations.findByName(candidate) != null) {
93
+ return candidate
94
+ }
95
+ }
96
+ return 'runtimeOnly'
97
+ }
98
+ `
99
+ : ''}
100
+ // Which loader this is comes from the CLI, which already had to decide before it could pick the
101
+ // artifact to inject. Asking Gradle instead is not free: registering a
102
+ // plugins.withId('net.fabricmc.fabric-loom') callback -- even an empty one -- is enough to make
103
+ // Loom 1.15 set Minecraft up before the build script's dependencies { } block has run, and the
104
+ // build dies with "Configuration 'mappings' has no dependencies", naming neither this script
105
+ // nor what it did.
106
+ //
107
+ // The additions are deferred to afterEvaluate for a related reason: adding to a Loom-managed
108
+ // configuration while the build script is still being evaluated has the same effect.
109
+ project.afterEvaluate {
110
+ ${options.loader === 'fabric'
111
+ ? ` project.dependencies.add(firstExisting('modLocalRuntime', 'localRuntime', 'runtimeOnly'),
112
+ clientDevBridgeDependency)
113
+ // Groovy is a plain library, not a mod, so it must never go through Loom's remapping.
114
+ project.dependencies.add('runtimeOnly', clientDevBridgeGroovy)`
115
+ : ` // NeoGradle and ModDevGradle both discover mods from the runtime classpath directly,
116
+ // and ModDevGradle 2 rejects additionalRuntimeClasspath outright, telling callers to
117
+ // use a standard configuration instead.
118
+ project.dependencies.add('runtimeOnly', clientDevBridgeDependency)
119
+ project.dependencies.add('runtimeOnly', clientDevBridgeGroovy)`}
120
+ }
121
+
122
+ project.tasks.matching { it.name == 'runClient' }.configureEach { task ->
123
+ if (task instanceof JavaExec) {
124
+ task.jvmArgs(clientDevBridgeJvmArgs)
125
+ // Program arguments go through an argument provider rather than args(). Gradle emits
126
+ // every static argument before every provider's, and ModDevGradle passes the real main
127
+ // class through a provider -- so appending statically puts our first argument ahead of
128
+ // it, and the launcher tries to load '--username' as the main class. Registering a
129
+ // provider last keeps ours genuinely last.
130
+ task.argumentProviders.add({ clientDevBridgeProgramArgs } as org.gradle.process.CommandLineArgumentProvider)
131
+ } else {
132
+ project.logger.warn("ClientDevBridge: task \${task.path} is not a JavaExec, so its JVM arguments were not set. " +
133
+ 'Report this with the loader and plugin versions at https://github.com/CyclopsMC/clientdevbridge-cli/issues')
134
+ }
135
+ }
136
+ }
137
+ `;
138
+ }
139
+ /**
140
+ * The client options that make screenshots reproducible from one run to the next.
141
+ *
142
+ * Anything that animates, adapts to the machine, or depends on focus is turned off; without this,
143
+ * `compare` against a golden image is noise.
144
+ */
145
+ export const DETERMINISM_OPTIONS = {
146
+ guiScale: '2',
147
+ pauseOnLostFocus: 'false',
148
+ enableVsync: 'false',
149
+ maxFps: '60',
150
+ renderClouds: '"false"',
151
+ particles: '2',
152
+ ao: 'false',
153
+ entityShadows: 'false',
154
+ bobView: 'false',
155
+ fov: '0.0',
156
+ gamma: '0.0',
157
+ darkMojangStudiosBackground: 'true',
158
+ narrator: '0',
159
+ soundCategory_master: '0.0',
160
+ tutorialStep: 'none',
161
+ skipMultiplayerWarning: 'true',
162
+ onboardAccessibility: 'false',
163
+ fullscreen: 'false',
164
+ };
165
+ /**
166
+ * Writes the determinism options into the run directory's `options.txt`.
167
+ *
168
+ * Keys the caller did not ask about are preserved, so a hand-tuned dev options file survives.
169
+ */
170
+ export function pinOptions(runDir) {
171
+ const optionsFile = path.join(runDir, 'options.txt');
172
+ fs.mkdirSync(runDir, { recursive: true });
173
+ const existing = new Map();
174
+ const order = [];
175
+ const created = !fs.existsSync(optionsFile);
176
+ if (!created) {
177
+ for (const line of fs.readFileSync(optionsFile, 'utf8').split('\n')) {
178
+ const separator = line.indexOf(':');
179
+ if (separator > 0) {
180
+ const key = line.slice(0, separator);
181
+ existing.set(key, line.slice(separator + 1));
182
+ order.push(key);
183
+ }
184
+ }
185
+ }
186
+ const changed = [];
187
+ for (const [key, value] of Object.entries(DETERMINISM_OPTIONS)) {
188
+ if (existing.get(key) !== value) {
189
+ if (existing.has(key)) {
190
+ changed.push(key);
191
+ }
192
+ else {
193
+ order.push(key);
194
+ }
195
+ existing.set(key, value);
196
+ }
197
+ }
198
+ const rendered = order.map((key) => `${key}:${existing.get(key)}`).join('\n');
199
+ fs.writeFileSync(optionsFile, `${rendered}\n`, 'utf8');
200
+ return { created, changed };
201
+ }
202
+ //# sourceMappingURL=initscript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initscript.js","sourceRoot":"","sources":["../src/initscript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAyBxF,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CA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AAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9E,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,GAAG,QAAQ,IAAI,EAAE,MAAM,CAAC,CAAC;IACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
package/dist/java.d.ts ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Finding the JDK Gradle will run on.
3
+ *
4
+ * This matters more than it looks like it should. The loader plugins check the JDK *Gradle itself*
5
+ * is running on, not the toolchain: Loom refuses to configure a Minecraft 26 project when Gradle
6
+ * runs on Java 21, with an error that arrives during configuration and never mentions JAVA_HOME.
7
+ * And Gradle takes that JDK from `JAVA_HOME`, not from `java` on the PATH, so a machine with a
8
+ * newer `java` first on the PATH and an older `JAVA_HOME` looks fine and is not.
9
+ */
10
+ export interface JavaProbe {
11
+ /** The JDK's home directory, or null when it was found on the PATH with no home to name. */
12
+ readonly home: string | null;
13
+ readonly major: number | null;
14
+ /** Human-readable first line of `java -version`, for reporting. */
15
+ readonly versionLine: string | null;
16
+ /** Where this JDK came from, e.g. `JAVA_HOME` or `PATH`. */
17
+ readonly source: string;
18
+ }
19
+ export declare function javaBinary(home: string | null): string;
20
+ /** Runs `java -version` and reads the major version out of it. */
21
+ export declare function probeJava(home: string | null, source: string): JavaProbe;
22
+ /** The JDK Gradle would use with no help: `JAVA_HOME` when set, the PATH otherwise. */
23
+ export declare function gradleJava(): JavaProbe;
24
+ /**
25
+ * Looks for an installed JDK of at least `requiredMajor`, preferring the lowest version that
26
+ * qualifies: a mod that asks for Java 21 is built and tested on 21, and running Gradle on a much
27
+ * newer JDK than the project expects trades one class of surprise for another.
28
+ *
29
+ * @return the JDK's home directory, or null when the machine has none
30
+ */
31
+ export declare function findJavaHome(requiredMajor: number): JavaProbe | null;
32
+ export interface JavaResolution {
33
+ /** What Gradle should be run with; null means "leave the environment alone". */
34
+ readonly javaHome: string | null;
35
+ readonly probe: JavaProbe;
36
+ /** Set when the environment's own JDK was too old and another one was found. */
37
+ readonly substituted: boolean;
38
+ }
39
+ /**
40
+ * Decides which JDK to run Gradle on.
41
+ *
42
+ * The environment's own choice wins whenever it is new enough — a developer who set `JAVA_HOME`
43
+ * meant it. Only when it would fail outright does this go looking, and the caller says so rather
44
+ * than silently running on a JDK nobody asked for.
45
+ */
46
+ export declare function resolveJavaHome(requiredMajor: number): JavaResolution;
47
+ //# sourceMappingURL=java.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"java.d.ts","sourceRoot":"","sources":["../src/java.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AAEH,MAAM,WAAW,SAAS;IACxB,4FAA4F;IAC5F,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEtD;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAexE;AAED,uFAAuF;AACvF,wBAAgB,UAAU,IAAI,SAAS,CAKtC;AA2CD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAkBpE;AAED,MAAM,WAAW,cAAc;IAC7B,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,cAAc,CAUrE"}
package/dist/java.js ADDED
@@ -0,0 +1,114 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import * as fs from 'node:fs';
3
+ import * as os from 'node:os';
4
+ import * as path from 'node:path';
5
+ export function javaBinary(home) {
6
+ return home === null ? 'java' : path.join(home, 'bin', process.platform === 'win32' ? 'java.exe' : 'java');
7
+ }
8
+ /** Runs `java -version` and reads the major version out of it. */
9
+ export function probeJava(home, source) {
10
+ // `java -version` reports on stderr, and some environments prepend a JAVA_TOOL_OPTIONS notice,
11
+ // so both streams are read and searched rather than just stdout.
12
+ const probe = spawnSync(javaBinary(home), ['-version'], { encoding: 'utf8' });
13
+ const output = `${probe.stdout ?? ''}\n${probe.stderr ?? ''}`;
14
+ const versionLine = output
15
+ .split('\n')
16
+ .map((entry) => entry.trim())
17
+ .find((entry) => entry.includes('version "')) ?? null;
18
+ const match = /version "(\d+)(?:\.(\d+))?/.exec(output);
19
+ // Java 8 and older report `1.8.0`; the major version is the second component there.
20
+ const major = match === null ? null : Number(match[1]) === 1 ? Number(match[2] ?? '0') : Number(match[1]);
21
+ return { home, major: Number.isNaN(major) ? null : major, versionLine, source };
22
+ }
23
+ /** The JDK Gradle would use with no help: `JAVA_HOME` when set, the PATH otherwise. */
24
+ export function gradleJava() {
25
+ const home = process.env['JAVA_HOME'];
26
+ return home === undefined || home.length === 0
27
+ ? probeJava(null, 'PATH')
28
+ : probeJava(home, 'JAVA_HOME');
29
+ }
30
+ /**
31
+ * Directories that conventionally hold one JDK each. Deliberately a short list of the layouts a
32
+ * mod developer's machine actually has, rather than a filesystem search.
33
+ */
34
+ function candidateRoots() {
35
+ const home = os.homedir();
36
+ return [
37
+ '/usr/lib/jvm',
38
+ '/usr/java',
39
+ path.join(home, '.sdkman', 'candidates', 'java'),
40
+ path.join(home, '.gradle', 'jdks'),
41
+ '/Library/Java/JavaVirtualMachines',
42
+ 'C:\\Program Files\\Java',
43
+ 'C:\\Program Files\\Eclipse Adoptium',
44
+ ];
45
+ }
46
+ function javaHomesIn(root) {
47
+ let entries;
48
+ try {
49
+ entries = fs.readdirSync(root, { withFileTypes: true });
50
+ }
51
+ catch {
52
+ return [];
53
+ }
54
+ const homes = [];
55
+ for (const entry of entries) {
56
+ if (!entry.isDirectory() && !entry.isSymbolicLink()) {
57
+ continue;
58
+ }
59
+ const base = path.join(root, entry.name);
60
+ // macOS buries the home one level down; everywhere else the directory is the home.
61
+ for (const candidate of [base, path.join(base, 'Contents', 'Home')]) {
62
+ if (fs.existsSync(javaBinary(candidate))) {
63
+ homes.push(candidate);
64
+ break;
65
+ }
66
+ }
67
+ }
68
+ return homes;
69
+ }
70
+ /**
71
+ * Looks for an installed JDK of at least `requiredMajor`, preferring the lowest version that
72
+ * qualifies: a mod that asks for Java 21 is built and tested on 21, and running Gradle on a much
73
+ * newer JDK than the project expects trades one class of surprise for another.
74
+ *
75
+ * @return the JDK's home directory, or null when the machine has none
76
+ */
77
+ export function findJavaHome(requiredMajor) {
78
+ const found = [];
79
+ const seen = new Set();
80
+ for (const root of candidateRoots()) {
81
+ for (const home of javaHomesIn(root)) {
82
+ const real = fs.existsSync(home) ? fs.realpathSync(home) : home;
83
+ if (seen.has(real)) {
84
+ continue;
85
+ }
86
+ seen.add(real);
87
+ const probe = probeJava(home, root);
88
+ if (probe.major !== null && probe.major >= requiredMajor) {
89
+ found.push(probe);
90
+ }
91
+ }
92
+ }
93
+ found.sort((left, right) => (left.major ?? 0) - (right.major ?? 0));
94
+ return found[0] ?? null;
95
+ }
96
+ /**
97
+ * Decides which JDK to run Gradle on.
98
+ *
99
+ * The environment's own choice wins whenever it is new enough — a developer who set `JAVA_HOME`
100
+ * meant it. Only when it would fail outright does this go looking, and the caller says so rather
101
+ * than silently running on a JDK nobody asked for.
102
+ */
103
+ export function resolveJavaHome(requiredMajor) {
104
+ const current = gradleJava();
105
+ if (current.major !== null && current.major >= requiredMajor) {
106
+ return { javaHome: current.home, probe: current, substituted: false };
107
+ }
108
+ const found = findJavaHome(requiredMajor);
109
+ if (found === null || found.home === null) {
110
+ return { javaHome: current.home, probe: current, substituted: false };
111
+ }
112
+ return { javaHome: found.home, probe: found, substituted: true };
113
+ }
114
+ //# sourceMappingURL=java.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"java.js","sourceRoot":"","sources":["../src/java.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAsBlC,MAAM,UAAU,UAAU,CAAC,IAAmB;IAC5C,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAC7G,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,SAAS,CAAC,IAAmB,EAAE,MAAc;IAC3D,+FAA+F;IAC/F,iEAAiE;IACjE,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAC9E,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,IAAI,EAAE,KAAK,KAAK,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;IAC9D,MAAM,WAAW,GACf,MAAM;SACH,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,KAAK,EAAE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AAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AACnE,CAAC"}
@@ -0,0 +1,104 @@
1
+ import { type Loader } from './detect.js';
2
+ import { type Session } from './session.js';
3
+ export declare const DEFAULT_PORT = 25599;
4
+ export declare const DEFAULT_WIDTH = 854;
5
+ export declare const DEFAULT_HEIGHT = 480;
6
+ export declare const DEFAULT_USERNAME = "ClientDevBridge";
7
+ export interface StartOptions {
8
+ readonly projectDir: string;
9
+ readonly loader?: Loader | undefined;
10
+ readonly minecraftVersion?: string | undefined;
11
+ readonly bridgeVersion?: string | undefined;
12
+ readonly world?: string | undefined;
13
+ readonly headed: boolean;
14
+ readonly port: number;
15
+ readonly timeoutMs: number;
16
+ readonly gradleArgs: readonly string[];
17
+ readonly width: number;
18
+ readonly height: number;
19
+ readonly evalEnabled: boolean;
20
+ readonly pinOptions: boolean;
21
+ readonly jdwpPort: number | null;
22
+ readonly onProgress?: (line: string) => void;
23
+ }
24
+ /**
25
+ * Best-effort identification of whatever holds a port, for the orphaned-client message.
26
+ * Returns null when the platform has no tool for it; this is a nicety, never a requirement.
27
+ */
28
+ /**
29
+ * Removes Loom's cached *remapped* copy of the bridge mod.
30
+ *
31
+ * Loom remaps every mod on the dev runtime classpath and caches the result keyed by group,
32
+ * artifact and version. A local build republished under the same version (`1.0.0-DEV`, say) is
33
+ * therefore never re-read: the client silently keeps running the previous build, which looks
34
+ * exactly like the new code having no effect. NeoGradle uses the jar directly and does not have
35
+ * this problem, so it only ever bites on Fabric — and only while developing ClientDevBridge
36
+ * itself, which is precisely when it is most confusing.
37
+ *
38
+ * Only local builds are affected: a released version is immutable, so its cache entry is correct.
39
+ */
40
+ export declare function clearLoomRemapCache(projectDir: string, minecraftVersion: string, loader: Loader): string[];
41
+ /**
42
+ * Asks whatever is listening on the bridge port who it is.
43
+ *
44
+ * A client on the port is not automatically an orphan: a mod developer with two checkouts open
45
+ * hits this constantly, and telling them to `kill` a perfectly healthy client of their own is bad
46
+ * advice given confidently. A ClientDevBridge client answers with the project it belongs to.
47
+ */
48
+ export declare function describeBridgeOnPort(port: number): Promise<{
49
+ projectDir: string | null;
50
+ mcVersion: string;
51
+ loader: string;
52
+ } | null>;
53
+ /** What to tell someone whose bridge port is already taken. */
54
+ export declare function hintForOccupiedPort(port: number, owner: string | null, bridge: {
55
+ projectDir: string | null;
56
+ mcVersion: string;
57
+ loader: string;
58
+ } | null, thisProject: string): string;
59
+ export declare function describePortOwner(port: number): string | null;
60
+ /**
61
+ * Whether nothing is listening on this port, on any loopback address.
62
+ *
63
+ * Both families are probed because a client can be on either -- see LOOPBACK_HOSTS. Treating a
64
+ * client on ::1 as "the port is free" is the worst of the two errors: `start` would launch a
65
+ * second one and then wait out its whole timeout for the first.
66
+ */
67
+ export declare function isPortFree(port: number): Promise<boolean>;
68
+ /**
69
+ * Launches a client and waits until it answers the handshake.
70
+ *
71
+ * The process is detached into its own group so it survives this short-lived CLI invocation;
72
+ * `stop` later kills the whole group, which is what actually reaps Gradle's forked JVM.
73
+ */
74
+ export declare function start(options: StartOptions): Promise<{
75
+ session: Session;
76
+ hello: unknown;
77
+ }>;
78
+ export declare function newestInMavenLocal(minecraftVersion: string, loader: Loader): string | null;
79
+ /**
80
+ * Asks the client JVM to print every thread's stack into the game log.
81
+ *
82
+ * SIGQUIT makes a JVM dump its threads to its own stdout, which the launcher is already capturing
83
+ * into gradle.log -- so the evidence ends up in the file the error message points at, with no
84
+ * debugger and no second run.
85
+ *
86
+ * Only the client JVM is signalled, located by the system property that launched it. Signalling
87
+ * the process group instead would reach xvfb-run and Xvfb, for which SIGQUIT is fatal: that would
88
+ * take the display down and destroy the very evidence being collected.
89
+ *
90
+ * @return whether a dump was requested from at least one process
91
+ */
92
+ export declare function requestThreadDump(): Promise<boolean>;
93
+ export declare function tailFile(file: string, lines: number): string;
94
+ /** Reads at most the last {@link GRADLE_LOG_MAX_BYTES} of a file, so a huge log cannot blow up memory. */
95
+ export declare function readTruncated(file: string): string;
96
+ /**
97
+ * Kills the whole process group, so Gradle, xvfb-run, and the forked client JVM all go together.
98
+ */
99
+ export declare function stop(projectDir: string, port?: number): Promise<{
100
+ stopped: boolean;
101
+ wasStale: boolean;
102
+ orphan: string | null;
103
+ }>;
104
+ //# sourceMappingURL=launcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAOA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAA6C,KAAK,OAAO,EAAgB,MAAM,cAAc,CAAC;AAKrG,eAAO,MAAM,YAAY,QAAQ,CAAC;AAClC,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AAKlD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MA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