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

maven_jar forces ijar usage #990

Closed
johnynek opened this issue Feb 29, 2016 · 5 comments
Closed

maven_jar forces ijar usage #990

johnynek opened this issue Feb 29, 2016 · 5 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request

Comments

@johnynek
Copy link
Member

When you add a maven_jar, it adds a java_import rule that exports the jar.

The problem is that in scala, macros are code in jars that is run at compile time. So, using ijar on them breaks compilation.

What we need is a way in maven_jar to control this.

One possibility is to add the ability to pass the BUILD to the rule, but to use this from java would mean solving #970

the work around now is to use http_file and special case handling that in the scala.bzl rules:

https://github.com/bazelbuild/rules_scala/blob/master/scala/scala.bzl#L185

@damienmg
Copy link
Contributor

damienmg commented Mar 3, 2016

Doesn't the maven_jar creates a //:file target that you can use? maven_jar wrap the jar in a java_import so yes it forces it.

@damienmg damienmg added type: feature request P3 We're not considering working on this, but happy to review a PR. (No assignee) labels Mar 3, 2016
@damienmg damienmg removed their assignment Mar 3, 2016
@johnynek
Copy link
Member Author

johnynek commented Mar 3, 2016

I don't see the file target. For example:

# DO NOT EDIT: automatically generated BUILD file for maven_jar rule jar_commons_logging_commons_logging
java_import(
    name = 'jar',
    jars = ['commons-logging-1.2.jar'],
    visibility = ['//visibility:public']
)

@damienmg
Copy link
Contributor

damienmg commented Mar 3, 2016

oh yeah it is not exported. Adding a filegroup would do the trick, no?

On Thu, Mar 3, 2016 at 9:29 AM P. Oscar Boykin notifications@github.com
wrote:

I don't see the file target. For example:

DO NOT EDIT: automatically generated BUILD file for maven_jar rule jar_commons_logging_commons_logging

java_import(
name = 'jar',
jars = ['commons-logging-1.2.jar'],
visibility = ['//visibility:public']
)


Reply to this email directly or view it on GitHub
#990 (comment).

@johnynek
Copy link
Member Author

johnynek commented Mar 3, 2016

I think so, yes.

@colinmarc
Copy link
Contributor

I did a gerrit thing, I think? =)

https://bazel-review.googlesource.com/#/c/3550/

luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 5, 2022
    Fixes bazelbuild/bazel#990.

    It's sometimes useful to be able to access the file pulled down
    with maven_jar; for example, scala macro jars don't work with ijar,
    so it's necessary to pull them into the compile-time classpath
    unharmed.

    --
    Change-Id: I1d9e1cb30ea6fa56c18cbfcc68ee9b203524dfd4
    Reviewed-on: https://bazel-review.googlesource.com/#/c/3550
    MOS_MIGRATED_REVID=121379551
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request
Projects
None yet
Development

No branches or pull requests

4 participants