-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
684 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
|
||
- basic image generation based on the while definition file | ||
- repository list generation | ||
- exclude functionallity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
function getArguments(subParser) { | ||
subParser.add_parser("repository-list", { | ||
const buildParser = subParser.add_parser("repository-list", { | ||
help: "repository list file generation" | ||
}); | ||
|
||
buildParser.add_argument("-exclude", { | ||
nargs: "*", | ||
required: false, | ||
help: | ||
"The list of projects or branches to exclude from project-list generation." | ||
}); | ||
|
||
buildParser.add_argument("-include", { | ||
nargs: "*", | ||
required: false, | ||
help: | ||
"The list of projects or branches to include from project-list generation." | ||
}); | ||
} | ||
|
||
module.exports = { getArguments }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5152,6 +5152,8 @@ const { | |
getDefinitionFile, | ||
getFileType, | ||
getOutputFilePath, | ||
getExclude, | ||
getInclude, | ||
getFont | ||
} = __webpack_require__(755); | ||
__webpack_require__(63).config(); | ||
|
@@ -5160,7 +5162,10 @@ async function main() { | |
if (getFileType() === "image") { | ||
await generateImage(getDefinitionFile(), getOutputFilePath(), getFont()); | ||
} else if (getFileType() === "repository-list") { | ||
await generateRepositoryList(getDefinitionFile(), getOutputFilePath()); | ||
await generateRepositoryList(getDefinitionFile(), getOutputFilePath(), { | ||
exclude: getExclude(), | ||
include: getInclude() | ||
}); | ||
} else { | ||
throw new Error( | ||
`file type input value '${getFileType()}' is not supported. Please check documentation.` | ||
|
@@ -6333,6 +6338,16 @@ function getOutputFilePath() { | |
return core.getInput("output-file-path"); | ||
} | ||
|
||
function getExclude() { | ||
const input = core.getInput("exclude"); | ||
return !input || Array.isArray(input) ? input : [input]; | ||
} | ||
|
||
function getInclude() { | ||
const input = core.getInput("include"); | ||
return !input || Array.isArray(input) ? input : [input]; | ||
} | ||
|
||
function getFont() { | ||
return core.getInput("font"); | ||
} | ||
|
@@ -6341,6 +6356,8 @@ module.exports = { | |
getDefinitionFile, | ||
getFileType, | ||
getOutputFilePath, | ||
getExclude, | ||
getInclude, | ||
getFont | ||
}; | ||
|
||
|
@@ -7025,15 +7042,22 @@ const { | |
const fs = __webpack_require__(747); | ||
const path = __webpack_require__(622); | ||
|
||
async function generateRepositoryList(definitionFile, outputFilePath) { | ||
async function generateRepositoryList( | ||
definitionFile, | ||
outputFilePath, | ||
options = {} | ||
) { | ||
logger.info(`Generating repository list file for ${definitionFile}`); | ||
const orderedList = (await getOrderedListForTree(definitionFile)).map( | ||
e => e.project | ||
); | ||
const orderedList = (await getOrderedListForTree(definitionFile)) | ||
.filter(node => isIncluded(node, options.include)) | ||
.filter(node => !isExcluded(node, options.exclude)) | ||
.map(e => e.project); | ||
const content = orderedList | ||
|
||
.map(project => (project ? project.split("/")[1] : project)) | ||
.reduce((acc, project) => acc.concat(`${project}\n`), ""); | ||
logger.info(content); | ||
logger.info(` | ||
${content}`); | ||
createFileContainer(outputFilePath); | ||
fs.writeFileSync(outputFilePath, content); | ||
logger.info( | ||
|
@@ -7044,6 +7068,32 @@ async function generateRepositoryList(definitionFile, outputFilePath) { | |
); | ||
} | ||
|
||
function isIncluded(node, include) { | ||
if (include) { | ||
return ( | ||
include.includes(node.project) || | ||
(node.mapping !== undefined && | ||
node.mapping.source !== undefined && | ||
node.mapping.target !== undefined && | ||
include.includes(`@${node.mapping.source}:${node.mapping.target}`)) | ||
); | ||
} | ||
return true; | ||
} | ||
|
||
function isExcluded(node, exclude) { | ||
if (exclude) { | ||
return ( | ||
exclude.includes(node.project) || | ||
(node.mapping !== undefined && | ||
node.mapping.source !== undefined && | ||
node.mapping.target !== undefined && | ||
exclude.includes(`@${node.mapping.source}:${node.mapping.target}`)) | ||
); | ||
} | ||
return false; | ||
} | ||
|
||
module.exports = { generateRepositoryList }; | ||
|
||
|
||
|
@@ -7052,7 +7102,7 @@ module.exports = { generateRepositoryList }; | |
/***/ 896: | ||
/***/ (function(module) { | ||
|
||
module.exports = {"_args":[["[email protected]","/home/emingora/development/projects/RedHat/issues/BXMSPROD-1044/build-chain-files-generator"]],"_from":"[email protected]","_id":"[email protected]","_inBundle":false,"_integrity":"sha512-S98rKsPcuhfTcYbtF53UIJhcbgIAK533d1kJKMwsMwAIFgfd58MOyxRud3kktlzWiEkFliaJtvyZCBtud/XVEA==","_location":"/canvas","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"[email protected]","name":"canvas","escapedName":"canvas","rawSpec":"2.6.1","saveSpec":null,"fetchSpec":"2.6.1"},"_requiredBy":["/tree-image-drawer"],"_resolved":"https://registry.npmjs.org/canvas/-/canvas-2.6.1.tgz","_spec":"2.6.1","_where":"/home/emingora/development/projects/RedHat/issues/BXMSPROD-1044/build-chain-files-generator","author":{"name":"TJ Holowaychuk","email":"[email protected]"},"binary":{"module_name":"canvas","module_path":"build/Release","host":"https://github.com/node-gfx/node-canvas-prebuilt/releases/download/","remote_path":"v{version}","package_name":"{module_name}-v{version}-{node_abi}-{platform}-{libc}-{arch}.tar.gz"},"browser":"browser.js","bugs":{"url":"https://github.com/Automattic/node-canvas/issues"},"contributors":[{"name":"Nathan Rajlich","email":"[email protected]"},{"name":"Rod Vagg","email":"[email protected]"},{"name":"Juriy Zaytsev","email":"[email protected]"}],"dependencies":{"nan":"^2.14.0","node-pre-gyp":"^0.11.0","simple-get":"^3.0.3"},"description":"Canvas graphics API backed by Cairo","devDependencies":{"@types/node":"^10.12.18","assert-rejects":"^1.0.0","dtslint":"^0.5.3","express":"^4.16.3","mocha":"^5.2.0","pixelmatch":"^4.0.2","standard":"^12.0.1"},"engines":{"node":">=6"},"files":["binding.gyp","lib/","src/","util/","types/index.d.ts"],"homepage":"https://github.com/Automattic/node-canvas","keywords":["canvas","graphic","graphics","pixman","cairo","image","images","pdf"],"license":"MIT","main":"index.js","name":"canvas","repository":{"type":"git","url":"git://github.com/Automattic/node-canvas.git"},"scripts":{"benchmark":"node benchmarks/run.js","dtslint":"dtslint types","install":"node-pre-gyp install --fallback-to-build","prebenchmark":"node-gyp build","pretest":"standard examples/*.js test/server.js test/public/*.js benchmarks/run.js lib/context2d.js util/has_lib.js browser.js index.js && node-gyp build","pretest-server":"node-gyp build","test":"mocha test/*.test.js","test-server":"node test/server.js"},"types":"types/index.d.ts","version":"2.6.1"}; | ||
module.exports = {"name":"canvas","description":"Canvas graphics API backed by Cairo","version":"2.6.1","author":"TJ Holowaychuk <[email protected]>","main":"index.js","browser":"browser.js","contributors":["Nathan Rajlich <[email protected]>","Rod Vagg <[email protected]>","Juriy Zaytsev <[email protected]>"],"keywords":["canvas","graphic","graphics","pixman","cairo","image","images","pdf"],"homepage":"https://github.com/Automattic/node-canvas","repository":"git://github.com/Automattic/node-canvas.git","scripts":{"prebenchmark":"node-gyp build","benchmark":"node benchmarks/run.js","pretest":"standard examples/*.js test/server.js test/public/*.js benchmarks/run.js lib/context2d.js util/has_lib.js browser.js index.js && node-gyp build","test":"mocha test/*.test.js","pretest-server":"node-gyp build","test-server":"node test/server.js","install":"node-pre-gyp install --fallback-to-build","dtslint":"dtslint types"},"binary":{"module_name":"canvas","module_path":"build/Release","host":"https://github.com/node-gfx/node-canvas-prebuilt/releases/download/","remote_path":"v{version}","package_name":"{module_name}-v{version}-{node_abi}-{platform}-{libc}-{arch}.tar.gz"},"files":["binding.gyp","lib/","src/","util/","types/index.d.ts"],"types":"types/index.d.ts","dependencies":{"nan":"^2.14.0","node-pre-gyp":"^0.11.0","simple-get":"^3.0.3"},"devDependencies":{"@types/node":"^10.12.18","assert-rejects":"^1.0.0","dtslint":"^0.5.3","express":"^4.16.3","mocha":"^5.2.0","pixelmatch":"^4.0.2","standard":"^12.0.1"},"engines":{"node":">=6"},"license":"MIT","_resolved":"https://registry.npmjs.org/canvas/-/canvas-2.6.1.tgz","_integrity":"sha512-S98rKsPcuhfTcYbtF53UIJhcbgIAK533d1kJKMwsMwAIFgfd58MOyxRud3kktlzWiEkFliaJtvyZCBtud/XVEA==","_from":"[email protected]"}; | ||
|
||
/***/ }), | ||
|
||
|
Oops, something went wrong.