google-nomulus/gradle
weiminyu 6a870e5820 Check for unused dependencies
Enabled unused-dependency check using nebula-lint.

Dependencies that are not used by compile or testing are
labeled with 'maybe_runtime". We leave these dependencies
in the script for easy reference. Before launching Gradle-based
release process we must determine which of these should
be removed and which should be relabeled as runtime.

Label assignment:
- All dependencies recommended for removal from 'compile'
  are changed to maybe_runtime
- All dependencies recommended for move from 'compile' to
  testCompile are split into two lines, one with testCompile,
  the other maybe_runtime

Incidentally, Gradle 4.10.2 needs a groovy upgrade before
it can work with Oracle JDK 11.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219803797
2018-11-02 14:49:18 -04:00
..
core Check for unused dependencies 2018-11-02 14:49:18 -04:00
third_party Reorganize Gradle dependencies 2018-10-25 14:50:26 -04:00
build.gradle Check for unused dependencies 2018-11-02 14:49:18 -04:00
README.md Explicitly state which Gradle version is tested. 2018-10-25 14:45:30 -04:00
settings.gradle Add javax.activation as a dependency of jaxb 2018-10-29 15:41:06 -04:00

This folder contains experimental Gradle scripts as an alternative to Bazel for the open-source Nomulus project. These are work-in-progress and are expected to evolve in the near future.

All testing is done with Gradle v4.10.2.

Current status

Currently there are two sub-projects, third_party, which contains the back-ported JUnit 4.13 code; and core, which contains all Nomulus source code. Gradle can be used to compile and run all Java tests.

Gradle is configured to use the directory containing this file as root, but use the existing Nomulus source tree.

Dependencies are mostly the same as in Bazel, with a few exceptions:

  • org.slf4j:slf4j-simple is added to provide a logging implementation in tests. Bazel does not need this.
  • com.googlecode.java-diff-utils:diffutils is not included. Bazel needs it for Truth's equality check, but Gradle works fine without it.
  • jaxb 2.2.11 is used instead of 2.3 in Bazel, since the latter breaks the ant.xjc task. The problem is reportedly fixed in jaxb 2.4.
  • The other dependencies are copied from Nomulus' repository.bzl config.
    • We still need to verify if there are unused dependencies.
    • Many dependencies are behind their latest versions.

Notable Issues

Only single-threaded test execution is allowed, due to race condition over global resources, such as the local Datastore instance, or updates to the System properties. This is a new problem with Gradle, which does not provide as much test isolation as Bazel. We are exploring solutions to this problem.

Test suites (RdeTestSuite and TmchTestSuite) are ignored to avoid duplicate execution of tests. Neither suite performs any shared test setup routine, so it is easier to exclude the suite classes than individual test classes.

Since Gradle does not support hierarchical build files, all file sets (e.g., resources) must be declared at the top, in root project config or the sub-project configs.

Initial Setup

Install Gradle on your local host, then run the following commands from this directory:

# One-time command to add gradle wrapper:
gradle wrapper

# Start the build:
./gradlew build

From now on, use './gradlew build' or './gradlew test' to build and test your changes.

To upgrade to a new Gradle version for this project, use:

gradle wrapper --gradle-version version-number