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

Expose default/warn strict_java_deps mode to skylark #3626

Closed
ittaiz opened this issue Aug 27, 2017 · 12 comments
Closed

Expose default/warn strict_java_deps mode to skylark #3626

ittaiz opened this issue Aug 27, 2017 · 12 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request

Comments

@ittaiz
Copy link
Member

ittaiz commented Aug 27, 2017

Description of the problem / feature request / question:

I'm integrating java_common.compile into rules_scala where we want to use strict_java_deps flag for compilation of java code and of scala code.
The beginning of this started in #3295.
While trying to integrate with it I get an error if I try to pass warn as an input.
I then saw that default isn't allowed as well.

I think it's obvious why I'd want warn and I need default since to the best of my understanding that is one of the possible values I can get from ctx.fragments.java.strict_java_deps (IIUC this will be the value when no value is given).

Environment info

  • Bazel version (output of bazel info release):
    0.5.3
@ittaiz
Copy link
Member Author

ittaiz commented Aug 28, 2017

@iirina this is the issue we discussed

@iirina iirina self-assigned this Aug 28, 2017
@iirina iirina added type: feature request P2 We'll consider working on this in future. (Assignee optional) category: rules > java labels Aug 28, 2017
@ittaiz
Copy link
Member Author

ittaiz commented Sep 2, 2017

btw, is it wise to have OFF as the default value? This feels like anti bazel idioms
command line defaults to "default"

@ittaiz
Copy link
Member Author

ittaiz commented Sep 3, 2017

oh, now I see that the default value is ERROR but the documentation is just wrong.

      @Param(
        name = "strict_deps",
        defaultValue = "'ERROR'",
        positional = false,
        named = true,
        type = String.class,
        doc = "A string that specifies how to handle strict deps. Possible values: 'OFF' (silently"
          + " allowing referencing transitive dependencies) and 'ERROR' (failing to build when"
          + " transitive dependencies are used directly). By default 'OFF'."
      ),

@ittaiz
Copy link
Member Author

ittaiz commented Sep 4, 2017

@iirina
I can send a PR to allow warn and default to the switch


I wasn't able to find tests though so I can send the PR as is.
FYI what I tried was to try changing the switch below to switch("") and ran the test bazel test //src/test/java/... and nothing fails.

@iirina
Copy link
Contributor

iirina commented Sep 5, 2017

Hi Ittai, I already have a change for this. I'm waiting for it to be pushed. It should be in bazel today.

@ittaiz
Copy link
Member Author

ittaiz commented Sep 5, 2017

Awesome, thanks!

@ittaiz
Copy link
Member Author

ittaiz commented Sep 5, 2017

BTW, did you include upper-casing? Since the command line docs are for lowercase but the switch on the string is upper-case.

@ittaiz
Copy link
Member Author

ittaiz commented Sep 5, 2017

Also another problem I saw when I hacked on this was that I got an exception from DependencyModule#StrictJavaDeps that there is no DEFAULT value in that enum because it's different than BuildConfiguration.StrictDepsMode

@iirina
Copy link
Contributor

iirina commented Sep 5, 2017

BTW, did you include upper-casing? Since the command line docs are for lowercase but the switch on the string is upper-case.

Yes

Also another problem I saw when I hacked on this was that I got an exception from DependencyModule#StrictJavaDeps that there is no DEFAULT value in that enum because it's different than BuildConfiguration.StrictDepsMode

Yes you are right, the DEFAULT value is missing from DependencyModule#StrictJavaDeps. The description of BuildConfiguration#StrictDepsMode#DEFAULT says "When no flag value is specified on the command line". From this I understand that when nothing is specified on the command line, the default value for strict deps for each language should be use. In our case, that value should be ERROR. I propose we use ERROR when passing DEFAULT to java_common.compile. WDYT?

@ittaiz
Copy link
Member Author

ittaiz commented Sep 5, 2017

sounds good. Whatever the default means for java_* rules I think it should apply here as well.

@ittaiz
Copy link
Member Author

ittaiz commented Sep 6, 2017

Hi,
Any update?

@iirina
Copy link
Contributor

iirina commented Sep 6, 2017

Yes, it should be here with the next push to GH. We had some problems with submitting changes internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request
Projects
None yet
Development

No branches or pull requests

2 participants