Skip to content

Commit c4aafe4

Browse files
committed
[INTERNAL] specification/Project: Make getSourcePath method public
The method will also be provided through TaskUtil and MiddlewareUtil. This should help use cases like in the ui5-middleware-fe-mockserver: https://github.com/SAP/open-ux-odata/blob/main/packages/ui5-middleware-fe-mockserver/src/index.ts#L10
1 parent ef07751 commit c4aafe4

File tree

7 files changed

+11
-6
lines changed

7 files changed

+11
-6
lines changed

lib/build/helpers/TaskUtil.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ class TaskUtil {
191191
* @property {Function} getNamespace Get the project namespace
192192
* @property {Function} getRootReader Get the project rootReader
193193
* @property {Function} getReader Get the project reader
194+
* @property {Function} getSourcePath Get the local File System path of the project's source directory
194195
* @property {Function} getCustomConfiguration Get the project Custom Configuration
195196
* @property {Function} isFrameworkProject Check whether the project is a UI5-Framework project
196197
*/
@@ -309,7 +310,8 @@ class TaskUtil {
309310
const baseProjectInterface = {};
310311
bindFunctions(project, baseProjectInterface, [
311312
"getType", "getName", "getVersion", "getNamespace",
312-
"getRootReader", "getReader", "getCustomConfiguration", "isFrameworkProject"
313+
"getRootReader", "getReader", "getSourcePath",
314+
"getCustomConfiguration", "isFrameworkProject"
313315
]);
314316
return baseProjectInterface;
315317
};

lib/specifications/Project.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Project extends Specification {
7878
* Get the path of the project's source directory. This might not be POSIX-style on some platforms.
7979
* Projects with multiple source paths will throw an error. For example Modules.
8080
*
81-
* @private
81+
* @public
8282
* @returns {string} Absolute path to the source directory of the project
8383
* @throws {Error} In case a project has multiple source directories
8484
*/

lib/specifications/types/Application.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Application extends ComponentProject {
3838
/**
3939
* Get the path of the project's source directory. This might not be POSIX-style on some platforms.
4040
*
41-
* @private
41+
* @public
4242
* @returns {string} Absolute path to the source directory of the project
4343
*/
4444
getSourcePath() {

lib/specifications/types/Library.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Library extends ComponentProject {
4949
/**
5050
* Get the path of the project's source directory. This might not be POSIX-style on some platforms.
5151
*
52-
* @private
52+
* @public
5353
* @returns {string} Absolute path to the source directory of the project
5454
*/
5555
getSourcePath() {

lib/specifications/types/Module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Module extends Project {
2424
/**
2525
* Since Modules have multiple source paths, this function always throws with an exception
2626
*
27-
* @private
27+
* @public
2828
* @throws {Error} Projects of type module have more than one source path
2929
*/
3030
getSourcePath() {

lib/specifications/types/ThemeLibrary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ThemeLibrary extends Project {
3232
/**
3333
* Get the path of the project's source directory
3434
*
35-
* @private
35+
* @public
3636
* @returns {string} Absolute path to the source directory of the project
3737
*/
3838
getSourcePath() {

test/lib/build/helpers/TaskUtil.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ test("getInterface: specVersion 3.0", (t) => {
411411
getNamespace: () => "namespace",
412412
getRootReader: () => "rootReader",
413413
getReader: () => "reader",
414+
getSourcePath: () => "sourcePath",
414415
getCustomConfiguration: () => "customConfiguration",
415416
isFrameworkProject: () => "isFrameworkProject",
416417
hasBuildManifest: () => "hasBuildManifest", // Should not be exposed
@@ -456,6 +457,7 @@ test("getInterface: specVersion 3.0", (t) => {
456457
"getNamespace",
457458
"getRootReader",
458459
"getReader",
460+
"getSourcePath",
459461
"getCustomConfiguration",
460462
"isFrameworkProject",
461463
], "Correct methods are provided");
@@ -465,6 +467,7 @@ test("getInterface: specVersion 3.0", (t) => {
465467
t.is(interfacedProject.getVersion(), "version", "getVersion function is bound correctly");
466468
t.is(interfacedProject.getNamespace(), "namespace", "getNamespace function is bound correctly");
467469
t.is(interfacedProject.getRootReader(), "rootReader", "getRootReader function is bound correctly");
470+
t.is(interfacedProject.getSourcePath(), "sourcePath", "getSourcePath function is bound correctly");
468471
t.is(interfacedProject.getReader(), "reader", "getReader function is bound correctly");
469472
t.is(interfacedProject.getCustomConfiguration(), "customConfiguration",
470473
"getCustomConfiguration function is bound correctly");

0 commit comments

Comments
 (0)