-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] JSDoc: Implement own tmp dir lifecycle
For this a new entity 'BuildContext' has been introduced in the builder. This might be the foundation for future enhancements of the (Custom-) Task API. Resolves https://github.com/SAP/ui5-cli/issues/187
- Loading branch information
1 parent
fe641cf
commit 3f85abf
Showing
11 changed files
with
332 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* Context of a build process | ||
* | ||
* @private | ||
* @memberof module:@ui5/builder.builder | ||
*/ | ||
class BuildContext { | ||
constructor() { | ||
this.projectBuildContexts = []; | ||
} | ||
|
||
createProjectContext({project, resources}) { | ||
const projectBuildContext = new ProjectBuildContext({ | ||
buildContext: this, | ||
project, | ||
resources | ||
}); | ||
this.projectBuildContexts.push(projectBuildContext); | ||
return projectBuildContext; | ||
} | ||
|
||
async executeCleanupTasks() { | ||
await Promise.all(this.projectBuildContexts.map((ctx) => { | ||
return ctx.executeCleanupTasks(); | ||
})); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Build context of a single project. Always part of an overall | ||
* [Build Context]{@link module:@ui5/builder.builder.BuildContext} | ||
* | ||
* @private | ||
* @memberof module:@ui5/builder.builder | ||
*/ | ||
class ProjectBuildContext { | ||
constructor({buildContext, project, resources}) { | ||
// this.buildContext = buildContext; | ||
// this.project = project; | ||
// this.resources = resources; | ||
this.queues = { | ||
cleanup: [] | ||
}; | ||
} | ||
|
||
registerCleanupTask(callback) { | ||
this.queues.cleanup.push(callback); | ||
} | ||
|
||
async executeCleanupTasks() { | ||
await Promise.all(this.queues.cleanup.map((callback) => { | ||
return callback(); | ||
})); | ||
} | ||
} | ||
|
||
module.exports = BuildContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.