Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable specified personal repos information #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ inputs:
description: 'A boolean value ("true" or "false") on whether the personalRepo should be used.'
required: false
default: false
openj9Repo:
description: 'openj9 Repo, example: eclipse-openj9/openj9:master'
required: false
openj9-omrRepo:
description: 'openj9-omr Repo, example: eclipse-openj9/openj9-omr:openj9'
required: false
openj9-openjdkRepo:
description: 'ibmruntimes extension Repo, example: ibmruntimes/openj9-openjdk-jdk11:openj9 '
required: false
outputs:
BuildJDKDir:
description: 'build jdk images directory'
Expand Down
51 changes: 42 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3335,14 +3335,14 @@ if (!tempDirectory) {
}
tempDirectory = path.join(baseLocation, 'actions', 'temp');
}
function buildJDK(version, usePersonalRepo) {
function buildJDK(version, usePersonalRepo, specifiedReposMap) {
return __awaiter(this, void 0, void 0, function* () {
const openj9Version = `openj9-openjdk-jdk${version}`;
yield installDependencies(version);
process.chdir(`${workDir}`);
yield getBootJdk(version);
process.chdir(`${workDir}`);
yield getSource(openj9Version, usePersonalRepo);
yield getSource(openj9Version, usePersonalRepo, specifiedReposMap);
yield setConfigure(version, openj9Version);
yield exec.exec(`make all`);
yield printJavaVersion(version, openj9Version);
Expand Down Expand Up @@ -3526,7 +3526,7 @@ function getBootJdk(version) {
}
});
}
function getSource(openj9Version, usePersonalRepo) {
function getSource(openj9Version, usePersonalRepo, specifiedReposMap) {
return __awaiter(this, void 0, void 0, function* () {
let openjdkOpenj9Repo = `ibmruntimes/${openj9Version}`;
let openjdkOpenj9Branch = 'openj9';
Expand Down Expand Up @@ -3557,7 +3557,31 @@ function getSource(openj9Version, usePersonalRepo) {
openj9Branch = branch;
}
else {
core.error(`${repo} is not one of openj9-openjdk-jdk8|11|12..., openj9, omr`);
//parsing personal openj9Repo, openj9 Repo, openj9-omrRepo openj9-openjdkRepo'
for (let [key, value] of specifiedReposMap) {
const personalRepo = parseRepoBranch(value)[0];
const personalBranch = parseRepoBranch(value)[1];
switch (key) {
case "openj9Repo": {
openj9Repo = personalRepo;
openj9Branch = personalBranch;
break;
}
case "openj9-omrRepo": {
omrRepo = personalRepo;
omrBranch = personalBranch;
break;
}
case "openj9-openjdkRepo": {
openjdkOpenj9Repo = personalRepo;
openjdkOpenj9Branch = personalBranch;
}
default: {
//statements;
break;
}
}
}
}
}
yield exec.exec(`git clone -b ${openjdkOpenj9Branch} https://github.com/${openjdkOpenj9Repo}.git`);
Expand Down Expand Up @@ -3669,6 +3693,10 @@ function getOsVersion() {
return osVersion;
});
}
function parseRepoBranch(repoBranch) {
const tempRepo = repoBranch.replace(/\s/g, '');
return tempRepo.split(':');
}


/***/ }),
Expand Down Expand Up @@ -4768,13 +4796,18 @@ function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const version = core.getInput('version', { required: false });
const repository = core.getInput('repository', { required: false });
const ref = core.getInput('ref', { required: false });
const usePersonalRepo = core.getInput('usePersonalRepo') === 'true';
if (repository.length === 0 && ref.length !== 0) {
core.error(`Please give repository name`);
let specifiedReposMap = new Map();
if (usePersonalRepo) {
const repos = ['openj9Repo', 'openj9-omrRepo', 'openj9-openjdkRepo'];
for (let repo of repos) {
const tempRepo = core.getInput(repo, { required: false });
if (tempRepo.length !== 0) {
specifiedReposMap.set(repo, tempRepo);
}
}
}
yield builder.buildJDK(version, usePersonalRepo);
yield builder.buildJDK(version, usePersonalRepo, specifiedReposMap);
}
catch (error) {
core.setFailed(error.message);
Expand Down
15 changes: 10 additions & 5 deletions src/build-openj9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ import * as builder from './builder'
async function run(): Promise<void> {
try {
const version = core.getInput('version', {required: false})
const repository = core.getInput('repository', {required: false})
const ref = core.getInput('ref', {required: false})
const usePersonalRepo = core.getInput('usePersonalRepo') === 'true'
if (repository.length === 0 && ref.length !== 0) {
core.error(`Please give repository name`)
let specifiedReposMap = new Map()
if (usePersonalRepo) {
const repos: string[] = ['openj9Repo', 'openj9-omrRepo', 'openj9-openjdkRepo']
for (let repo of repos) {
const tempRepo = core.getInput(repo, { required: false })
if (tempRepo.length !== 0) {
specifiedReposMap.set(repo, tempRepo)
}
}
}
await builder.buildJDK(version, usePersonalRepo)
await builder.buildJDK(version, usePersonalRepo, specifiedReposMap)
} catch (error) {
core.setFailed(error.message)
}
Expand Down
39 changes: 35 additions & 4 deletions src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ if (!tempDirectory) {

export async function buildJDK(
version: string,
usePersonalRepo: boolean
usePersonalRepo: boolean,
specifiedReposMap: Map<string, string>
): Promise<void> {
const openj9Version = `openj9-openjdk-jdk${version}`
await installDependencies(version)
process.chdir(`${workDir}`)
await getBootJdk(version)
process.chdir(`${workDir}`)
await getSource(openj9Version, usePersonalRepo)
await getSource(openj9Version, usePersonalRepo, specifiedReposMap)
await setConfigure(version, openj9Version)
await exec.exec(`make all`)
await printJavaVersion(version, openj9Version)
Expand Down Expand Up @@ -249,7 +250,8 @@ async function getBootJdk(version: string): Promise<void> {

async function getSource(
openj9Version: string,
usePersonalRepo: boolean
usePersonalRepo: boolean,
specifiedReposMap: Map<string, string>
): Promise<void> {
let openjdkOpenj9Repo = `ibmruntimes/${openj9Version}`
let openjdkOpenj9Branch = 'openj9'
Expand Down Expand Up @@ -277,7 +279,31 @@ async function getSource(
openj9Repo = repo
openj9Branch = branch
} else {
core.error(`${repo} is not one of openj9-openjdk-jdk8|11|12..., openj9, omr`)
//parsing personal openj9Repo, openj9 Repo, openj9-omrRepo openj9-openjdkRepo'
for (let [key, value] of specifiedReposMap) {
const personalRepo = parseRepoBranch(value)[0]
const personalBranch = parseRepoBranch(value)[1]
switch(key) {
case "openj9Repo": {
openj9Repo = personalRepo
openj9Branch = personalBranch
break;
}
case "openj9-omrRepo": {
omrRepo = personalRepo
omrBranch = personalBranch
break;
}
case "openj9-openjdkRepo": {
openjdkOpenj9Repo = personalRepo
openjdkOpenj9Branch = personalBranch
}
default: {
//statements;
break;
}
}
}
}
}

Expand Down Expand Up @@ -384,3 +410,8 @@ async function getOsVersion(): Promise<string> {
}
return osVersion
}

function parseRepoBranch(repoBranch: string): string[] {
const tempRepo = repoBranch.replace(/\s/g, '')
return tempRepo.split(':')
}