Skip to content

Commit

Permalink
Fix issue in dependency handling, improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
codeworrior authored and tobiasso85 committed Jun 22, 2020
1 parent 5252ab6 commit df0fb0b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 28 deletions.
6 changes: 1 addition & 5 deletions lib/processors/resourceListCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ class ResourceInfo {
}
return result;
}

isEmpty() {
return this.i18nLocale == null && this.i18nName == null && this.isDebug == false && this.theme == null && this.merged == false;
}
}

/**
Expand Down Expand Up @@ -412,7 +408,7 @@ class ResourceCollector {
resourceInfo.condRequired = resourceInfo.condRequired || new Set();
info.dependencies.forEach((dep) => {
if ( info.isConditionalDependency(dep) ) {
resourceInfo.condRequired.push(dep);
resourceInfo.condRequired.add(dep);
} else if ( !info.isImplicitDependency(dep) ) {
resourceInfo.required.add(dep);
}
Expand Down
28 changes: 10 additions & 18 deletions lib/types/library/LibraryBuilder.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
const AbstractBuilder = require("../AbstractBuilder");
const tasks = { // can't require index.js due to circular dependency
generateComponentPreload: require("../../tasks/bundlers/generateComponentPreload"),
generateFlexChangesBundle: require("../../tasks/bundlers/generateFlexChangesBundle"),
generateBundle: require("../../tasks/bundlers/generateBundle"),
generateLibraryPreload: require("../../tasks/bundlers/generateLibraryPreload"),
generateManifestBundle: require("../../tasks/bundlers/generateManifestBundle"),
generateStandaloneAppBundle: require("../../tasks/bundlers/generateStandaloneAppBundle"),
escapeNonAsciiCharacters: require("../../tasks/escapeNonAsciiCharacters"),
buildThemes: require("../../tasks/buildThemes"),
createDebugFiles: require("../../tasks/createDebugFiles"),
generateJsdoc: require("../../tasks/jsdoc/generateJsdoc"),
executeJsdocSdkTransformation: require("../../tasks/jsdoc/executeJsdocSdkTransformation"),
generateLibraryManifest: require("../../tasks/generateLibraryManifest"),
generateVersionInfo: require("../../tasks/generateVersionInfo"),
replaceCopyright: require("../../tasks/replaceCopyright"),
replaceVersion: require("../../tasks/replaceVersion"),
uglify: require("../../tasks/uglify")
};
const {getTask} = require("../../tasks/taskRepository");

class LibraryBuilder extends AbstractBuilder {
addStandardTasks({resourceCollections, project, log, buildContext}) {
Expand Down Expand Up @@ -194,6 +177,15 @@ class LibraryBuilder extends AbstractBuilder {
}
});
});

this.addTask("generateResourcesJson", () => {
return getTask("generateResourcesJson").task({
workspace: resourceCollections.workspace,
dependencies: resourceCollections.dependencies,
options: {
}
});
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sap.ui.define([
) {
"use strict";

return Control.extend("library.n.Button", {
return Control.extend("library.n.Button", {
metadata : {
library : "library.n",
properties : {
Expand Down Expand Up @@ -44,6 +44,13 @@ sap.ui.define([
oRm.close("span");
oRm.close("button");
}
},
helper: function(sCalendarType) {
var sCalendar = "sap/ui/core/date/" + sCalendarType;
sap.ui.require(["sap/ui/core/format/DateFormat", sCalendar], function(DateFormat, Calendar) {
DateFormat.getInstance();
new Calendar();
});
}
});

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@
"required": [
"library/n/library.js",
"sap/ui/core/Control.js"
]
],
"condRequired": [
"sap/ui/core/format/DateFormat.js"
],
"dynRequired": true
},
{
"name": "Button.js",
"module": "library/n/Button.js",
"required": [
"library/n/library.js",
"sap/ui/core/Control.js"
]
],
"condRequired": [
"sap/ui/core/format/DateFormat.js"
],
"dynRequired": true
},
{
"name": "changeHandler/SplitButton-dbg.js",
Expand Down
9 changes: 8 additions & 1 deletion test/fixtures/library.n/src/library/n/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sap.ui.define([
) {
"use strict";

return Control.extend("library.n.Button", {
return Control.extend("library.n.Button", {
metadata : {
library : "library.n",
properties : {
Expand Down Expand Up @@ -42,6 +42,13 @@ sap.ui.define([
oRm.close("span");
oRm.close("button");
}
},
helper: function(sCalendarType) {
var sCalendar = "sap/ui/core/date/" + sCalendarType;
sap.ui.require(["sap/ui/core/format/DateFormat", sCalendar], function(DateFormat, Calendar) {
DateFormat.getInstance();
new Calendar();
});
}
});

Expand Down

0 comments on commit df0fb0b

Please sign in to comment.