@ui5/builder 3.0.0-alpha.4 → 3.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -1
- package/index.js +0 -39
- package/lib/lbt/analyzer/JSModuleAnalyzer.js +13 -2
- package/lib/lbt/bundle/Builder.js +18 -48
- package/lib/lbt/resources/LocatorResource.js +1 -1
- package/lib/lbt/resources/ResourceCollector.js +22 -15
- package/lib/lbt/resources/ResourceInfoList.js +0 -1
- package/lib/lbt/resources/ResourcePool.js +7 -6
- package/lib/lbt/utils/escapePropertiesFile.js +3 -6
- package/lib/processors/bundlers/moduleBundler.js +2 -3
- package/lib/processors/jsdoc/lib/transformApiJson.js +13 -4
- package/lib/processors/manifestCreator.js +8 -45
- package/lib/tasks/TaskUtil.js +82 -17
- package/lib/tasks/bundlers/generateComponentPreload.js +14 -14
- package/lib/tasks/bundlers/generateFlexChangesBundle.js +6 -2
- package/lib/tasks/bundlers/generateLibraryPreload.js +84 -91
- package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
- package/lib/tasks/bundlers/generateStandaloneAppBundle.js +7 -2
- package/lib/tasks/bundlers/utils/createModuleNameMapping.js +3 -2
- package/lib/tasks/generateCachebusterInfo.js +7 -3
- package/lib/tasks/generateLibraryManifest.js +6 -8
- package/lib/tasks/generateResourcesJson.js +1 -1
- package/lib/tasks/generateThemeDesignerResources.js +118 -2
- package/lib/tasks/generateVersionInfo.js +5 -5
- package/lib/tasks/taskRepository.js +1 -13
- package/lib/tasks/transformBootstrapHtml.js +6 -1
- package/package.json +4 -5
- package/lib/builder/BuildContext.js +0 -60
- package/lib/builder/ProjectBuildContext.js +0 -61
- package/lib/builder/builder.js +0 -425
- package/lib/types/AbstractBuilder.js +0 -270
- package/lib/types/AbstractFormatter.js +0 -66
- package/lib/types/AbstractUi5Formatter.js +0 -95
- package/lib/types/application/ApplicationBuilder.js +0 -211
- package/lib/types/application/ApplicationFormatter.js +0 -227
- package/lib/types/application/applicationType.js +0 -15
- package/lib/types/library/LibraryBuilder.js +0 -232
- package/lib/types/library/LibraryFormatter.js +0 -519
- package/lib/types/library/libraryType.js +0 -15
- package/lib/types/module/ModuleBuilder.js +0 -7
- package/lib/types/module/ModuleFormatter.js +0 -54
- package/lib/types/module/moduleType.js +0 -15
- package/lib/types/themeLibrary/ThemeLibraryBuilder.js +0 -64
- package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
- package/lib/types/themeLibrary/themeLibraryType.js +0 -15
- package/lib/types/typeRepository.js +0 -46
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const log = require("@ui5/logger").getLogger("builder:tasks:generateLibraryManifest");
|
|
4
4
|
const manifestCreator = require("../processors/manifestCreator");
|
|
5
|
-
const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized;
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -12,23 +11,19 @@ const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritiz
|
|
|
12
11
|
* @alias module:@ui5/builder.tasks.generateLibraryManifest
|
|
13
12
|
* @param {object} parameters Parameters
|
|
14
13
|
* @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
|
|
15
|
-
* @param {module:@ui5/
|
|
14
|
+
* @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
|
|
16
15
|
* @param {object} parameters.options Options
|
|
17
16
|
* @param {string} parameters.options.projectName Project name
|
|
18
17
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
19
18
|
*/
|
|
20
|
-
module.exports = function({workspace,
|
|
21
|
-
const combo = new ReaderCollectionPrioritized({
|
|
22
|
-
name: `libraryManifestGenerator - prioritize workspace over dependencies: ${projectName}`,
|
|
23
|
-
readers: [workspace, dependencies]
|
|
24
|
-
});
|
|
19
|
+
module.exports = function({workspace, taskUtil, options: {projectName}}) {
|
|
25
20
|
// Note:
|
|
26
21
|
// *.library files are needed to identify libraries
|
|
27
22
|
// *.json files are needed to avoid overwriting them
|
|
28
23
|
// *.js files are needed to identify nested components
|
|
29
24
|
// *.less, *.css, *.theming and *.theme files are needed to identify supported themes
|
|
30
25
|
// *.properties to identify existence of i18n bundles (e.g. messagebundle.properties)
|
|
31
|
-
return
|
|
26
|
+
return workspace.byGlob("/resources/**/*.{js,json,library,less,css,theming,theme,properties}").then((resources) => {
|
|
32
27
|
// Find all libraries and create a manifest.json file
|
|
33
28
|
return workspace.byGlob("/resources/**/.library").then((libraryIndicatorResources) => {
|
|
34
29
|
if (libraryIndicatorResources.length < 1) {
|
|
@@ -51,6 +46,9 @@ module.exports = function({workspace, dependencies, options: {projectName}}) {
|
|
|
51
46
|
libraryResource: libraryIndicatorResource,
|
|
52
47
|
namespace: libraryNamespace,
|
|
53
48
|
resources,
|
|
49
|
+
getProjectVersion: (projectName) => {
|
|
50
|
+
return taskUtil?.getProject(projectName)?.getVersion();
|
|
51
|
+
},
|
|
54
52
|
options: {
|
|
55
53
|
}
|
|
56
54
|
}).then((manifest) => {
|
|
@@ -43,7 +43,7 @@ function getCreatorOptions(projectName) {
|
|
|
43
43
|
*
|
|
44
44
|
* <p>
|
|
45
45
|
* The detailed structure can be found in the documentation:
|
|
46
|
-
* {@link https://openui5.
|
|
46
|
+
* {@link https://sdk.openui5.org/topic/adcbcf8b50924556ab3f321fcd9353ea}
|
|
47
47
|
* </p>
|
|
48
48
|
*
|
|
49
49
|
* <p>
|
|
@@ -3,6 +3,37 @@ const log = require("@ui5/logger").getLogger("builder:tasks:generateThemeDesigne
|
|
|
3
3
|
const libraryLessGenerator = require("../processors/libraryLessGenerator");
|
|
4
4
|
const {ReaderCollectionPrioritized, Resource, fsInterface} = require("@ui5/fs");
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Returns a relative path from the given themeFolder to the root namespace.
|
|
8
|
+
*
|
|
9
|
+
* When combining the given themeFolder with the returned relative path it
|
|
10
|
+
* resolves to "/resources/". However the "/resources/" part is not important
|
|
11
|
+
* here as it doesn't exist within the theming engine environment where the
|
|
12
|
+
* UI5 resources are part of a "UI5" folder (e.g. "UI5/sap/ui/core/") that
|
|
13
|
+
* is next to a "Base" folder.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* getPathToRoot("/resources/sap/ui/foo/themes/base")
|
|
17
|
+
* > "../../../../../"
|
|
18
|
+
*
|
|
19
|
+
* @param {string} themeFolder Virtual path including /resources/
|
|
20
|
+
* @returns {string} Relative path to root namespace
|
|
21
|
+
*/
|
|
22
|
+
function getPathToRoot(themeFolder) {
|
|
23
|
+
// -2 for initial "/"" and "resources/"
|
|
24
|
+
return "../".repeat(themeFolder.split("/").length - 2);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Generates an less import statement for the given <code>filePath</code>
|
|
29
|
+
*
|
|
30
|
+
* @param {string} filePath The path to the desired file
|
|
31
|
+
* @returns {string} The less import statement
|
|
32
|
+
*/
|
|
33
|
+
function lessImport(filePath) {
|
|
34
|
+
return `@import "${filePath}";\n`;
|
|
35
|
+
}
|
|
36
|
+
|
|
6
37
|
function generateLibraryDotTheming({namespace, version, hasThemes}) {
|
|
7
38
|
const dotTheming = {
|
|
8
39
|
sEntity: "Library",
|
|
@@ -80,6 +111,83 @@ async function generateThemeDotTheming({workspace, combo, themeFolder}) {
|
|
|
80
111
|
return newDotThemingResource;
|
|
81
112
|
}
|
|
82
113
|
|
|
114
|
+
async function createCssVariablesLessResource({workspace, combo, themeFolder}) {
|
|
115
|
+
const pathToRoot = getPathToRoot(themeFolder);
|
|
116
|
+
const cssVariablesSourceLessFile = "css_variables.source.less";
|
|
117
|
+
const cssVariablesLessFile = "css_variables.less";
|
|
118
|
+
|
|
119
|
+
// posix as it is a virtual path (separated with /)
|
|
120
|
+
const themeName = posixPath.basename(themeFolder);
|
|
121
|
+
// The "base" theme of the baseLib is called "baseTheme"
|
|
122
|
+
const baseLibThemeName = themeName === "base" ? "baseTheme" : themeName;
|
|
123
|
+
|
|
124
|
+
// Some themes do not have a base.less file (e.g. sap_hcb)
|
|
125
|
+
const hasBaseLess = !!(await combo.byPath(`/resources/sap/ui/core/themes/${themeName}/base.less`));
|
|
126
|
+
|
|
127
|
+
let cssVariablesLess =
|
|
128
|
+
`/* NOTE: This file was generated as an optimized version of "${cssVariablesSourceLessFile}" \
|
|
129
|
+
for the Theme Designer. */\n\n`;
|
|
130
|
+
|
|
131
|
+
if (themeName !== "base") {
|
|
132
|
+
const cssVariablesSourceLessResource = await workspace.byPath(
|
|
133
|
+
posixPath.join(themeFolder, cssVariablesSourceLessFile)
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
if (!cssVariablesSourceLessResource) {
|
|
137
|
+
throw new Error(`Could not find file "${cssVariablesSourceLessFile}" in theme "${themeFolder}"`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const cssVariablesSourceLess = await cssVariablesSourceLessResource.getString();
|
|
141
|
+
|
|
142
|
+
cssVariablesLess += lessImport(`../base/${cssVariablesLessFile}`);
|
|
143
|
+
cssVariablesLess += `
|
|
144
|
+
/* START "${cssVariablesSourceLessFile}" */
|
|
145
|
+
${cssVariablesSourceLess}
|
|
146
|
+
/* END "${cssVariablesSourceLessFile}" */
|
|
147
|
+
|
|
148
|
+
`;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (hasBaseLess) {
|
|
152
|
+
cssVariablesLess += lessImport(`${pathToRoot}../Base/baseLib/${baseLibThemeName}/base.less`);
|
|
153
|
+
}
|
|
154
|
+
cssVariablesLess += lessImport(`${pathToRoot}sap/ui/core/themes/${themeName}/global.less`);
|
|
155
|
+
|
|
156
|
+
return new Resource({
|
|
157
|
+
path: posixPath.join(themeFolder, cssVariablesLessFile),
|
|
158
|
+
string: cssVariablesLess
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function generateCssVariablesLess({workspace, combo, namespace}) {
|
|
163
|
+
let cssVariablesSourceLessResourcePattern;
|
|
164
|
+
if (namespace) {
|
|
165
|
+
// In case of a library only check for themes directly below the namespace
|
|
166
|
+
cssVariablesSourceLessResourcePattern = `/resources/${namespace}/themes/*/css_variables.source.less`;
|
|
167
|
+
} else {
|
|
168
|
+
// In case of a theme-library check for all "themes"
|
|
169
|
+
cssVariablesSourceLessResourcePattern = `/resources/**/themes/*/css_variables.source.less`;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const cssVariablesSourceLessResource = await workspace.byGlob(cssVariablesSourceLessResourcePattern);
|
|
173
|
+
|
|
174
|
+
const hasCssVariables = cssVariablesSourceLessResource.length > 0;
|
|
175
|
+
|
|
176
|
+
if (hasCssVariables) {
|
|
177
|
+
await Promise.all(
|
|
178
|
+
cssVariablesSourceLessResource.map(async (cssVariableSourceLess) => {
|
|
179
|
+
const themeFolder = posixPath.dirname(cssVariableSourceLess.getPath());
|
|
180
|
+
log.verbose(`Generating css_variables.less for theme ${themeFolder}`);
|
|
181
|
+
const r = await createCssVariablesLessResource({
|
|
182
|
+
workspace, combo, themeFolder
|
|
183
|
+
});
|
|
184
|
+
return await workspace.write(r);
|
|
185
|
+
})
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* eslint "jsdoc/check-param-names": ["error", {"disableExtraPropertyReporting":true}] */
|
|
83
191
|
/**
|
|
84
192
|
* Generates resources required for integration with the SAP Theme Designer.
|
|
85
193
|
*
|
|
@@ -91,11 +199,16 @@ async function generateThemeDotTheming({workspace, combo, themeFolder}) {
|
|
|
91
199
|
* @param {object} parameters.options Options
|
|
92
200
|
* @param {string} parameters.options.projectName Project name
|
|
93
201
|
* @param {string} parameters.options.version Project version
|
|
94
|
-
* @param {string} [parameters.options.
|
|
202
|
+
* @param {string} [parameters.options.projectNamespace] If the project is of type <code>library</code>,
|
|
203
|
+
* provide its namespace.
|
|
95
204
|
* Omit for type <code>theme-library</code>
|
|
96
205
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
97
206
|
*/
|
|
98
|
-
module.exports = async function({workspace, dependencies, options
|
|
207
|
+
module.exports = async function({workspace, dependencies, options}) {
|
|
208
|
+
const {projectName, version} = options;
|
|
209
|
+
// Backward compatibility: "namespace" option got renamed to "projectNamespace"
|
|
210
|
+
const namespace = options.projectNamespace || options.namespace;
|
|
211
|
+
|
|
99
212
|
// Skip sap.ui.documentation since it is not intended to be available in SAP Theme Designer to create custom themes
|
|
100
213
|
if (namespace === "sap/ui/documentation") {
|
|
101
214
|
return;
|
|
@@ -163,4 +276,7 @@ module.exports = async function({workspace, dependencies, options: {projectName,
|
|
|
163
276
|
await Promise.all(
|
|
164
277
|
libraryLessResources.map((resource) => workspace.write(resource))
|
|
165
278
|
);
|
|
279
|
+
|
|
280
|
+
// css_variables.less
|
|
281
|
+
await generateCssVariablesLess({workspace, combo, namespace});
|
|
166
282
|
};
|
|
@@ -19,7 +19,7 @@ module.exports = async ({workspace, dependencies, options: {rootProject, pattern
|
|
|
19
19
|
const resources = await dependencies.byGlob(pattern);
|
|
20
20
|
|
|
21
21
|
const libraryInfosPromises = resources.map((dotLibResource) => {
|
|
22
|
-
const namespace = dotLibResource.
|
|
22
|
+
const namespace = dotLibResource.getProject().getNamespace();
|
|
23
23
|
// pass all required resources to the processor
|
|
24
24
|
// the processor will then filter
|
|
25
25
|
return dependencies.byGlob(`/resources/${namespace}/**/${MANIFEST_JSON}`).then((manifestResources) => {
|
|
@@ -31,8 +31,8 @@ module.exports = async ({workspace, dependencies, options: {rootProject, pattern
|
|
|
31
31
|
return {
|
|
32
32
|
libraryManifest,
|
|
33
33
|
embeddedManifests,
|
|
34
|
-
name: dotLibResource.
|
|
35
|
-
version: dotLibResource.
|
|
34
|
+
name: dotLibResource.getProject().getName(),
|
|
35
|
+
version: dotLibResource.getProject().getVersion()
|
|
36
36
|
};
|
|
37
37
|
});
|
|
38
38
|
});
|
|
@@ -40,8 +40,8 @@ module.exports = async ({workspace, dependencies, options: {rootProject, pattern
|
|
|
40
40
|
|
|
41
41
|
const [versionInfoResource] = await versionInfoGenerator({
|
|
42
42
|
options: {
|
|
43
|
-
rootProjectName: rootProject.
|
|
44
|
-
rootProjectVersion: rootProject.
|
|
43
|
+
rootProjectName: rootProject.getName(),
|
|
44
|
+
rootProjectVersion: rootProject.getVersion(),
|
|
45
45
|
libraryInfos
|
|
46
46
|
}
|
|
47
47
|
});
|
|
@@ -36,30 +36,18 @@ function getTask(taskName) {
|
|
|
36
36
|
try {
|
|
37
37
|
const task = require(taskInfo.path);
|
|
38
38
|
return {
|
|
39
|
-
task
|
|
40
|
-
specVersion: taskInfo.specVersion
|
|
39
|
+
task
|
|
41
40
|
};
|
|
42
41
|
} catch (err) {
|
|
43
42
|
throw new Error(`taskRepository: Failed to require task module for ${taskName}: ${err.message}`);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
function addTask({name, specVersion, taskPath}) {
|
|
48
|
-
if (taskInfos[name]) {
|
|
49
|
-
throw new Error(`taskRepository: A task with the name ${name} has already been registered`);
|
|
50
|
-
}
|
|
51
|
-
taskInfos[name] = {
|
|
52
|
-
path: taskPath,
|
|
53
|
-
specVersion
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
46
|
function getAllTaskNames() {
|
|
58
47
|
return Object.keys(taskInfos);
|
|
59
48
|
}
|
|
60
49
|
|
|
61
50
|
module.exports = {
|
|
62
51
|
getTask,
|
|
63
|
-
addTask,
|
|
64
52
|
getAllTaskNames
|
|
65
53
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const log = require("@ui5/logger").getLogger("builder:tasks:transformBootstrapHtml");
|
|
2
2
|
const bootstrapHtmlTransformer = require("../processors/bootstrapHtmlTransformer");
|
|
3
3
|
|
|
4
|
+
/* eslint "jsdoc/check-param-names": ["error", {"disableExtraPropertyReporting":true}] */
|
|
4
5
|
/**
|
|
5
6
|
* Task for transforming the application bootstrap HTML file.
|
|
6
7
|
*
|
|
@@ -12,7 +13,11 @@ const bootstrapHtmlTransformer = require("../processors/bootstrapHtmlTransformer
|
|
|
12
13
|
* @param {string} [parameters.options.namespace] Project namespace
|
|
13
14
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
14
15
|
*/
|
|
15
|
-
module.exports = async function({workspace, options
|
|
16
|
+
module.exports = async function({workspace, options}) {
|
|
17
|
+
const {projectName} = options;
|
|
18
|
+
// Backward compatibility: "namespace" option got renamed to "projectNamespace"
|
|
19
|
+
const namespace = options.projectNamespace || options.namespace;
|
|
20
|
+
|
|
16
21
|
let indexPath;
|
|
17
22
|
if (namespace) {
|
|
18
23
|
indexPath = `/resources/${namespace}/index.html`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/builder",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.7",
|
|
4
4
|
"description": "UI5 Tooling - Builder",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -105,28 +105,27 @@
|
|
|
105
105
|
"url": "git@github.com:SAP/ui5-builder.git"
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
|
-
"@ui5/fs": "^3.0.0-alpha.
|
|
108
|
+
"@ui5/fs": "^3.0.0-alpha.4",
|
|
109
109
|
"@ui5/logger": "^3.0.1-alpha.1",
|
|
110
110
|
"cheerio": "1.0.0-rc.9",
|
|
111
111
|
"escape-unicode": "^0.2.0",
|
|
112
112
|
"escope": "^3.6.0",
|
|
113
113
|
"espree": "^9.3.1",
|
|
114
|
-
"globby": "^11.1.0",
|
|
115
114
|
"graceful-fs": "^4.2.9",
|
|
116
115
|
"jsdoc": "^3.6.7",
|
|
117
116
|
"less-openui5": "^0.11.2",
|
|
118
117
|
"make-dir": "^3.1.0",
|
|
119
118
|
"pretty-data": "^0.40.0",
|
|
120
|
-
"pretty-hrtime": "^1.0.3",
|
|
121
119
|
"replacestream": "^4.0.3",
|
|
122
120
|
"rimraf": "^3.0.2",
|
|
123
121
|
"semver": "^7.3.5",
|
|
124
122
|
"sourcemap-codec": "^1.4.8",
|
|
125
|
-
"terser": "^5.
|
|
123
|
+
"terser": "^5.14.1",
|
|
126
124
|
"xml2js": "^0.4.23",
|
|
127
125
|
"yazl": "^2.5.1"
|
|
128
126
|
},
|
|
129
127
|
"devDependencies": {
|
|
128
|
+
"@ui5/project": "SAP/ui5-project#ui5-project-3.0",
|
|
130
129
|
"ava": "^3.15.0",
|
|
131
130
|
"chai": "^4.3.4",
|
|
132
131
|
"chai-fs": "^2.0.0",
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const ResourceTagCollection = require("@ui5/fs").ResourceTagCollection;
|
|
2
|
-
const ProjectBuildContext = require("./ProjectBuildContext");
|
|
3
|
-
|
|
4
|
-
// Note: When adding standard tags, always update the public documentation in TaskUtil
|
|
5
|
-
// (Type "module:@ui5/builder.tasks.TaskUtil~StandardBuildTags")
|
|
6
|
-
const GLOBAL_TAGS = Object.freeze({
|
|
7
|
-
IsDebugVariant: "ui5:IsDebugVariant",
|
|
8
|
-
HasDebugVariant: "ui5:HasDebugVariant",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Context of a build process
|
|
13
|
-
*
|
|
14
|
-
* @private
|
|
15
|
-
* @memberof module:@ui5/builder.builder
|
|
16
|
-
*/
|
|
17
|
-
class BuildContext {
|
|
18
|
-
constructor({rootProject, options = {}}) {
|
|
19
|
-
if (!rootProject) {
|
|
20
|
-
throw new Error(`Missing parameter 'rootProject'`);
|
|
21
|
-
}
|
|
22
|
-
this.rootProject = rootProject;
|
|
23
|
-
this.projectBuildContexts = [];
|
|
24
|
-
this._resourceTagCollection = new ResourceTagCollection({
|
|
25
|
-
allowedTags: Object.values(GLOBAL_TAGS)
|
|
26
|
-
});
|
|
27
|
-
this.options = options;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
getRootProject() {
|
|
31
|
-
return this.rootProject;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
getOption(key) {
|
|
35
|
-
return this.options[key];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
createProjectContext({project, resources}) {
|
|
39
|
-
const projectBuildContext = new ProjectBuildContext({
|
|
40
|
-
buildContext: this,
|
|
41
|
-
globalTags: GLOBAL_TAGS,
|
|
42
|
-
project,
|
|
43
|
-
resources
|
|
44
|
-
});
|
|
45
|
-
this.projectBuildContexts.push(projectBuildContext);
|
|
46
|
-
return projectBuildContext;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async executeCleanupTasks() {
|
|
50
|
-
await Promise.all(this.projectBuildContexts.map((ctx) => {
|
|
51
|
-
return ctx.executeCleanupTasks();
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getResourceTagCollection() {
|
|
56
|
-
return this._resourceTagCollection;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
module.exports = BuildContext;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
const ResourceTagCollection = require("@ui5/fs").ResourceTagCollection;
|
|
2
|
-
|
|
3
|
-
// Note: When adding standard tags, always update the public documentation in TaskUtil
|
|
4
|
-
// (Type "module:@ui5/builder.tasks.TaskUtil~StandardBuildTags")
|
|
5
|
-
const STANDARD_TAGS = {
|
|
6
|
-
OmitFromBuildResult: "ui5:OmitFromBuildResult",
|
|
7
|
-
IsBundle: "ui5:IsBundle",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Build context of a single project. Always part of an overall
|
|
12
|
-
* [Build Context]{@link module:@ui5/builder.builder.BuildContext}
|
|
13
|
-
*
|
|
14
|
-
* @private
|
|
15
|
-
* @memberof module:@ui5/builder.builder
|
|
16
|
-
*/
|
|
17
|
-
class ProjectBuildContext {
|
|
18
|
-
constructor({buildContext, globalTags, project, resources}) {
|
|
19
|
-
if (!buildContext || !globalTags || !project || !resources) {
|
|
20
|
-
throw new Error(`One or more mandatory parameters are missing`);
|
|
21
|
-
}
|
|
22
|
-
this._buildContext = buildContext;
|
|
23
|
-
this._project = project;
|
|
24
|
-
// this.resources = resources;
|
|
25
|
-
this.queues = {
|
|
26
|
-
cleanup: []
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
this.STANDARD_TAGS = Object.assign({}, STANDARD_TAGS, globalTags);
|
|
30
|
-
Object.freeze(this.STANDARD_TAGS);
|
|
31
|
-
|
|
32
|
-
this._resourceTagCollection = new ResourceTagCollection({
|
|
33
|
-
allowedTags: Object.values(this.STANDARD_TAGS),
|
|
34
|
-
superCollection: this._buildContext.getResourceTagCollection()
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
isRootProject() {
|
|
39
|
-
return this._project === this._buildContext.getRootProject();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
getOption(key) {
|
|
43
|
-
return this._buildContext.getOption(key);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
registerCleanupTask(callback) {
|
|
47
|
-
this.queues.cleanup.push(callback);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async executeCleanupTasks() {
|
|
51
|
-
await Promise.all(this.queues.cleanup.map((callback) => {
|
|
52
|
-
return callback();
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
getResourceTagCollection() {
|
|
57
|
-
return this._resourceTagCollection;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
module.exports = ProjectBuildContext;
|