Skip to content

Commit ed0f4ad

Browse files
committed
To be removed: Cherry-Pick of #639
1 parent 42f7651 commit ed0f4ad

29 files changed

+250
-89
lines changed

lib/specifications/SpecificationVersion.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const SPEC_VERSION_PATTERN = /^\d+\.\d+$/;
44
const SUPPORTED_VERSIONS = [
55
"0.1", "1.0", "1.1",
66
"2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6",
7-
"3.0"
7+
"3.0", "3.1"
88
];
99

1010
/**
@@ -63,8 +63,8 @@ class SpecificationVersion {
6363
* Test whether the instance's Specification Version falls into the provided range
6464
*
6565
* @public
66-
@param {string} range [Semver]{@link https://www.npmjs.com/package/semver}-style version range,
67-
for example <code>2.2 - 2.4</code>
66+
* @param {string} range [Semver]{@link https://www.npmjs.com/package/semver}-style version range,
67+
* for example <code>2.2 - 2.4</code> or <code>=3.0</code>
6868
* @returns {boolean} True if the instance's Specification Version falls into the provided range
6969
*/
7070
satisfies(range) {
@@ -263,6 +263,22 @@ for example <code>2.2 - 2.4</code>
263263
const comparator = new SpecificationVersion(specVersion);
264264
return comparator.neq(testVersion);
265265
}
266+
267+
/**
268+
* Create an array of Specification Versions that match with the provided range. This is mainly used
269+
* for testing purposes. I.e. to execute identical tests for a range of specification versions.
270+
*
271+
* @public
272+
* @param {string} range [Semver]{@link https://www.npmjs.com/package/semver}-style version range,
273+
* for example <code>2.2 - 2.4</code> or <code>=3.0</code>
274+
* @returns {string[]} Array of versions that match the specified range
275+
*/
276+
static getVersionsForRange(range) {
277+
return SUPPORTED_VERSIONS.filter((specVersion) => {
278+
const comparator = new SpecificationVersion(specVersion);
279+
return comparator.satisfies(range);
280+
});
281+
}
266282
}
267283

268284
function getUnsupportedSpecVersionMessage(specVersion) {

lib/specifications/types/Application.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,17 @@ class Application extends ComponentProject {
6666
return null; // Applications do not have a dedicated test directory
6767
}
6868

69+
/**
70+
* Get a resource reader for the sources of the project (excluding any test resources)
71+
* without a virtual base path
72+
*
73+
* @returns {@ui5/fs/ReaderCollection} Reader collection
74+
*/
6975
_getRawSourceReader() {
7076
return createReader({
7177
fsBasePath: this.getSourcePath(),
7278
virBasePath: "/",
73-
name: `Source reader for application project ${this.getName()}`,
79+
name: `Raw source reader for application project ${this.getName()}`,
7480
project: this
7581
});
7682
}

lib/specifications/types/Library.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,18 @@ class Library extends ComponentProject {
107107
}
108108

109109
/**
110-
*
111110
* Get a resource reader for the sources of the project (excluding any test resources)
111+
* without a virtual base path
112112
* In the future the path structure can be flat or namespaced depending on the project
113+
* setup
113114
*
114115
* @returns {@ui5/fs/ReaderCollection} Reader collection
115116
*/
116117
_getRawSourceReader() {
117118
return resourceFactory.createReader({
118119
fsBasePath: this.getSourcePath(),
119120
virBasePath: "/",
120-
name: `Source reader for library project ${this.getName()}`,
121+
name: `Raw source reader for library project ${this.getName()}`,
121122
project: this
122123
});
123124
}

lib/validation/schema/specVersion/kind/extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "object",
66
"required": ["specVersion", "kind", "type", "metadata"],
77
"properties": {
8-
"specVersion": { "enum": ["3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] },
8+
"specVersion": { "enum": ["3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] },
99
"kind": {
1010
"enum": ["extension"]
1111
},

lib/validation/schema/specVersion/kind/extension/project-shim.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
"required": ["specVersion", "kind", "type", "metadata", "shims"],
77
"if": {
88
"properties": {
9-
"specVersion": { "enum": ["3.0"] }
9+
"specVersion": { "enum": ["3.0", "3.1"] }
1010
}
1111
},
1212
"then": {
1313
"additionalProperties": false,
1414
"properties": {
1515
"specVersion": {
16-
"enum": ["3.0"]
16+
"enum": ["3.0", "3.1"]
1717
},
1818
"kind": {
1919
"enum": ["extension"]

lib/validation/schema/specVersion/kind/extension/server-middleware.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"required": ["specVersion", "kind", "type", "metadata", "middleware"],
88
"if": {
99
"properties": {
10-
"specVersion": { "enum": ["3.0"] }
10+
"specVersion": { "enum": ["3.0", "3.1"] }
1111
}
1212
},
1313
"then": {
1414
"additionalProperties": false,
1515
"properties": {
16-
"specVersion": { "enum": ["3.0"] },
16+
"specVersion": { "enum": ["3.0", "3.1"] },
1717
"kind": {
1818
"enum": ["extension"]
1919
},

lib/validation/schema/specVersion/kind/extension/task.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"required": ["specVersion", "kind", "type", "metadata", "task"],
77
"if": {
88
"properties": {
9-
"specVersion": { "enum": ["3.0"] }
9+
"specVersion": { "enum": ["3.0", "3.1"] }
1010
}
1111
},
1212
"then": {
1313
"additionalProperties": false,
1414
"properties": {
15-
"specVersion": { "enum": ["3.0"] },
15+
"specVersion": { "enum": ["3.0", "3.1"] },
1616
"kind": {
1717
"enum": ["extension"]
1818
},

lib/validation/schema/specVersion/kind/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "object",
66
"required": ["specVersion", "type"],
77
"properties": {
8-
"specVersion": { "enum": ["3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] },
8+
"specVersion": { "enum": ["3.1", "3.0", "2.6", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"] },
99
"kind": {
1010
"enum": ["project", null],
1111
"$comment": "Using null to allow not defining 'kind' which defaults to project"
@@ -19,6 +19,7 @@
1919
]
2020
}
2121
},
22+
2223
"if": {
2324
"properties": {
2425
"type": {"const": null}

lib/validation/schema/specVersion/kind/project/application.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"required": ["specVersion", "type", "metadata"],
77
"if": {
88
"properties": {
9-
"specVersion": { "enum": ["3.0"] }
9+
"specVersion": { "enum": ["3.0", "3.1"] }
1010
}
1111
},
1212
"then": {
1313
"additionalProperties": false,
1414
"properties": {
15-
"specVersion": { "enum": ["3.0"] },
15+
"specVersion": { "enum": ["3.0", "3.1"] },
1616
"kind": {
1717
"enum": ["project", null]
1818
},

lib/validation/schema/specVersion/kind/project/library.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"required": ["specVersion", "type", "metadata"],
77
"if": {
88
"properties": {
9-
"specVersion": { "enum": ["3.0"] }
9+
"specVersion": { "enum": ["3.0", "3.1"] }
1010
}
1111
},
1212
"then": {
1313
"additionalProperties": false,
1414
"properties": {
15-
"specVersion": { "enum": ["3.0"] },
15+
"specVersion": { "enum": ["3.0", "3.1"] },
1616
"kind": {
1717
"enum": ["project", null]
1818
},

0 commit comments

Comments
 (0)