Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
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
4 changes: 4 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ platforms:
- "@nodejs//:yarn"
build_targets:
- "..."
- "@disable_tsetse_for_external_test//..."
test_flags:
# TODO(gregmagolan): shared libs needed by chrome & firefox not available on ubuntu1404
- "--test_tag_filters=-browser:chromium-local,-browser:firefox-local"
Expand All @@ -17,6 +18,7 @@ platforms:
- "@nodejs//:yarn"
build_targets:
- "..."
- "@disable_tsetse_for_external_test//..."
test_flags:
# TODO(gregmagolan): shared libs needed by chrome & firefox not available on ubuntu1604
- "--test_tag_filters=-browser:chromium-local,-browser:firefox-local"
Expand All @@ -28,6 +30,7 @@ platforms:
- "@nodejs//:yarn"
build_targets:
- "..."
- "@disable_tsetse_for_external_test//..."
test_flags:
# TODO(gregmagolan): chrome & firefox unknown breakage on macos target here; does work locally on mac
- "--test_tag_filters=-browser:chromium-local,-browser:firefox-local"
Expand All @@ -39,5 +42,6 @@ platforms:
- "@nodejs//:yarn"
build_targets:
- "..."
- "@disable_tsetse_for_external_test//..."
test_targets:
- "..."
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
- run: bazel info release
- run: bazel build ...
- run: bazel test ...
- run: bazel build @disable_tsetse_for_external_test//...

# This job tests the same stuff, but without the .bazelrc file.
# It disables worker mode, for example.
Expand All @@ -77,6 +78,7 @@ jobs:
# is required to keep Bazel from exhausting the memory.
- run: bazel --bazelrc=/dev/null --host_jvm_args=-Xmx3g build ... --local_resources=2560,1.0,1.0
- run: bazel --bazelrc=/dev/null --host_jvm_args=-Xmx3g test ... --local_resources=2560,1.0,1.0
- run: bazel --bazelrc=/dev/null --host_jvm_args=-Xmx3g build @disable_tsetse_for_external_test//... --local_resources=2560,1.0,1.0

- save_cache:
key: *cache_key
Expand Down
5 changes: 5 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,8 @@ local_repository(
name = "package_typescript_karma_e2e",
path = "internal/e2e/package_typescript_karma",
)

local_repository(
name = "disable_tsetse_for_external_test",
path = "internal/e2e/disable_tsetse_for_external",
)
1 change: 1 addition & 0 deletions internal/common/tsconfig.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def create_tsconfig(
"workspaceName": ctx.workspace_name,
"target": str(ctx.label),
"package": ctx.label.package,
"externalTarget": ctx.label.workspace_root.startswith("external/"),
"tsickleGenerateExterns": getattr(ctx.attr, "generate_externs", True),
"tsickleExternsPath": tsickle_externs.path if tsickle_externs else "",
"untyped": not getattr(ctx.attr, "tsickle_typed", False),
Expand Down
23 changes: 23 additions & 0 deletions internal/e2e/disable_tsetse_for_external/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

package(default_visibility = ["//visibility:public"])

load("@build_bazel_rules_typescript//internal:defaults.bzl", "ts_library")

ts_library(
name = "main",
srcs = glob(["*.ts"]),
deps = ["@npm//:@types"],
)
15 changes: 15 additions & 0 deletions internal/e2e/disable_tsetse_for_external/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

workspace(name = "disable_tsetse_for_external_test")
19 changes: 19 additions & 0 deletions internal/e2e/disable_tsetse_for_external/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export {};

// string.trim() result is unused
let stringUnused;
stringUnused = 'hello';
stringUnused.trim();
const stringLiteralUnused = 'hello';
stringLiteralUnused.trim();

// Array.concat() result is unused.
const arrayOfStringsUnused = ['hello'];
arrayOfStringsUnused.concat(arrayOfStringsUnused);

// Object.create() result is unused
const objectUnused = {};
Object.create(objectUnused);

// string.replace() with a substring
stringUnused.replace('o', 'O');
Empty file.
6 changes: 5 additions & 1 deletion internal/tsc_wrapped/tsc_wrapped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ function runOneBuild(
ignoredFilesPrefixes,
});
}
program = tsetsePlugin.wrap(program, disabledTsetseRules);

// Only apply tsetse checks to the internal repository
if (!bazelOpts.externalTarget) {
program = tsetsePlugin.wrap(program, disabledTsetseRules);
}

// These checks mirror ts.getPreEmitDiagnostics, with the important
// exception that if you call program.getDeclarationDiagnostics() it somehow
Expand Down
3 changes: 3 additions & 0 deletions internal/tsc_wrapped/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export interface BazelOptions {
/** The bazel package, eg my/pkg */
package: string;

/** True if the target being built is from an external workspace. */
externalTarget: boolean;

/** If true, convert require()s into goog.module(). */
googmodule: boolean;

Expand Down