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

fix: ts_project external workspace builds #310

Merged
merged 2 commits into from
Feb 11, 2023

Conversation

dgp1130
Copy link
Contributor

@dgp1130 dgp1130 commented Feb 9, 2023

Fixes #284.

short_path is not sufficient to handle external paths and we need to strip ctx.bin_dir.path instead. This updates the ts_project() rules as well as adds a regression test which triggers a ts_project() target to build from the context of an external workspace.

e2e/external_dep/WORKSPACE Outdated Show resolved Hide resolved
ts/private/ts_project.bzl Outdated Show resolved Hide resolved
ts/private/ts_project.bzl Outdated Show resolved Hide resolved
@dgp1130 dgp1130 force-pushed the external_ts_project branch from eaa18c6 to 0043de1 Compare February 10, 2023 02:05
@dgp1130
Copy link
Contributor Author

dgp1130 commented Feb 10, 2023

Question: Where are the e2e workspaces tested in CI? I don't see anything which obvious runs (cd e2e/*/ && bazel test //...). My new test case actually has a nested external workspaces and I realized I forgot to .bazelignore it in the outer workspace (which also doesn't include a test). I would have expected CI to report a failure but it didn't. Do I need to update something to register this example to run on CI?

@jbedard
Copy link
Member

jbedard commented Feb 10, 2023

See .github/workflows/ci.yaml, currently they're listed manually in there (if I'm reading that right...)

ts/private/ts_project.bzl Outdated Show resolved Hide resolved
@dgp1130 dgp1130 force-pushed the external_ts_project branch from 0043de1 to ae5b699 Compare February 10, 2023 06:55
@dgp1130
Copy link
Contributor Author

dgp1130 commented Feb 10, 2023

Ah thanks, I did look in ci.yaml and saw the bazel test //... but missed the working directory matrix. Added the new e2e test there as well.

Copy link
Member

@gregmagolan gregmagolan left a comment

Choose a reason for hiding this comment

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

Left some suggestions

@dgp1130 dgp1130 force-pushed the external_ts_project branch from ae5b699 to 2e188e7 Compare February 11, 2023 22:50
@dgp1130
Copy link
Contributor Author

dgp1130 commented Feb 11, 2023

Thanks for the suggestions @gregmagolan, updated with the fixes!

Copy link
Member

@gregmagolan gregmagolan left a comment

Choose a reason for hiding this comment

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

🦖

@gregmagolan gregmagolan changed the title Fix external workspace builds fix: fix ts_project external workspace builds Feb 11, 2023
@gregmagolan gregmagolan self-requested a review February 11, 2023 23:02
Copy link
Member

@gregmagolan gregmagolan left a comment

Choose a reason for hiding this comment

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

Noticed one last thing

@gregmagolan gregmagolan changed the title fix: fix ts_project external workspace builds fix: ts_project external workspace builds Feb 11, 2023
Refs aspect-build#284.

This allows `ts_project()` to build correctly while in an external workspace. This commit is a slightly modified version of [this diff](aspect-build#284 (comment)).
…pace

Closes aspect-build#284.

This sets up two workspaces, one with a `ts_project()` and another which depends on the first. When the second workspace is built, it triggers a build of the `ts_project()` which is under `@lib_wksp`, not the main workspace. This would trigger aspect-build#284 if not properly fixed. Note that we don't actually need to do anything with the `ts_project()` output, we just need to trigger to build, so a `build_test()` is sufficient to reproduce the error.
@dgp1130 dgp1130 force-pushed the external_ts_project branch from 2e188e7 to 0139263 Compare February 11, 2023 23:33
Copy link
Member

@gregmagolan gregmagolan left a comment

Choose a reason for hiding this comment

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

🌮

@gregmagolan gregmagolan merged commit 5ea2d01 into aspect-build:main Feb 11, 2023
@dgp1130 dgp1130 deleted the external_ts_project branch February 11, 2023 23:53
dgp1130 added a commit to dgp1130/rules_prerender that referenced this pull request Feb 12, 2023
Refs #48.

This pulls in aspect-build/rules_ts#310 to fix `ts_project()` builds in external workspaces, meaning we can remove the local patch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Bug]: ts_project does not work in an external workspace
3 participants