mirror of
https://github.com/actions/setup-java
synced 2024-12-22 21:22:41 +00:00
Use console.log where appropriate
This commit is contained in:
parent
24327359f8
commit
b8a0027e2c
3 changed files with 9 additions and 7 deletions
|
@ -25,14 +25,14 @@ exports.SETTINGS_FILE = 'settings.xml';
|
||||||
function configAuthentication(id, username, password) {
|
function configAuthentication(id, username, password) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (id && username && password) {
|
if (id && username && password) {
|
||||||
core.debug(`configAuthentication with ${username} and a password`);
|
console.log(`creating ${exports.SETTINGS_FILE} with server-id: ${id}, username: ${username}, and a password`);
|
||||||
const directory = path.join(os.homedir(), exports.M2_DIR);
|
const directory = path.join(os.homedir(), exports.M2_DIR);
|
||||||
yield io.mkdirP(directory);
|
yield io.mkdirP(directory);
|
||||||
core.debug(`created directory ${directory}`);
|
core.debug(`created directory ${directory}`);
|
||||||
yield write(directory, generate(id, username, password));
|
yield write(directory, generate(id, username, password));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.debug(`no auth without username: ${username} and password: ${password}`);
|
core.debug(`no ${exports.SETTINGS_FILE} without server-id: ${id}, username: ${username}, and a password`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ function write(directory, settings) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const options = { encoding: 'utf-8' };
|
const options = { encoding: 'utf-8' };
|
||||||
const location = path.join(directory, exports.SETTINGS_FILE);
|
const location = path.join(directory, exports.SETTINGS_FILE);
|
||||||
core.debug(`writing ${location}`);
|
console.log(`writing ${location}`);
|
||||||
return fs.writeFileSync(location, settings, options);
|
return fs.writeFileSync(location, settings, options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ function run() {
|
||||||
yield installer.getJava(version, arch, jdkFile);
|
yield installer.getJava(version, arch, jdkFile);
|
||||||
const matchersPath = path.join(__dirname, '..', '.github');
|
const matchersPath = path.join(__dirname, '..', '.github');
|
||||||
console.log(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
console.log(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
||||||
const id = core.getInput('id', { required: false });
|
const id = core.getInput('server-id', { required: false });
|
||||||
const username = core.getInput('username', { required: false });
|
const username = core.getInput('username', { required: false });
|
||||||
const password = core.getInput('password', { required: false });
|
const password = core.getInput('password', { required: false });
|
||||||
if (id && username && password) {
|
if (id && username && password) {
|
||||||
|
|
|
@ -13,14 +13,16 @@ export async function configAuthentication(
|
||||||
password: string
|
password: string
|
||||||
) {
|
) {
|
||||||
if (id && username && password) {
|
if (id && username && password) {
|
||||||
core.debug(`configAuthentication with ${username} and a password`);
|
console.log(
|
||||||
|
`creating ${SETTINGS_FILE} with server-id: ${id}, username: ${username}, and a password`
|
||||||
|
);
|
||||||
const directory: string = path.join(os.homedir(), M2_DIR);
|
const directory: string = path.join(os.homedir(), M2_DIR);
|
||||||
await io.mkdirP(directory);
|
await io.mkdirP(directory);
|
||||||
core.debug(`created directory ${directory}`);
|
core.debug(`created directory ${directory}`);
|
||||||
await write(directory, generate(id, username, password));
|
await write(directory, generate(id, username, password));
|
||||||
} else {
|
} else {
|
||||||
core.debug(
|
core.debug(
|
||||||
`no auth without username: ${username} and password: ${password}`
|
`no ${SETTINGS_FILE} without server-id: ${id}, username: ${username}, and a password`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +45,6 @@ export function generate(id: string, username: string, password: string) {
|
||||||
async function write(directory: string, settings: string) {
|
async function write(directory: string, settings: string) {
|
||||||
const options = {encoding: 'utf-8'};
|
const options = {encoding: 'utf-8'};
|
||||||
const location = path.join(directory, SETTINGS_FILE);
|
const location = path.join(directory, SETTINGS_FILE);
|
||||||
core.debug(`writing ${location}`);
|
console.log(`writing ${location}`);
|
||||||
return fs.writeFileSync(location, settings, options);
|
return fs.writeFileSync(location, settings, options);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue