Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selects #4

Open
wants to merge 9 commits into
base: simple-java-library-targets
Choose a base branch
from
Open
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
15 changes: 13 additions & 2 deletions java/example/simple/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ 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"],
)

simple_java_library(
name = "simple_dep",
src = "Dep.java",
)

simple_java_library(
name = "simple_dep_linux",
src = "LinuxDep.java",
)
5 changes: 5 additions & 0 deletions java/example/simple/LinuxDep.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package example.simple;

public class LinuxDep {
public static final String NAME = "LinuxDep";
}
7 changes: 7 additions & 0 deletions java/example/simple/SimpleLinux.java
Original file line number Diff line number Diff line change
@@ -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);
}
}