Skip to content

Commit 011b05b

Browse files
committed
Fix build
1 parent 50d3ed1 commit 011b05b

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99

1010
### Fixed
1111

12-
- tbd
12+
- Fix build task in case of compilation errors
1313

1414
## Version 1.12.5 - 2024-02-09
1515

src/build.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"use strict";
22

33
const cds = require("@sap/cds");
4-
54
const { path } = cds.utils;
65

6+
const DEFAULT_MAIN_FOLDER = "_main";
7+
78
module.exports = class COV2APBuildPlugin extends cds.build.BuildPlugin {
89
static hasTask() {
910
cds.env.cov2ap = cds.env.cov2ap || {};
@@ -25,7 +26,12 @@ module.exports = class COV2APBuildPlugin extends cds.build.BuildPlugin {
2526
this.task.src = mtxBuildTask.src;
2627
const sidecarEnv = cds.env.for("cds", mtxBuildTask.src);
2728
const modelProviderService = sidecarEnv.requires["cds.xt.ModelProviderService"];
28-
this.task.dest = path.join(mtxBuildTask.dest, modelProviderService.root, cds.env.folders.srv, "odata/v2");
29+
let main = modelProviderService.root;
30+
const profiles = cds.env.profiles ?? [];
31+
if (!profiles.includes("production") && !profiles.includes("prod")) {
32+
main = DEFAULT_MAIN_FOLDER;
33+
}
34+
this.task.dest = path.join(mtxBuildTask.dest, main, cds.env.folders.srv, "odata/v2");
2935
}
3036

3137
async build() {
@@ -48,9 +54,9 @@ module.exports = class COV2APBuildPlugin extends cds.build.BuildPlugin {
4854
});
4955
this.write(result).to(`${service.name}.xml`);
5056
} catch (err) {
51-
this._logger.info(
52-
`EDMX V2 compilation failed. Service '${service.name}' is (probably) not compatible with OData V2`,
53-
err,
57+
this.pushMessage(
58+
`EDMX V2 compilation failed. Service '${service.name}' is (probably) not compatible with OData V2: ` + err,
59+
COV2APBuildPlugin.INFO,
5460
);
5561
}
5662
}

0 commit comments

Comments
 (0)