-
Notifications
You must be signed in to change notification settings - Fork 537
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
improvement(build-tools): support 1-deep transitive deps #23863
base: main
Are you sure you want to change the base?
improvement(build-tools): support 1-deep transitive deps #23863
Conversation
In policy checks transitive dependencies are not deeply considered. But one level deep checks are now added to handle regular tasks that are expanded to be complex (multiple tasks).
Add "includes" to Task Definitions to understand what other tasks are run when running a task. This enables policy checks to work with a multi-step task as a dependency and not requiring explicit dependency on one or each part. "includes" property of Task Definition is computed from script command line explicitly and is not manually configurable. Scripts listed via `npm run` (no other arguments) and `concurrently` are recognized. Refactors existing logic from taskFactory to support `concurrently` parsing.
Reviewers may want to review each of the first 3 commits separately. The third is all about readonly changes to help see where cloning should be used to avoid comingling of changes. |
Add broad `readonly` attribute to Task Definitions and Configs that shouldn't be changed. Add cloning where mutation may occur. (Note that TypeScript doesn't detect all cases where something readonly is assigned to non-readonly context. See microsoft/TypeScript#18770) Where mutability is needed in policy fix-up handler cast away to writeable.
15a5ed4
to
20e6ce9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide an example of what the task definitions look like before and after this change? I'm havbing a little trouble understanding what this addresses, but maybe it's because we don't have any tasks yet for which this is needed?
The includes
property seems to be useful, but couldn’t it be sourced from the task graph itself rather than parsing the args separatel? I would expect the task graph to already have done the parsing and task decomposition.
For example, if I have a task definition like this:
"clean": "concurrently npm:clean:build npm:clean:manifest"
If I run fluid-build . -t clean
, I see two tasks:
Start tasks 'clean' in 1 matched packages (2 total tasks in 3 packages)
[1/2] ✓ dill-cli: rimraf esm *.tsbuildinfo *.done.build.log - 0.067s (non-incremental)
[2/2] ✓ dill-cli: rimraf oclif.manifest.json - 0.065s (non-incremental)
So with this change, the "includes" property for the "clean" task would contain rimraf esm *.tsbuildinfo *.done.build.log
and rimraf oclif.manifest.json
, right?
Separately, have you tested this against the main branch? I tried using the approach described here but got an error during build graph creation:
⠋ Creating build graph...
ERROR: @fluid-internal/devtools-view: Failed to load build package in /home/tylerbu/code/FluidFramework/packages/tools/devtools/devtools-view
build-tools/packages/build-tools/src/fluidBuild/fluidTaskDefinitions.ts
Outdated
Show resolved
Hide resolved
build-tools/packages/build-tools/src/fluidBuild/fluidTaskDefinitions.ts
Outdated
Show resolved
Hide resolved
Example provided in updated description. |
The |
Yep. It is sniffing out incorrect package script definitions. There is a separate PR to clean those: #23865 |
Ah, got it, that makes sense. I'm still confused about the issue this is addressing. Looking at your example: - "build:esnext": "tsc --project ./tsconfig.json",
+ "build:esnext": "npm run build:esnext:main && npm run build:esnext:experimental",
+ "build:esnext:experimental": "tsc --project ./tsconfig.json",
+ "build:esnext:main": "tsc --project ./tsconfig.main.json", It's not clear to me how these changes are needed to enable those sorts of script changes. Doesn't this example work as expected today? Alternatively, couldn't the root And much like other top-level scripts like |
The build graph and dependencies understood by
And I think that implies then defining that "build:esnext" depends on those "children" tasks. It feels wrong to me to invoke First commit of PR would still be needed to support making "build:esnext" into a fluid-build task. The policy checker knows that a certain script is required in the upstream package. |
/azp run "Build - build-tools" |
You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list. |
No pipelines are associated with this pull request. |
detected by pending build-tools changes in #23863
In policy checks transitive dependencies are not deeply considered. But one level deep checks are now added to handle regular tasks that are expanded to be complex (multiple tasks).
Example
Splitting common
build:esnext
into two steps should not require downstream consumers to change dependencies as dependency onbuild:esnext
still ensures that all of the build steps are run. The policy checkers know thatbuild:esnext:main
and/orbuild:esnext:experimental
are required, but not thatbuild:esnext
ensures they are run.Infrastructure changes in support:
Add "children" to Task Definitions to understand what other tasks are run when running a task. This enables policy checks to work with a multi-step task as a dependency and not requiring explicit dependency on one or each part.
"children" property of Task Definition is computed from script command line explicitly and is not manually configurable. Scripts listed via
npm run
(no other arguments) andconcurrently
are recognized.Refactors existing logic from taskFactory to support
concurrently
parsing.Add broad
readonly
attribute to Task Definitions and Configs that shouldn't be changed. Add cloning where mutation may occur. (Note that TypeScript doesn't detect all cases where something readonly is assigned to non-readonly context. See Strict variance and read-only versions of types TypeScript#18770.) Where mutability is needed in policy fix-up handler, cast away to writeable.