ics-builder 4.2.2 → 4.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/builder/api/dotnetApiBuilder.js +3 -3
- package/src/builder/api/net5Builder.js +53 -20
- package/src/builder/api/xmlFile.js +5 -1
- package/src/builder/baseBuilder.js +0 -3
- package/src/builder/ui/customUiBuilder.js +10 -5
- package/src/services/buildManager.js +8 -14
- package/src/services/packageManager.js +20 -13
package/package.json
CHANGED
|
@@ -33,10 +33,10 @@ var DotnetApiBuilder = /** @class */ (function (_super) {
|
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
this.config.packages.forEach(function (pkg) {
|
|
36
|
-
var
|
|
37
|
-
if (
|
|
36
|
+
var pkgInfo = pkg.packageInfo;
|
|
37
|
+
if (pkgInfo.api && pkgInfo.api.project) {
|
|
38
38
|
var apiSourceDir = path.join(_this.config.paths.source, pkg.name, "api");
|
|
39
|
-
_this.buildApiModule(path.dirname(path.join(apiSourceDir,
|
|
39
|
+
_this.buildApiModule(path.dirname(path.join(apiSourceDir, pkgInfo.api.project)), pkg.name);
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
42
|
_this.buildApiModules(pkg);
|
|
@@ -46,31 +46,41 @@ var Net5ApiBuilder = /** @class */ (function (_super) {
|
|
|
46
46
|
this._build();
|
|
47
47
|
};
|
|
48
48
|
Net5ApiBuilder.prototype._build = function () {
|
|
49
|
+
var _a;
|
|
50
|
+
if (this.modules.length == 0) {
|
|
51
|
+
utils_1.Logger.warn("Api layer not found, skipping.");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
var configuration = ((_a = this.config.api) === null || _a === void 0 ? void 0 : _a.configuration) || "Debug";
|
|
55
|
+
this._buildProjects(configuration);
|
|
56
|
+
this._buildSolutions(configuration);
|
|
57
|
+
};
|
|
58
|
+
Net5ApiBuilder.prototype._buildProjects = function (configuration) {
|
|
49
59
|
var _this = this;
|
|
50
60
|
var _a;
|
|
51
|
-
var coreModule = this.modules.find(function (m) { return m.
|
|
61
|
+
var coreModule = (_a = this.modules.find(function (m) { return m.isCoreModule; })) !== null && _a !== void 0 ? _a : this.modules[0];
|
|
52
62
|
var slnName = "Mdt";
|
|
53
|
-
var slnDir = path.dirname(coreModule.
|
|
54
|
-
var configuration = ((_a = this.config.api) === null || _a === void 0 ? void 0 : _a.configuration) || "Debug";
|
|
63
|
+
var slnDir = path.dirname(coreModule.buildFile.path);
|
|
55
64
|
var tempSlnPath = path.join(slnDir, slnName + ".sln");
|
|
65
|
+
var projects = this.modules.map(function (m) { return m.buildFile; }).filter(function (f) { return f.type == ApiModuleBuildFileType.Project; });
|
|
56
66
|
try {
|
|
57
67
|
dotnetUtils_1.DotnetUtils.createTempSln(slnDir, slnName);
|
|
58
|
-
for (var _i = 0,
|
|
59
|
-
var
|
|
60
|
-
var csproj = new csprojFile_1.CsprojFile(
|
|
61
|
-
csproj.setPublishPath(
|
|
62
|
-
csproj.save(
|
|
68
|
+
for (var _i = 0, projects_1 = projects; _i < projects_1.length; _i++) {
|
|
69
|
+
var p = projects_1[_i];
|
|
70
|
+
var csproj = new csprojFile_1.CsprojFile(p.path);
|
|
71
|
+
csproj.setPublishPath(p.outputPath);
|
|
72
|
+
csproj.save(p.path);
|
|
63
73
|
}
|
|
64
|
-
dotnetUtils_1.DotnetUtils.addProjectsToSln(tempSlnPath,
|
|
74
|
+
dotnetUtils_1.DotnetUtils.addProjectsToSln(tempSlnPath, projects.map(function (p) { return p.path; }));
|
|
65
75
|
dotnetUtils_1.DotnetUtils.restoreNugetPackages(tempSlnPath);
|
|
66
76
|
dotnetUtils_1.DotnetUtils.publish(tempSlnPath, configuration);
|
|
67
|
-
var webConfigFilePath = path.join(coreModule.
|
|
77
|
+
var webConfigFilePath = path.join(coreModule.buildFile.outputPath, "web.config");
|
|
68
78
|
var webConfigFile = new webConfigFile_1.WebConfigFile(webConfigFilePath);
|
|
69
79
|
webConfigFile.addDotnetProcessPath();
|
|
70
80
|
webConfigFile.save();
|
|
71
|
-
|
|
72
|
-
var projectDir = path.dirname(
|
|
73
|
-
_this.copyModuleConfig(projectDir,
|
|
81
|
+
projects.filter(function (p) { return p.path != coreModule.buildFile.path; }).forEach(function (p) {
|
|
82
|
+
var projectDir = path.dirname(p.path);
|
|
83
|
+
_this.copyModuleConfig(projectDir, p.outputPath, _this.configFile);
|
|
74
84
|
});
|
|
75
85
|
this.emptyModulesWithConfig.forEach(function (val, key) {
|
|
76
86
|
_this.copyModuleConfig(val, path.join(_this.buildApiFolder, "modules", key), _this.configFile);
|
|
@@ -80,6 +90,16 @@ var Net5ApiBuilder = /** @class */ (function (_super) {
|
|
|
80
90
|
utils_1.Utils.deleteFile(tempSlnPath);
|
|
81
91
|
}
|
|
82
92
|
};
|
|
93
|
+
Net5ApiBuilder.prototype._buildSolutions = function (configuration) {
|
|
94
|
+
var solutions = this.modules.map(function (m) { return m.buildFile; }).filter(function (f) { return f.type == ApiModuleBuildFileType.Solution; });
|
|
95
|
+
if (solutions.length == 0)
|
|
96
|
+
return;
|
|
97
|
+
utils_1.Logger.info("building additional solutions");
|
|
98
|
+
solutions.forEach(function (solution) {
|
|
99
|
+
dotnetUtils_1.DotnetUtils.restoreNugetPackages(solution.path);
|
|
100
|
+
dotnetUtils_1.DotnetUtils.publish(solution.path, configuration, solution.outputPath);
|
|
101
|
+
});
|
|
102
|
+
};
|
|
83
103
|
Net5ApiBuilder.prototype.collectModuleInfo = function (pkg) {
|
|
84
104
|
var _this = this;
|
|
85
105
|
packageStructureManager_1.packageStructureManager.getModuleSourcePaths(pkg, "api", this.config).forEach(function (_a) {
|
|
@@ -134,14 +154,27 @@ var Net5ApiBuilder = /** @class */ (function (_super) {
|
|
|
134
154
|
}(baseBuilder_1.BaseBuilder));
|
|
135
155
|
exports.Net5ApiBuilder = Net5ApiBuilder;
|
|
136
156
|
var ApiModuleInfo = /** @class */ (function () {
|
|
137
|
-
function ApiModuleInfo(pkg, module,
|
|
138
|
-
this.
|
|
139
|
-
this.
|
|
140
|
-
this.
|
|
141
|
-
|
|
142
|
-
this.OutputPath = this.IsCoreModule
|
|
157
|
+
function ApiModuleInfo(pkg, module, buildFilePath, buildApiFolder) {
|
|
158
|
+
this.package = pkg;
|
|
159
|
+
this.module = module;
|
|
160
|
+
this.isCoreModule = module.name == "_core" && pkg == "mdt";
|
|
161
|
+
var outputPath = this.isCoreModule
|
|
143
162
|
? buildApiFolder
|
|
144
|
-
: path.join(buildApiFolder, "modules", utils_1.Utils.getFileName(
|
|
163
|
+
: path.join(buildApiFolder, "modules", utils_1.Utils.getFileName(buildFilePath));
|
|
164
|
+
this.buildFile = new ApiModuleBuildFile(buildFilePath, outputPath);
|
|
145
165
|
}
|
|
146
166
|
return ApiModuleInfo;
|
|
147
167
|
}());
|
|
168
|
+
var ApiModuleBuildFile = /** @class */ (function () {
|
|
169
|
+
function ApiModuleBuildFile(path, outputPath) {
|
|
170
|
+
this.path = path;
|
|
171
|
+
this.outputPath = outputPath;
|
|
172
|
+
this.type = path.endsWith(".csproj") ? ApiModuleBuildFileType.Project : ApiModuleBuildFileType.Solution;
|
|
173
|
+
}
|
|
174
|
+
return ApiModuleBuildFile;
|
|
175
|
+
}());
|
|
176
|
+
var ApiModuleBuildFileType;
|
|
177
|
+
(function (ApiModuleBuildFileType) {
|
|
178
|
+
ApiModuleBuildFileType[ApiModuleBuildFileType["Project"] = 0] = "Project";
|
|
179
|
+
ApiModuleBuildFileType[ApiModuleBuildFileType["Solution"] = 1] = "Solution";
|
|
180
|
+
})(ApiModuleBuildFileType || (ApiModuleBuildFileType = {}));
|
|
@@ -10,7 +10,11 @@ var XmlFile = /** @class */ (function () {
|
|
|
10
10
|
XmlFile.prototype._readFile = function () {
|
|
11
11
|
var _this = this;
|
|
12
12
|
var file = fs.readFileSync(this._path);
|
|
13
|
-
xml2js.parseString(file, { explicitArray: false }, function (err, result) {
|
|
13
|
+
xml2js.parseString(file, { explicitArray: false }, function (err, result) {
|
|
14
|
+
if (err)
|
|
15
|
+
throw new Error("Error while parsing xml file " + _this._path + ":\n" + err.message);
|
|
16
|
+
_this._xmlObj = result;
|
|
17
|
+
});
|
|
14
18
|
};
|
|
15
19
|
XmlFile.prototype.save = function (path) {
|
|
16
20
|
if (path === void 0) { path = null; }
|
|
@@ -15,9 +15,6 @@ var BaseBuilder = /** @class */ (function () {
|
|
|
15
15
|
BaseBuilder.prototype.parsePackageInfoLegacy = function (path) {
|
|
16
16
|
return utils_1.Utils.ensurePath(path) ? yaml.load(path) : {};
|
|
17
17
|
};
|
|
18
|
-
BaseBuilder.prototype.parsePackageInfo = function (path) {
|
|
19
|
-
return utils_1.Utils.ensurePath(path) ? yaml.load(path) : {};
|
|
20
|
-
};
|
|
21
18
|
BaseBuilder.prototype.writeBuildInfo = function (targetPath, object, mode) {
|
|
22
19
|
fs.writeFileSync(targetPath.replace(new RegExp("." + mode.replace("yml", "ya?ml") + "$"), "").concat("." + mode), mode === "json" ? JSON.stringify(object, null, "\t") : yaml.stringify(object));
|
|
23
20
|
};
|
|
@@ -25,11 +25,11 @@ var CustomUiBuilder = /** @class */ (function (_super) {
|
|
|
25
25
|
CustomUiBuilder.prototype.run = function () {
|
|
26
26
|
var _this = this;
|
|
27
27
|
this.config.packages.forEach(function (pkg) {
|
|
28
|
-
var _a, _b;
|
|
28
|
+
var _a, _b, _c, _d;
|
|
29
29
|
var packageDir = path.join(_this.config.paths.source, pkg.name);
|
|
30
|
-
var
|
|
31
|
-
var buildDir = path.join(packageDir, (
|
|
32
|
-
var cmd = ((
|
|
30
|
+
var pkgInfo = pkg.packageInfo;
|
|
31
|
+
var buildDir = path.join(packageDir, (((_b = (_a = pkgInfo === null || pkgInfo === void 0 ? void 0 : pkgInfo.builder) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.path) || "").replace(pkg.name, ""));
|
|
32
|
+
var cmd = ((_d = (_c = pkgInfo === null || pkgInfo === void 0 ? void 0 : pkgInfo.builder) === null || _c === void 0 ? void 0 : _c.ui) === null || _d === void 0 ? void 0 : _d.cmd) || "";
|
|
33
33
|
var envArgs = _this.prepareEnvArgs();
|
|
34
34
|
if (envArgs.length)
|
|
35
35
|
cmd = _this.prepareCmd(cmd, envArgs);
|
|
@@ -37,10 +37,15 @@ var CustomUiBuilder = /** @class */ (function (_super) {
|
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
CustomUiBuilder.prototype.prepareEnvArgs = function () {
|
|
40
|
+
var _this = this;
|
|
40
41
|
var env = this.config.ui.env || {};
|
|
41
42
|
return Object.keys(env).map(function (k) {
|
|
42
43
|
var v = env[k];
|
|
43
|
-
|
|
44
|
+
var splitters = {
|
|
45
|
+
space: " ",
|
|
46
|
+
dot: "."
|
|
47
|
+
};
|
|
48
|
+
return "--env" + (splitters[_this.config.ui.envSplitter] || ".") + k + "=" + (v instanceof Array ? v.toString() : v);
|
|
44
49
|
});
|
|
45
50
|
};
|
|
46
51
|
CustomUiBuilder.prototype.prepareCmd = function (cmd, args) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BuildManager = void 0;
|
|
4
|
-
var path = require("path");
|
|
5
|
-
var yaml = require("yamljs");
|
|
6
4
|
var utils_1 = require("../utils");
|
|
7
5
|
var dotnetApiBuilder_1 = require("../builder/api/dotnetApiBuilder");
|
|
8
6
|
var dbBuilder_1 = require("../builder/db/dbBuilder");
|
|
@@ -75,18 +73,14 @@ var BuildManager = /** @class */ (function () {
|
|
|
75
73
|
var layerBuilders = new Map();
|
|
76
74
|
var packages = this.packageManager.getAllPackages();
|
|
77
75
|
packages.forEach(function (pkg) {
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
var builderType_1 = layerInfo.type || _this.getDefaultBuilder(layer);
|
|
87
|
-
_this.updateLayerBuilder(layer, builderType_1, layerBuilders, pkg);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
76
|
+
var newVersionOfPackageYaml = !pkg.packageInfo.api;
|
|
77
|
+
var pkgInfo = pkg.packageInfo;
|
|
78
|
+
if (newVersionOfPackageYaml && pkgInfo.builder && pkgInfo.builder[layer]) {
|
|
79
|
+
var layerInfo = pkgInfo.builder[layer];
|
|
80
|
+
layerInfo.path = layerInfo.path || layer;
|
|
81
|
+
var builderType_1 = layerInfo.type || _this.getDefaultBuilder(layer);
|
|
82
|
+
_this.updateLayerBuilder(layer, builderType_1, layerBuilders, pkg);
|
|
83
|
+
return;
|
|
90
84
|
}
|
|
91
85
|
var builderType = _this.getDefaultBuilder(layer);
|
|
92
86
|
_this.updateLayerBuilder(layer, builderType, layerBuilders, pkg);
|
|
@@ -36,7 +36,8 @@ var PackageManager = /** @class */ (function () {
|
|
|
36
36
|
var mainPackage = this.config.package;
|
|
37
37
|
if (!skipload)
|
|
38
38
|
this.sourceManager.loadSource(mainPackage, skipload);
|
|
39
|
-
|
|
39
|
+
mainPackage.packageInfo = this.getPackageInfo(mainPackage.name);
|
|
40
|
+
var pkgDependencies = this.getPackageDependencies(mainPackage, skipload);
|
|
40
41
|
packageStructureManager_1.packageStructureManager.writePackageStructureInfo(mainPackage, this.config);
|
|
41
42
|
this.packages.set(mainPackage.name, this.preparePackageModules(mainPackage, pkgDependencies));
|
|
42
43
|
}
|
|
@@ -56,22 +57,19 @@ var PackageManager = /** @class */ (function () {
|
|
|
56
57
|
pkg.url = packageName;
|
|
57
58
|
}
|
|
58
59
|
_this.sourceManager.loadSource(pkg, skipload);
|
|
59
|
-
|
|
60
|
+
pkg.packageInfo = _this.getPackageInfo(pkg.name);
|
|
61
|
+
var pkgDependencies = _this.getPackageDependencies(pkg, skipload);
|
|
60
62
|
packageStructureManager_1.packageStructureManager.writePackageStructureInfo(pkg, _this.config);
|
|
61
63
|
_this.packages.set(packageName, _this.preparePackageModules(pkg, pkgDependencies));
|
|
62
64
|
});
|
|
63
65
|
}
|
|
64
66
|
};
|
|
65
|
-
PackageManager.prototype.getPackageDependencies = function (
|
|
66
|
-
var pkgDependencies =
|
|
67
|
-
var
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (pkgInfo.using) {
|
|
72
|
-
delete pkgInfo.using[packageName];
|
|
73
|
-
this.loadPackages(pkgInfo.using, pkgInfoPath, skipload);
|
|
74
|
-
}
|
|
67
|
+
PackageManager.prototype.getPackageDependencies = function (pkg, skipload) {
|
|
68
|
+
var pkgDependencies = pkg.packageInfo.modules;
|
|
69
|
+
var using = pkg.packageInfo.using;
|
|
70
|
+
if (using) {
|
|
71
|
+
delete using[pkg.name];
|
|
72
|
+
this.loadPackages(using, this.getPackageInfoPath(pkg.name), skipload);
|
|
75
73
|
}
|
|
76
74
|
return pkgDependencies;
|
|
77
75
|
};
|
|
@@ -134,8 +132,17 @@ var PackageManager = /** @class */ (function () {
|
|
|
134
132
|
var _this = this;
|
|
135
133
|
return packages.sort(function (prev, curr) { return _this.config.packagesOrder.indexOf(prev.name) - _this.config.packagesOrder.indexOf(curr.name); });
|
|
136
134
|
};
|
|
135
|
+
PackageManager.prototype.getPackageInfo = function (packageName) {
|
|
136
|
+
var pkgInfoPath = this.getPackageInfoPath(packageName);
|
|
137
|
+
return utils_1.Utils.ensurePath(pkgInfoPath) ? yaml.load(pkgInfoPath) : {};
|
|
138
|
+
};
|
|
137
139
|
PackageManager.prototype.getPackageInfoPath = function (packageName) {
|
|
138
|
-
|
|
140
|
+
var packagePath = path.join(this.config.paths.source, packageName);
|
|
141
|
+
var packageInfoPath = path.join(packagePath, "package.yml");
|
|
142
|
+
if (utils_1.Utils.ensurePath(packageInfoPath))
|
|
143
|
+
return packageInfoPath;
|
|
144
|
+
packageInfoPath = path.join(packagePath, "package.yaml");
|
|
145
|
+
return packageInfoPath;
|
|
139
146
|
};
|
|
140
147
|
return PackageManager;
|
|
141
148
|
}());
|