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

refactor: update to rules_js 1.0.0-rc.4 #113

Merged
merged 1 commit into from
Aug 2, 2022
Merged

refactor: update to rules_js 1.0.0-rc.4 #113

merged 1 commit into from
Aug 2, 2022

Conversation

gregmagolan
Copy link
Member

@gregmagolan gregmagolan commented Aug 1, 2022

rc4 is not out yet but this update to what the derivate rules API will look like when it is released

@gregmagolan gregmagolan force-pushed the rules_js_rc4 branch 4 times, most recently from 6faf6bc to c44bc38 Compare August 1, 2022 22:07
@gregmagolan gregmagolan changed the title refactor: update to rules_js rc4 refactor: update to rules_js 1.0.0-rc.4 Aug 1, 2022
@gregmagolan gregmagolan force-pushed the rules_js_rc4 branch 5 times, most recently from ee30c00 to ec5245c Compare August 2, 2022 04:15
@gregmagolan gregmagolan marked this pull request as ready for review August 2, 2022 04:17
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
examples/declarationdir_with_value/BUILD.bazel Outdated Show resolved Hide resolved
examples/deps_lib/BUILD.bazel Show resolved Hide resolved
@@ -12,7 +12,7 @@ ValidOptionsInfo = provider(

# Targets in deps must provide one or the other of these
DEPS_PROVIDERS = [
[DeclarationInfo],
Copy link
Member

Choose a reason for hiding this comment

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

https://en.wikipedia.org/wiki/Robustness_principle suggests that we should consider keeping DeclarationInfo here as an option. I think it's pretty trivial in the implementation to check it if JsInfo isn't present on a dep

Copy link
Member Author

Choose a reason for hiding this comment

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

One problem with that is that we'd be advertising interop when we wouldn't be picking up the transitive npm dependencies from any ts_projects the produce DeclarationInfo

Copy link
Member

Choose a reason for hiding this comment

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

yes that will be confusing for users that some deps have different behavior. I'm okay with this like it is

ts/private/ts_lib.bzl Outdated Show resolved Hide resolved
ts/private/ts_project.bzl Outdated Show resolved Hide resolved
else:
# We must avoid tsc writing any JS files in this case, as tsc was only run for typings, and some other
# action will try to write the JS files. We must avoid collisions where two actions write the same file.
arguments.add("--emitDeclarationOnly")

# We don't produce any DefaultInfo outputs in this case, because we avoid running the tsc action
# unless the DeclarationInfo is requested.
default_outputs_depset = depset([])
# unless the declarations are requested.
Copy link
Member

Choose a reason for hiding this comment

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

did you verify if this continues to work? If some downstream action asks for the JsInfo but doesn't need declarations, are we now going to trigger typechecks where we didn't previously?

(that may be a critical reason to keep the DeclarationInfo separate from JsInfo)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll double check but yes it should work. A declaration file is only created if it ends up as an input to an action. Having File objects passed around in declarations and transitive_declarations in JsInfo doesn't trigger the actions unless they are passed as inputs to actions that need to run or as runfiles to binary targets that are run.

Copy link
Member

Choose a reason for hiding this comment

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

I verified this locally and pretty sure it does work correctly, since include_declarations is False by default

@gregmagolan gregmagolan force-pushed the rules_js_rc4 branch 4 times, most recently from 9183fa1 to 21faff5 Compare August 2, 2022 16:53
ts/private/ts_lib.bzl Outdated Show resolved Hide resolved
@gregmagolan gregmagolan force-pushed the rules_js_rc4 branch 5 times, most recently from 142bc92 to 5dfa5f4 Compare August 2, 2022 20:59
@gregmagolan gregmagolan force-pushed the rules_js_rc4 branch 2 times, most recently from ef164f9 to 86668b6 Compare August 2, 2022 22:52
@gregmagolan gregmagolan merged commit 74d54bd into main Aug 2, 2022
@alexeagle alexeagle deleted the rules_js_rc4 branch May 22, 2024 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants