Skip to content

Commit

Permalink
[FEATURE] Simple Build Extensibility: Pass project namespace to custo…
Browse files Browse the repository at this point in the history
…m tasks

Resolves SAP/ui5-tooling#153
  • Loading branch information
RandomByte committed Oct 14, 2019
1 parent 747c0aa commit 1a167c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/types/AbstractBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class AbstractBuilder {
{module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
{Object} parameters.options Options
{string} parameters.options.projectName Project name
{string} [parameters.options.projectNamespace] Project namespace if available
{string} [parameters.options.configuration] Task configuration if given in ui5.yaml
Returns:
{Promise<undefined>} Promise resolving with undefined once data has been written
Expand All @@ -106,6 +107,7 @@ class AbstractBuilder {
dependencies: resourceCollections.dependencies,
options: {
projectName: project.metadata.name,
projectNamespace: project.metadata.namespace,
configuration: taskDef.configuration
}
});
Expand Down
4 changes: 3 additions & 1 deletion test/lib/types/AbstractBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const applicationBTree = {
specVersion: "0.1",
type: "application",
metadata: {
name: "application.b"
name: "application.b",
namespace: "application/b"
},
resources: {
configuration: {
Expand Down Expand Up @@ -206,6 +207,7 @@ test.serial("Instantiation with custom task defined three times", (t) => {
test.serial("Instantiation with custom task: Custom task called correctly", (t) => {
const customTask = function({workspace, dependencies, options}) {
t.deepEqual(options.projectName, "application.b", "Correct project name passed to custom task");
t.deepEqual(options.projectNamespace, "application/b", "Correct project namespace passed to custom task");
t.deepEqual(options.configuration, "pony", "Correct configuration passed to custom task");
t.deepEqual(workspace, "myWorkspace", "Correct workspace passed to custom task");
t.deepEqual(dependencies, "myDependencies", "Correct dependency collection passed to custom task");
Expand Down

0 comments on commit 1a167c5

Please sign in to comment.