I am trying to find the path of the modules present inside the SBT built projects.
For example, take this project -> https://github.com/scala/scala
In this project, I executed the dependency tree and got the following list of first level modules.
[info] org.scala-lang:root_2.13:2.13.11-bin-SNAPSHOT [S]
[info] org.scala-lang:scala-reflect:2.13.11-bin-SNAPSHOT [S]
[info] org.scala-lang:scala-compiler:2.13.11-bin-SNAPSHOT [S]
[info] org.scala-lang:scalap:2.13.11-bin-SNAPSHOT
[info] org.scala-lang:scala-compiler-doc:2.13.11-bin-SNAPSHOT
[info] org.scala-lang:scala-compiler-interactive:2.13.11-bin-SNAPSHOT
[info] org.scala-lang:scala-tastytest:2.13.11-bin-SNAPSHOT [S]
[info] org.scala-lang:scala-testkit:2.13.11-bin-SNAPSHOT
[info] org.scala-lang:repl:2.13.11-bin-SNAPSHOT
[info] org.scala-lang:scala-dist:2.13.11-bin-SNAPSHOT [S]
[info] org.scala-lang:tasty:2.13.11-bin-SNAPSHOT
[info] org.scala-lang:scalacheck:2.13.11-bin-SNAPSHOT [S]
[info] org.scala-lang:scala-repl-frontend:2.13.11-bin-SNAPSHOT
[info] org.scala-lang:junit:2.13.11-bin-SNAPSHOT
[info] org.scala-lang:scala-partest:2.13.11-bin-SNAPSHOT [S]
This is the directory structure of the mentioned project (src and test folder)
├── src
│ ├── compiler
│ ├── intellij
│ ├── interactive
│ ├── library
│ ├── library-aux
│ ├── manual
│ ├── partest
│ ├── partest-javaagent
│ ├── reflect
│ ├── repl
│ ├── repl-frontend
│ ├── scaladoc
│ ├── scalap
│ ├── tastytest
│ └── testkit
├── test
│ ├── async
│ ├── benchmarks
│ ├── files
│ ├── instrumented
│ ├── jcstress
│ ├── junit
│ ├── macro-annot
│ ├── osgi
│ ├── scalacheck
│ ├── scaladoc
│ ├── script-tests
│ └── tasty
Main Issue:
As you can see, I cant exactly map the modules straightforwardly to a folder in the directories.
I need
[info] org.scala-lang:scala-reflect:2.13.11-bin-SNAPSHOT [S] -> /path/src/reflect/
[info] org.scala-lang:scalacheck:2.13.11-bin-SNAPSHOT [S] -> /path/test/scalacheck/
For now, I had another SBT project as reference, where it was quite straightforward to map the module to source code directory.
Apache Pekko -> https://github.com/apache/pekko
We can just take the artifact name and append it to the base source code path.
Example Code:
String gavid = line.substring(startIndex, line.lastIndexOf(":"));
System.out.println("GAV id: " + gavid);
String[] parts1 = gavid.split(":");
String[] parts2 = parts1[1].split("_");
int hyphenIndex = parts2[0].indexOf('-');
String directory = parts2[0].substring(hyphenIndex + 1);
new_module.setSrcCodePath(object.getSrcCodePath() + directory + '/');