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

Group Maven dependencies: production dependencies and build / test dependencies #226

Open
lolski opened this issue Nov 27, 2020 · 1 comment

Comments

@lolski
Copy link
Member

lolski commented Nov 27, 2020

artifacts.bzl` declares what dependencies are allowed in a given repository and has allowed us to manage dependencies and versioning effectively.

Some dependencies declared there are only used in building and testing (eg., JUnit, Github library, Checkstyle, etc) whereas some others are used in production (ie., actually included in the distribution).

We should split the declaration in artifacts.bzl accordingly

  • production dependencies (for dependencies used in the distribution)
  • build dependencies (for dependencies used in build and test)

With this split, a library declared in production can be included in the distribution whereas a library declared in build cannot, and should only be used in assembly, deployment, or tests.

The workspace name for each dependencies should also clearly indicate whether they are production or a build dependency:

java_library(
  ...
  deps = [
    @production//google_or_tools
  ]
)

java_test(
  ...
  deps = [
    @build//junit_junit
  ]
)

We should also create a way to verify that there are no build dependency that is used in production:

bazel run //:dependency-test
ERROR: target //server:server depends on a build dependency '@build//junit_junit'

Being able to separate production and build dependencies will help us manage the dependency better - we can be strict in allowing what goes in production, while being more lenient for dependencies in build.

@lolski lolski changed the title Group Maven artifacts into production and build Group Maven dependencies: production dependencies and build / test dependencies Nov 27, 2020
@haikalpribadi
Copy link
Member

Copying over the content of a duplicate issue from #244


Description

We need to improve our Maven dependency snapshot by categorising them into three categories:

  1. artifacts-distribution.snapshot: the dependencies that get included in the distribution. For example, for Grakn Core it would be the zip and tar distribution and for Client Java the Maven JAR.
  2. artifacts-test.snapshot: dependencies that are used in tests (eg., JUnit, GraknCoreRunner, Cucumber), minus the dependencies in artifacts-distribution.snapshot. (ps: Could this be sufficiently implemented by querying for all dependencies of java_test targets??)
  3. artifacts-build.snapshot: the rest of the dependencies, that are not in artifact-distribution.snapshot or artifact-test.snapshot.

They should be generated in the same way as the old one, eg., when the user invokes update.sh:

$ ./dependencies/maven/update.sh assemble-mac-zip, assemble-linux-targz, assemble-windows-zip
Regenerating new snapshot files from WORKSPACE...
DONE!
'artifacts-distribution.snapshot' refreshed: 3 dependencies added, 1 dependencies removed.
Added dependencies:
- @maven//a
- @maven//b
- @maven//c
Removed dependencies:
- @maven//d

'artifacts-test.snapshot' refreshed: 0 dependencies added, 0 dependencies removed.
'artifacts-build.snapshot' refreshed: 0 dependencies added, 0 dependencies removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants