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
4 changes: 4 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
run: bazelisk --version
- name: Java 8 Build
run: bazel build ... --java_language_version=8 --java_runtime_version=8 --build_tag_filters=-conformance_maven
- name: Verify ErrorProne Toolchain (Java 8)
run: bazel aquery --java_language_version=8 --java_runtime_version=8 'mnemonic("Javac", //common/src/main/java/dev/cel/common:cel_descriptors)' | grep -F -- '-Xep:RemoveUnusedImports:ERROR'
- name: Unwanted Dependencies
run: .github/workflows/unwanted_deps.sh
- name: Cross-artifact Duplicate Classes Check
Expand Down Expand Up @@ -109,6 +111,8 @@ jobs:
# Exclude codelab exercises as they are intentionally made to fail
# Exclude maven conformance tests. They are only executed when there's version change.
run: bazelisk test ... --deleted_packages=//codelab/src/test/codelab --test_output=errors --test_tag_filters=-conformance_maven --build_tag_filters=-conformance_maven
- name: Verify ErrorProne Toolchain
run: bazelisk aquery --deleted_packages=//codelab/src/test/codelab 'mnemonic("Javac", //common/src/main/java/dev/cel/common:cel_descriptors)' | grep -F -- '-Xep:RemoveUnusedImports:ERROR'
- name: Prune disk cache entries not used by this job
# Bazel bumps mtimes on use; drop stale entries so the saved cache doesn't grow unbounded.
if: github.event_name != 'pull_request'
Expand Down
30 changes: 12 additions & 18 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,14 @@
# Includes package-wide build definitions for maven imported java targets
# that needs to be defined separately.

load(
"@bazel_tools//tools/jdk:default_java_toolchain.bzl",
"BASE_JDK9_JVM_OPTS",
"DEFAULT_JAVACOPTS",
"DEFAULT_TOOLCHAIN_CONFIGURATION",
"default_java_toolchain",
)
load(
"@rules_java//java:defs.bzl",
"java_binary",
"java_library",
"java_package_configuration",
"java_plugin",
)
load("@rules_java//toolchains:default_java_toolchain.bzl", "default_java_toolchain")
load("@rules_license//rules:license.bzl", "license")

