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

Provide as single jar file for the dagger-compiler #1010

Closed
scharf opened this issue Dec 27, 2017 · 2 comments
Closed

Provide as single jar file for the dagger-compiler #1010

scharf opened this issue Dec 27, 2017 · 2 comments

Comments

@scharf
Copy link

scharf commented Dec 27, 2017

The Readme.md says:

Developer snapshots are available from Sonatype's snapshot repository, and are built on a clean build of the GitHub project's master branch.

I am using dagger without maven or gradle. For the compiler, the dagger dependency seems to have exploded since version 2.0. When I use maven I see the following dependencies (using mvn install dependency:copy-dependencies and looking at target/dependency directory):

animal-sniffer-annotations-1.14.jar
checker-compat-qual-2.3.0.jar
dagger-2.14.1.jar
dagger-compiler-2.14.1.jar
dagger-producers-2.14.1.jar
dagger-spi-2.14.1.jar
error_prone_annotations-2.0.18.jar
google-java-format-1.4.jar
guava-23.3-jre.jar
j2objc-annotations-1.1.jar
javac-shaded-9-dev-r4023-3.jar
javapoet-1.8.0.jar
javax.inject-1.jar
jsr250-api-1.0.jar
jsr305-1.3.9.jar

For the runtime, dagger-2.14.1.jar and javax.inject-1.jar seem to be sufficient. For the compiler there are lots of dependencies. This is a pain to download and figure out manually.

However, for dagger-2.0 the situation was much simpler:

dagger-2.0.jar
dagger-compiler-2.0.jar
dagger-producers-2.0-beta.jar
guava-18.0.jar
javax.inject-1.jar

I think there should be a one-stop solution to download the compiler and its dependencies as a single file.

@ronshapiro
Copy link

Dagger is never intended to be run in a standalone mode (like, say google-java-format is, which does have a fat jar), and having a single jar is asking for confusing integration issues with other libraries' versions. That's why build systems exist (to help you with that).

I'm not sure how mvn install dependency:copy-dependencies works, but some of these aren't necessary. I think animal-sniffer-annotations-1.14.jar is a build-time dependency of Guava. I think j2objc-annotations can be omitted as well but I'm not positive.

If you really would like to have a fat jar, you can build a _deploy.jar of the compiler artifact using bazel, but it's not something we'd like to promote.

@scharf
Copy link
Author

scharf commented Dec 27, 2017

That's why build systems exist (to help you with that).

Yes! Many build systems distinguish between the build tools and the artifacts they build.

If I may want to use make (one of the oldest build systems), then I want to have the tools, like the dagger-compiler to be installed somewhere else than the application that I build. The application itself has a small runtime dependency (dagger-2.14.1.jar plus javax.inject`). Ideally, the dagger compiler is a single file that I can execute and simply upgrade.

If I want to use the javac then the -processorpath gets pretty long with the 16 dependencies that the dagger-compiler-2.14 needs.

Or when I want to use eclipse to do the dependency injection, I have to somehow fetch all those dependencies and add them in the preferences:
annoying-setup

All of this is very annoying, because upgrading dagger (in this context) becomes complicated and I see no reason why the dagger compiler cannot be a single easy to use jar....

With dagger-2.9, the compiler dependencies have been simple (if I exclude the runtime dependencies javax.inject and dagger) :

dagger-compiler-2.8.jar
dagger-producers-2.8.jar
guava-20.0-rc1.jar

dagger-2.10 till dagger-2.13 had 8 dependencies:

auto-common-0.8.jar
dagger-compiler-2.10.jar
dagger-producers-2.10.jar
google-java-format-1.3.jar
guava-21.0-rc1.jar
javac-9-dev-r3297-1-shaded.jar
javapoet-1.7.0.jar
jsr305-3.0.1.jar

In dagger-2.14 the list gets more bloated: it now depends on 16 jar files:

animal-sniffer-annotations-1.14.jar
checker-compat-qual-2.3.0.jar
dagger-compiler-2.14.jar
dagger-producers-2.14.jar
dagger-spi-2.14.jar
error_prone_annotations-2.0.18.jar
google-java-format-1.4.jar
guava-23.3-jre.jar
j2objc-annotations-1.1.jar
javac-shaded-9-dev-r4023-3.jar
javapoet-1.8.0.jar
jsr250-api-1.0.jar
jsr305-1.3.9.jar

The original 3 files for the dagger-compiler were quite manageable, but in my opinion, the 16 files and growing are not acceptable anymore.

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

No branches or pull requests

2 participants