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

BUILD files to build Gson with Bazel and easily depend on it in Bazel projects #2150

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ build
.DS_Store

examples/android-proguard-example/gen

bazel-*
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ Maven:
</dependency>
```

<!-- TODO(pawelz): replace branch="master" with tag="gson-parent-X.Y.Z" once the bazel BUILD files make it to a release. -->
Bazel:
```bzl
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name="gson",
remote="https://github.com/google/gson.git",
branch="master",
)
```

[Gson jar downloads](https://maven-badges.herokuapp.com/maven-central/com.google.code.gson/gson) are available from Maven Central.

![Build Status](https://github.com/google/gson/actions/workflows/build.yml/badge.svg)
Expand Down
1 change: 1 addition & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
workspace(name = "com_google_gson")
9 changes: 9 additions & 0 deletions gson/src/main/java-templates/com/google/gson/internal/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
java_library(
name = "gson_build_config",
srcs = [
"GsonBuildConfig.java",
],
visibility = [
"//gson/src/main/java/com/google/gson:__subpackages__",
],
)
8 changes: 8 additions & 0 deletions gson/src/main/java/com/google/gson/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
java_library(
name = "gson",
srcs = glob(["*.java", "**/*.java"]),
deps = [
"//gson/src/main/java-templates/com/google/gson/internal:gson_build_config",
],
visibility = ["//visibility:public"],
)