Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 6561f95

Browse files
gregmagolanalexeagle
authored andcommitted
Only apply tsetse checks to internal repository
Verify that tsetse is not run on external targets Closes #293 PiperOrigin-RevId: 215772284
1 parent ec4b8a4 commit 6561f95

File tree

8 files changed

+84
-0
lines changed

8 files changed

+84
-0
lines changed

.bazelci/presubmit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ platforms:
66
- "@nodejs//:yarn"
77
build_targets:
88
- "..."
9+
- "@disable_tsetse_for_external_test//..."
910
test_flags:
1011
# TODO(gregmagolan): shared libs needed by chrome & firefox not available on ubuntu1404
1112
- "--test_tag_filters=-browser:chromium-local,-browser:firefox-local"
@@ -17,6 +18,7 @@ platforms:
1718
- "@nodejs//:yarn"
1819
build_targets:
1920
- "..."
21+
- "@disable_tsetse_for_external_test//..."
2022
test_flags:
2123
# TODO(gregmagolan): shared libs needed by chrome & firefox not available on ubuntu1604
2224
- "--test_tag_filters=-browser:chromium-local,-browser:firefox-local"
@@ -28,6 +30,7 @@ platforms:
2830
- "@nodejs//:yarn"
2931
build_targets:
3032
- "..."
33+
- "@disable_tsetse_for_external_test//..."
3134
test_flags:
3235
# TODO(gregmagolan): chrome & firefox unknown breakage on macos target here; does work locally on mac
3336
- "--test_tag_filters=-browser:chromium-local,-browser:firefox-local"
@@ -39,5 +42,6 @@ platforms:
3942
- "@nodejs//:yarn"
4043
build_targets:
4144
- "..."
45+
- "@disable_tsetse_for_external_test//..."
4246
test_targets:
4347
- "..."

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
- run: bazel info release
5757
- run: bazel build ...
5858
- run: bazel test ...
59+
- run: bazel build @disable_tsetse_for_external_test//...
5960

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

8183
- save_cache:
8284
key: *cache_key

WORKSPACE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,8 @@ local_repository(
199199
name = "package_typescript_karma_e2e",
200200
path = "internal/e2e/package_typescript_karma",
201201
)
202+
203+
local_repository(
204+
name = "disable_tsetse_for_external_test",
205+
path = "internal/e2e/disable_tsetse_for_external",
206+
)

internal/build_defs.bzl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,22 @@ def tsc_wrapped_tsconfig(
199199
if jsx_factory:
200200
config["compilerOptions"]["jsxFactory"] = jsx_factory
201201

202+
tsetse_disabled_rules = []
203+
204+
# Matches section in javascript/typescript/tsconfig.bzl
205+
# TODO(alexeagle): make them share code
206+
if ctx.label.workspace_root.startswith("external/"):
207+
# Violated by rxjs
208+
tsetse_disabled_rules += ["ban-promise-as-condition"]
209+
210+
# For local testing
211+
tsetse_disabled_rules += ["check-return-value"]
212+
213+
config["compilerOptions"]["plugins"] = [{
214+
"name": "@bazel/tsetse",
215+
"disabledRules": tsetse_disabled_rules,
216+
}]
217+
202218
return config
203219

204220
# ************ #
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2017 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
package(default_visibility = ["//visibility:public"])
16+
17+
load("@build_bazel_rules_typescript//internal:defaults.bzl", "ts_library")
18+
19+
ts_library(
20+
name = "main",
21+
srcs = glob(["*.ts"]),
22+
deps = ["@npm//@types"],
23+
)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2017 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
workspace(name = "disable_tsetse_for_external_test")
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export {};
2+
3+
// string.trim() result is unused
4+
let stringUnused;
5+
stringUnused = 'hello';
6+
stringUnused.trim();
7+
const stringLiteralUnused = 'hello';
8+
stringLiteralUnused.trim();
9+
10+
// Array.concat() result is unused.
11+
const arrayOfStringsUnused = ['hello'];
12+
arrayOfStringsUnused.concat(arrayOfStringsUnused);
13+
14+
// Object.create() result is unused
15+
const objectUnused = {};
16+
Object.create(objectUnused);
17+
18+
// string.replace() with a substring
19+
stringUnused.replace('o', 'O');

internal/e2e/disable_tsetse_for_external/tsconfig.json

Whitespace-only changes.

0 commit comments

Comments
 (0)