Skip to content

Commit 81bdb27

Browse files
committed
Collection handling: Ignore projects of collections
To be compatible with the current behavior of the projectPreprocessor. Apparently the open.fe setup relies on that.
1 parent febbd91 commit 81bdb27

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

lib/graph/Module.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,28 @@ class Module {
104104
}
105105

106106
async _getSpecifications() {
107-
const configs = await this._getConfigurations();
107+
let configs = await this._getConfigurations();
108+
109+
// I'm using hacks here:
110+
// Filter out project-shims to check whether the this module is a collection
111+
const isCollection = configs.find((configuration) => {
112+
if (configuration.kind === "extension" && configuration.type === "project-shim") {
113+
// TODO create Specification instance and ask it for the configuration
114+
if (configuration.shims && configuration.shims.collections &&
115+
configuration.shims.collections[this.getId()]) {
116+
return true;
117+
}
118+
}
119+
});
120+
121+
if (isCollection) {
122+
// This module is configured as a collection
123+
// For compatibility reasons with the behavior of projectPreprocessor,
124+
// the project contained in this module must be ignored
125+
configs = configs.filter((configuration) => {
126+
return configuration.kind !== "project";
127+
});
128+
}
108129

109130
const specs = await Promise.all(configs.map(async (configuration) => {
110131
const spec = await Specification.create({

lib/graph/ShimCollection.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ class ShimCollection {
2222
addProjectShim(shimExtension) {
2323
const name = shimExtension.getName();
2424
log.verbose(`Adding new shim ${name}...`);
25-
// TODO: Move this into a dedicated ShimConfiguration class?
26-
const {configurations, dependencies, collections} = shimExtension.getShimConfiguration();
25+
26+
const configurations = shimExtension.getConfigurationShims();
2727
if (configurations) {
2828
addToMap(name, configurations, this._projectConfigShims);
2929
}
30+
const dependencies = shimExtension.getDependencyShims();
3031
if (dependencies) {
3132
addToMap(name, dependencies, this._dependencyShims);
3233
}
34+
const collections = shimExtension.getCollectionShims();
3335
if (collections) {
3436
addToMap(name, collections, this._collectionShims);
3537
}

lib/specifications/types/ProjectShim.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,22 @@ class ProjectShim extends Extension {
1010
/**
1111
* @public
1212
*/
13-
getShimConfiguration() {
14-
return this._config.shims;
13+
getDependencyShims() {
14+
return this._config.shims.dependencies;
15+
}
16+
17+
/**
18+
* @public
19+
*/
20+
getConfigurationShims() {
21+
return this._config.shims.configurations;
22+
}
23+
24+
/**
25+
* @public
26+
*/
27+
getCollectionShims() {
28+
return this._config.shims.collections;
1529
}
1630

1731
/* === Internals === */

0 commit comments

Comments
 (0)