mirror of
https://github.com/actions/setup-java.git
synced 2026-10-31 10:34:57 +01:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cd57eb681 | ||
|
|
816722acf8 |
No files matched your search
@@ -175,94 +175,6 @@ jobs:
|
||||
throw "settings.xml file is not found in expected location"
|
||||
}
|
||||
|
||||
test-maven-mirrors:
|
||||
name: Maven mirrors (${{ matrix.mirror-of }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
mirror-of: ['*', 'external:*']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure Maven mirrors without repository inputs
|
||||
uses: $/
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
settings-path: ${{ runner.temp }}/maven-mirror-test
|
||||
mvn-server-credentials: |
|
||||
private:PRIVATE_USERNAME:PRIVATE_TOKEN
|
||||
mvn-mirrors: |
|
||||
private:https://mirror.example.invalid/maven:${{ matrix.mirror-of }}
|
||||
- name: Validate generated settings and Maven mirror selection
|
||||
env:
|
||||
MIRROR_OF: ${{ matrix.mirror-of }}
|
||||
PRIVATE_USERNAME: mirror-test-user
|
||||
PRIVATE_TOKEN: mirror-test-token
|
||||
run: |
|
||||
$directory = Join-Path $env:RUNNER_TEMP "maven-mirror-test"
|
||||
$settingsPath = Join-Path $directory "settings.xml"
|
||||
[xml]$settings = Get-Content -Path $settingsPath -Raw
|
||||
$mirrors = @($settings.settings.mirrors.mirror)
|
||||
if ($mirrors.Count -ne 1 -or $mirrors[0].id -ne "private" -or $mirrors[0].url -ne "https://mirror.example.invalid/maven" -or $mirrors[0].mirrorOf -ne $env:MIRROR_OF) {
|
||||
throw "Incorrect generated mirror"
|
||||
}
|
||||
if ($settings.settings.profiles -or $settings.settings.activeProfiles) {
|
||||
throw "Mirror-only settings must not add repository profiles"
|
||||
}
|
||||
$server = $settings.settings.servers.server
|
||||
if ($server.id -ne "private" -or $server.username -ne '${env.PRIVATE_USERNAME}' -or $server.password -ne '${env.PRIVATE_TOKEN}') {
|
||||
throw "Mirror credentials were not preserved"
|
||||
}
|
||||
|
||||
$pomPath = Join-Path $directory "pom.xml"
|
||||
@'
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>setup-java.test</groupId>
|
||||
<artifactId>mirror-settings</artifactId>
|
||||
<version>1.0</version>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>pom-dependencies</id>
|
||||
<url>https://dependencies.example.invalid/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>pom-plugins</id>
|
||||
<url>https://plugins.example.invalid/maven</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
||||
'@ | Set-Content -Path $pomPath
|
||||
|
||||
# validate requires no plugins or dependencies, so mirror selection can
|
||||
# be inspected offline without contacting the deliberately invalid URLs.
|
||||
$output = & mvn --batch-mode --no-transfer-progress --offline --debug `
|
||||
--settings $settingsPath --file $pomPath `
|
||||
"-Dmaven.repo.local=$directory/repository" validate 2>&1
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Could not inspect Maven mirror selection: $output"
|
||||
}
|
||||
$log = $output -join "`n"
|
||||
foreach ($id in @("central", "pom-dependencies")) {
|
||||
$expected = "Using mirror private (https://mirror.example.invalid/maven) for $id ("
|
||||
if (-not $log.Contains($expected)) {
|
||||
throw "Maven did not select the mirror for ${id}: $log"
|
||||
}
|
||||
}
|
||||
foreach ($type in @("dependencies", "plugins")) {
|
||||
$pattern = 'Repositories \(' + $type + '\)\s*: \[private \(https://mirror\.example\.invalid/maven, [^\]]+\)\]'
|
||||
if ($log -notmatch $pattern) {
|
||||
throw "Maven did not redirect all $type repositories: $log"
|
||||
}
|
||||
}
|
||||
|
||||
test-maven-repositories:
|
||||
name: Maven ${{ matrix.repositories }} repositories
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: undici
|
||||
version: 6.29.0
|
||||
version: 6.29.1
|
||||
type: npm
|
||||
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||
homepage: https://undici.nodejs.org
|
||||
|
||||
@@ -171,7 +171,6 @@ steps:
|
||||
| `mvn-server-repository-origins` | Multiline Maven credential origins in the format `server-id:repository-origin`. Each origin must belong to a configured server ID. Requires Maven 3.10+. | |
|
||||
| `mvn-repositories` | Multiline Maven dependency repositories in the format `repository-id:repository-url:snapshots-enabled`. | |
|
||||
| `mvn-plugin-repositories` | Multiline Maven plugin repositories in the format `repository-id:repository-url:snapshots-enabled`. Can be used independently of `mvn-repositories`. | |
|
||||
| `mvn-mirrors` | Multiline Maven mirrors in the format `mirror-id:mirror-url:mirror-of`. Redirect matching dependency and plugin repositories; use a matching server ID for authentication. | |
|
||||
| `mvn-repositories-include-central` | Include Maven Central for dependency and plugin repositories in the generated profile. When `false`, Central is disabled for both types unless that type explicitly declares `central`. Has no effect when neither repository list is configured. | `true` |
|
||||
| `mvn-repositories-prioritize-central` | Place Maven Central before custom dependency and plugin repositories. Has no effect when Central is excluded or neither repository list is configured. | `true` |
|
||||
| `settings-path` | Directory where `settings.xml` is written. | `~/.m2` |
|
||||
@@ -491,11 +490,6 @@ match `mvn-server-credentials` IDs when authentication is required.
|
||||
See [Resolving Maven dependencies from custom repositories](docs/advanced-usage.md#resolving-maven-dependencies-from-custom-repositories)
|
||||
and [Resolving Maven plugins from custom repositories](docs/advanced-usage.md#resolving-maven-plugins-from-custom-repositories).
|
||||
|
||||
To redirect repositories, including Central and repositories declared in project
|
||||
or parent POMs, use [`mvn-mirrors`](docs/advanced-usage.md#redirecting-maven-repositories-with-mirrors).
|
||||
It works independently of the repository inputs; a `mirrorOf` pattern of `*`
|
||||
routes all dependency and plugin repositories through the configured mirror.
|
||||
|
||||
> [!WARNING]
|
||||
> `mvn-repositories-include-central: false` now disables inherited Maven Central
|
||||
> for **both dependencies and plugins**, even in existing workflows that only
|
||||
|
||||
@@ -882,186 +882,6 @@ describe('auth tests', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
'*',
|
||||
'central',
|
||||
'external:*',
|
||||
'external:http:*',
|
||||
'*,!internal',
|
||||
'external:*,!internal',
|
||||
'!internal,external:http:*',
|
||||
'external:*,!external:http:*'
|
||||
])('preserves the mirror selector %s and URL colons', mirrorOf => {
|
||||
expect(
|
||||
auth.parseMavenMirrors([
|
||||
'',
|
||||
' \t ',
|
||||
` private : https://[2001:db8::1]:8443/maven : ${mirrorOf} `,
|
||||
'public:https://repo.example.com:443/releases:central'
|
||||
])
|
||||
).toEqual([
|
||||
{
|
||||
id: 'private',
|
||||
url: 'https://[2001:db8::1]:8443/maven',
|
||||
mirrorOf
|
||||
},
|
||||
{
|
||||
id: 'public',
|
||||
url: 'https://repo.example.com:443/releases',
|
||||
mirrorOf: 'central'
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
'https://repo.example.com:8443',
|
||||
'https://repo.example.com:8443/maven',
|
||||
'https://[2001:db8::1]',
|
||||
'https://[2001:db8::1]/maven',
|
||||
'https://[2001:db8::1]:8443',
|
||||
'https://[2001:db8::1]:8443/maven',
|
||||
'https://repo.example.com/maven?redirect=https%3A//upstream.example.com%3A8443',
|
||||
'https://repo.example.com/maven#urn%3Aartifact',
|
||||
'https://repo.example.com/maven?redirect=https://upstream.example.com:8443',
|
||||
'https://repo.example.com/maven#urn:artifact'
|
||||
])('preserves the complete mirror URL %s with an explicit selector', url => {
|
||||
expect(
|
||||
auth.parseMavenMirrors([`private:${url}:external:http:*,!internal`])
|
||||
).toEqual([{id: 'private', url, mirrorOf: 'external:http:*,!internal'}]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
'private',
|
||||
'private:https://repo.example.com',
|
||||
'private:https://repo.example.com:8443',
|
||||
'private:https://repo.example.com:8443/maven',
|
||||
'private:https://[2001:db8::1]',
|
||||
'private:https://[2001:db8::1]/maven',
|
||||
'private:https://[2001:db8::1]:8443',
|
||||
'private:https://[2001:db8::1]:8443/maven',
|
||||
'private:repo.example.com:central',
|
||||
':https://repo.example.com:*',
|
||||
'private::*',
|
||||
'private:https://repo.example.com:',
|
||||
'private: :*',
|
||||
'private:https://repo.example.com: '
|
||||
])('rejects malformed mirror entry %s with a line number', entry => {
|
||||
expect(() => auth.parseMavenMirrors(['', entry])).toThrow(
|
||||
'Invalid mvn-mirrors entry at line 2.'
|
||||
);
|
||||
});
|
||||
|
||||
it('rejects duplicate mirror IDs after trimming', () => {
|
||||
expect(() =>
|
||||
auth.parseMavenMirrors([
|
||||
'private:https://first.example.com:*',
|
||||
' private :https://second.example.com:central'
|
||||
])
|
||||
).toThrow("Duplicate mirror-id 'private' in mvn-mirrors input at line 2");
|
||||
});
|
||||
|
||||
it('leaves settings unchanged for absent or blank mirrors', () => {
|
||||
const servers = credentials('github', 'USERNAME', 'PASSWORD');
|
||||
expect(auth.parseMavenMirrors(['', ' ', '\t'])).toEqual([]);
|
||||
expect(auth.generate(servers, undefined, undefined, [])).toBe(
|
||||
auth.generate(servers)
|
||||
);
|
||||
expect(auth.generate(servers)).not.toContain('<mirrors>');
|
||||
});
|
||||
|
||||
it('generates public mirrors without credentials or repository profiles', () => {
|
||||
const mirrors = auth.parseMavenMirrors([
|
||||
'public:https://repo.example.com:external:*',
|
||||
'fallback:https://other.example.com:central'
|
||||
]);
|
||||
const xml = auth.generate([], undefined, undefined, mirrors);
|
||||
expect(parseXmlObject(xml)).toMatchObject({
|
||||
settings: {mirrors: {mirror: mirrors}}
|
||||
});
|
||||
expect(xml).not.toContain('<profiles>');
|
||||
expect(xml).not.toContain('<activeProfiles>');
|
||||
});
|
||||
|
||||
it('escapes all mirror fields as XML text', () => {
|
||||
const mirror = {
|
||||
id: 'private<&>',
|
||||
url: 'https://repo.example.com/maven?a=1&b=<value>',
|
||||
mirrorOf: '*,!internal<&>'
|
||||
};
|
||||
const xml = auth.generate([], undefined, undefined, [mirror]);
|
||||
expect(xml).toContain('<id>private<&></id>');
|
||||
expect(xml).toContain('a=1&b=<value>');
|
||||
expect(xml).toContain('<mirrorOf>*,!internal<&></mirrorOf>');
|
||||
expect(parseXmlObject(xml)).toMatchObject({
|
||||
settings: {mirrors: {mirror}}
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
{combined: false, overwrite: true},
|
||||
{combined: true, overwrite: true},
|
||||
{combined: true, overwrite: false}
|
||||
])(
|
||||
'configures mirrors with combined=$combined and overwrite=$overwrite',
|
||||
async ({combined, overwrite}) => {
|
||||
const directory = path.join(m2Dir, 'mirrors');
|
||||
const location = path.join(directory, MVN_SETTINGS_FILE);
|
||||
fs.mkdirSync(directory, {recursive: true});
|
||||
fs.writeFileSync(location, 'EXISTING SETTINGS');
|
||||
const url = 'https://maven.example.com/releases';
|
||||
const inputs: Record<string, string> = {
|
||||
'settings-path': directory,
|
||||
'overwrite-settings': String(overwrite),
|
||||
'mvn-repositories-include-central': 'false',
|
||||
...(combined ? {'gpg-passphrase-env-var': 'GPG_PASSPHRASE'} : {})
|
||||
};
|
||||
const multilineInputs: Record<string, string[]> = {
|
||||
'mvn-server-credentials': ['private:PRIVATE_USERNAME:PRIVATE_TOKEN'],
|
||||
'mvn-mirrors': [`private:${url}:*`],
|
||||
...(combined
|
||||
? {
|
||||
'mvn-repositories': [`private:${url}:false`],
|
||||
'mvn-plugin-repositories': [`private:${url}:false`]
|
||||
}
|
||||
: {})
|
||||
};
|
||||
jest.mocked(core.getInput).mockImplementation(name => inputs[name] ?? '');
|
||||
jest
|
||||
.mocked(core.getMultilineInput)
|
||||
.mockImplementation(name => multilineInputs[name] ?? []);
|
||||
|
||||
await auth.configureAuthentication();
|
||||
|
||||
const xml = fs.readFileSync(location, 'utf8');
|
||||
if (!overwrite) {
|
||||
expect(xml).toBe('EXISTING SETTINGS');
|
||||
return;
|
||||
}
|
||||
expect(parseXmlObject(xml)).toMatchObject({
|
||||
settings: {
|
||||
mirrors: {mirror: {id: 'private', url, mirrorOf: '*'}},
|
||||
servers: {
|
||||
server: {
|
||||
id: 'private',
|
||||
username: '${env.PRIVATE_USERNAME}',
|
||||
password: '${env.PRIVATE_TOKEN}'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (combined) {
|
||||
expect(xml).toContain('<repositories>');
|
||||
expect(xml).toContain('<pluginRepositories>');
|
||||
expect(xml).toContain('<gpg.passphraseEnvName>GPG_PASSPHRASE');
|
||||
} else {
|
||||
expect(xml).not.toContain('<profiles>');
|
||||
expect(core.getInput).not.toHaveBeenCalledWith(
|
||||
'mvn-repositories-include-central'
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
it.each(repositoryInputs)(
|
||||
'parses %s while preserving colons in URLs',
|
||||
inputName => {
|
||||
|
||||
@@ -15,6 +15,7 @@ import type {
|
||||
} from '../../src/distributions/liberica/models.js';
|
||||
import {HttpClient} from '@actions/http-client';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import manifestData from '../data/liberica.json' with {type: 'json'};
|
||||
|
||||
@@ -253,35 +254,68 @@ describe('findPackageForDownload', () => {
|
||||
expect(result.version).toBe(expected);
|
||||
});
|
||||
|
||||
describe('compound build versions', () => {
|
||||
describe.each([
|
||||
[17, 20],
|
||||
[25, 4]
|
||||
])('patch releases for Java %s.0.%s', (featureVersion, updateVersion) => {
|
||||
const mainVersion = `${featureVersion}.0.${updateVersion}`;
|
||||
|
||||
beforeEach(() => {
|
||||
distribution['getAvailableVersions'] = async () =>
|
||||
['1', '1.1', '1.2', '1.10'].map(build => ({
|
||||
featureVersion: 25,
|
||||
['+1', '+10', '.1+1', '.1+2', '.1+10', '.2+1', '.10+1'].map(suffix => ({
|
||||
featureVersion,
|
||||
interimVersion: 0,
|
||||
updateVersion: 4,
|
||||
buildVersion: 1,
|
||||
version: `25.0.4+${build}`,
|
||||
downloadUrl: `https://download.bell-sw.com/java/25.0.4+${build}/bellsoft-jdk25.0.4+${build}-macos-aarch64.tar.gz`
|
||||
updateVersion,
|
||||
buildVersion: Number(suffix.split('+')[1]),
|
||||
version: `${mainVersion}${suffix}`,
|
||||
downloadUrl: `https://download.bell-sw.com/java/${mainVersion}${suffix}/bellsoft-jdk${mainVersion}${suffix}-macos-aarch64.tar.gz`
|
||||
}));
|
||||
});
|
||||
|
||||
it.each([
|
||||
['25.0.4+1.1', '25.0.4+1.1'],
|
||||
['25.0.4+1', '25.0.4+1'],
|
||||
['25.0.4', '25.0.4+1.10'],
|
||||
['25', '25.0.4+1.10']
|
||||
])('version is %s -> %s', async (input, expected) => {
|
||||
[`${mainVersion}+1.1`, `${mainVersion}+1.1`, '.1+1'],
|
||||
[`${mainVersion}+1.2`, `${mainVersion}+1.2`, '.1+2'],
|
||||
[`${mainVersion}+1.10`, `${mainVersion}+1.10`, '.1+10'],
|
||||
[`${mainVersion}+1`, `${mainVersion}+1`, '+1'],
|
||||
[mainVersion, `${mainVersion}+10.1`, '.10+1'],
|
||||
[`${featureVersion}`, `${mainVersion}+10.1`, '.10+1']
|
||||
])('version is %s -> %s', async (input, expected, suffix) => {
|
||||
const result = await distribution['findPackageForDownload'](input);
|
||||
expect(result).toEqual({
|
||||
version: expected,
|
||||
url: `https://download.bell-sw.com/java/${expected}/bellsoft-jdk${expected}-macos-aarch64.tar.gz`
|
||||
url: `https://download.bell-sw.com/java/${mainVersion}${suffix}/bellsoft-jdk${mainVersion}${suffix}-macos-aarch64.tar.gz`
|
||||
});
|
||||
});
|
||||
|
||||
it('sorts builds within the same patch numerically', async () => {
|
||||
const versions = await distribution['getAvailableVersions']();
|
||||
distribution['getAvailableVersions'] = async () =>
|
||||
versions.filter(item => item.version.startsWith(`${mainVersion}.1+`));
|
||||
|
||||
const result = await distribution['findPackageForDownload'](mainVersion);
|
||||
expect(result.version).toBe(`${mainVersion}+1.10`);
|
||||
});
|
||||
|
||||
it('selects the newest build for a four-component patch-only request', async () => {
|
||||
const patchDistribution = new LibericaDistributions({
|
||||
version: `${mainVersion}.1`,
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
patchDistribution['getAvailableVersions'] =
|
||||
distribution['getAvailableVersions'];
|
||||
|
||||
await expect(
|
||||
patchDistribution['findPackageForDownload'](
|
||||
patchDistribution['version']
|
||||
)
|
||||
).resolves.toMatchObject({version: `${mainVersion}+1.10`});
|
||||
});
|
||||
|
||||
it('does not substitute a different compound build', async () => {
|
||||
await expect(
|
||||
distribution['findPackageForDownload']('25.0.4+1.3')
|
||||
distribution['findPackageForDownload'](`${mainVersion}+1.3`)
|
||||
).rejects.toThrow(/No matching version found for SemVer/);
|
||||
});
|
||||
});
|
||||
@@ -293,6 +327,160 @@ describe('findPackageForDownload', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('patch request resolution from the constructor', () => {
|
||||
const releases: LibericaVersion[] = ['17.0.20+10', '17.0.20.1+1'].map(
|
||||
version => ({
|
||||
featureVersion: 17,
|
||||
interimVersion: 0,
|
||||
updateVersion: 20,
|
||||
buildVersion: Number(version.split('+')[1]),
|
||||
version,
|
||||
downloadUrl: `https://download.bell-sw.com/java/${version}/jdk.tar.gz`
|
||||
})
|
||||
);
|
||||
let cacheRoot: string;
|
||||
let previousToolcache: string | undefined;
|
||||
|
||||
beforeEach(async () => {
|
||||
previousToolcache = process.env['RUNNER_TOOL_CACHE'];
|
||||
cacheRoot = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'liberica-'));
|
||||
process.env['RUNNER_TOOL_CACHE'] = cacheRoot;
|
||||
for (const version of ['17.0.20-10', '17.0.20-1.1']) {
|
||||
const javaPath = path.join(
|
||||
cacheRoot,
|
||||
'Java_Liberica_jdk',
|
||||
version,
|
||||
'x64'
|
||||
);
|
||||
await fs.promises.mkdir(javaPath, {recursive: true});
|
||||
await fs.promises.writeFile(`${javaPath}.complete`, '');
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
if (previousToolcache === undefined) {
|
||||
delete process.env['RUNNER_TOOL_CACHE'];
|
||||
} else {
|
||||
process.env['RUNNER_TOOL_CACHE'] = previousToolcache;
|
||||
}
|
||||
await fs.promises.rm(cacheRoot, {recursive: true, force: true});
|
||||
});
|
||||
|
||||
it.each([
|
||||
['17', '17.0.20+1.1', '17.0.20.1+1'],
|
||||
['17.0.20', '17.0.20+1.1', '17.0.20.1+1'],
|
||||
['17.0.20+10', '17.0.20+10', '17.0.20+10'],
|
||||
['17.0.20+1.1', '17.0.20+1.1', '17.0.20.1+1'],
|
||||
['17.0.20.1', '17.0.20+1.1', '17.0.20.1+1'],
|
||||
['17.0.20.1+1', '17.0.20+1.1', '17.0.20.1+1'],
|
||||
['17.0.20.0', '17.0.20+10', '17.0.20+10']
|
||||
])(
|
||||
'resolves %s consistently remotely and in cache',
|
||||
async (input, expected, apiVersion) => {
|
||||
const distribution = new LibericaDistributions({
|
||||
version: input,
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => releases;
|
||||
|
||||
await expect(
|
||||
distribution['findPackageForDownload'](distribution['version'])
|
||||
).resolves.toEqual({
|
||||
version: expected,
|
||||
url: `https://download.bell-sw.com/java/${apiVersion}/jdk.tar.gz`
|
||||
});
|
||||
expect(distribution['findInToolcache']()).toEqual({
|
||||
version: expected,
|
||||
path: path.join(
|
||||
cacheRoot,
|
||||
'Java_Liberica_jdk',
|
||||
expected.replace('+', '-'),
|
||||
'x64'
|
||||
)
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
it.each(['17.0.20.2', '17.0.20+1.2'])(
|
||||
'does not substitute a different patch or exact build for %s',
|
||||
async version => {
|
||||
const distribution = new LibericaDistributions({
|
||||
version,
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => releases;
|
||||
|
||||
await expect(
|
||||
distribution['findPackageForDownload'](distribution['version'])
|
||||
).rejects.toThrow(/No matching version found/);
|
||||
expect(distribution['findInToolcache']()).toBeNull();
|
||||
}
|
||||
);
|
||||
|
||||
it('keeps patch-only and exact-build resolution cache identities distinct', () => {
|
||||
const distribution = new LibericaDistributions({
|
||||
version: '17.0.20.1',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
expect(distribution['version']).toBe('17.0.20.1');
|
||||
});
|
||||
|
||||
it('orders main versions, patches, and builds consistently in cache', async () => {
|
||||
for (const version of ['17.0.20-1.2', '17.0.20-1.10', '17.0.21-1']) {
|
||||
const javaPath = path.join(
|
||||
cacheRoot,
|
||||
'Java_Liberica_jdk',
|
||||
version,
|
||||
'x64'
|
||||
);
|
||||
await fs.promises.mkdir(javaPath, {recursive: true});
|
||||
await fs.promises.writeFile(`${javaPath}.complete`, '');
|
||||
}
|
||||
|
||||
for (const [version, expected] of [
|
||||
['17', '17.0.21+1'],
|
||||
['17.0.20', '17.0.20+1.10'],
|
||||
['17.0.20.1', '17.0.20+1.10']
|
||||
]) {
|
||||
const distribution = new LibericaDistributions({
|
||||
version,
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
expect(distribution['findInToolcache']()?.version).toBe(expected);
|
||||
}
|
||||
});
|
||||
|
||||
it('preserves early-access handling for patch-only requests', async () => {
|
||||
const javaPath = path.join(
|
||||
cacheRoot,
|
||||
'Java_Liberica_jdk',
|
||||
'17.0.20-ea.1.2',
|
||||
'x64'
|
||||
);
|
||||
await fs.promises.mkdir(javaPath, {recursive: true});
|
||||
await fs.promises.writeFile(`${javaPath}.complete`, '');
|
||||
const distribution = new LibericaDistributions({
|
||||
version: '17.0.20.1-ea',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
expect(distribution['stable']).toBe(false);
|
||||
expect(distribution['findInToolcache']()).toEqual({
|
||||
version: '17.0.20+1.2',
|
||||
path: javaPath
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getPlatformOption', () => {
|
||||
beforeEach(() => {
|
||||
// The linux row below is glibc, so pin the Alpine probe rather than
|
||||
@@ -369,6 +557,36 @@ describe('convertVersionToSemver', () => {
|
||||
},
|
||||
'11.0.0+13'
|
||||
],
|
||||
[
|
||||
{
|
||||
version: '17.0.20.1+1',
|
||||
featureVersion: 17,
|
||||
interimVersion: 0,
|
||||
updateVersion: 20,
|
||||
buildVersion: 1
|
||||
},
|
||||
'17.0.20+1.1'
|
||||
],
|
||||
[
|
||||
{
|
||||
version: '25.0.4.1+1',
|
||||
featureVersion: 25,
|
||||
interimVersion: 0,
|
||||
updateVersion: 4,
|
||||
buildVersion: 1
|
||||
},
|
||||
'25.0.4+1.1'
|
||||
],
|
||||
[
|
||||
{
|
||||
version: '17.0.20.1+2',
|
||||
featureVersion: 17,
|
||||
interimVersion: 0,
|
||||
updateVersion: 20,
|
||||
buildVersion: 2
|
||||
},
|
||||
'17.0.20+1.2'
|
||||
],
|
||||
[
|
||||
{
|
||||
version: '25.0.4+1.1',
|
||||
|
||||
@@ -75,9 +75,6 @@ inputs:
|
||||
mvn-plugin-repositories:
|
||||
description: 'Multiline list of Maven plugin repositories in the format `repository-id:repository-url:snapshots-enabled`.'
|
||||
required: false
|
||||
mvn-mirrors:
|
||||
description: 'Multiline list of Maven mirrors in the format `mirror-id:mirror-url:mirror-of`. The URL must include a scheme; percent-encode colons in its path, query, or fragment. Use a matching server ID for authentication. Can be used independently of repository inputs.'
|
||||
required: false
|
||||
mvn-repositories-include-central:
|
||||
description: 'Include Maven Central for dependency and plugin repositories in the generated profile. When false, Central is disabled for both types unless that type explicitly declares ID `central`. Has no effect when neither repository list is configured.'
|
||||
required: false
|
||||
|
||||
Vendored
+135
-32
@@ -7217,7 +7217,7 @@ function defaultFactory (origin, opts) {
|
||||
}
|
||||
|
||||
class Agent extends DispatcherBase {
|
||||
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
||||
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, tls, ...options } = {}) {
|
||||
if (typeof factory !== 'function') {
|
||||
throw new InvalidArgumentError('factory must be a function.')
|
||||
}
|
||||
@@ -7236,11 +7236,15 @@ class Agent extends DispatcherBase {
|
||||
connect = { ...connect }
|
||||
}
|
||||
|
||||
if (tls && typeof tls !== 'function') {
|
||||
tls = { ...tls }
|
||||
}
|
||||
|
||||
this[kInterceptors] = options.interceptors?.Agent && Array.isArray(options.interceptors.Agent)
|
||||
? options.interceptors.Agent
|
||||
: [createRedirectInterceptor({ maxRedirections })]
|
||||
|
||||
this[kOptions] = { ...util.deepClone(options), connect }
|
||||
this[kOptions] = { ...util.deepClone(options), connect, tls }
|
||||
this[kOptions].interceptors = options.interceptors
|
||||
? { ...options.interceptors }
|
||||
: undefined
|
||||
@@ -8273,8 +8277,6 @@ async function connectH1 (client, socket) {
|
||||
socket[kParser] = new Parser(client, socket, llhttpInstance)
|
||||
|
||||
addListener(socket, 'error', function (err) {
|
||||
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
||||
|
||||
const parser = this[kParser]
|
||||
|
||||
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
||||
@@ -9204,8 +9206,6 @@ async function connectH2 (client, socket) {
|
||||
socket[kHTTP2Session] = session
|
||||
|
||||
util.addListener(socket, 'error', function (err) {
|
||||
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
||||
|
||||
this[kError] = err
|
||||
|
||||
this[kClient][kOnError](err)
|
||||
@@ -9279,8 +9279,6 @@ function resumeH2 (client) {
|
||||
}
|
||||
|
||||
function onHttp2SessionError (err) {
|
||||
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
||||
|
||||
this[kSocket][kError] = err
|
||||
this[kClient][kOnError](err)
|
||||
}
|
||||
@@ -9978,9 +9976,10 @@ class Client extends DispatcherBase {
|
||||
// h2
|
||||
maxConcurrentStreams,
|
||||
allowH2,
|
||||
webSocket
|
||||
webSocket,
|
||||
eventSource
|
||||
} = {}) {
|
||||
super({ webSocket })
|
||||
super({ webSocket, eventSource })
|
||||
|
||||
if (keepAlive !== undefined) {
|
||||
throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
|
||||
@@ -10501,6 +10500,7 @@ module.exports = Client
|
||||
|
||||
|
||||
|
||||
const buffer = __nccwpck_require__(4573)
|
||||
const Dispatcher = __nccwpck_require__(883)
|
||||
const {
|
||||
ClientDestroyedError,
|
||||
@@ -10513,6 +10513,7 @@ const kOnDestroyed = Symbol('onDestroyed')
|
||||
const kOnClosed = Symbol('onClosed')
|
||||
const kInterceptedDispatch = Symbol('Intercepted Dispatch')
|
||||
const kWebSocketOptions = Symbol('webSocketOptions')
|
||||
const kEventSourceOptions = Symbol('eventSourceOptions')
|
||||
|
||||
class DispatcherBase extends Dispatcher {
|
||||
constructor (opts) {
|
||||
@@ -10523,6 +10524,7 @@ class DispatcherBase extends Dispatcher {
|
||||
this[kClosed] = false
|
||||
this[kOnClosed] = []
|
||||
this[kWebSocketOptions] = opts?.webSocket ?? {}
|
||||
this[kEventSourceOptions] = opts?.eventSource ?? {}
|
||||
}
|
||||
|
||||
get webSocketOptions () {
|
||||
@@ -10532,6 +10534,12 @@ class DispatcherBase extends Dispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
get eventSourceOptions () {
|
||||
return {
|
||||
maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer.kStringMaxLength
|
||||
}
|
||||
}
|
||||
|
||||
get destroyed () {
|
||||
return this[kDestroyed]
|
||||
}
|
||||
@@ -16890,6 +16898,7 @@ module.exports = {
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
|
||||
const buffer = __nccwpck_require__(4573)
|
||||
const { Transform } = __nccwpck_require__(7075)
|
||||
const { isASCIINumber, isValidLastEventId } = __nccwpck_require__(4811)
|
||||
|
||||
@@ -16914,11 +16923,19 @@ const COLON = 0x3A
|
||||
*/
|
||||
const SPACE = 0x20
|
||||
|
||||
const defaultMaxEventSize = buffer.kStringMaxLength
|
||||
|
||||
const DATA = Buffer.from('data')
|
||||
const EVENT = Buffer.from('event')
|
||||
const ID = Buffer.from('id')
|
||||
const RETRY = Buffer.from('retry')
|
||||
|
||||
// Each data field creates a string node, and each unconsumed input chunk keeps
|
||||
// a Buffer wrapper. The absolute ceiling protects the large default byte limit.
|
||||
const minParserItems = 1024
|
||||
const maxParserItems = 131072
|
||||
const bytesPerParserItem = 128
|
||||
|
||||
function isASCIINumberBytes (buffer, start) {
|
||||
if (start >= buffer.length) {
|
||||
return false
|
||||
@@ -16957,6 +16974,12 @@ function isFieldName (line, length, field) {
|
||||
return true
|
||||
}
|
||||
|
||||
function createMaxEventSizeExceededError () {
|
||||
const error = new Error('EventSource message size exceeded')
|
||||
error.aborted = false
|
||||
return error
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} EventSourceStreamEvent
|
||||
* @type {object}
|
||||
@@ -17005,6 +17028,13 @@ class EventSourceStream extends Transform {
|
||||
pos = 0
|
||||
lineChunkIndex = 0
|
||||
linePos = 0
|
||||
lineLength = 0
|
||||
eventSize = 0
|
||||
eventFieldSizes = { data: 0, event: 0, id: 0, retry: 0 }
|
||||
dataLineCount = 0
|
||||
maxEventSize
|
||||
maxDataLines
|
||||
maxBufferedChunks
|
||||
|
||||
event = {
|
||||
data: undefined,
|
||||
@@ -17015,6 +17045,7 @@ class EventSourceStream extends Transform {
|
||||
|
||||
/**
|
||||
* @param {object} options
|
||||
* @param {number} [options.maxEventSize]
|
||||
* @param {eventSourceSettings} options.eventSourceSettings
|
||||
* @param {Function} [options.push]
|
||||
*/
|
||||
@@ -17026,6 +17057,12 @@ class EventSourceStream extends Transform {
|
||||
super(options)
|
||||
|
||||
this.state = options.eventSourceSettings || {}
|
||||
this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize
|
||||
const parserItemLimit = this.maxEventSize > 0
|
||||
? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem)))
|
||||
: 0
|
||||
this.maxDataLines = parserItemLimit
|
||||
this.maxBufferedChunks = parserItemLimit
|
||||
if (options.push) {
|
||||
this.push = options.push
|
||||
}
|
||||
@@ -17043,6 +17080,14 @@ class EventSourceStream extends Transform {
|
||||
return
|
||||
}
|
||||
|
||||
// A leading line ending can immediately release the currently buffered
|
||||
// line, even when it uses the final allowed chunk slot.
|
||||
if (this.maxEventSize > 0 &&
|
||||
this.chunks.length >= this.maxBufferedChunks &&
|
||||
chunk[0] !== LF && chunk[0] !== CR) {
|
||||
callback(createMaxEventSizeExceededError())
|
||||
return
|
||||
}
|
||||
this.chunks.push(chunk)
|
||||
|
||||
// Strip leading byte-order-mark if we opened the stream and started
|
||||
@@ -17121,7 +17166,12 @@ class EventSourceStream extends Transform {
|
||||
|
||||
// In any case, we can process the line as we reached an
|
||||
// end-of-line character
|
||||
this.parseLine(this.readLine(), this.event)
|
||||
try {
|
||||
this.parseLine(this.readLine(), this.event)
|
||||
} catch (error) {
|
||||
callback(error)
|
||||
return
|
||||
}
|
||||
this.consumeCurrentByte()
|
||||
// A line was processed and this could be the end of the event. We need
|
||||
// to check if the next line is empty to determine if the event is
|
||||
@@ -17130,15 +17180,28 @@ class EventSourceStream extends Transform {
|
||||
continue
|
||||
}
|
||||
|
||||
// readLine() is only called after CR or LF. Reject an unfinished line
|
||||
// before it can retain an unbounded number of decoded chunks. The seven
|
||||
// extra bytes allow the longest field prefix ("event: " or "retry: ").
|
||||
if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
|
||||
callback(createMaxEventSizeExceededError())
|
||||
return
|
||||
}
|
||||
this.advanceCursor()
|
||||
}
|
||||
|
||||
callback()
|
||||
}
|
||||
|
||||
_destroy (error, callback) {
|
||||
this.chunks.length = 0
|
||||
this.clearEvent()
|
||||
super._destroy(error, callback)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Buffer} line
|
||||
* @param {EventStreamEvent} event
|
||||
* @param {EventSourceStreamEvent} event
|
||||
*/
|
||||
parseLine (line, event) {
|
||||
// If the line is empty (a blank line)
|
||||
@@ -17172,6 +17235,13 @@ class EventSourceStream extends Transform {
|
||||
}
|
||||
|
||||
if (isFieldName(line, fieldLength, DATA)) {
|
||||
if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) {
|
||||
throw createMaxEventSizeExceededError()
|
||||
}
|
||||
const valueBytes = line.length - valueStart
|
||||
const dataSize = this.eventFieldSizes.data + (event.data === undefined ? 0 : 1) + valueBytes
|
||||
this.setEventFieldSize('data', dataSize)
|
||||
|
||||
const value = line.toString('utf8', valueStart)
|
||||
|
||||
if (event.data === undefined) {
|
||||
@@ -17179,11 +17249,13 @@ class EventSourceStream extends Transform {
|
||||
} else {
|
||||
event.data += `\n${value}`
|
||||
}
|
||||
this.dataLineCount++
|
||||
return
|
||||
}
|
||||
|
||||
if (isFieldName(line, fieldLength, RETRY)) {
|
||||
if (isASCIINumberBytes(line, valueStart)) {
|
||||
this.setEventFieldSize('retry', line.length - valueStart)
|
||||
event.retry = line.toString('utf8', valueStart)
|
||||
}
|
||||
return
|
||||
@@ -17191,20 +17263,29 @@ class EventSourceStream extends Transform {
|
||||
|
||||
if (isFieldName(line, fieldLength, ID)) {
|
||||
if (isValidLastEventIdBytes(line, valueStart)) {
|
||||
this.setEventFieldSize('id', line.length - valueStart)
|
||||
event.id = line.toString('utf8', valueStart)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (isFieldName(line, fieldLength, EVENT)) {
|
||||
const value = line.toString('utf8', valueStart)
|
||||
|
||||
if (value.length > 0) {
|
||||
event.event = value
|
||||
if (valueStart < line.length) {
|
||||
this.setEventFieldSize('event', line.length - valueStart)
|
||||
event.event = line.toString('utf8', valueStart)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setEventFieldSize (field, size) {
|
||||
const eventSize = this.eventSize - this.eventFieldSizes[field] + size
|
||||
if (this.maxEventSize > 0 && eventSize > this.maxEventSize) {
|
||||
throw createMaxEventSizeExceededError()
|
||||
}
|
||||
this.eventSize = eventSize
|
||||
this.eventFieldSizes[field] = size
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {EventSourceStreamEvent} event
|
||||
*/
|
||||
@@ -17235,6 +17316,12 @@ class EventSourceStream extends Transform {
|
||||
this.event.event = undefined
|
||||
this.event.id = undefined
|
||||
this.event.retry = undefined
|
||||
this.eventSize = 0
|
||||
this.dataLineCount = 0
|
||||
this.eventFieldSizes.data = 0
|
||||
this.eventFieldSizes.event = 0
|
||||
this.eventFieldSizes.id = 0
|
||||
this.eventFieldSizes.retry = 0
|
||||
}
|
||||
|
||||
hasPendingEvent () {
|
||||
@@ -17270,14 +17357,16 @@ class EventSourceStream extends Transform {
|
||||
syncLineStartToCursor () {
|
||||
this.lineChunkIndex = this.chunkIndex
|
||||
this.linePos = this.pos
|
||||
this.lineLength = 0
|
||||
this.dropConsumedChunks()
|
||||
}
|
||||
|
||||
dropConsumedChunks () {
|
||||
while (this.lineChunkIndex > 0) {
|
||||
this.chunks.shift()
|
||||
this.lineChunkIndex--
|
||||
this.chunkIndex--
|
||||
if (this.lineChunkIndex > 0) {
|
||||
const consumed = this.lineChunkIndex
|
||||
this.chunks.splice(0, consumed)
|
||||
this.lineChunkIndex = 0
|
||||
this.chunkIndex -= consumed
|
||||
}
|
||||
|
||||
if (this.chunkIndex === this.chunks.length) {
|
||||
@@ -17402,6 +17491,7 @@ const { isNetworkError } = __nccwpck_require__(9051)
|
||||
const { delay } = __nccwpck_require__(4811)
|
||||
const { kEnumerableProperty } = __nccwpck_require__(3440)
|
||||
const { environmentSettingsObject } = __nccwpck_require__(3168)
|
||||
const { getGlobalDispatcher } = __nccwpck_require__(2581)
|
||||
|
||||
let experimentalWarned = false
|
||||
|
||||
@@ -17683,6 +17773,7 @@ class EventSource extends EventTarget {
|
||||
|
||||
const eventSourceStream = new EventSourceStream({
|
||||
eventSourceSettings: this.#state,
|
||||
maxEventSize: this.#dispatcher.eventSourceOptions?.maxEventSize,
|
||||
push: (event) => {
|
||||
this.dispatchEvent(createFastMessageEvent(
|
||||
event.type,
|
||||
@@ -17861,7 +17952,8 @@ webidl.converters.EventSourceInitDict = webidl.dictionaryConverter([
|
||||
},
|
||||
{
|
||||
key: 'dispatcher', // undici only
|
||||
converter: webidl.converters.any
|
||||
converter: webidl.converters.any,
|
||||
defaultValue: () => getGlobalDispatcher()
|
||||
}
|
||||
])
|
||||
|
||||
@@ -22957,8 +23049,10 @@ async function httpNetworkFetch (
|
||||
// 19. Run these steps in parallel:
|
||||
|
||||
// 1. Run these steps, but abort when fetchParams is canceled:
|
||||
fetchParams.controller.onAborted = onAborted
|
||||
fetchParams.controller.on('terminated', onAborted)
|
||||
if (!fetchParams.controller.resume) {
|
||||
fetchParams.controller.on('terminated', onAborted)
|
||||
}
|
||||
|
||||
fetchParams.controller.resume = async () => {
|
||||
// 1. While true
|
||||
while (true) {
|
||||
@@ -23127,8 +23221,6 @@ async function httpNetworkFetch (
|
||||
}
|
||||
location = headersList.get('location', true)
|
||||
|
||||
this.body = new Readable({ read: resume })
|
||||
|
||||
const decoders = []
|
||||
|
||||
const willFollow = location && request.redirect === 'follow' &&
|
||||
@@ -23146,7 +23238,7 @@ async function httpNetworkFetch (
|
||||
// CVE fix similar to urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206).
|
||||
const maxContentEncodings = 5
|
||||
if (codings.length > maxContentEncodings) {
|
||||
reject(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
|
||||
this.abort(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -23179,6 +23271,8 @@ async function httpNetworkFetch (
|
||||
}
|
||||
}
|
||||
|
||||
this.body = new Readable({ read: resume })
|
||||
|
||||
const onError = this.onError.bind(this)
|
||||
|
||||
resolve({
|
||||
@@ -23225,10 +23319,6 @@ async function httpNetworkFetch (
|
||||
fetchParams.controller.off('terminated', this.abort)
|
||||
}
|
||||
|
||||
if (fetchParams.controller.onAborted) {
|
||||
fetchParams.controller.off('terminated', fetchParams.controller.onAborted)
|
||||
}
|
||||
|
||||
fetchParams.controller.ended = true
|
||||
|
||||
this.body.push(null)
|
||||
@@ -29703,6 +29793,20 @@ class ByteParser extends Writable {
|
||||
if (isControlFrame(this.#info.opcode)) {
|
||||
this.#loop = this.parseControlFrame(body)
|
||||
this.#state = parserStates.INFO
|
||||
|
||||
// If the automatic PONG/CLOSE reply filled the socket's write buffer,
|
||||
// stop parsing and resume on drain so a PING flood cannot grow the
|
||||
// outbound queue without bound.
|
||||
const socket = this.ws[kResponse].socket
|
||||
if (this.#loop && socket.writableNeedDrain) {
|
||||
this.#loop = false
|
||||
socket.once('drain', () => {
|
||||
if (this.destroyed) return
|
||||
this.#loop = true
|
||||
this.run(callback)
|
||||
})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (!this.#info.compressed) {
|
||||
if (!this.writeFragments(body)) {
|
||||
@@ -31040,7 +31144,7 @@ module.exports = {
|
||||
/* harmony export */ gk: () => (/* binding */ INPUT_CACHE),
|
||||
/* harmony export */ wG: () => (/* binding */ INPUT_JOB_STATUS)
|
||||
/* harmony export */ });
|
||||
/* unused harmony exports MACOS_JAVA_CONTENT_POSTFIX, INPUT_JAVA_VERSION, INPUT_JAVA_VERSION_FILE, INPUT_ARCHITECTURE, INPUT_JAVA_PACKAGE, INPUT_DISTRIBUTION, INPUT_JDK_FILE, INPUT_JDK_FILE_DEPRECATED, INPUT_CHECK_LATEST, INPUT_FORCE_DOWNLOAD, INPUT_SET_DEFAULT, INPUT_PROBLEM_MATCHER, INPUT_VERIFY_SIGNATURE, INPUT_VERIFY_SIGNATURE_PUBLIC_KEY, SIGNATURE_VERIFICATION_DOCUMENTATION_URL, SIGNATURE_VERIFICATION_FAILURE_HELP, INPUT_MVN_SERVER_CREDENTIALS, INPUT_MVN_SERVER_REPOSITORY_ORIGINS, INPUT_MVN_REPOSITORIES, INPUT_MVN_PLUGIN_REPOSITORIES, INPUT_MVN_MIRRORS, INPUT_MVN_REPOSITORIES_INCLUDE_CENTRAL, INPUT_MVN_REPOSITORIES_PRIORITIZE_CENTRAL, INPUT_SERVER_ID, INPUT_SERVER_USERNAME_ENV_VAR, INPUT_SERVER_PASSWORD_ENV_VAR, INPUT_SERVER_USERNAME_DEPRECATED, INPUT_SERVER_PASSWORD_DEPRECATED, INPUT_SETTINGS_PATH, INPUT_OVERWRITE_SETTINGS, INPUT_GPG_PRIVATE_KEY, INPUT_GPG_PASSPHRASE_ENV_VAR, INPUT_GPG_PASSPHRASE_DEPRECATED, INPUT_DEFAULT_SERVER_USERNAME, INPUT_DEFAULT_SERVER_PASSWORD, INPUT_DEFAULT_GPG_PRIVATE_KEY, INPUT_DEFAULT_GPG_PASSPHRASE, MAVEN_GPG_PASSPHRASE_DEFAULT_ENV, GPG_PASSPHRASE_PROFILE_ID, MAVEN_REPOSITORIES_PROFILE_ID, MAVEN_CENTRAL_REPOSITORY_ID, MAVEN_CENTRAL_REPOSITORY_URL, INPUT_CACHE_DEPENDENCY_PATH, INPUT_CACHE_PATH, M2_DIR, MVN_SETTINGS_FILE, MVN_TOOLCHAINS_FILE, INPUT_MVN_TOOLCHAIN_ID, INPUT_MVN_TOOLCHAIN_VENDOR, INPUT_SHOW_DOWNLOAD_PROGRESS, MAVEN_ARGS_ENV, MAVEN_NO_TRANSFER_PROGRESS_FLAG, MAVEN_NO_TRANSFER_PROGRESS_LONG_FLAG, DISTRIBUTIONS_ONLY_MAJOR_VERSION */
|
||||
/* unused harmony exports MACOS_JAVA_CONTENT_POSTFIX, INPUT_JAVA_VERSION, INPUT_JAVA_VERSION_FILE, INPUT_ARCHITECTURE, INPUT_JAVA_PACKAGE, INPUT_DISTRIBUTION, INPUT_JDK_FILE, INPUT_JDK_FILE_DEPRECATED, INPUT_CHECK_LATEST, INPUT_FORCE_DOWNLOAD, INPUT_SET_DEFAULT, INPUT_PROBLEM_MATCHER, INPUT_VERIFY_SIGNATURE, INPUT_VERIFY_SIGNATURE_PUBLIC_KEY, SIGNATURE_VERIFICATION_DOCUMENTATION_URL, SIGNATURE_VERIFICATION_FAILURE_HELP, INPUT_MVN_SERVER_CREDENTIALS, INPUT_MVN_SERVER_REPOSITORY_ORIGINS, INPUT_MVN_REPOSITORIES, INPUT_MVN_PLUGIN_REPOSITORIES, INPUT_MVN_REPOSITORIES_INCLUDE_CENTRAL, INPUT_MVN_REPOSITORIES_PRIORITIZE_CENTRAL, INPUT_SERVER_ID, INPUT_SERVER_USERNAME_ENV_VAR, INPUT_SERVER_PASSWORD_ENV_VAR, INPUT_SERVER_USERNAME_DEPRECATED, INPUT_SERVER_PASSWORD_DEPRECATED, INPUT_SETTINGS_PATH, INPUT_OVERWRITE_SETTINGS, INPUT_GPG_PRIVATE_KEY, INPUT_GPG_PASSPHRASE_ENV_VAR, INPUT_GPG_PASSPHRASE_DEPRECATED, INPUT_DEFAULT_SERVER_USERNAME, INPUT_DEFAULT_SERVER_PASSWORD, INPUT_DEFAULT_GPG_PRIVATE_KEY, INPUT_DEFAULT_GPG_PASSPHRASE, MAVEN_GPG_PASSPHRASE_DEFAULT_ENV, GPG_PASSPHRASE_PROFILE_ID, MAVEN_REPOSITORIES_PROFILE_ID, MAVEN_CENTRAL_REPOSITORY_ID, MAVEN_CENTRAL_REPOSITORY_URL, INPUT_CACHE_DEPENDENCY_PATH, INPUT_CACHE_PATH, M2_DIR, MVN_SETTINGS_FILE, MVN_TOOLCHAINS_FILE, INPUT_MVN_TOOLCHAIN_ID, INPUT_MVN_TOOLCHAIN_VENDOR, INPUT_SHOW_DOWNLOAD_PROGRESS, MAVEN_ARGS_ENV, MAVEN_NO_TRANSFER_PROGRESS_FLAG, MAVEN_NO_TRANSFER_PROGRESS_LONG_FLAG, DISTRIBUTIONS_ONLY_MAJOR_VERSION */
|
||||
const MACOS_JAVA_CONTENT_POSTFIX = 'Contents/Home';
|
||||
const INPUT_JAVA_VERSION = 'java-version';
|
||||
const INPUT_JAVA_VERSION_FILE = 'java-version-file';
|
||||
@@ -31061,7 +31165,6 @@ const INPUT_MVN_SERVER_CREDENTIALS = 'mvn-server-credentials';
|
||||
const INPUT_MVN_SERVER_REPOSITORY_ORIGINS = 'mvn-server-repository-origins';
|
||||
const INPUT_MVN_REPOSITORIES = 'mvn-repositories';
|
||||
const INPUT_MVN_PLUGIN_REPOSITORIES = 'mvn-plugin-repositories';
|
||||
const INPUT_MVN_MIRRORS = 'mvn-mirrors';
|
||||
const INPUT_MVN_REPOSITORIES_INCLUDE_CENTRAL = 'mvn-repositories-include-central';
|
||||
const INPUT_MVN_REPOSITORIES_PRIORITIZE_CENTRAL = 'mvn-repositories-prioritize-central';
|
||||
const INPUT_SERVER_ID = 'server-id';
|
||||
|
||||
Vendored
+10
-4
@@ -378,7 +378,7 @@ class JavaBase {
|
||||
core/* info */.pq(`Java ${foundJava.version} was downloaded`);
|
||||
if (javaRelease.floating) {
|
||||
if (!semver_default().valid(foundJava.version) ||
|
||||
!(0,util/* isVersionSatisfies */.y)(this.version, foundJava.version)) {
|
||||
!this.isVersionSatisfied(this.version, foundJava.version)) {
|
||||
throw new Error(`The downloaded ${this.distribution} artifact reported Java ${foundJava.version}, which does not satisfy '${this.version}'.`);
|
||||
}
|
||||
javaRelease = { ...javaRelease, version: foundJava.version };
|
||||
@@ -501,7 +501,7 @@ class JavaBase {
|
||||
return javaRelease;
|
||||
}
|
||||
if (!semver_default().valid(restored.release.version) ||
|
||||
!(0,util/* isVersionSatisfies */.y)(this.version, restored.release.version)) {
|
||||
!this.isVersionSatisfied(this.version, restored.release.version)) {
|
||||
core/* debug */.Yz(`Ignoring the cached concrete version '${restored.release.version}' for ${this.distribution} ${this.version}.`);
|
||||
return javaRelease;
|
||||
}
|
||||
@@ -684,10 +684,10 @@ class JavaBase {
|
||||
})
|
||||
.filter(item => item.stable === this.stable);
|
||||
const satisfiedVersions = availableVersions
|
||||
.filter(item => (0,util/* isVersionSatisfies */.y)(this.version, item.version))
|
||||
.filter(item => this.isVersionSatisfied(this.version, item.version))
|
||||
.filter(item => item.path)
|
||||
.sort((a, b) => {
|
||||
return -semver_default().compareBuild(a.version, b.version);
|
||||
return -this.compareVersions(a.version, b.version);
|
||||
});
|
||||
if (!satisfiedVersions || satisfiedVersions.length === 0) {
|
||||
return null;
|
||||
@@ -697,6 +697,12 @@ class JavaBase {
|
||||
path: satisfiedVersions[0].path
|
||||
};
|
||||
}
|
||||
isVersionSatisfied(range, version) {
|
||||
return (0,util/* isVersionSatisfies */.y)(range, version);
|
||||
}
|
||||
compareVersions(a, b) {
|
||||
return semver_default().compareBuild(a, b);
|
||||
}
|
||||
normalizeVersion(version) {
|
||||
let stable = true;
|
||||
const latest = false;
|
||||
|
||||
Vendored
+38
-2
@@ -52,14 +52,46 @@ class LibericaDistributions extends _base_installer_js__WEBPACK_IMPORTED_MODULE_
|
||||
version: this.convertVersionToSemver(item)
|
||||
}));
|
||||
const satisfiedVersion = availableVersions
|
||||
.filter(item => (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .isVersionSatisfies */ .y)(range, item.version))
|
||||
.sort((a, b) => -semver__WEBPACK_IMPORTED_MODULE_1___default().compareBuild(a.version, b.version))[0];
|
||||
.filter(item => this.isVersionSatisfied(range, item.version))
|
||||
.sort((a, b) => -this.compareVersions(a.version, b.version))[0];
|
||||
if (!satisfiedVersion) {
|
||||
const availableVersionStrings = availableVersions.map(item => item.version);
|
||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||
}
|
||||
return satisfiedVersion;
|
||||
}
|
||||
normalizeVersion(version) {
|
||||
const normalized = super.normalizeVersion(version);
|
||||
if (/^\d+\.\d+\.\d+\.\d+(?:-ea)?$/.test(version)) {
|
||||
// Keep patch-only requests distinct from exact SDKMAN build requests.
|
||||
normalized.version = version.replace(/-ea$/, '');
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
isVersionSatisfied(range, version) {
|
||||
const patchRequest = range.match(/^(\d+\.\d+\.\d+)\.(\d+)$/);
|
||||
if (patchRequest) {
|
||||
const candidate = semver__WEBPACK_IMPORTED_MODULE_1___default().parse(version);
|
||||
if (!candidate || !semver__WEBPACK_IMPORTED_MODULE_1___default().eq(patchRequest[1], candidate)) {
|
||||
return false;
|
||||
}
|
||||
const patch = candidate.build.length > 1 ? candidate.build[0] : '0';
|
||||
return patch === patchRequest[2];
|
||||
}
|
||||
return super.isVersionSatisfied(range, version);
|
||||
}
|
||||
compareVersions(a, b) {
|
||||
const mainComparison = semver__WEBPACK_IMPORTED_MODULE_1___default().compare(a, b);
|
||||
if (mainComparison !== 0) {
|
||||
return mainComparison;
|
||||
}
|
||||
// SDKMAN encodes patch.build, but unpatched releases contain only build.
|
||||
const patchAndBuild = (version) => {
|
||||
const build = new (semver__WEBPACK_IMPORTED_MODULE_1___default().SemVer)(version).build;
|
||||
return (build.length > 1 ? build : ['0', ...build]).join('.');
|
||||
};
|
||||
return semver__WEBPACK_IMPORTED_MODULE_1___default().compareBuild(`0.0.0+${patchAndBuild(a)}`, `0.0.0+${patchAndBuild(b)}`);
|
||||
}
|
||||
async getAvailableVersions() {
|
||||
if (_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .isDebug */ ._o()) {
|
||||
console.time('Retrieving available versions for Liberica took'); // eslint-disable-line no-console
|
||||
@@ -131,6 +163,10 @@ class LibericaDistributions extends _base_installer_js__WEBPACK_IMPORTED_MODULE_
|
||||
const { featureVersion, interimVersion, updateVersion } = version;
|
||||
const buildVersion = version.version.split('+')[1] || version.buildVersion;
|
||||
const mainVersion = [featureVersion, interimVersion, updateVersion].join('.');
|
||||
const patchVersion = version.version.split('+')[0].split('.')[3];
|
||||
if (patchVersion) {
|
||||
return `${mainVersion}+${patchVersion}.${buildVersion}`;
|
||||
}
|
||||
if (buildVersion != 0) {
|
||||
return `${mainVersion}+${buildVersion}`;
|
||||
}
|
||||
|
||||
Vendored
+4
-44
@@ -14,7 +14,6 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ getInputWithDeprecatedAlias: () => (/* binding */ getInputWithDeprecatedAlias),
|
||||
/* harmony export */ getMavenRepositorySettings: () => (/* binding */ getMavenRepositorySettings),
|
||||
/* harmony export */ getMavenServerSettings: () => (/* binding */ getMavenServerSettings),
|
||||
/* harmony export */ parseMavenMirrors: () => (/* binding */ parseMavenMirrors),
|
||||
/* harmony export */ parseMavenRepositories: () => (/* binding */ parseMavenRepositories),
|
||||
/* harmony export */ parseMavenServerCredentials: () => (/* binding */ parseMavenServerCredentials)
|
||||
/* harmony export */ });
|
||||
@@ -43,7 +42,6 @@ const MAVEN_REPOSITORY_ORIGIN = /^[A-Za-z][A-Za-z0-9+.-]*:\/\/[^/?#@]+\/?$/;
|
||||
async function configureAuthentication() {
|
||||
const servers = getMavenServerSettings();
|
||||
const repositorySettings = getMavenRepositorySettings();
|
||||
const mirrors = parseMavenMirrors(_actions_core__WEBPACK_IMPORTED_MODULE_1__/* .getMultilineInput */ .q3(_constants_js__WEBPACK_IMPORTED_MODULE_7__/* .INPUT_MVN_MIRRORS */ .K));
|
||||
const settingsDirectory = _actions_core__WEBPACK_IMPORTED_MODULE_1__/* .getInput */ .V4(_constants_js__WEBPACK_IMPORTED_MODULE_7__/* .INPUT_SETTINGS_PATH */ .Xh) ||
|
||||
path__WEBPACK_IMPORTED_MODULE_0__.join(os__WEBPACK_IMPORTED_MODULE_4__.homedir(), _constants_js__WEBPACK_IMPORTED_MODULE_7__/* .M2_DIR */ .iT);
|
||||
const overwriteSettings = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .getBooleanInput */ .Vt)(_constants_js__WEBPACK_IMPORTED_MODULE_7__/* .INPUT_OVERWRITE_SETTINGS */ .TS, true);
|
||||
@@ -53,7 +51,7 @@ async function configureAuthentication() {
|
||||
if (gpgPrivateKey) {
|
||||
_actions_core__WEBPACK_IMPORTED_MODULE_1__/* .setSecret */ .Pq(gpgPrivateKey);
|
||||
}
|
||||
await createAuthenticationSettings(servers, settingsDirectory, overwriteSettings, gpgPassphraseEnvVar, repositorySettings, mirrors);
|
||||
await createAuthenticationSettings(servers, settingsDirectory, overwriteSettings, gpgPassphraseEnvVar, repositorySettings);
|
||||
if (gpgPrivateKey) {
|
||||
_actions_core__WEBPACK_IMPORTED_MODULE_1__/* .info */ .pq('Importing private gpg key');
|
||||
const gpgHome = await _gpg_js__WEBPACK_IMPORTED_MODULE_5__/* .importKey */ .Fh(gpgPrivateKey);
|
||||
@@ -224,37 +222,6 @@ function parseMavenRepositories(entries, includeCentral, inputName = _constants_
|
||||
});
|
||||
return repositories;
|
||||
}
|
||||
// only exported for testing purposes
|
||||
function parseMavenMirrors(entries) {
|
||||
const mirrors = [];
|
||||
const mirrorIds = new Set();
|
||||
entries.forEach((entry, index) => {
|
||||
if (!entry.trim()) {
|
||||
return;
|
||||
}
|
||||
const separator = entry.indexOf(':');
|
||||
const remainder = entry.slice(separator + 1).trim();
|
||||
// Protect scheme/authority colons (including IPv6 and ports) before
|
||||
// finding the selector, which may itself contain external:http:*.
|
||||
const urlPrefix = /^[A-Za-z][A-Za-z0-9+.-]*:(?:\/\/(?:[^/?#@\s]*@)?(?:\[[^\]]+\]|[^:/?#\s]+)(?::\d+(?=[/?#:\s]|$))?)?/.exec(remainder)?.[0] ?? '';
|
||||
const fields = /^(.*?):((?:\s*!?external:(?:http:)?\*\s*|[^:,]*)(?:,(?:\s*!?external:(?:http:)?\*\s*|[^:,]*))*)$/.exec(remainder.slice(urlPrefix.length));
|
||||
if (separator < 0 || !fields) {
|
||||
throw new Error(`Invalid mvn-mirrors entry at line ${index + 1}. Expected format: mirror-id:mirror-url:mirror-of`);
|
||||
}
|
||||
const id = entry.slice(0, separator).trim();
|
||||
const url = `${urlPrefix}${fields[1]}`.trim();
|
||||
const mirrorOf = fields[2].trim();
|
||||
if (!id || !url || !mirrorOf) {
|
||||
throw new Error(`Invalid mvn-mirrors entry at line ${index + 1}. mirror-id, mirror URL, and mirror-of are required`);
|
||||
}
|
||||
if (mirrorIds.has(id)) {
|
||||
throw new Error(`Duplicate mirror-id '${id}' in mvn-mirrors input at line ${index + 1}`);
|
||||
}
|
||||
mirrorIds.add(id);
|
||||
mirrors.push({ id, url, mirrorOf });
|
||||
});
|
||||
return mirrors;
|
||||
}
|
||||
function generateRepositorySection(customRepositories, settings, element) {
|
||||
if (!customRepositories.length && settings.includeCentral) {
|
||||
return [];
|
||||
@@ -286,15 +253,15 @@ function generateRepositorySection(customRepositories, settings, element) {
|
||||
lines.push(` </${container}>`);
|
||||
return lines;
|
||||
}
|
||||
async function createAuthenticationSettings(servers, settingsDirectory, overwriteSettings, gpgPassphraseEnvVar = undefined, repositorySettings = undefined, mirrors = []) {
|
||||
async function createAuthenticationSettings(servers, settingsDirectory, overwriteSettings, gpgPassphraseEnvVar = undefined, repositorySettings = undefined) {
|
||||
_actions_core__WEBPACK_IMPORTED_MODULE_1__/* .info */ .pq(`Creating ${_constants_js__WEBPACK_IMPORTED_MODULE_7__/* .MVN_SETTINGS_FILE */ .vO} with server-id: ${servers.map(server => server.id).join(', ')}`);
|
||||
// when an alternate m2 location is specified use only that location (no .m2 directory)
|
||||
// otherwise use the home/.m2/ path
|
||||
await _actions_io__WEBPACK_IMPORTED_MODULE_2__/* .mkdirP */ .U$(settingsDirectory);
|
||||
await write(settingsDirectory, generate(servers, gpgPassphraseEnvVar, repositorySettings, mirrors), overwriteSettings);
|
||||
await write(settingsDirectory, generate(servers, gpgPassphraseEnvVar, repositorySettings), overwriteSettings);
|
||||
}
|
||||
// only exported for testing purposes
|
||||
function generate(servers, gpgPassphraseEnvVar, repositorySettings, mirrors = []) {
|
||||
function generate(servers, gpgPassphraseEnvVar, repositorySettings) {
|
||||
// The maven-gpg-plugin reads the passphrase from the environment variable
|
||||
// named by the `gpg.passphraseEnvName` property (default MAVEN_GPG_PASSPHRASE).
|
||||
// Only configure it when the requested env var name differs from that default;
|
||||
@@ -322,13 +289,6 @@ function generate(servers, gpgPassphraseEnvVar, repositorySettings, mirrors = []
|
||||
lines.push(' </server>');
|
||||
}
|
||||
lines.push(' </servers>');
|
||||
if (mirrors.length) {
|
||||
lines.push(' <mirrors>');
|
||||
for (const mirror of mirrors) {
|
||||
lines.push(' <mirror>', ` <id>${(0,_xml_js__WEBPACK_IMPORTED_MODULE_8__/* .escapeXmlText */ .I)(mirror.id)}</id>`, ` <url>${(0,_xml_js__WEBPACK_IMPORTED_MODULE_8__/* .escapeXmlText */ .I)(mirror.url)}</url>`, ` <mirrorOf>${(0,_xml_js__WEBPACK_IMPORTED_MODULE_8__/* .escapeXmlText */ .I)(mirror.mirrorOf)}</mirrorOf>`, ' </mirror>');
|
||||
}
|
||||
lines.push(' </mirrors>');
|
||||
}
|
||||
if (repositorySettings || includeGpgPassphraseProfile) {
|
||||
lines.push(' <profiles>');
|
||||
if (repositorySettings) {
|
||||
|
||||
Vendored
+134
-32
@@ -7217,7 +7217,7 @@ function defaultFactory (origin, opts) {
|
||||
}
|
||||
|
||||
class Agent extends DispatcherBase {
|
||||
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
||||
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, tls, ...options } = {}) {
|
||||
if (typeof factory !== 'function') {
|
||||
throw new InvalidArgumentError('factory must be a function.')
|
||||
}
|
||||
@@ -7236,11 +7236,15 @@ class Agent extends DispatcherBase {
|
||||
connect = { ...connect }
|
||||
}
|
||||
|
||||
if (tls && typeof tls !== 'function') {
|
||||
tls = { ...tls }
|
||||
}
|
||||
|
||||
this[kInterceptors] = options.interceptors?.Agent && Array.isArray(options.interceptors.Agent)
|
||||
? options.interceptors.Agent
|
||||
: [createRedirectInterceptor({ maxRedirections })]
|
||||
|
||||
this[kOptions] = { ...util.deepClone(options), connect }
|
||||
this[kOptions] = { ...util.deepClone(options), connect, tls }
|
||||
this[kOptions].interceptors = options.interceptors
|
||||
? { ...options.interceptors }
|
||||
: undefined
|
||||
@@ -8273,8 +8277,6 @@ async function connectH1 (client, socket) {
|
||||
socket[kParser] = new Parser(client, socket, llhttpInstance)
|
||||
|
||||
addListener(socket, 'error', function (err) {
|
||||
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
||||
|
||||
const parser = this[kParser]
|
||||
|
||||
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
||||
@@ -9204,8 +9206,6 @@ async function connectH2 (client, socket) {
|
||||
socket[kHTTP2Session] = session
|
||||
|
||||
util.addListener(socket, 'error', function (err) {
|
||||
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
||||
|
||||
this[kError] = err
|
||||
|
||||
this[kClient][kOnError](err)
|
||||
@@ -9279,8 +9279,6 @@ function resumeH2 (client) {
|
||||
}
|
||||
|
||||
function onHttp2SessionError (err) {
|
||||
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
||||
|
||||
this[kSocket][kError] = err
|
||||
this[kClient][kOnError](err)
|
||||
}
|
||||
@@ -9978,9 +9976,10 @@ class Client extends DispatcherBase {
|
||||
// h2
|
||||
maxConcurrentStreams,
|
||||
allowH2,
|
||||
webSocket
|
||||
webSocket,
|
||||
eventSource
|
||||
} = {}) {
|
||||
super({ webSocket })
|
||||
super({ webSocket, eventSource })
|
||||
|
||||
if (keepAlive !== undefined) {
|
||||
throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
|
||||
@@ -10501,6 +10500,7 @@ module.exports = Client
|
||||
|
||||
|
||||
|
||||
const buffer = __nccwpck_require__(4573)
|
||||
const Dispatcher = __nccwpck_require__(883)
|
||||
const {
|
||||
ClientDestroyedError,
|
||||
@@ -10513,6 +10513,7 @@ const kOnDestroyed = Symbol('onDestroyed')
|
||||
const kOnClosed = Symbol('onClosed')
|
||||
const kInterceptedDispatch = Symbol('Intercepted Dispatch')
|
||||
const kWebSocketOptions = Symbol('webSocketOptions')
|
||||
const kEventSourceOptions = Symbol('eventSourceOptions')
|
||||
|
||||
class DispatcherBase extends Dispatcher {
|
||||
constructor (opts) {
|
||||
@@ -10523,6 +10524,7 @@ class DispatcherBase extends Dispatcher {
|
||||
this[kClosed] = false
|
||||
this[kOnClosed] = []
|
||||
this[kWebSocketOptions] = opts?.webSocket ?? {}
|
||||
this[kEventSourceOptions] = opts?.eventSource ?? {}
|
||||
}
|
||||
|
||||
get webSocketOptions () {
|
||||
@@ -10532,6 +10534,12 @@ class DispatcherBase extends Dispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
get eventSourceOptions () {
|
||||
return {
|
||||
maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer.kStringMaxLength
|
||||
}
|
||||
}
|
||||
|
||||
get destroyed () {
|
||||
return this[kDestroyed]
|
||||
}
|
||||
@@ -16890,6 +16898,7 @@ module.exports = {
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
|
||||
const buffer = __nccwpck_require__(4573)
|
||||
const { Transform } = __nccwpck_require__(7075)
|
||||
const { isASCIINumber, isValidLastEventId } = __nccwpck_require__(4811)
|
||||
|
||||
@@ -16914,11 +16923,19 @@ const COLON = 0x3A
|
||||
*/
|
||||
const SPACE = 0x20
|
||||
|
||||
const defaultMaxEventSize = buffer.kStringMaxLength
|
||||
|
||||
const DATA = Buffer.from('data')
|
||||
const EVENT = Buffer.from('event')
|
||||
const ID = Buffer.from('id')
|
||||
const RETRY = Buffer.from('retry')
|
||||
|
||||
// Each data field creates a string node, and each unconsumed input chunk keeps
|
||||
// a Buffer wrapper. The absolute ceiling protects the large default byte limit.
|
||||
const minParserItems = 1024
|
||||
const maxParserItems = 131072
|
||||
const bytesPerParserItem = 128
|
||||
|
||||
function isASCIINumberBytes (buffer, start) {
|
||||
if (start >= buffer.length) {
|
||||
return false
|
||||
@@ -16957,6 +16974,12 @@ function isFieldName (line, length, field) {
|
||||
return true
|
||||
}
|
||||
|
||||
function createMaxEventSizeExceededError () {
|
||||
const error = new Error('EventSource message size exceeded')
|
||||
error.aborted = false
|
||||
return error
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} EventSourceStreamEvent
|
||||
* @type {object}
|
||||
@@ -17005,6 +17028,13 @@ class EventSourceStream extends Transform {
|
||||
pos = 0
|
||||
lineChunkIndex = 0
|
||||
linePos = 0
|
||||
lineLength = 0
|
||||
eventSize = 0
|
||||
eventFieldSizes = { data: 0, event: 0, id: 0, retry: 0 }
|
||||
dataLineCount = 0
|
||||
maxEventSize
|
||||
maxDataLines
|
||||
maxBufferedChunks
|
||||
|
||||
event = {
|
||||
data: undefined,
|
||||
@@ -17015,6 +17045,7 @@ class EventSourceStream extends Transform {
|
||||
|
||||
/**
|
||||
* @param {object} options
|
||||
* @param {number} [options.maxEventSize]
|
||||
* @param {eventSourceSettings} options.eventSourceSettings
|
||||
* @param {Function} [options.push]
|
||||
*/
|
||||
@@ -17026,6 +17057,12 @@ class EventSourceStream extends Transform {
|
||||
super(options)
|
||||
|
||||
this.state = options.eventSourceSettings || {}
|
||||
this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize
|
||||
const parserItemLimit = this.maxEventSize > 0
|
||||
? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem)))
|
||||
: 0
|
||||
this.maxDataLines = parserItemLimit
|
||||
this.maxBufferedChunks = parserItemLimit
|
||||
if (options.push) {
|
||||
this.push = options.push
|
||||
}
|
||||
@@ -17043,6 +17080,14 @@ class EventSourceStream extends Transform {
|
||||
return
|
||||
}
|
||||
|
||||
// A leading line ending can immediately release the currently buffered
|
||||
// line, even when it uses the final allowed chunk slot.
|
||||
if (this.maxEventSize > 0 &&
|
||||
this.chunks.length >= this.maxBufferedChunks &&
|
||||
chunk[0] !== LF && chunk[0] !== CR) {
|
||||
callback(createMaxEventSizeExceededError())
|
||||
return
|
||||
}
|
||||
this.chunks.push(chunk)
|
||||
|
||||
// Strip leading byte-order-mark if we opened the stream and started
|
||||
@@ -17121,7 +17166,12 @@ class EventSourceStream extends Transform {
|
||||
|
||||
// In any case, we can process the line as we reached an
|
||||
// end-of-line character
|
||||
this.parseLine(this.readLine(), this.event)
|
||||
try {
|
||||
this.parseLine(this.readLine(), this.event)
|
||||
} catch (error) {
|
||||
callback(error)
|
||||
return
|
||||
}
|
||||
this.consumeCurrentByte()
|
||||
// A line was processed and this could be the end of the event. We need
|
||||
// to check if the next line is empty to determine if the event is
|
||||
@@ -17130,15 +17180,28 @@ class EventSourceStream extends Transform {
|
||||
continue
|
||||
}
|
||||
|
||||
// readLine() is only called after CR or LF. Reject an unfinished line
|
||||
// before it can retain an unbounded number of decoded chunks. The seven
|
||||
// extra bytes allow the longest field prefix ("event: " or "retry: ").
|
||||
if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
|
||||
callback(createMaxEventSizeExceededError())
|
||||
return
|
||||
}
|
||||
this.advanceCursor()
|
||||
}
|
||||
|
||||
callback()
|
||||
}
|
||||
|
||||
_destroy (error, callback) {
|
||||
this.chunks.length = 0
|
||||
this.clearEvent()
|
||||
super._destroy(error, callback)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Buffer} line
|
||||
* @param {EventStreamEvent} event
|
||||
* @param {EventSourceStreamEvent} event
|
||||
*/
|
||||
parseLine (line, event) {
|
||||
// If the line is empty (a blank line)
|
||||
@@ -17172,6 +17235,13 @@ class EventSourceStream extends Transform {
|
||||
}
|
||||
|
||||
if (isFieldName(line, fieldLength, DATA)) {
|
||||
if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) {
|
||||
throw createMaxEventSizeExceededError()
|
||||
}
|
||||
const valueBytes = line.length - valueStart
|
||||
const dataSize = this.eventFieldSizes.data + (event.data === undefined ? 0 : 1) + valueBytes
|
||||
this.setEventFieldSize('data', dataSize)
|
||||
|
||||
const value = line.toString('utf8', valueStart)
|
||||
|
||||
if (event.data === undefined) {
|
||||
@@ -17179,11 +17249,13 @@ class EventSourceStream extends Transform {
|
||||
} else {
|
||||
event.data += `\n${value}`
|
||||
}
|
||||
this.dataLineCount++
|
||||
return
|
||||
}
|
||||
|
||||
if (isFieldName(line, fieldLength, RETRY)) {
|
||||
if (isASCIINumberBytes(line, valueStart)) {
|
||||
this.setEventFieldSize('retry', line.length - valueStart)
|
||||
event.retry = line.toString('utf8', valueStart)
|
||||
}
|
||||
return
|
||||
@@ -17191,20 +17263,29 @@ class EventSourceStream extends Transform {
|
||||
|
||||
if (isFieldName(line, fieldLength, ID)) {
|
||||
if (isValidLastEventIdBytes(line, valueStart)) {
|
||||
this.setEventFieldSize('id', line.length - valueStart)
|
||||
event.id = line.toString('utf8', valueStart)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (isFieldName(line, fieldLength, EVENT)) {
|
||||
const value = line.toString('utf8', valueStart)
|
||||
|
||||
if (value.length > 0) {
|
||||
event.event = value
|
||||
if (valueStart < line.length) {
|
||||
this.setEventFieldSize('event', line.length - valueStart)
|
||||
event.event = line.toString('utf8', valueStart)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setEventFieldSize (field, size) {
|
||||
const eventSize = this.eventSize - this.eventFieldSizes[field] + size
|
||||
if (this.maxEventSize > 0 && eventSize > this.maxEventSize) {
|
||||
throw createMaxEventSizeExceededError()
|
||||
}
|
||||
this.eventSize = eventSize
|
||||
this.eventFieldSizes[field] = size
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {EventSourceStreamEvent} event
|
||||
*/
|
||||
@@ -17235,6 +17316,12 @@ class EventSourceStream extends Transform {
|
||||
this.event.event = undefined
|
||||
this.event.id = undefined
|
||||
this.event.retry = undefined
|
||||
this.eventSize = 0
|
||||
this.dataLineCount = 0
|
||||
this.eventFieldSizes.data = 0
|
||||
this.eventFieldSizes.event = 0
|
||||
this.eventFieldSizes.id = 0
|
||||
this.eventFieldSizes.retry = 0
|
||||
}
|
||||
|
||||
hasPendingEvent () {
|
||||
@@ -17270,14 +17357,16 @@ class EventSourceStream extends Transform {
|
||||
syncLineStartToCursor () {
|
||||
this.lineChunkIndex = this.chunkIndex
|
||||
this.linePos = this.pos
|
||||
this.lineLength = 0
|
||||
this.dropConsumedChunks()
|
||||
}
|
||||
|
||||
dropConsumedChunks () {
|
||||
while (this.lineChunkIndex > 0) {
|
||||
this.chunks.shift()
|
||||
this.lineChunkIndex--
|
||||
this.chunkIndex--
|
||||
if (this.lineChunkIndex > 0) {
|
||||
const consumed = this.lineChunkIndex
|
||||
this.chunks.splice(0, consumed)
|
||||
this.lineChunkIndex = 0
|
||||
this.chunkIndex -= consumed
|
||||
}
|
||||
|
||||
if (this.chunkIndex === this.chunks.length) {
|
||||
@@ -17402,6 +17491,7 @@ const { isNetworkError } = __nccwpck_require__(9051)
|
||||
const { delay } = __nccwpck_require__(4811)
|
||||
const { kEnumerableProperty } = __nccwpck_require__(3440)
|
||||
const { environmentSettingsObject } = __nccwpck_require__(3168)
|
||||
const { getGlobalDispatcher } = __nccwpck_require__(2581)
|
||||
|
||||
let experimentalWarned = false
|
||||
|
||||
@@ -17683,6 +17773,7 @@ class EventSource extends EventTarget {
|
||||
|
||||
const eventSourceStream = new EventSourceStream({
|
||||
eventSourceSettings: this.#state,
|
||||
maxEventSize: this.#dispatcher.eventSourceOptions?.maxEventSize,
|
||||
push: (event) => {
|
||||
this.dispatchEvent(createFastMessageEvent(
|
||||
event.type,
|
||||
@@ -17861,7 +17952,8 @@ webidl.converters.EventSourceInitDict = webidl.dictionaryConverter([
|
||||
},
|
||||
{
|
||||
key: 'dispatcher', // undici only
|
||||
converter: webidl.converters.any
|
||||
converter: webidl.converters.any,
|
||||
defaultValue: () => getGlobalDispatcher()
|
||||
}
|
||||
])
|
||||
|
||||
@@ -22957,8 +23049,10 @@ async function httpNetworkFetch (
|
||||
// 19. Run these steps in parallel:
|
||||
|
||||
// 1. Run these steps, but abort when fetchParams is canceled:
|
||||
fetchParams.controller.onAborted = onAborted
|
||||
fetchParams.controller.on('terminated', onAborted)
|
||||
if (!fetchParams.controller.resume) {
|
||||
fetchParams.controller.on('terminated', onAborted)
|
||||
}
|
||||
|
||||
fetchParams.controller.resume = async () => {
|
||||
// 1. While true
|
||||
while (true) {
|
||||
@@ -23127,8 +23221,6 @@ async function httpNetworkFetch (
|
||||
}
|
||||
location = headersList.get('location', true)
|
||||
|
||||
this.body = new Readable({ read: resume })
|
||||
|
||||
const decoders = []
|
||||
|
||||
const willFollow = location && request.redirect === 'follow' &&
|
||||
@@ -23146,7 +23238,7 @@ async function httpNetworkFetch (
|
||||
// CVE fix similar to urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206).
|
||||
const maxContentEncodings = 5
|
||||
if (codings.length > maxContentEncodings) {
|
||||
reject(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
|
||||
this.abort(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -23179,6 +23271,8 @@ async function httpNetworkFetch (
|
||||
}
|
||||
}
|
||||
|
||||
this.body = new Readable({ read: resume })
|
||||
|
||||
const onError = this.onError.bind(this)
|
||||
|
||||
resolve({
|
||||
@@ -23225,10 +23319,6 @@ async function httpNetworkFetch (
|
||||
fetchParams.controller.off('terminated', this.abort)
|
||||
}
|
||||
|
||||
if (fetchParams.controller.onAborted) {
|
||||
fetchParams.controller.off('terminated', fetchParams.controller.onAborted)
|
||||
}
|
||||
|
||||
fetchParams.controller.ended = true
|
||||
|
||||
this.body.push(null)
|
||||
@@ -29703,6 +29793,20 @@ class ByteParser extends Writable {
|
||||
if (isControlFrame(this.#info.opcode)) {
|
||||
this.#loop = this.parseControlFrame(body)
|
||||
this.#state = parserStates.INFO
|
||||
|
||||
// If the automatic PONG/CLOSE reply filled the socket's write buffer,
|
||||
// stop parsing and resume on drain so a PING flood cannot grow the
|
||||
// outbound queue without bound.
|
||||
const socket = this.ws[kResponse].socket
|
||||
if (this.#loop && socket.writableNeedDrain) {
|
||||
this.#loop = false
|
||||
socket.once('drain', () => {
|
||||
if (this.destroyed) return
|
||||
this.#loop = true
|
||||
this.run(callback)
|
||||
})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (!this.#info.compressed) {
|
||||
if (!this.writeFragments(body)) {
|
||||
@@ -31040,7 +31144,6 @@ module.exports = {
|
||||
/* harmony export */ GL: () => (/* binding */ INPUT_CACHE_JDK),
|
||||
/* harmony export */ H5: () => (/* binding */ INPUT_MVN_REPOSITORIES_INCLUDE_CENTRAL),
|
||||
/* harmony export */ I9: () => (/* binding */ INPUT_FORCE_DOWNLOAD),
|
||||
/* harmony export */ K: () => (/* binding */ INPUT_MVN_MIRRORS),
|
||||
/* harmony export */ K$: () => (/* binding */ GPG_PASSPHRASE_PROFILE_ID),
|
||||
/* harmony export */ LS: () => (/* binding */ INPUT_ARCHITECTURE),
|
||||
/* harmony export */ MM: () => (/* binding */ INPUT_MVN_SERVER_CREDENTIALS),
|
||||
@@ -31112,7 +31215,6 @@ const INPUT_MVN_SERVER_CREDENTIALS = 'mvn-server-credentials';
|
||||
const INPUT_MVN_SERVER_REPOSITORY_ORIGINS = 'mvn-server-repository-origins';
|
||||
const INPUT_MVN_REPOSITORIES = 'mvn-repositories';
|
||||
const INPUT_MVN_PLUGIN_REPOSITORIES = 'mvn-plugin-repositories';
|
||||
const INPUT_MVN_MIRRORS = 'mvn-mirrors';
|
||||
const INPUT_MVN_REPOSITORIES_INCLUDE_CENTRAL = 'mvn-repositories-include-central';
|
||||
const INPUT_MVN_REPOSITORIES_PRIORITIZE_CENTRAL = 'mvn-repositories-prioritize-central';
|
||||
const INPUT_SERVER_ID = 'server-id';
|
||||
|
||||
+6
-71
@@ -28,7 +28,6 @@
|
||||
- [Testing against different platforms](#Testing-against-different-platforms)
|
||||
- [Publishing using Apache Maven](#Publishing-using-Apache-Maven)
|
||||
- [Publishing to multiple Maven servers](#publishing-to-multiple-maven-servers)
|
||||
- [Redirecting Maven repositories with mirrors](#redirecting-maven-repositories-with-mirrors)
|
||||
- [Apache Maven with a settings path](#apache-maven-with-a-settings-path)
|
||||
- [Maven transfer progress (download logs)](#Maven-transfer-progress-download-logs)
|
||||
- [Java problem matcher (compiler annotations)](#java-problem-matcher-compiler-annotations)
|
||||
@@ -84,6 +83,12 @@ steps:
|
||||
|
||||
### Liberica
|
||||
|
||||
Exact patch releases use SDKMAN's `X.Y.Z+P.B` notation, including in `.sdkmanrc`.
|
||||
For example, `java=17.0.20+1.1-librca` selects BellSoft's `17.0.20.1+1` release.
|
||||
Alternatively, `java-version: '17.0.20.1'` selects the newest build of patch 1,
|
||||
whereas `java-version: '17.0.20+1'` selects the exact unpatched build 1.
|
||||
Floating versions such as `17` prefer newer patches before comparing build numbers.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
@@ -1091,76 +1096,6 @@ default; `mvn-repositories-prioritize-central: false` places it after them.
|
||||
All repository generation respects `settings-path` and `overwrite-settings`;
|
||||
an existing settings file is left untouched when `overwrite-settings: false`.
|
||||
|
||||
### Redirecting Maven repositories with mirrors
|
||||
|
||||
Use `mvn-mirrors` to redirect matching dependency and plugin repositories,
|
||||
including Maven Central and repositories declared in project or parent POMs.
|
||||
Unlike repository profiles, mirrors replace the destination Maven contacts.
|
||||
The Central controls described above do not redirect arbitrary POM repositories.
|
||||
|
||||
Each nonblank line has the format `mirror-id:mirror-url:mirror-of`. IDs must be
|
||||
unique within this input. `mirror-url` must be an absolute URL that includes a
|
||||
scheme, such as `https://`. URL schemes, ports, IPv6 addresses, and colons in
|
||||
`mirrorOf` selectors are preserved. An explicit `mirror-of` field is required
|
||||
after the complete URL, including any port. Percent-encode colons in the URL
|
||||
path, query, or fragment as `%3A`. Otherwise, text after the last unencoded
|
||||
colon may be read as the `mirror-of` value. For example:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-java@v6
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
mvn-server-credentials: |
|
||||
private:PRIVATE_REPOSITORY_USERNAME:PRIVATE_REPOSITORY_TOKEN
|
||||
mvn-mirrors: |
|
||||
private:https://maven.example.com/releases:*
|
||||
- run: mvn --batch-mode verify
|
||||
env:
|
||||
PRIVATE_REPOSITORY_USERNAME: ${{ secrets.PRIVATE_REPOSITORY_USERNAME }}
|
||||
PRIVATE_REPOSITORY_TOKEN: ${{ secrets.PRIVATE_REPOSITORY_TOKEN }}
|
||||
```
|
||||
|
||||
This adds the following directly under `<settings>`, not inside a profile:
|
||||
|
||||
```xml
|
||||
<mirrors>
|
||||
<mirror>
|
||||
<id>private</id>
|
||||
<url>https://maven.example.com/releases</url>
|
||||
<mirrorOf>*</mirrorOf>
|
||||
</mirror>
|
||||
</mirrors>
|
||||
```
|
||||
|
||||
For authentication, the mirror ID must match a server ID configured through
|
||||
`mvn-server-credentials` or the single-server inputs. Public mirrors do not need
|
||||
matching credentials. Credentials remain environment-variable references in the
|
||||
generated settings; do not put credential values in `mvn-mirrors`.
|
||||
|
||||
Mirrors can be used alone, as above, or alongside `mvn-repositories` and
|
||||
`mvn-plugin-repositories`. They do not change those inputs or the Central
|
||||
controls. Omitting `mvn-mirrors`, or supplying only blank lines, adds no
|
||||
`<mirrors>` section or repository profile.
|
||||
|
||||
Maven interprets `mirrorOf`: `*` matches every repository, `central` matches
|
||||
only that repository ID, `external:*` matches external repositories, and
|
||||
`external:http:*` matches external HTTP repositories. Comma-separated patterns
|
||||
such as `external:*,!internal` exclude specific IDs. Selector text and mirror
|
||||
order are retained; Maven applies its own matching and precedence rules.
|
||||
For example, a public mirror needs no additional repository or credential input:
|
||||
|
||||
```yaml
|
||||
mvn-mirrors: |
|
||||
public:https://mirror.example.com:8443/maven:external:*,!internal
|
||||
```
|
||||
|
||||
Mirror generation respects `settings-path` and `overwrite-settings`. An existing
|
||||
settings file is left untouched when `overwrite-settings: false`; this input
|
||||
does not merge mirrors into that file.
|
||||
|
||||
### GPG
|
||||
|
||||
The example above uses the [Maven GPG Plugin](https://maven.apache.org/plugins/maven-gpg-plugin/)'s Bouncy Castle signer (`-Dgpg.signer=bc`, available since `maven-gpg-plugin` 3.2.0). It is a pure-Java signer that reads the key directly from the `MAVEN_GPG_KEY` environment variable, so it does **not** require the `gpg` executable, importing the key into a GPG keychain, or the `--pinentry-mode loopback` workaround in your `pom.xml`. The key must be an ASCII-armored secret key (transferable secret key format).
|
||||
|
||||
Generated
+3
-3
@@ -6375,9 +6375,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "6.29.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.29.0.tgz",
|
||||
"integrity": "sha512-R+RODBqp6i2pPflGdq+xIOUkl+RNfGgHwoinecKu/JCuf2uO06cOKoDbI2P7Dn6KcswdKwrczbU6IYJ6K8X+wg==",
|
||||
"version": "6.29.1",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz",
|
||||
"integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18.17"
|
||||
|
||||
+4
-79
@@ -30,20 +30,11 @@ export interface MavenRepositorySettings {
|
||||
prioritizeCentral: boolean;
|
||||
}
|
||||
|
||||
export interface MavenMirror {
|
||||
id: string;
|
||||
url: string;
|
||||
mirrorOf: string;
|
||||
}
|
||||
|
||||
const MAVEN_REPOSITORY_ORIGIN = /^[A-Za-z][A-Za-z0-9+.-]*:\/\/[^/?#@]+\/?$/;
|
||||
|
||||
export async function configureAuthentication() {
|
||||
const servers = getMavenServerSettings();
|
||||
const repositorySettings = getMavenRepositorySettings();
|
||||
const mirrors = parseMavenMirrors(
|
||||
core.getMultilineInput(constants.INPUT_MVN_MIRRORS)
|
||||
);
|
||||
const settingsDirectory =
|
||||
core.getInput(constants.INPUT_SETTINGS_PATH) ||
|
||||
path.join(os.homedir(), constants.M2_DIR);
|
||||
@@ -69,8 +60,7 @@ export async function configureAuthentication() {
|
||||
settingsDirectory,
|
||||
overwriteSettings,
|
||||
gpgPassphraseEnvVar,
|
||||
repositorySettings,
|
||||
mirrors
|
||||
repositorySettings
|
||||
);
|
||||
|
||||
if (gpgPrivateKey) {
|
||||
@@ -343,55 +333,6 @@ export function parseMavenRepositories(
|
||||
return repositories;
|
||||
}
|
||||
|
||||
// only exported for testing purposes
|
||||
export function parseMavenMirrors(entries: string[]): MavenMirror[] {
|
||||
const mirrors: MavenMirror[] = [];
|
||||
const mirrorIds = new Set<string>();
|
||||
|
||||
entries.forEach((entry, index) => {
|
||||
if (!entry.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const separator = entry.indexOf(':');
|
||||
const remainder = entry.slice(separator + 1).trim();
|
||||
// Protect scheme/authority colons (including IPv6 and ports) before
|
||||
// finding the selector, which may itself contain external:http:*.
|
||||
const urlPrefix =
|
||||
/^[A-Za-z][A-Za-z0-9+.-]*:(?:\/\/(?:[^/?#@\s]*@)?(?:\[[^\]]+\]|[^:/?#\s]+)(?::\d+(?=[/?#:\s]|$))?)?/.exec(
|
||||
remainder
|
||||
)?.[0] ?? '';
|
||||
const fields =
|
||||
/^(.*?):((?:\s*!?external:(?:http:)?\*\s*|[^:,]*)(?:,(?:\s*!?external:(?:http:)?\*\s*|[^:,]*))*)$/.exec(
|
||||
remainder.slice(urlPrefix.length)
|
||||
);
|
||||
if (separator < 0 || !fields) {
|
||||
throw new Error(
|
||||
`Invalid mvn-mirrors entry at line ${index + 1}. Expected format: mirror-id:mirror-url:mirror-of`
|
||||
);
|
||||
}
|
||||
|
||||
const id = entry.slice(0, separator).trim();
|
||||
const url = `${urlPrefix}${fields[1]}`.trim();
|
||||
const mirrorOf = fields[2].trim();
|
||||
if (!id || !url || !mirrorOf) {
|
||||
throw new Error(
|
||||
`Invalid mvn-mirrors entry at line ${index + 1}. mirror-id, mirror URL, and mirror-of are required`
|
||||
);
|
||||
}
|
||||
if (mirrorIds.has(id)) {
|
||||
throw new Error(
|
||||
`Duplicate mirror-id '${id}' in mvn-mirrors input at line ${index + 1}`
|
||||
);
|
||||
}
|
||||
|
||||
mirrorIds.add(id);
|
||||
mirrors.push({id, url, mirrorOf});
|
||||
});
|
||||
|
||||
return mirrors;
|
||||
}
|
||||
|
||||
function generateRepositorySection(
|
||||
customRepositories: MavenRepository[],
|
||||
settings: MavenRepositorySettings,
|
||||
@@ -447,8 +388,7 @@ export async function createAuthenticationSettings(
|
||||
settingsDirectory: string,
|
||||
overwriteSettings: boolean,
|
||||
gpgPassphraseEnvVar: string | undefined = undefined,
|
||||
repositorySettings: MavenRepositorySettings | undefined = undefined,
|
||||
mirrors: MavenMirror[] = []
|
||||
repositorySettings: MavenRepositorySettings | undefined = undefined
|
||||
) {
|
||||
core.info(
|
||||
`Creating ${constants.MVN_SETTINGS_FILE} with server-id: ${servers.map(server => server.id).join(', ')}`
|
||||
@@ -458,7 +398,7 @@ export async function createAuthenticationSettings(
|
||||
await io.mkdirP(settingsDirectory);
|
||||
await write(
|
||||
settingsDirectory,
|
||||
generate(servers, gpgPassphraseEnvVar, repositorySettings, mirrors),
|
||||
generate(servers, gpgPassphraseEnvVar, repositorySettings),
|
||||
overwriteSettings
|
||||
);
|
||||
}
|
||||
@@ -467,8 +407,7 @@ export async function createAuthenticationSettings(
|
||||
export function generate(
|
||||
servers: MavenServerCredentials[],
|
||||
gpgPassphraseEnvVar?: string | undefined,
|
||||
repositorySettings?: MavenRepositorySettings | undefined,
|
||||
mirrors: MavenMirror[] = []
|
||||
repositorySettings?: MavenRepositorySettings | undefined
|
||||
) {
|
||||
// The maven-gpg-plugin reads the passphrase from the environment variable
|
||||
// named by the `gpg.passphraseEnvName` property (default MAVEN_GPG_PASSPHRASE).
|
||||
@@ -508,20 +447,6 @@ export function generate(
|
||||
}
|
||||
lines.push(' </servers>');
|
||||
|
||||
if (mirrors.length) {
|
||||
lines.push(' <mirrors>');
|
||||
for (const mirror of mirrors) {
|
||||
lines.push(
|
||||
' <mirror>',
|
||||
` <id>${escapeXmlText(mirror.id)}</id>`,
|
||||
` <url>${escapeXmlText(mirror.url)}</url>`,
|
||||
` <mirrorOf>${escapeXmlText(mirror.mirrorOf)}</mirrorOf>`,
|
||||
' </mirror>'
|
||||
);
|
||||
}
|
||||
lines.push(' </mirrors>');
|
||||
}
|
||||
|
||||
if (repositorySettings || includeGpgPassphraseProfile) {
|
||||
lines.push(' <profiles>');
|
||||
if (repositorySettings) {
|
||||
|
||||
@@ -20,7 +20,6 @@ export const INPUT_MVN_SERVER_REPOSITORY_ORIGINS =
|
||||
'mvn-server-repository-origins';
|
||||
export const INPUT_MVN_REPOSITORIES = 'mvn-repositories';
|
||||
export const INPUT_MVN_PLUGIN_REPOSITORIES = 'mvn-plugin-repositories';
|
||||
export const INPUT_MVN_MIRRORS = 'mvn-mirrors';
|
||||
export const INPUT_MVN_REPOSITORIES_INCLUDE_CENTRAL =
|
||||
'mvn-repositories-include-central';
|
||||
export const INPUT_MVN_REPOSITORIES_PRIORITIZE_CENTRAL =
|
||||
|
||||
@@ -241,7 +241,7 @@ export abstract class JavaBase {
|
||||
if (javaRelease.floating) {
|
||||
if (
|
||||
!semver.valid(foundJava.version) ||
|
||||
!isVersionSatisfies(this.version, foundJava.version)
|
||||
!this.isVersionSatisfied(this.version, foundJava.version)
|
||||
) {
|
||||
throw new Error(
|
||||
`The downloaded ${this.distribution} artifact reported Java ${foundJava.version}, which does not satisfy '${this.version}'.`
|
||||
@@ -401,7 +401,7 @@ export abstract class JavaBase {
|
||||
}
|
||||
if (
|
||||
!semver.valid(restored.release.version) ||
|
||||
!isVersionSatisfies(this.version, restored.release.version)
|
||||
!this.isVersionSatisfied(this.version, restored.release.version)
|
||||
) {
|
||||
core.debug(
|
||||
`Ignoring the cached concrete version '${restored.release.version}' for ${this.distribution} ${this.version}.`
|
||||
@@ -622,10 +622,10 @@ export abstract class JavaBase {
|
||||
.filter(item => item.stable === this.stable);
|
||||
|
||||
const satisfiedVersions = availableVersions
|
||||
.filter(item => isVersionSatisfies(this.version, item.version))
|
||||
.filter(item => this.isVersionSatisfied(this.version, item.version))
|
||||
.filter(item => item.path)
|
||||
.sort((a, b) => {
|
||||
return -semver.compareBuild(a.version, b.version);
|
||||
return -this.compareVersions(a.version, b.version);
|
||||
});
|
||||
if (!satisfiedVersions || satisfiedVersions.length === 0) {
|
||||
return null;
|
||||
@@ -637,6 +637,14 @@ export abstract class JavaBase {
|
||||
};
|
||||
}
|
||||
|
||||
protected isVersionSatisfied(range: string, version: string): boolean {
|
||||
return isVersionSatisfies(range, version);
|
||||
}
|
||||
|
||||
protected compareVersions(a: string, b: string): number {
|
||||
return semver.compareBuild(a, b);
|
||||
}
|
||||
|
||||
protected normalizeVersion(version: string) {
|
||||
let stable = true;
|
||||
const latest = false;
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
cacheJdkDir,
|
||||
extractJdkFile,
|
||||
getDownloadArchiveExtension,
|
||||
isVersionSatisfies,
|
||||
renameWinArchive
|
||||
} from '../../util.js';
|
||||
import * as core from '@actions/core';
|
||||
@@ -66,8 +65,8 @@ export class LibericaDistributions extends JavaBase {
|
||||
}));
|
||||
|
||||
const satisfiedVersion = availableVersions
|
||||
.filter(item => isVersionSatisfies(range, item.version))
|
||||
.sort((a, b) => -semver.compareBuild(a.version, b.version))[0];
|
||||
.filter(item => this.isVersionSatisfied(range, item.version))
|
||||
.sort((a, b) => -this.compareVersions(a.version, b.version))[0];
|
||||
|
||||
if (!satisfiedVersion) {
|
||||
const availableVersionStrings = availableVersions.map(
|
||||
@@ -79,6 +78,45 @@ export class LibericaDistributions extends JavaBase {
|
||||
return satisfiedVersion;
|
||||
}
|
||||
|
||||
protected normalizeVersion(version: string) {
|
||||
const normalized = super.normalizeVersion(version);
|
||||
if (/^\d+\.\d+\.\d+\.\d+(?:-ea)?$/.test(version)) {
|
||||
// Keep patch-only requests distinct from exact SDKMAN build requests.
|
||||
normalized.version = version.replace(/-ea$/, '');
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
protected isVersionSatisfied(range: string, version: string): boolean {
|
||||
const patchRequest = range.match(/^(\d+\.\d+\.\d+)\.(\d+)$/);
|
||||
if (patchRequest) {
|
||||
const candidate = semver.parse(version);
|
||||
if (!candidate || !semver.eq(patchRequest[1], candidate)) {
|
||||
return false;
|
||||
}
|
||||
const patch = candidate.build.length > 1 ? candidate.build[0] : '0';
|
||||
return patch === patchRequest[2];
|
||||
}
|
||||
return super.isVersionSatisfied(range, version);
|
||||
}
|
||||
|
||||
protected compareVersions(a: string, b: string): number {
|
||||
const mainComparison = semver.compare(a, b);
|
||||
if (mainComparison !== 0) {
|
||||
return mainComparison;
|
||||
}
|
||||
|
||||
// SDKMAN encodes patch.build, but unpatched releases contain only build.
|
||||
const patchAndBuild = (version: string): string => {
|
||||
const build = new semver.SemVer(version).build;
|
||||
return (build.length > 1 ? build : ['0', ...build]).join('.');
|
||||
};
|
||||
return semver.compareBuild(
|
||||
`0.0.0+${patchAndBuild(a)}`,
|
||||
`0.0.0+${patchAndBuild(b)}`
|
||||
);
|
||||
}
|
||||
|
||||
private async getAvailableVersions(): Promise<LibericaVersion[]> {
|
||||
if (core.isDebug()) {
|
||||
console.time('Retrieving available versions for Liberica took'); // eslint-disable-line no-console
|
||||
@@ -171,6 +209,10 @@ export class LibericaDistributions extends JavaBase {
|
||||
const mainVersion = [featureVersion, interimVersion, updateVersion].join(
|
||||
'.'
|
||||
);
|
||||
const patchVersion = version.version.split('+')[0].split('.')[3];
|
||||
if (patchVersion) {
|
||||
return `${mainVersion}+${patchVersion}.${buildVersion}`;
|
||||
}
|
||||
if (buildVersion != 0) {
|
||||
return `${mainVersion}+${buildVersion}`;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user