Skip to content

refactor: decouple migrations from CLI devkit #19014

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

Merged
merged 2 commits into from
Apr 25, 2020
Merged

Conversation

devversion
Copy link
Member

We want to refactor our update-tool to no longer rely
on specifics from the Angular CLI devkit. This has various benefits:

  • Ability to run migrations inside Google.
  • Ability to run migrations in a standalone tool (for people not using the CLI)
  • No tight dependency on the CLI devkit API. We could easily switch tools if needed.
  • Ability to wrap migrations in tslint rules (or other tools if needed).

Additionally, this PR fixes an issue with Bazel on Windows where runfiles no longer can be resolved. This is because rules_nodejs symlinks the workspace into the @npm repository now, and resolving runfiles through relative paths no longer works.

@devversion devversion requested a review from jelbourn as a code owner April 7, 2020 20:09
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 7, 2020
@devversion devversion added merge safe target: patch This PR is targeted for the next patch release labels Apr 7, 2020
@devversion
Copy link
Member Author

Regardless of whether we'll share the MDC migration code internally and externally, these changes can be useful to land in master. It will allow us to easily start running migrations internally if we ever need to, and has various other benefits (as noted in the PR description)

* for this has been removed and absolute manifest paths or the runfile helpers are now needed
* on Windows. This helper provides a resolution method that works similar on all platforms.
*/
export function resolveBazel(parent: string, relativePath: string) {
Copy link
Member

Choose a reason for hiding this comment

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

resolveBazelPath?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that makes sense to me.

// Imports the runfile helpers from the Bazel NodeJS rules. This should be ideally
// a separate package with types. https://github.com/bazelbuild/rules_nodejs/issues/1793.
// Note: We don't want to import this outside of this function as the runfile helpers are
// quite large we don't want to load them for every import to `@angular/cdk/testing/private`.
Copy link
Member

Choose a reason for hiding this comment

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

I'm starting to feel like we should keep a centralized list of all the bazel-related rough edges / workarounds we have in place.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, agreed. Maybe we should move this stuff into tools/bazel so that we can have a clear picture of what is specific to Bazel. We can do that as a follow-up if you think that makes sense.

Copy link
Member

Choose a reason for hiding this comment

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

Up to you; you're the one who ends up dealing with it the most, so whatever makes your life easier

@devversion devversion force-pushed the migrations-mdc-g3 branch 2 times, most recently from 2e64c8c to e8fec55 Compare April 24, 2020 15:35
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn
Copy link
Member

Looks like there's a circular dep?

@jelbourn jelbourn added the lgtm label Apr 24, 2020
We want to refactor our update-tool to no longer rely
on specifics from the Angular CLI devkit. This has various benefits:

* Ability to run migrations inside Google.
* Ability to run migrations in a standalone tool (for people not using the CLI!)
* No tight dependency on the CLI devkit API. We could easily switch tools if needed.
* Ability to wrap migrations in tslint rules (or other tools).
* And potentially more. These are just the ones that came to mind yet.
@devversion
Copy link
Member Author

Yeah, should be fixed now.

@devversion devversion added the action: merge The PR is ready for merge by the caretaker label Apr 25, 2020
@jelbourn jelbourn merged commit 668f791 into master Apr 25, 2020
jelbourn pushed a commit that referenced this pull request Apr 25, 2020
* refactor: decouple migrations from CLI devkit (#19004)

We want to refactor our update-tool to no longer rely
on specifics from the Angular CLI devkit. This has various benefits:

* Ability to run migrations inside Google.
* Ability to run migrations in a standalone tool (for people not using the CLI!)
* No tight dependency on the CLI devkit API. We could easily switch tools if needed.
* Ability to wrap migrations in tslint rules (or other tools).
* And potentially more. These are just the ones that came to mind yet.

* Address feedback
@devversion devversion deleted the migrations-mdc-g3 branch May 8, 2020 23:02
@angular-automatic-lock-bot
Copy link

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 Jun 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants