Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fluid-build): Add support for declarative tasks #22663

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Sep 27, 2024

Adds support for creating fluid-build tasks from config only, by declaring the command corresponding to the task and providing globs for input and output files.

  • Adds two new settings to the fluid-build config.
    • declarativeTasks?: DeclarativeTasks; - a mapping of executable/command to input/output globs and a gitignore setting that controls whether gitignore rules are applied to the input/output globs.
    • multiCommandExecutables?: string[] - a list of executables that have subcommands, like flub or oclif. This is needed to ensure that the commands in the declarative tasks are parsed correctly.
  • Added types to represent "task handlers" - functions that create LeafTask objects to handle tasks.
  • Added support for free functions that return instances of LeafTasks - this is needed so that task handlers can be dynamically created. Task subclasses with constructors still work as before.
  • Added a new DeclarativeTaskHandler class that handles the declarative tasks. It is a typical Task class, but the primary way it is used is via a factory function. This allows us to pass in the configuration settings for each task dynamically but re-use the DeclarativeTask class for all the core functionality.
  • Defined new declarative tasks for oclif, jssm-viz, and syncpack in the root fluid-build config. These won't take effect until the new version of build-tools is integrated into client.
  • New dependency: globby - globby is helpful because it can auto-apply gitignore rules which we need to do for some tasks input/output globs.

AB#13203

@github-actions github-actions bot added area: build Build related issues area: contributor experience dependencies Pull requests that update a dependency file base: main PRs targeted against main branch labels Sep 27, 2024
@msfluid-bot
Copy link
Collaborator

msfluid-bot commented Sep 27, 2024

@fluid-example/bundle-size-tests: +245 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 460.47 KB 460.5 KB +35 Bytes
azureClient.js 557.45 KB 557.5 KB +49 Bytes
connectionState.js 724 Bytes 724 Bytes No change
containerRuntime.js 259.74 KB 259.76 KB +14 Bytes
fluidFramework.js 405.95 KB 405.96 KB +14 Bytes
loader.js 134.34 KB 134.36 KB +14 Bytes
map.js 42.46 KB 42.46 KB +7 Bytes
matrix.js 148.63 KB 148.64 KB +7 Bytes
odspClient.js 524.41 KB 524.46 KB +49 Bytes
odspDriver.js 97.84 KB 97.86 KB +21 Bytes
odspPrefetchSnapshot.js 42.81 KB 42.82 KB +14 Bytes
sharedString.js 164.82 KB 164.83 KB +7 Bytes
sharedTree.js 396.41 KB 396.41 KB +7 Bytes
Total Size 3.31 MB 3.31 MB +245 Bytes

Baseline commit: 920a65f

Generated by 🚫 dangerJS against 930535d

tylerbutler added a commit that referenced this pull request Sep 27, 2024
While testing #22663, I found that the output of the donefile when using
hashes was not always ordered the same. This may be more likely to
happen with the changes in #22663 since the task handling is more
dynamic. Regardless, the bug existed prior to those changes.
.vscode/launch.json Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the dependencies Pull requests that update a dependency file label Sep 30, 2024
@tylerbutler tylerbutler marked this pull request as ready for review September 30, 2024 20:16
@tylerbutler tylerbutler requested a review from a team September 30, 2024 20:16
@tylerbutler tylerbutler marked this pull request as draft September 30, 2024 21:09
@tylerbutler tylerbutler marked this pull request as ready for review September 30, 2024 23:02
Comment on lines +84 to +101
/**
* Declarative tasks allow fluid-build to support incremental builds for tasks it doesn't natively identify. A
* DeclarativeTask defines a set of input and output globs, and files matching those globs will be included in the
* donefiles for the task. Note that gitignored files are treated differently for input globs vs. output globs. See the
* property documentation for details.
*/
export interface DeclarativeTask {
/**
* An array of globs that will be used to identify input files for the task. Globs are interpreted relative to the
* package. **Files ignored by git are never included.**
*/
inputGlobs: string[];

/**
* An array of globs that will be used to identify input files for the task. Unlike the inputGlobs, outputGlobs
* **will** match files ignored by git, because build output is often gitignored.
*/
outputGlobs: string[];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments are outdated; fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build Build related issues base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants