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

Exodus generated bazel build files fail for files with lombok annotation #57

Open
aman-harness opened this issue Jul 11, 2020 · 4 comments

Comments

@aman-harness
Copy link

aman-harness commented Jul 11, 2020

The build fails with error: error: symbol not found io.harness.rule.DevInfo$DevInfoBuilder

the file is defined like this:

@Builder
public class DevInfo {

Is there any best practices over how to use annotation processor with exodus?
I checked the documentation but couldn't find anything in the troubleshooting guide: https://wix.github.io/exodus/troubleshooting.html

@aman-harness aman-harness changed the title Exodus generated files fail for files with lombok annotation Exodus generated bazel build files fail for files with lombok annotation Jul 11, 2020
@natansil
Copy link
Collaborator

Exodus employs a static dependency analyzer. As such it cannot understand annotations.
One way to resolve this is to add temporary "fake" usages of DevInfoBuilder like:

public class TempUsage {
  public static void use() {
      println(new DevInfoBuilder())
  }
}

Another way is to use override mechanism (write to bazel_migration folder to internal_file_deps.overrides file in some format)
it depends how widespread is the use of these annotations.

maybe adding these usage classes artificially for the build is easiest

@aman-harness
Copy link
Author

aman-harness commented Jul 11, 2020

We use @slf4j annotation in almost all the files (> 7k) which automatically creates the logger.

Also, using lombok needs special handeling using processor class.

java_plugin(
  name = "lombok_plugin",
  processor_class = "lombok.launch.AnnotationProcessorHider$AnnotationProcessor",
  deps = ["@lombok_jar//jar"],
)

I don't see these in the bazel generated files. So I think this will need some special handeling in internal_file_deps.overrides file.

@natansil
Copy link
Collaborator

So which bazel target do you want to add as dependency?
I think that the best option will actually be to run buildozer after migration is done:
Something like:
buildozer 'add deps [lombok target]' //...

@natansil
Copy link
Collaborator

Hi @aman,
I’ve fixed the parallization of analysis issue. So you can now run more than one module at a time:
#55

Did you manage to solve the lombok issue with a buildozer command?

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