-
Notifications
You must be signed in to change notification settings - Fork 299
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
How can I find out which gradle module a class belongs to #1289
Comments
This information should be available via
|
I don't quite understand what you mean, I can get the path of the imported class through JavaClass.getSource(), but I still don't know which module this class's source code belongs to. For example, I have two classes, separately from two modules, and the package names of the two modules are both The URI prefix of the two classes is the same, so it's impossible to distinguish which module they belong to. |
Oh! I thought that the |
Even if the prefixes are different, it's still impossible to know which module the class belongs to, because after being converted into bytecode, the information about module ownership is lost. I'm wondering if you have any other methods to meet my needs. |
Just FYI: In my gradle multi-module project,
|
@GeeJoe I'm wondering, if you have two Gradle modules and one class in each, why would both end up in the same build output folder afterwards? That doesn't seem normal even for Android, no? I.e. in the example you're giving, what is |
The example I gave is from an Android project, and their URI prefixes may indeed be different. Some of their classes' URIs include the module, while others do not. Here are two examples
The second class contains module information, but the first class does not. |
I hope to scan out the dependencies between two modules, for example, a class in module A, and I want to scan out all the classes in Class A's dependencies that belong to module B. So I need to know whether a class belongs to module A or B. I have thought about distinguishing them by their package names, but in Android projects, two modules can have the same package name, so this method won't work. Are there any better ways?
The text was updated successfully, but these errors were encountered: