Skip to content

Commit

Permalink
Mod:修改两个编译问题
Browse files Browse the repository at this point in the history
3.1 bazelbuild#15168

distdir_deps.bzl 文件修改
"abseil-cpp": {
        "archive": "997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
        "sha256": "35f22ef5cb286f09954b7cc4c85b5a3f6221c9d4df6b8c4a1e9d399555b366ee",
        "urls": [
            "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
            "https://github.com/abseil/abseil-cpp/archive/997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
        ],
        "used_in": [
            "additional_distfiles",
            "test_WORKSPACE_files",
        ],
    },
"com_google_absl": {
        "archive": "20211102.0.tar.gz",
        "sha256": "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4",
        "urls": [
            "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
            "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
        ],
        "used_in": [
            "additional_distfiles",
            "test_WORKSPACE_files",
        ],
        "strip_prefix": "abseil-cpp-20211102.0",
    },

WORKSPACE 文件增加
# Override the abseil-cpp version defined in grpc_deps(), which doesn't work on latest macOS
# Fixes bazelbuild#15168
dist_http_archive(
    name = "com_google_absl",
)

  3.2 src/main/java/net/starlark/java/eval/EvalUtils.java:399: 错误: 找不到符号
      return s.repeat(n);
              ^
  符号:   方法 repeat(int)
  位置: 类型为String的变量 s

    .bazelrc
     # Enable Bzlmod
     build:bzlmod --experimental_enable_bzlmod
     # TODO(pcloudy): The following should be removed after fixing bazelbuild#14279
     build:bzlmod --crosstool_top=@rules_cc.0.0.1.cc_configure.local_config_cc//:toolchain
     build:bzlmod --xcode_version_config=@rules_cc.0.0.1.cc_configure.local_config_xcode//:host_xcodes

     # Enable Java 11 language features (bazelbuild#14592)
     # Toolchain resolution configuration for Bazel >= 5
     build --java_language_version=11
     build --tool_java_language_version=11
     # Legacy configuration for Bazel <= 4
     build --java_toolchain=@bazel_tools//tools/jdk:toolchain_java11
     build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_java11
  • Loading branch information
linyuqiang-tal committed May 14, 2023
1 parent 80c56ff commit 47f6de8
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 41 deletions.
19 changes: 19 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,24 @@ build:remote --config=ubuntu1804_java11

build:macos --macos_minimum_os=10.10

#src/main/java/com/google/devtools/common/options/OptionsUsage.java:59: 错误: 找不到符号
# String indentString = " ".repeat(indent);
# ^
# 符号: 方法 repeat(int)

# Enable Bzlmod
build:bzlmod --experimental_enable_bzlmod
# TODO(pcloudy): The following should be removed after fixing https://github.com/bazelbuild/bazel/issues/14279
build:bzlmod --crosstool_top=@rules_cc.0.0.1.cc_configure.local_config_cc//:toolchain
build:bzlmod --xcode_version_config=@rules_cc.0.0.1.cc_configure.local_config_xcode//:host_xcodes

# Enable Java 11 language features (https://github.com/bazelbuild/bazel/issues/14592)
# Toolchain resolution configuration for Bazel >= 5
build --java_language_version=11
build --tool_java_language_version=11
# Legacy configuration for Bazel <= 4
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_java11
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_java11

# User-specific .bazelrc
try-import user.bazelrc
6 changes: 6 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,12 @@ dist_http_archive(
name = "com_github_grpc_grpc",
)

# Override the abseil-cpp version defined in grpc_deps(), which doesn't work on latest macOS
# Fixes https://github.com/bazelbuild/bazel/issues/15168
dist_http_archive(
name = "com_google_absl",
)

