Skip to content

build(bazel): some cleanup tasks#47632

Merged
devversion merged 9 commits into
angular:aio-bazel-migrationfrom
aspect-forks:aio-bazel-cleanup
Oct 20, 2022
Merged

build(bazel): some cleanup tasks#47632
devversion merged 9 commits into
angular:aio-bazel-migrationfrom
aspect-forks:aio-bazel-cleanup

Conversation

@kormide
Copy link
Copy Markdown
Contributor

@kormide kormide commented Oct 5, 2022

@devversion @josephperrott @gregmagolan

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the new behavior?

Updated CLI sources version to match with main, removed some unused package.json scripts.

Does this PR introduce a breaking change?

  • Yes
  • No

@jessicajaniuk jessicajaniuk added the area: bazel Issues related to the published `@angular/bazel` build rules label Oct 6, 2022
@ngbot ngbot Bot added this to the Backlog milestone Oct 6, 2022
@kormide kormide force-pushed the aio-bazel-cleanup branch 2 times, most recently from 6140579 to 4c38e68 Compare October 7, 2022 01:45
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This fixes a regression caused by 92a06f7#diff-077dd6145fe7c7d7e36918be05c1ccac4aa3393ff98f743feaa0730ea2d86b6aR7.

Basically, the realX properties are undefined when the doc is outside of packages/, e.g., a doc inside of /aio/content. projectRelativePath doesn't do any resolution so it's always defined, causing some files to get the pacakges/ prefix that shouldn't.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice catch. Capturing this here for the future. Even though this is in the angular-api-package- there is aio/content files processed. These don't use the TS processor and therefore are not scoped to the /packages base path. Non TS files do not have the realFilePath property: https://github.com/angular/dgeni-packages/blob/9dfdd284c09776a48b5eae031441d410de556192/base/processors/read-files.js#L99-L100.

@kormide kormide force-pushed the aio-bazel-cleanup branch from 4c38e68 to ac89362 Compare October 7, 2022 02:00
Comment thread aio/BUILD.bazel Outdated
Comment on lines 36 to 52
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because dgeni needs to be able to walk angular's node_modules tree to resolve typescript types, I had to add no-remote-exec because we're going over the RBE limit. Limit is 70,000 and this puts it at ~96000.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In the components repo we are just doing this explicitly. Can we do this here too? https://github.com/angular/components/blob/main/src/BUILD.bazel#L34-L39

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe you should be able to fine-grain select dependencies which are relevant for the TS API doc generation-like we do in the components repo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call. Turns out I only needed

        "@npm//rxjs",
        "@npm//@types/node",

Comment thread aio/BUILD.bazel Outdated
Comment on lines 36 to 52
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe you should be able to fine-grain select dependencies which are relevant for the TS API doc generation-like we do in the components repo.

Comment thread aio/angular.json Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, I feel like I keep asking on this symlinking stuff but I want to be sure we capture this in the relevant spots. Why do we need to follow symlinks for these files but not for the other generated files? Especially if we use copy_to_bin? Isn't everything a symlink in the runfiles directory?

This stuff can be captured in the commit messages too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not exactly sure why these assets were failing to load on Windows. @alan-agius4 pointed me to this fix and it seemed to just work.

I want to double check why it's not needed for the other folders, or at least what makes the cases different. I'll do that and I'll try to write a better comment.

Copy link
Copy Markdown
Contributor Author

@kormide kormide Oct 18, 2022

Choose a reason for hiding this comment

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

I looked into this a bit further.

The assets are layed out in the symlink tree the same way on all platforms: asset (source) files are symlinks, laid out in real folders.

Something different about the assets below these ones, stackblitz/generated, example-zips/generates etc. is that these are directory artifacts, so the folder itself is a symlink to the output tree but then all of the files are real.

For whatever reason, architect on Windows has issues following symlinks to files but not symlinked directories to real files. I checked to see whether this was related to the "serve" target using assets from the source tree rather than the copied-to-bin version, but it's the same result.

So this may just be an architect issue (fyi @alan-agius4 ), or just an issue with Windows symlinks behaving differently.

@devversion I'll improve the comment but are you okay with this workaround for now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice catch. Capturing this here for the future. Even though this is in the angular-api-package- there is aio/content files processed. These don't use the TS processor and therefore are not scoped to the /packages base path. Non TS files do not have the realFilePath property: https://github.com/angular/dgeni-packages/blob/9dfdd284c09776a48b5eae031441d410de556192/base/processors/read-files.js#L99-L100.

@kormide kormide added the action: merge The PR is ready for merge by the caretaker label Oct 20, 2022
@ngbot
Copy link
Copy Markdown

ngbot Bot commented Oct 20, 2022

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "ci/circleci: test_aio_local" is failing
    pending missing required labels: target: *
    pending status "pullapprove" is pending
    pending missing required status "google-internal-tests"
    pending 1 pending code review

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@devversion devversion added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker labels Oct 20, 2022
It was out of date with the current legacy build
No longer needed after the migration
Windows

Added "followSymlinks" blocks on the assets.
Add the hack to a central location so that it's easier to fix later.
rules_nodejs released  a fix for the RUNFILES issue.
Fixes the 'Export has no declarations: unknown' warning and
unresolved type warnings.
written

Incorrectly prepended 'packages/' to docs that were under aio/content.
Caused by chromium debug logs in @angular/build-tooling.
Some earlier refactoring prevented the watchr script from running in
the source tree. There was also a Windows issue where running architect
didn't preserve symlinks causing the app to not be served.
@kormide kormide added the action: merge The PR is ready for merge by the caretaker label Oct 20, 2022
@devversion devversion merged commit d34b4c1 into angular:aio-bazel-migration Oct 20, 2022
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Nov 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews action: merge The PR is ready for merge by the caretaker area: bazel Issues related to the published `@angular/bazel` build rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants