|
1 | 1 | /**
|
2 | 2 | * @license
|
3 |
| - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. |
| 3 | + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. |
4 | 4 | * Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
5 | 5 | */
|
6 | 6 | 'use strict';
|
@@ -279,9 +279,31 @@ function (WitActionsBase, project, wktConsole, wdtModelPreparer, i18n, projectIo
|
279 | 279 | }
|
280 | 280 |
|
281 | 281 | addWdtConfig(projectDirectory, createConfig) {
|
| 282 | + const variableFiles = this.project.wdtModel.propertiesFiles.value; |
| 283 | + const nonEmptyVariableFiles = []; |
| 284 | + if (Array.isArray(variableFiles) && variableFiles.length > 0) { |
| 285 | + // This code currently supports a single variable file. |
| 286 | + const variableFileContent = this.project.wdtModel.getPropertyFileContents(); |
| 287 | + for (const [file, contents] of Object.entries(variableFileContent)) { |
| 288 | + if (Object.getOwnPropertyNames(contents).length > 0) { |
| 289 | + nonEmptyVariableFiles.push(file); |
| 290 | + } |
| 291 | + } |
| 292 | + } |
| 293 | + |
| 294 | + const archiveFiles = this.project.wdtModel.archiveFiles.value; |
| 295 | + const nonEmptyArchiveFiles = []; |
| 296 | + if (Array.isArray(archiveFiles) && archiveFiles.length > 0) { |
| 297 | + // This code currently supports a single archive file. |
| 298 | + const archiveRoots = this.project.wdtModel.archiveRoots(); |
| 299 | + if (Array.isArray(archiveRoots) && archiveRoots.length > 0) { |
| 300 | + nonEmptyArchiveFiles.push(archiveFiles[0]); |
| 301 | + } |
| 302 | + } |
| 303 | + |
282 | 304 | createConfig.modelFiles = this.getAbsoluteModelFiles(projectDirectory, this.project.wdtModel.modelFiles.value);
|
283 |
| - createConfig.variableFiles = this.getAbsoluteModelFiles(projectDirectory, this.project.wdtModel.propertiesFiles.value); |
284 |
| - createConfig.archiveFiles = this.getAbsoluteModelFiles(projectDirectory, this.project.wdtModel.archiveFiles.value); |
| 305 | + createConfig.variableFiles = this.getAbsoluteModelFiles(projectDirectory, nonEmptyVariableFiles); |
| 306 | + createConfig.archiveFiles = this.getAbsoluteModelFiles(projectDirectory, nonEmptyArchiveFiles); |
285 | 307 | // Because we are overriding the defaults for these next two options,
|
286 | 308 | // we should always include them if they have a value.
|
287 | 309 | //
|
|
0 commit comments