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

feat: validate tsconfig outDir vs ts_project(out_dir) #730

Merged
merged 23 commits into from
Jan 7, 2025

Conversation

Mivr
Copy link
Contributor

@Mivr Mivr commented Nov 1, 2024

Changes are visible to end-users: no

Test plan

  • New test cases added

Resolves: #644

By adding a validation to the tsconfig file. If a out_dir parameter is set to the rule and the tsconfig file does not have the exclude key set the build will fail

@Mivr Mivr marked this pull request as draft November 1, 2024 16:51
Copy link

aspect-workflows bot commented Nov 1, 2024

Test

⚠️ GitHub Actions build #1115 failed.

//examples/transpiler:babel failed to build

remote spawn failed: UNIMPLEMENTED: Failed to route action: Failed to analyze initial size class: Failed to read previous execution stats for reduced action digest "1-74756d07ff0869dd2641455b91569e397f9e4653b3456b1be55f6ddf3c663146-232-": Failed to read mutable Protobuf message with digest "1-74756d07ff0869dd2641455b91569e397f9e4653b3456b1be55f6ddf3c663146-232-": Shard 1: unknown service buildbarn.iscc.InitialSizeClassCache
remote spawn failed: UNIMPLEMENTED: Failed to route action: Failed to analyze initial size class: Failed to read previous execution stats for reduced action digest "1-cd2b0635d7d8741f0a3681caa747acfbaf87912aec5bfb83375fefe554c389e3-232-": Failed to read mutable Protobuf message with digest "1-cd2b0635d7d8741f0a3681caa747acfbaf87912aec5bfb83375fefe554c389e3-232-": Shard 0: unknown service buildbarn.iscc.InitialSizeClassCache

//examples/lib_nocompile_linked:lib failed to build

remote spawn failed: UNIMPLEMENTED: Failed to route action: Failed to analyze initial size class: Failed to read previous execution stats for reduced action digest "1-73635a7baf60e6d0f384bb6b6cc9a12565f6a982538cc951bad81ba7deba1b36-232-": Failed to read mutable Protobuf message with digest "1-73635a7baf60e6d0f384bb6b6cc9a12565f6a982538cc951bad81ba7deba1b36-232-": Shard 2: unknown service buildbarn.iscc.InitialSizeClassCache

//examples/no_emit:typecheck_nodeclarations_js failed to build

remote spawn failed: UNIMPLEMENTED: Failed to route action: Failed to analyze initial size class: Failed to read previous execution stats for reduced action digest "1-68a38e29f00de7b98b884bf830d099f948fd994b7d2e3a02a75ce21f53b04176-232-": Failed to read mutable Protobuf message with digest "1-68a38e29f00de7b98b884bf830d099f948fd994b7d2e3a02a75ce21f53b04176-232-": Shard 1: unknown service buildbarn.iscc.InitialSizeClassCache
remote spawn failed: UNIMPLEMENTED: Failed to route action: Failed to analyze initial size class: Failed to read previous execution stats for reduced action digest "1-f29da188f160329d6345dfbcadd05f219075932fb9be14dca3fd0612c3a489b8-232-": Failed to read mutable Protobuf message with digest "1-f29da188f160329d6345dfbcadd05f219075932fb9be14dca3fd0612c3a489b8-232-": Shard 2: unknown service buildbarn.iscc.InitialSizeClassCache

124 other actions failed to build.

💡 To reproduce the build failures, run

bazel build --output_groups=+typecheck --output_groups=+types //examples/transpiler:babel //examples/lib_nocompile_linked:lib //examples/no_emit:typecheck_nodeclarations_js

Buildifier      Format

@Mivr Mivr marked this pull request as ready for review November 4, 2024 16:13
@Mivr Mivr changed the title Draft: Add tsconfig exclude validation Add tsconfig exclude validation Nov 4, 2024
@jbedard jbedard self-requested a review November 29, 2024 21:26
ts/defs.bzl Outdated Show resolved Hide resolved
@Mivr
Copy link
Contributor Author

Mivr commented Dec 22, 2024

After some discussions with @jbedard, I tested if the exclude is still needed at all for several parameters.
The tests made are as follows:

root_dir parameter testing (Latest rules_ts + default TS and node version)

root_dir tsconfig rootDir tsconfig exclude Result
. undefined undefined BUILD PASSED
./ undefined undefined BUILD PASSED
./src undefined undefined BUILD FAILED - cannot find outputs
./src undefined [] BUILD FAILED - cannot find outputs
./src src undefined BUILD FAILED - cannot find outputs
./src ./src undefined BUILD FAILED - cannot find outputs
src src [] BUILD PASSED
src src undefined BUILD PASSED
src ./src undefined BUILD PASSED
src undefined undefined BUILD PASSED
src undefined [] BUILD PASSED

out_dir parameter testing (Latest rules_ts + default TS and node version)

out_dir tsconfig outDir tsconfig exclude Result
out Undefined Undefined BUILD PASSED
out out Undefined BUILD PASSED
out ./out Undefined BUILD PASSED
Undefined ./out Undefined BUILD FAILED - cannot find outputs
Undefined ./out [] BUILD FAILED - cannot find outputs
Undefined out Undefined BUILD FAILED - cannot find outputs
Undefined out [] BUILD FAILED - cannot find outputs
. Undefined Undefined BUILD PASSED
./ Undefined Undefined BUILD FAILED - ./ messes up outputs paths
./ Undefined [] BUILD FAILED - ./ messes up outputs paths
./out Undefined Undefined BUILD FAILED - ./ messes up outputs paths

declaration_dir parameter testing declaration=True (Latest rules_ts + default TS and node version)

declaration_dir tsconfig declarationDir tsconfig exclude Result
"dec" "dec" Undefined BUILD PASSED
"dec" Undefined Undefined BUILD FAILED - cannot find output declarations
Undefined "dec" Undefined BUILD FAILED - cannot find output declarations

All tests were made before the changes in this branch. No tests show the need for exclude to be added at this point.

Is there a test case that still fails with the latest rules_ts?

And should we make these errors more friendly?
@jbedard

Copy link

aspect-workflows bot commented Jan 6, 2025

Test

All tests were cache hits

153 tests (100.0%) were fully cached saving 10s.


Buildifier      Format

@jbedard jbedard enabled auto-merge (squash) January 7, 2025 00:33
@jbedard jbedard changed the title Add tsconfig exclude validation feat: validate tsconfig outDir vs ts_project(out_dir) Jan 7, 2025
@jbedard jbedard merged commit 9700b5e into aspect-build:main Jan 7, 2025
19 of 20 checks passed
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.

[Bug]: typescript 5.5.2 cannot find input files with source tsconfig.json
2 participants