Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/local-actions/branch-manager/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/local-actions/labels-sync/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/local-actions/lock-closed/main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ register_toolchains(

bazel_dep(name = "yq.bzl", version = "0.3.5")
bazel_dep(name = "tar.bzl", version = "0.9.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.22.5")
bazel_dep(name = "bazel_lib", version = "3.2.2")
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "aspect_rules_js", version = "2.9.2")
bazel_dep(name = "aspect_rules_js", version = "3.0.2")
bazel_dep(name = "rules_pkg", version = "1.2.0")
bazel_dep(name = "aspect_rules_jasmine", version = "2.0.4")
bazel_dep(name = "platforms", version = "1.0.0")
Expand Down
230 changes: 47 additions & 183 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bazel/api-golden/api_golden_test.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
load("@bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("//bazel/api-golden:api_golden_test_npm_package.bzl", "api_golden_test_npm_package", "default_strip_export_pattern")

Expand Down
2 changes: 1 addition & 1 deletion bazel/api-golden/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("@bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("//bazel/api-golden:index.bzl", "api_golden_test", "api_golden_test_npm_package")

package(default_visibility = ["//bazel/api-golden/test:__pkg__"])
Expand Down
2 changes: 1 addition & 1 deletion bazel/api-golden/test/fixtures/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
load("@bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")

package(default_visibility = ["//bazel/api-golden/test:__pkg__"])

Expand Down
14 changes: 9 additions & 5 deletions bazel/http-server/server.mts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ import path from 'node:path';
import send from 'send';
import assert from 'node:assert';

// The current working directory is the runfiles root.
const runfilesRoot = process.env['RUNFILES']!;
assert(runfilesRoot, 'Expected `RUNFILES` to be set.');

/**
* Http Server implementation that uses browser-sync internally. This server
* supports Bazel runfile resolution in order to make it work in a Bazel sandbox
Expand All @@ -32,6 +28,9 @@ export class HttpServer {
/** Options of the browser-sync server. */
options: browserSync.Options;

/** The runfiles root directory. */
private readonly runfilesRoot: string;

constructor(
readonly port: number,
private _rootPaths: string[],
Expand All @@ -40,6 +39,11 @@ export class HttpServer {
private _environmentVariables: string[] = [],
private _relaxCors: boolean = false,
) {
// The current working directory is the runfiles root.
const runfilesRoot = process.env['JS_BINARY__RUNFILES'];
assert(runfilesRoot, 'Expected `JS_BINARY__RUNFILES` to be set.');
this.runfilesRoot = runfilesRoot;

this.options = {
open: false,
online: false,
Expand Down Expand Up @@ -141,7 +145,7 @@ export class HttpServer {
private _resolveUrlFromRunfiles(url: string): string | null {
for (let rootPath of this._rootPaths) {
const fragment = path.posix.join(rootPath, getManifestPath(url));
const diskPath = path.join(runfilesRoot, fragment);
const diskPath = path.join(this.runfilesRoot, fragment);

if (fs.existsSync(diskPath)) {
return diskPath;
Expand Down
2 changes: 1 addition & 1 deletion bazel/jasmine/stack-traces.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {install} from 'source-map-support';
install();

/** The root path that the test files are running from within. */
let rootPath = `${process.env.RUNFILES}/${process.env.TEST_WORKSPACE}/`;
let rootPath = `${process.env.JS_BINARY__RUNFILES}/${process.env.TEST_WORKSPACE}/`;
/** The root path match for when test files are not within the sandbox, but the executation is happening within the sandbox. */
let sandboxPath = `/.*${process.env.JS_BINARY__WORKSPACE}/${process.env.JS_BINARY__BINDIR}/`;
/** Regex to capture the content and name of the function in the stack trace. */
Expand Down
16 changes: 10 additions & 6 deletions bazel/ts_project/strict_deps/index.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,20 @@ def _strict_deps_impl(ctx):
),
)

transitive_runfiles = [
ctx.attr._bin[DefaultInfo].default_runfiles,
ctx.runfiles(transitive_files = ctx.attr.tsconfig[DefaultInfo].files),
]

if JsInfo in ctx.attr.tsconfig:
transitive_runfiles.append(ctx.runfiles(transitive_files = ctx.attr.tsconfig[JsInfo].transitive_sources))

runfiles = ctx.runfiles(
files = [
manifest,
] + ctx.files.srcs +
ctx.files._runfiles_lib +
ctx.files.tsconfig,
).merge_all([
ctx.attr._bin[DefaultInfo].default_runfiles,
ctx.attr.tsconfig[DefaultInfo].default_runfiles,
])
ctx.files._runfiles_lib,
).merge_all(transitive_runfiles)

return [
DefaultInfo(
Expand Down
7 changes: 6 additions & 1 deletion bazel/ts_project/strict_deps/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import {isBuiltin} from 'node:module';
import fs from 'node:fs/promises';
import assert from 'node:assert';
import path from 'node:path';
import ts from 'typescript';
import {createDiagnostic} from './diagnostic.mjs';
Expand All @@ -18,6 +19,10 @@ import {readTsConfig} from './tsconfig.mjs';
const [manifestExecPath, expectedFailureRaw] = process.argv.slice(2);
const expectedFailure = expectedFailureRaw === 'true';

assert(process.env['JS_BINARY__RUNFILES'], 'JS_BINARY__RUNFILES is not defined');
assert(process.env['TEST_WORKSPACE'], 'TEST_WORKSPACE is not defined');

const runfilesRoot = path.join(process.env['JS_BINARY__RUNFILES'], process.env['TEST_WORKSPACE']);
const manifest: StrictDepsManifest = JSON.parse(await fs.readFile(manifestExecPath, 'utf8'));

/**
Expand All @@ -39,7 +44,7 @@ const allowedModuleNames = new Set<string>(
const allowedSources = new Set<string>(
manifest.allowedSources.map((s) => s.replace(extensionRemoveRegex, '')),
);
const tsconfig = readTsConfig(path.join(process.cwd(), manifest.tsconfigPath));
const tsconfig = readTsConfig(path.join(runfilesRoot, manifest.tsconfigPath));
const diagnostics: ts.Diagnostic[] = [];

/** Check if the moduleSpecifier matches any of the provided paths. */
Expand Down
2 changes: 1 addition & 1 deletion bazel/validation/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("@bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")

copy_to_bin(
name = "verify-typescript",
Expand Down
4 changes: 3 additions & 1 deletion bazel/validation/verify-typescript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

import {readFile} from 'node:fs/promises';
import {join} from 'node:path';
import assert from 'node:assert';

/** The runfiles directory for the script. */
const runfiles = process.env['RUNFILES'];
const runfiles = process.env['JS_BINARY__RUNFILES'];
assert(runfiles, 'Expected `JS_BINARY__RUNFILES` to be set.');

async function main([packageJsonPath, moduleLockFilePath]) {
/** The json contents of the BAZEL.module.lock file. */
Expand Down
2 changes: 1 addition & 1 deletion github-actions/branch-manager/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-actions/google-internal-tests/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-actions/labeling/issue/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-actions/labeling/pull-request/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-actions/org-file-sync/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-actions/post-approval-changes/main.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-actions/unified-status-check/main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tools/defaults.bzl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", _copy_to_bin = "copy_to_bin")
load("@aspect_bazel_lib//lib:write_source_files.bzl", _write_source_file = "write_source_file")
load("@aspect_rules_esbuild//esbuild:defs.bzl", _esbuild = "esbuild")
load("@aspect_rules_js//js:defs.bzl", _js_binary = "js_binary")
load("@aspect_rules_js//npm:defs.bzl", _npm_package = "npm_package")
load("@aspect_rules_ts//ts:defs.bzl", _ts_config = "ts_config")
load("@bazel_lib//lib:copy_to_bin.bzl", _copy_to_bin = "copy_to_bin")
load("@bazel_lib//lib:write_source_files.bzl", _write_source_file = "write_source_file")
load("@rules_angular//src/ng_package/text_replace:index.bzl", _text_replace = "text_replace")
load("@rules_angular//src/ng_project:index.bzl", _ng_project = "ng_project")
load("@rules_angular//src/ts_project:index.bzl", _ts_project = "ts_project")
Expand Down
Loading