Skip to content

Commit 1a167c5

Browse files
committed
[FEATURE] Simple Build Extensibility: Pass project namespace to custom tasks
Resolves SAP/ui5-tooling#153
1 parent 747c0aa commit 1a167c5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/types/AbstractBuilder.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class AbstractBuilder {
9797
{module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
9898
{Object} parameters.options Options
9999
{string} parameters.options.projectName Project name
100+
{string} [parameters.options.projectNamespace] Project namespace if available
100101
{string} [parameters.options.configuration] Task configuration if given in ui5.yaml
101102
Returns:
102103
{Promise<undefined>} Promise resolving with undefined once data has been written
@@ -106,6 +107,7 @@ class AbstractBuilder {
106107
dependencies: resourceCollections.dependencies,
107108
options: {
108109
projectName: project.metadata.name,
110+
projectNamespace: project.metadata.namespace,
109111
configuration: taskDef.configuration
110112
}
111113
});

test/lib/types/AbstractBuilder.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ const applicationBTree = {
2929
specVersion: "0.1",
3030
type: "application",
3131
metadata: {
32-
name: "application.b"
32+
name: "application.b",
33+
namespace: "application/b"
3334
},
3435
resources: {
3536
configuration: {
@@ -206,6 +207,7 @@ test.serial("Instantiation with custom task defined three times", (t) => {
206207
test.serial("Instantiation with custom task: Custom task called correctly", (t) => {
207208
const customTask = function({workspace, dependencies, options}) {
208209
t.deepEqual(options.projectName, "application.b", "Correct project name passed to custom task");
210+
t.deepEqual(options.projectNamespace, "application/b", "Correct project namespace passed to custom task");
209211
t.deepEqual(options.configuration, "pony", "Correct configuration passed to custom task");
210212
t.deepEqual(workspace, "myWorkspace", "Correct workspace passed to custom task");
211213
t.deepEqual(dependencies, "myDependencies", "Correct dependency collection passed to custom task");

0 commit comments

Comments
 (0)