rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

WIP: proof of concept for license splicing

Open aiuto opened this issue 2 years ago • 6 comments

@danielmachlab This is proof of concept of the license lookup indirection.

I am not happy that we can't get a fallback repository. But, it could be done in setup, with the requirement that you call setup.

aiuto avatar Apr 25 '22 21:04 aiuto

This is quite annoying.

  • The primary setup method rules_jvm_external_deps() calls maven_install to create the repo rules_jvm_external_deps
  • so maven_install can't load the the classifier repository unless that was created
  • but the place you want to create it is in rules_jvm_external_deps()
  • then the setup method depends on the repo rules_jvm_external_deps

Sigh...

aiuto avatar Apr 26 '22 04:04 aiuto

@aiuto this workflow looks good, especially considering the restrictions we have. It all works locally for me. What should the next steps be? It might be useful to get a third opinion on the direction we are heading in while finishing up the prototype lookup_license function. I can make a PR tomorrow or Friday into this PR to fill in the lookup_license function.

danielmachlab avatar Apr 27 '22 22:04 danielmachlab

I don't know. I don't really like that you need a third setup function for this repository. I want to get the @license_checker repository injected by one of the first rules, so that all the examples don't have to change. My thought is that I could point to rules_jvm_external for the checker as a default, and add an optional rule that rewrites the dependency reader to point to the other repository.

But... you could certainly use what I have here to test the license injection at your scale.

aiuto avatar Apr 28 '22 04:04 aiuto

I'm quite confused about what's happening here. Is there an issue/context for this FR?

jin avatar Apr 28 '22 07:04 jin

Hi @jin we are trying to find a good way to allow users of rules_jvm_external to apply rules_license licenses to the artifacts that they import with maven_install. This is coming out of the new rules_license SIG (see monthly meeting notes here). Here is a document which describes our problem and our original approach for this change. The initial approach didn't work out since we can't pass a macro to a repository rule.

danielmachlab avatar Apr 28 '22 16:04 danielmachlab

Hi @aiuto, circling back to this. In this approach, why couldn't we make it so it is backward compatible where users not using a license classifier can avoid adding use_default_license_classifier() to their WORKSPACE?

I'm thinking that the optimal case would be for a user to:

  1. create a file defining lookup_license
  2. load set_license_classifier from rje, which accepts the path of the lookup_license file.

danielmachlab avatar May 10 '22 18:05 danielmachlab