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: exporting symbols from @bazel/concatjs #3286

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions packages/concatjs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@ load("//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "co
ts_project(
name = "bazel_concatjs_lib",
srcs = glob(["*.ts"]),
tsconfig = {
"compilerOptions": {
"declaration": True,
"module": "umd",
"moduleResolution": "node",
"types": ["node"],
},
},
allow_js = True,
declaration = True,
tsconfig = ":tsconfig.json",
deps = [
"//packages/concatjs/internal:tsc_wrapped_lib",
"@npm//@types/node",
"@npm//karma",
"@npm//tsickle",
],
)

Expand All @@ -42,6 +39,12 @@ js_library(
package_name = "@bazel/concatjs",
srcs = ["bazel_concatjs_lib"],
visibility = ["//packages/concatjs:__subpackages__"],
deps = [
"//packages/concatjs/internal:tsc_wrapped_lib",
"//packages/concatjs/third_party/github.com/bazelbuild/bazel/src/main/protobuf:npm_package_assets",
"@npm//protobufjs",
"@npm//typescript",
],
)

bzl_library(
Expand Down
2 changes: 2 additions & 0 deletions packages/concatjs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ function watcher(fileList: {refresh: () => void}) {

(watcher as any).$inject = ['fileList'];

export * from "./internal/tsc_wrapped";

module.exports = {
'framework:concat_js': ['factory', initConcatJs],
'watcher': ['value', watcher],
Expand Down
7 changes: 6 additions & 1 deletion packages/concatjs/internal/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# gazelle:exclude worker_protocol.proto

load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("//:index.bzl", "nodejs_binary")
load("//:index.bzl", "js_library", "nodejs_binary")
load("//packages/jasmine:index.bzl", "jasmine_node_test")
load("//packages/concatjs:index.bzl", "ts_library")
load("@npm//typescript:index.bzl", "tsc")
Expand Down Expand Up @@ -82,6 +82,11 @@ tsc(
visibility = ["//visibility:public"],
)

js_library(
name = "tsc_wrapped_lib",
srcs = [":tsc_wrapped"],
)

# Other ts_library rules will use this custom compiler, which calls the
# TypeScript APIs to act like tsc, but adds capabilities like Bazel workers.
# TODO(gregmagolan): make @npm//tsickle dependency optional
Expand Down
26 changes: 26 additions & 0 deletions packages/concatjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"declaration": true,
"module": "umd",
"allowJs": true,
"moduleResolution": "node",
"types": ["node"],
"rootDirs": [
".",
"../../bazel-out/darwin-fastbuild/bin/packages/concatjs",
Copy link
Collaborator

@gregmagolan gregmagolan Jan 26, 2022

Choose a reason for hiding this comment

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

CI error is that you're missing some possible paths here

ERROR: /home/circleci/rules_nodejs/packages/concatjs/BUILD.bazel:23:11: Compiling TypeScript project //packages/concatjs:bazel_concatjs_lib [tsc -p packages/concatjs/tsconfig.json] failed: (Exit 2): tsc.sh failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/external/npm/typescript/bin/tsc.sh --project packages/concatjs/tsconfig.json --outDir bazel-out/k8-opt-exec-2B5CBBC6/bin/packages/concatjs --rootDir packages/concatjs ... (remaining 3 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox
packages/concatjs/index.ts(131,15): error TS2307: Cannot find module './internal/tsc_wrapped' or its corresponding type declarations.

Copy link
Collaborator

Choose a reason for hiding this comment

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

k8-opt-exec-2B5CBBC6
darwin-opt-exec-2B5CBBC6
windows-opt-exec-2B5CBBC6

These are the outputs trees for the host (2B5CBBC6) execution platform

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't recall ever seeing a linux-* platform. Where did those ones come from?

"../../bazel-out/k8-fastbuild/bin/packages/concatjs",
"../../bazel-out/host/bin/packages/concatjs",
"../../bazel-out/darwin_arm64-fastbuild/bin/packages/concatjs",
"../../bazel-out/darwin_amd64-fastbuild/bin/packages/concatjs",
"../../bazel-out/x64_windows-fastbuild/bin/packages/concatjs",
"../../bazel-out/darwin-dbg/bin/packages/concatjs",
"../../bazel-out/k8-dbg/bin/packages/concatjs",
"../../bazel-out/x64_windows-dbg/bin/packages/concatjs",
"../../bazel-out/k8-opt-exec-2B5CBBC6/bin/packages/concatjs",
"../../bazel-out/darwin-opt-exec-2B5CBBC6/bin/packages/concatjs",
"../../bazel-out/windows-opt-exec-2B5CBBC6/bin/packages/concatjs",
"../../bazel-out/x64_windows-opt-exec-2B5CBBC6/bin/packages/concatjs",
"../../bazel-out/k8-opt-exec-60723E07/bin/packages/concatjs",
]
}
}