# Projects using gRPC as an external dependency must call both grpc_deps() and
# grpc_extra_deps().
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
Expand Down
25 changes: 13 additions & 12 deletions distdir_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,19 @@ DIST_DEPS = {
"test_WORKSPACE_files",
],
},
"abseil-cpp": {
"archive": "997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
"sha256": "35f22ef5cb286f09954b7cc4c85b5a3f6221c9d4df6b8c4a1e9d399555b366ee",
"urls": [
"https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
"https://github.com/abseil/abseil-cpp/archive/997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"com_google_absl": {
"archive": "20211102.0.tar.gz",
"sha256": "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4",
"urls": [
"https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
"https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
"strip_prefix": "abseil-cpp-20211102.0",
},
###################################################
#
# Build time dependencies for testing and packaging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public AnalysisResult update(
"Analysis succeeded for only %d of %d top-level targets",
numSuccessful, numTargetsToAnalyze);
eventHandler.handle(Event.info(msg));
logger.atInfo().log(msg);
logger.atInfo().log("%s",msg);
}

AnalysisResult result;
Expand Down Expand Up @@ -468,7 +468,7 @@ public AnalysisResult update(
topLevelTargetsWithConfigsResult,
/*includeExecutionPhase=*/ false);
}
logger.atInfo().log("Finished analysis");
logger.atInfo().log("%s","Finished analysis");
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ private void reportError(
// Don't hide unchecked exceptions as part of the error reporting.
Throwables.throwIfUnchecked(exception);

logger.atSevere().withCause(exception).log(msg);
logger.atSevere().withCause(exception).log("%s",msg);
// logger.atSevere().withCause(exception).log(msg);
reportCommandLineError(commandLineReporter, exception);
moduleEnvironment.exit(createAbruptExitException(exception, msg, besCode));
}
Expand Down Expand Up @@ -254,7 +255,7 @@ private void waitForPreviousInvocation(boolean isShutdown) {
+ "Cancelling and starting a new invocation...",
waitedMillis / 1000, waitedMillis % 1000);
reporter.handle(Event.warn(msg));
logger.atWarning().withCause(exception).log(msg);
logger.atWarning().withCause(exception).log("%s",msg);
cancelCloseFutures = true;
} catch (ExecutionException e) {
String msg;
Expand All @@ -274,7 +275,7 @@ private void waitForPreviousInvocation(boolean isShutdown) {
e.getMessage());
}
reporter.handle(Event.warn(msg));
logger.atWarning().withCause(e).log(msg);
logger.atWarning().withCause(e).log("%s",msg);
cancelCloseFutures = true;
} finally {
if (cancelCloseFutures) {
Expand Down Expand Up @@ -416,10 +417,10 @@ private void forceShutdownBuildEventStreamer(AbortReason reason) {
closeFuturesWithTimeoutsMap =
constructCloseFuturesMapWithTimeouts(streamer.getCloseFuturesMap());
try {
logger.atInfo().log("Closing pending build event transports");
logger.atInfo().log("%s","Closing pending build event transports");
Uninterruptibles.getUninterruptibly(Futures.allAsList(closeFuturesWithTimeoutsMap.values()));
} catch (ExecutionException e) {
logger.atSevere().withCause(e).log("Failed to close a build event transport");
logger.atSevere().withCause(e).log("%s","Failed to close a build event transport");
} finally {
cancelAndResetPendingUploads();
}
Expand All @@ -428,7 +429,7 @@ private void forceShutdownBuildEventStreamer(AbortReason reason) {
@Override
public void blazeShutdownOnCrash(DetailedExitCode exitCode) {
if (streamer != null) {
logger.atWarning().log("Attempting to close BES streamer on crash");
logger.atWarning().log("%s","Attempting to close BES streamer on crash");
forceShutdownBuildEventStreamer(
exitCode.getExitCode().equals(ExitCode.OOM_ERROR)
? AbortReason.OUT_OF_MEMORY
Expand All @@ -449,7 +450,7 @@ public void blazeShutdown() {
getMaxWaitForPreviousInvocation().getSeconds(),
TimeUnit.SECONDS);
} catch (TimeoutException | ExecutionException exception) {
logger.atWarning().withCause(exception).log(
logger.atWarning().withCause(exception).log("%s",
"Encountered Exception when closing BEP transports in Blaze's shutting down sequence");
} finally {
cancelAndResetPendingUploads();
Expand Down Expand Up @@ -579,7 +580,7 @@ public void afterCommand() throws AbruptExitException {
if (!streamer.isClosed()) {
// This should not occur, but close with an internal error if a {@link BuildEventStreamer}
// bug manifests as an unclosed streamer.
logger.atWarning().log("Attempting to close BES streamer after command");
logger.atWarning().log("%s","Attempting to close BES streamer after command");
reporter.handle(Event.warn("BES was not properly closed"));
forceShutdownBuildEventStreamer(AbortReason.INTERNAL);
}
Expand Down Expand Up @@ -671,7 +672,7 @@ private BuildEventServiceTransport createBesTransport(
String.format(
"Build Event Service uploads disabled due to a connectivity problem: %s", status);
reporter.handle(Event.warn(message));
logger.atWarning().log(message);
logger.atWarning().log("%s",message);
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ ListenableFuture<Void> getHalfCloseFuture() {

private DetailedExitCode logAndSetException(
String message, BuildProgress.Code bpCode, Throwable cause) {
logger.atSevere().log(message);
// logger.atSevere().log(message);
logger.atSevere().log("%s", message);
DetailedExitCode detailedExitCode =
DetailedExitCode.of(
FailureDetail.newBuilder()
Expand Down Expand Up @@ -490,15 +491,15 @@ private void publishBuildEvents()
String.format(
"Expected ACK with seqNum=%d but received ACK with seqNum=%d",
expected.getSequenceNumber(), actualSeqNum);
logger.atInfo().log(message);
logger.atInfo().log("%s", message);
streamContext.abortStream(Status.FAILED_PRECONDITION.withDescription(message));
}
} else {
String message =
String.format(
"Received ACK (seqNum=%d) when no ACK was expected",
ackEvent.getSequenceNumber());
logger.atInfo().log(message);
logger.atInfo().log("%s", message);
streamContext.abortStream(Status.FAILED_PRECONDITION.withDescription(message));
}
}
Expand Down Expand Up @@ -537,7 +538,7 @@ private void publishBuildEvents()
if (!shouldRetryStatus(streamStatus)) {
String message =
String.format("Not retrying publishBuildEvents: status='%s'", streamStatus);
logger.atInfo().log(message);
logger.atInfo().log("%s", message);
throw withFailureDetail(
streamStatus.asException(),
BuildProgress.Code.BES_STREAM_NOT_RETRYING_FAILURE,
Expand All @@ -548,7 +549,7 @@ private void publishBuildEvents()
String.format(
"Not retrying publishBuildEvents, no more attempts left: status='%s'",
streamStatus);
logger.atInfo().log(message);
logger.atInfo().log("%s", message);
throw withFailureDetail(
streamStatus.asException(),
BuildProgress.Code.BES_UPLOAD_RETRY_LIMIT_EXCEEDED_FAILURE,
Expand Down Expand Up @@ -636,7 +637,7 @@ private void publishLifecycleEvent(PublishLifecycleEventRequest request)
if (!shouldRetryStatus(e.getStatus())) {
String message =
String.format("Not retrying publishLifecycleEvent: status='%s'", e.getStatus());
logger.atInfo().log(message);
logger.atInfo().log("%s", message);
throw withFailureDetail(e, BuildProgress.Code.BES_STREAM_NOT_RETRYING_FAILURE, message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ private void exitFailure(Throwable e) {
.build()),
e));
pendingWrites.clear();
logger.atSevere().withCause(e).log(message);
// logger.atSevere().withCause(e).log(message);
logger.atSevere().withCause(e).log("%s", message);
}

private static BuildProgress.Code getBuildProgressCode(Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ private static void logDeleteTreeFailure(
for (Path entry : entries) {
directoryDetails.append(" '").append(entry.getBaseName()).append("'");
}
logger.atWarning().log(directoryDetails.toString());
logger.atWarning().log("%s",directoryDetails.toString());
} catch (IOException e) {
logger.atWarning().withCause(e).log("'%s' exists but could not be read", directory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ private void stepLog(
Level level, @Nullable Throwable cause, @FormatString String fmt, Object... args) {
String msg = String.format(fmt, args);
String toLog = String.format("%s (#%d %s)", msg, id, desc());
logger.at(level).withCause(cause).log(toLog);
logger.at(level).withCause(cause).log("%s",toLog);
}

private String desc() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ public void afterCommand() throws AbruptExitException {
failure = e;
failureCode = Code.RPC_LOG_FAILURE;
failureMessage = "Partially wrote rpc log file";
logger.atWarning().withCause(e).log(failureMessage);
logger.atWarning().withCause(e).log("%s",failureMessage);
}

executorService = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ DetailedExitCode parseStarlarkOptions(CommandEnvironment env, ExtendedEventHandl
StarlarkOptionsParser.newStarlarkOptionsParser(env, optionsParser).parse(eventHandler);
} catch (OptionsParsingException e) {
String logMessage = "Error parsing Starlark options";
logger.atInfo().withCause(e).log(logMessage);
logger.atInfo().withCause(e).log("%s",logMessage);
return processOptionsParsingException(
eventHandler, e, logMessage, Code.STARLARK_OPTIONS_PARSE_FAILURE);
}
Expand Down Expand Up @@ -343,7 +343,7 @@ DetailedExitCode parseOptions(List<String> args, ExtendedEventHandler eventHandl
}
} catch (OptionsParsingException e) {
String logMessage = "Error parsing options";
logger.atInfo().withCause(e).log(logMessage);
logger.atInfo().withCause(e).log("%s",logMessage);
return processOptionsParsingException(
eventHandler, e, logMessage, Code.OPTIONS_PARSE_FAILURE);
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ private static int batchMain(Iterable<BlazeModule> modules, String[] args) {
boolean shutdownDone = false;

try {
logger.atInfo().log(
logger.atInfo().log("%s",
SafeRequestLogging.getRequestLogString(commandLineOptions.getOtherArgs()));
BlazeCommandResult result =
dispatcher.exec(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void buildComplete(BuildCompleteEvent event) {
event.getResult().getBuildToolLogCollection()
.addDirectValue(
"critical path", criticalPath.toString().getBytes(StandardCharsets.UTF_8));
logger.atInfo().log(criticalPath.toString());
logger.atInfo().log("%s",criticalPath.toString());
logger.atInfo().log(
"Slowest actions:\n %s",
Joiner.on("\n ").join(criticalPathComputer.getSlowestComponents()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,8 @@ private void executeCommand(RunRequest request, BlockingStreamObserver<RunRespon
.collect(ImmutableList.toImmutableList());

InvocationPolicy policy = InvocationPolicyParser.parsePolicy(request.getInvocationPolicy());
logger.atInfo().log(SafeRequestLogging.getRequestLogString(args));
// logger.atInfo().log(SafeRequestLogging.getRequestLogString(args));
logger.atInfo().log("%s", SafeRequestLogging.getRequestLogString(args));
result =
dispatcher.exec(
policy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private static void printStack(IOException e) {
printErr.println("=======[BAZEL SERVER: ENCOUNTERED IO EXCEPTION]=======");
e.printStackTrace(printErr);
printErr.println("=====================================================");
logger.atSevere().log(err.toString());
// logger.atSevere().log(err.toString());
logger.atSevere().log("%s", err);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,8 @@ public int available() {
}

private static void processInput(InputStream stdinInput, Subprocess process) {
logger.atFiner().log(stdinInput.toString());
// logger.atFiner().log(stdinInput.toString());
logger.atFiner().log("%s", stdinInput);
try (OutputStream out = process.getOutputStream()) {
ByteStreams.copy(stdinInput, out);
} catch (IOException ioe) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ private static void logDiffInfo(
}
}

logger.atInfo().log(result.toString());
logger.atInfo().log("%s",result.toString());
}

private static int getNumberOfModifiedFiles(Iterable<SkyKey> modifiedValues) {
Expand Down

0 comments on commit 47f6de8

Please sign in to comment.