diff --git a/java/example/simple/BUILD.bazel b/java/example/simple/BUILD.bazel index 65d9e7e..5d3c185 100644 --- a/java/example/simple/BUILD.bazel +++ b/java/example/simple/BUILD.bazel @@ -2,8 +2,14 @@ load("//rules:simple_java_library.bzl", "simple_java_library") simple_java_library( name = "simple", - src = "Simple.java", - deps = [":simple_dep"], + src = select({ + "@platforms//os:linux": "SimpleLinux.java", + "//conditions:default": "Simple.java", + }), + deps = select({ + "@platforms//os:linux": [":simple_dep_linux"], + "//conditions:default": [":simple_dep"], + }), visibility = ["//visibility:public"], ) @@ -11,3 +17,8 @@ simple_java_library( name = "simple_dep", src = "Dep.java", ) + +simple_java_library( + name = "simple_dep_linux", + src = "LinuxDep.java", +) diff --git a/java/example/simple/LinuxDep.java b/java/example/simple/LinuxDep.java new file mode 100644 index 0000000..3d2b729 --- /dev/null +++ b/java/example/simple/LinuxDep.java @@ -0,0 +1,5 @@ +package example.simple; + +public class LinuxDep { + public static final String NAME = "LinuxDep"; +} diff --git a/java/example/simple/SimpleLinux.java b/java/example/simple/SimpleLinux.java new file mode 100644 index 0000000..4294a08 --- /dev/null +++ b/java/example/simple/SimpleLinux.java @@ -0,0 +1,7 @@ +package example.simple; + +public class SimpleLinux { + public static String description() { + return String.format("I am a simple class named SimpleLinux, and I know about %s", LinuxDep.NAME); + } +}