Mark war-provided libraries as neverlink inside the Gerrit tree

When Gitiles is built as a Gerrit plugin from source, the plugin jar was
packaging the full transitive closure of libraries that Gerrit already
ships in gerrit.war (Guava, Gson, Soy, ICU4J, JGit, commons-lang3/io,
text/reload4j/flogger, ASM, html-types, ...). That inflated gitiles.jar
to ~34 MB of classes that are already on the plugin's runtime classpath
via gerrit.war -- pure duplication.

Introduce lib/provided.bzl with a provided_java_library() wrapper: a
single java_library whose neverlink attribute is a select() on the
existing @com_googlesource_gerrit_bazlets//flags:in_gerrit_tree flag.

Gerrit sets that flag in its .bazelrc; standalone Gitiles never does, so
it defaults to false.

* Standalone (flag false): the libraries are linked exactly as before
  and bundled into gitiles.war -- no behavioral change, zero regression
  risk.
* In the Gerrit tree (flag true): they become neverlink, so their
  classes are dropped from the plugin's runtime closure and are not
  re-packaged into gitiles.jar. Gerrit already provides them.

Only libraries that gerrit.war actually ships are converted (lib/BUILD,
lib/soy, lib/flogger). Gitiles-only libraries (the commonmark family,
java-prettify and autolink) stay linked in both configurations.

Alternative considered: exclude the same closure with deploy_env from
within the Gerrit plugin's BUILD (the pattern used by other plugins). We
defer that here because in_gerrit_tree is more principled -- Gitiles
itself declares "these are provided when I'm built inside Gerrit," so
the knowledge lives with the dependency declarations instead of being
duplicated as an exclusion list in Gerrit's plugin wiring. deploy_env
remains a viable follow-up if we later prefer to keep this decision
entirely on the Gerrit side.

Change-Id: I4f12d3a4be71a89df8830ecc872877f869997a8c
4 files changed
tree: 1fcf3a97f4db6cdf61bc5e48b7bcb00431729530
  1. .settings/
  2. Documentation/
  3. java/
  4. javatests/
  5. lib/
  6. modules/
  7. resources/
  8. tools/
  9. .bazelignore
  10. .bazelrc
  11. .bazelversion
  12. .gitignore
  13. .gitmodules
  14. .mailmap
  15. .zuul.yaml
  16. BUILD
  17. COPYING
  18. external_deps.lock.json
  19. fake_pom_deploy.xml
  20. MODULE.bazel
  21. MODULE.bazel.lock
  22. navbar.md
  23. README.md
  24. version.bzl
README.md

Gitiles - A simple JGit repository browser

Gitiles is a simple repository browser for Git repositories, built on JGit. Its guiding principle is simplicity: it has no formal access controls, no write access, no fancy Javascript, etc.

Gitiles automatically renders *.md Markdown files into HTML for simplified documentation. Refer to the Markdown documentation for details.

Configuration

Gitiles is configurable in a git-style configuration file named gitiles.config. Refer to the configuration documentation for details.

Bugs

Use gerrit's issue tracker to file bugs.

Contributing to Gitiles

Please refer to the Developer Guide.