@invarn/cibuild 2.6.6 → 2.6.7
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.
|
@@ -45,14 +45,21 @@ describe('gradleJavaCeiling / gradleJavaFloor', () => {
|
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
47
|
describe('runnableJavaVersion', () => {
|
|
48
|
-
test('
|
|
48
|
+
test('stays on the default when the default covers the declaration', () => {
|
|
49
|
+
// 11 is installed, but AGP 8.x cannot run on it — a project declaring
|
|
50
|
+
// sourceCompatibility 11 must still be built on 17.
|
|
49
51
|
expect(runnableJavaVersion(11)).toBe(17);
|
|
50
52
|
expect(runnableJavaVersion(17)).toBe(17);
|
|
51
53
|
expect(runnableJavaVersion(21)).toBe(21);
|
|
52
54
|
});
|
|
53
|
-
test('defaults to the
|
|
55
|
+
test('defaults to the preferred JDK when nothing is declared', () => {
|
|
54
56
|
expect(runnableJavaVersion(undefined)).toBe(17);
|
|
55
57
|
});
|
|
58
|
+
test('steps down to 11 only when the wrapper rules the default out', () => {
|
|
59
|
+
expect(runnableJavaVersion(undefined, '5.2.1')).toBe(11);
|
|
60
|
+
expect(runnableJavaVersion(11, '5.2.1')).toBe(11);
|
|
61
|
+
expect(runnableJavaVersion(undefined, '6.9')).toBe(11);
|
|
62
|
+
});
|
|
56
63
|
test('never names a JDK no build machine has', () => {
|
|
57
64
|
expect(AVAILABLE_JAVA_VERSIONS).toContain(runnableJavaVersion(23));
|
|
58
65
|
expect(AVAILABLE_JAVA_VERSIONS).toContain(runnableJavaVersion(25, '8.9'));
|
|
@@ -67,19 +74,22 @@ describe('runnableJavaVersion', () => {
|
|
|
67
74
|
});
|
|
68
75
|
describe('javaVersionProblem', () => {
|
|
69
76
|
test('names a Gradle version no installed JDK can run', () => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
expect(problem).toContain('
|
|
77
|
+
// 4.10.2 tops out at Java 8, and no image carries 8.
|
|
78
|
+
const problem = javaVersionProblem(undefined, '4.10.2');
|
|
79
|
+
expect(problem).toContain('Gradle 4.10.2');
|
|
80
|
+
expect(problem).toContain('Java 8');
|
|
73
81
|
});
|
|
74
82
|
test('names a declaration above every installed JDK', () => {
|
|
75
83
|
const problem = javaVersionProblem(23, '8.9');
|
|
76
84
|
expect(problem).toContain('Java 23');
|
|
77
|
-
expect(problem).toContain('17 and 21');
|
|
85
|
+
expect(problem).toContain('11, 17 and 21');
|
|
78
86
|
});
|
|
79
87
|
test('is silent when every constraint was honoured', () => {
|
|
80
88
|
expect(javaVersionProblem(17, '8.9')).toBeUndefined();
|
|
81
89
|
expect(javaVersionProblem(undefined, '8.9')).toBeUndefined();
|
|
82
90
|
expect(javaVersionProblem(undefined, undefined)).toBeUndefined();
|
|
91
|
+
// 5.2.1 used to be a problem. The images carry 11 now, so it is not.
|
|
92
|
+
expect(javaVersionProblem(undefined, '5.2.1')).toBeUndefined();
|
|
83
93
|
});
|
|
84
94
|
});
|
|
85
95
|
//# sourceMappingURL=android-java-version.test.js.map
|
|
@@ -67,12 +67,26 @@ export declare function gradleJavaFloor(gradleVersion: string | undefined): numb
|
|
|
67
67
|
/**
|
|
68
68
|
* The JDKs a build machine installs, and therefore the only values the
|
|
69
69
|
* generated `set-java-version` step can satisfy.
|
|
70
|
+
*
|
|
71
|
+
* 11 joined the images on 2026-09-05, for Gradle 5.x and 6.x — which cannot
|
|
72
|
+
* *start* on 17, whatever the sources declare. It is a fallback, never a
|
|
73
|
+
* preference; see `PREFERRED_JAVA_VERSION`.
|
|
70
74
|
*/
|
|
71
75
|
export declare const AVAILABLE_JAVA_VERSIONS: number[];
|
|
72
76
|
/**
|
|
73
|
-
* The
|
|
74
|
-
*
|
|
75
|
-
*
|
|
77
|
+
* The JDK to write whenever nothing forces otherwise.
|
|
78
|
+
*
|
|
79
|
+
* This is what makes 11 safe to list. The selection below used to answer with
|
|
80
|
+
* the *lowest* usable JDK, which was harmless while the lowest was 17. With 11
|
|
81
|
+
* installed that rule would write `JAVA_VERSION: 11` for every project whose
|
|
82
|
+
* `sourceCompatibility` is 11 — and AGP 8.x will not run on JDK 11, so
|
|
83
|
+
* pipelines that build today would stop building.
|
|
84
|
+
*/
|
|
85
|
+
export declare const PREFERRED_JAVA_VERSION = 17;
|
|
86
|
+
/**
|
|
87
|
+
* The Java version to write into a generated pipeline: `PREFERRED_JAVA_VERSION`
|
|
88
|
+
* whenever it satisfies both what the sources declare and what the Gradle
|
|
89
|
+
* wrapper can run on, and the nearest available JDK that does when it cannot.
|
|
76
90
|
*
|
|
77
91
|
* Source compatibility is a floor, not an exact request — a project
|
|
78
92
|
* declaring 11 compiles fine on 17 — but it is not the only constraint.
|
|
@@ -80,8 +94,10 @@ export declare const AVAILABLE_JAVA_VERSIONS: number[];
|
|
|
80
94
|
* pinning an old Gradle caps the JDK no matter what the sources say, and a
|
|
81
95
|
* declaration above every installed JDK cannot be honoured at all.
|
|
82
96
|
*
|
|
83
|
-
* Falls back to the
|
|
84
|
-
* met, because a pipeline has to name something
|
|
97
|
+
* Falls back to the preferred JDK — not the lowest — when the constraints
|
|
98
|
+
* cannot all be met, because a pipeline has to name something and the
|
|
99
|
+
* unsatisfiable cases are overwhelmingly "declared something newer than we
|
|
100
|
+
* have", where 17 is a far better guess than 11. `javaVersionProblem` says
|
|
85
101
|
* what was given up so the caller can warn.
|
|
86
102
|
*/
|
|
87
103
|
export declare function runnableJavaVersion(detectedJavaVersion: number | undefined, gradleVersion?: string): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android-scanner.d.ts","sourceRoot":"","sources":["../../../src/commands/android-scanner.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,CAAC;AAEjD,MAAM,MAAM,eAAe,GACvB,cAAc,GACd,SAAS,GACT,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,UAAU,GACV,gBAAgB,CAAC;AAErB,MAAM,WAAW,YAAY;IAC3B,QAAQ,EA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AC,EAAE,MAAM,GACrB,MAAM,CAYR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,GAAG,SAAS,CAkBpB;AA6FD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,aAAa,CAmCxE;AAMD,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CA4PjF;AAgBD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAyD3D"}
|
|
@@ -375,12 +375,26 @@ export function gradleJavaFloor(gradleVersion) {
|
|
|
375
375
|
/**
|
|
376
376
|
* The JDKs a build machine installs, and therefore the only values the
|
|
377
377
|
* generated `set-java-version` step can satisfy.
|
|
378
|
+
*
|
|
379
|
+
* 11 joined the images on 2026-09-05, for Gradle 5.x and 6.x — which cannot
|
|
380
|
+
* *start* on 17, whatever the sources declare. It is a fallback, never a
|
|
381
|
+
* preference; see `PREFERRED_JAVA_VERSION`.
|
|
378
382
|
*/
|
|
379
|
-
export const AVAILABLE_JAVA_VERSIONS = [17, 21];
|
|
383
|
+
export const AVAILABLE_JAVA_VERSIONS = [11, 17, 21];
|
|
380
384
|
/**
|
|
381
|
-
* The
|
|
382
|
-
*
|
|
383
|
-
*
|
|
385
|
+
* The JDK to write whenever nothing forces otherwise.
|
|
386
|
+
*
|
|
387
|
+
* This is what makes 11 safe to list. The selection below used to answer with
|
|
388
|
+
* the *lowest* usable JDK, which was harmless while the lowest was 17. With 11
|
|
389
|
+
* installed that rule would write `JAVA_VERSION: 11` for every project whose
|
|
390
|
+
* `sourceCompatibility` is 11 — and AGP 8.x will not run on JDK 11, so
|
|
391
|
+
* pipelines that build today would stop building.
|
|
392
|
+
*/
|
|
393
|
+
export const PREFERRED_JAVA_VERSION = 17;
|
|
394
|
+
/**
|
|
395
|
+
* The Java version to write into a generated pipeline: `PREFERRED_JAVA_VERSION`
|
|
396
|
+
* whenever it satisfies both what the sources declare and what the Gradle
|
|
397
|
+
* wrapper can run on, and the nearest available JDK that does when it cannot.
|
|
384
398
|
*
|
|
385
399
|
* Source compatibility is a floor, not an exact request — a project
|
|
386
400
|
* declaring 11 compiles fine on 17 — but it is not the only constraint.
|
|
@@ -388,23 +402,36 @@ export const AVAILABLE_JAVA_VERSIONS = [17, 21];
|
|
|
388
402
|
* pinning an old Gradle caps the JDK no matter what the sources say, and a
|
|
389
403
|
* declaration above every installed JDK cannot be honoured at all.
|
|
390
404
|
*
|
|
391
|
-
* Falls back to the
|
|
392
|
-
* met, because a pipeline has to name something
|
|
405
|
+
* Falls back to the preferred JDK — not the lowest — when the constraints
|
|
406
|
+
* cannot all be met, because a pipeline has to name something and the
|
|
407
|
+
* unsatisfiable cases are overwhelmingly "declared something newer than we
|
|
408
|
+
* have", where 17 is a far better guess than 11. `javaVersionProblem` says
|
|
393
409
|
* what was given up so the caller can warn.
|
|
394
410
|
*/
|
|
395
411
|
export function runnableJavaVersion(detectedJavaVersion, gradleVersion) {
|
|
396
|
-
const lowest = Math.min(...AVAILABLE_JAVA_VERSIONS);
|
|
397
412
|
const ceiling = gradleJavaCeiling(gradleVersion) ?? Infinity;
|
|
398
413
|
const floor = Math.max(detectedJavaVersion ?? 0, gradleJavaFloor(gradleVersion) ?? 0);
|
|
399
414
|
const usable = AVAILABLE_JAVA_VERSIONS.filter((v) => v >= floor && v <= ceiling).sort((a, b) => a - b);
|
|
400
|
-
|
|
415
|
+
if (usable.length === 0)
|
|
416
|
+
return PREFERRED_JAVA_VERSION;
|
|
417
|
+
if (usable.includes(PREFERRED_JAVA_VERSION))
|
|
418
|
+
return PREFERRED_JAVA_VERSION;
|
|
419
|
+
// Forced off the default: below it take the newest that fits under the
|
|
420
|
+
// ceiling, above it the oldest that clears the floor.
|
|
421
|
+
const below = usable.filter((v) => v < PREFERRED_JAVA_VERSION);
|
|
422
|
+
return below.length > 0 ? below[below.length - 1] : usable[0];
|
|
401
423
|
}
|
|
402
424
|
/**
|
|
403
425
|
* What `runnableJavaVersion` could not honour, as a sentence, or undefined
|
|
404
426
|
* when it honoured everything.
|
|
405
427
|
*/
|
|
406
428
|
export function javaVersionProblem(detectedJavaVersion, gradleVersion) {
|
|
407
|
-
|
|
429
|
+
// "11, 17 and 21", not "11 and 17 and 21" — a human reads this next to a
|
|
430
|
+
// build that will not start.
|
|
431
|
+
const sorted = [...AVAILABLE_JAVA_VERSIONS].sort((a, b) => a - b);
|
|
432
|
+
const installed = sorted.length > 1
|
|
433
|
+
? `${sorted.slice(0, -1).join(", ")} and ${sorted[sorted.length - 1]}`
|
|
434
|
+
: String(sorted[0]);
|
|
408
435
|
const ceiling = gradleJavaCeiling(gradleVersion);
|
|
409
436
|
const lowest = Math.min(...AVAILABLE_JAVA_VERSIONS);
|
|
410
437
|
if (ceiling !== undefined && ceiling < lowest) {
|