licenses(["notice"]) # Apache License 2.0
Expand Down Expand Up @@ -106,16 +100,22 @@ java_library(

default_java_toolchain(
name = "repository_default_toolchain",
configuration = DEFAULT_TOOLCHAIN_CONFIGURATION,
javacopts = DEFAULT_JAVACOPTS,
jvm_opts = BASE_JDK9_JVM_OPTS,
package_configuration = [
":error_prone",
],
source_version = "11",
target_version = "11",
)

default_java_toolchain(
name = "repository_java8_toolchain",
package_configuration = [
":error_prone",
],
source_version = "8",
target_version = "8",
)

# This associates a set of javac flags with a set of packages
java_package_configuration(
name = "error_prone",
Expand All @@ -131,7 +131,6 @@ java_package_configuration(
"-Xep:ClassNewInstance:ERROR",
"-Xep:DefaultCharset:ERROR",
"-Xep:DoubleCheckedLocking:ERROR",
"-Xep:ElementsCountedInLoop:ERROR",
"-Xep:EqualsHashCode:ERROR",
"-Xep:EqualsIncompatibleType:ERROR",
"-Xep:Finally:ERROR",
Expand All @@ -150,7 +149,6 @@ java_package_configuration(
"-Xep:JUnit3FloatingPointComparisonWithoutDelta:ERROR",
"-Xep:JUnitAmbiguousTestClass:ERROR",
"-Xep:Java8ApiChecker:ERROR",
"-Xep:LiteralClassName:ERROR",
"-Xep:MissingCasesInEnumSwitch:ERROR",
"-Xep:MissingFail:ERROR",
"-Xep:MissingOverride:ERROR",
Expand All @@ -164,15 +162,12 @@ java_package_configuration(
"-Xep:OperatorPrecedence:ERROR",
"-Xep:OverridesGuiceInjectableMethod:ERROR",
"-Xep:PreconditionsInvalidPlaceholder:ERROR",
"-Xep:ProtoFieldPreconditionsCheckNotNull:ERROR",
"-Xep:ProtocolBufferOrdinal:ERROR",
"-Xep:ReferenceEquality:ERROR",
"-Xep:ReferenceEquality:OFF",
"-Xep:RemoveUnusedImports:ERROR",
"-Xep:RequiredModifiers:ERROR",
"-Xep:ShortCircuitBoolean:ERROR",
"-Xep:SimpleDateFormatConstant:ERROR",
"-Xep:StaticGuardedByInstance:ERROR",
"-Xep:StringEquality:ERROR",
"-Xep:SynchronizeOnNonFinalField:ERROR",
"-Xep:TruthConstantAsserts:ERROR",
"-Xep:TypeParameterShadowing:ERROR",
Expand All @@ -183,10 +178,9 @@ java_package_configuration(
"-Xep:UnusedVariable:ERROR",
"-Xep:WaitNotInLoop:ERROR",
"-Xep:WildcardImport:ERROR",
"-XepDisableWarningsInGeneratedCode",
"-XepExcludedPaths:.*/bazel-out/.*",
],
packages = ["error_prone_packages"],
packages = [":error_prone_packages"],
)

# This is a regular package_group, which is used to specify a set of packages to apply flags to
Expand Down
7 changes: 7 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ module(
name = "cel_java",
)

register_toolchains(
"//:repository_default_toolchain_definition",
"//:repository_default_toolchain_default_definition",
"//:repository_java8_toolchain_definition",
dev_dependency = True,
)

bazel_dep(name = "bazel_skylib", version = "1.9.2")
bazel_dep(name = "rules_jvm_external", version = "7.2")
bazel_dep(name = "protobuf", version = "36.2", repo_name = "com_google_protobuf")
Expand Down
2 changes: 0 additions & 2 deletions bundle/src/test/java/dev/cel/bundle/CelImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@
import com.google.protobuf.Descriptors.FileDescriptor;
import com.google.protobuf.Duration;
import com.google.protobuf.DynamicMessage;
import com.google.protobuf.Empty;
import com.google.protobuf.ExtensionRegistry;
import com.google.protobuf.FieldMask;
import com.google.protobuf.Message;
import com.google.protobuf.Struct;
import com.google.protobuf.TextFormat;
import com.google.protobuf.Timestamp;
import com.google.protobuf.TypeRegistry;
import com.google.protobuf.WrappersProto;
import com.google.rpc.context.AttributeContext;
import com.google.testing.junit.testparameterinjector.TestParameter;
import com.google.testing.junit.testparameterinjector.TestParameterInjector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ private static CelAbstractSyntaxTree tagAstExtension(CelAbstractSyntaxTree ast)
}

private static CelDescriptorPool newDescriptorPool(
SelectOptimizerOptions options, Iterable<FileDescriptor> fileDescriptors) {
Iterable<FileDescriptor> fileDescriptors) {
CelDescriptors celDescriptors =
CelDescriptorUtil.getAllDescriptorsFromFileDescriptor(checkNotNull(fileDescriptors));
ImmutableList.Builder<CelDescriptorPool> descriptorPools = ImmutableList.builder();
Expand All @@ -607,7 +607,9 @@ private SelectOptimizer(
SelectOptimizerOptions options, Iterable<FileDescriptor> fileDescriptors) {
this.options = checkNotNull(options);
this.astMutator = AstMutator.newInstance(options.iterationLimit());
this.descriptorPool = newDescriptorPool(options, checkNotNull(fileDescriptors));
this.descriptorPool =
newDescriptorPool(
checkNotNull(fileDescriptors));
}

/** Options configuring the behavior of {@link SelectOptimizer}. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import dev.cel.runtime.CelEvaluationListener;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down
Loading