2828
2929import java .nio .file .Files ;
3030import java .nio .file .Path ;
31+ import java .nio .file .Paths ;
3132import java .util .ArrayList ;
3233import java .util .HashMap ;
3334import java .util .LinkedList ;
@@ -51,6 +52,7 @@ public String name() {
5152 */
5253 @ Override
5354 public boolean process (final List <Path []> classpath ) {
55+ final Path spongeRoot = Paths .get (System .getProperty ("sponge.dev.root" )).toAbsolutePath ();
5456 final Set <String > bootLibs = Set .of (System .getProperty ("sponge.dev.boot" ).split (";" ));
5557 final Set <String > gameShadedLibs = Set .of (System .getProperty ("sponge.dev.gameShaded" ).split (";" ));
5658
@@ -67,46 +69,55 @@ public boolean process(final List<Path[]> classpath) {
6769 return false ;
6870 }
6971
70- final Path path = paths [0 ];
72+ final Path path = paths [0 ]. toAbsolutePath () ;
7173 final SourceSet sourceSet = SourceSet .identify (path );
7274 if (sourceSet != null ) {
73- if (DEBUG ) {
74- System .out .println ("SourceSet (" + sourceSet + "): " + path );
75- }
75+ if (sourceSet .project ().startsWith (spongeRoot )) {
76+ if (DEBUG ) {
77+ System .out .println ("Sponge SourceSet (" + sourceSet + "): " + path );
78+ }
7679
77- switch (sourceSet .project ()) {
78- case "modlauncher-transformers" :
79- bootSourceSets .computeIfAbsent ("transformers" , k -> new LinkedList <>()).add (path );
80- break ;
81- case "SpongeAPI" :
82- switch (sourceSet .name ()) {
83- case "ap" :
84- // ignore
85- break ;
86- case "main" :
87- hasAPISourceSet .set (true );
88- // no break
89- default :
90- spongeImplUnion .add (path );
91- break ;
92- }
93- break ;
94- case "Sponge" , "vanilla" :
95- switch (sourceSet .name ()) {
96- case "devlaunch" :
97- // ignore
98- break ;
99- case "applaunch" :
100- bootSourceSets .computeIfAbsent ("applaunch" , k -> new LinkedList <>()).add (path );
101- break ;
102- default :
103- spongeImplUnion .add (path );
104- break ;
105- }
106- break ;
107- default :
108- unknownProjects .computeIfAbsent (sourceSet .project (), k -> new LinkedList <>()).add (path );
109- break ;
80+ final String projectName = spongeRoot .relativize (sourceSet .project ()).toString ();
81+ switch (projectName ) {
82+ case "modlauncher-transformers" :
83+ bootSourceSets .computeIfAbsent ("transformers" , k -> new LinkedList <>()).add (path );
84+ break ;
85+ case "SpongeAPI" :
86+ switch (sourceSet .name ()) {
87+ case "ap" :
88+ // ignore
89+ break ;
90+ case "main" :
91+ hasAPISourceSet .set (true );
92+ // no break
93+ default :
94+ spongeImplUnion .add (path );
95+ break ;
96+ }
97+ break ;
98+ case "" , "vanilla" :
99+ switch (sourceSet .name ()) {
100+ case "devlaunch" :
101+ // ignore
102+ break ;
103+ case "applaunch" :
104+ bootSourceSets .computeIfAbsent ("applaunch" , k -> new LinkedList <>()).add (path );
105+ break ;
106+ default :
107+ spongeImplUnion .add (path );
108+ break ;
109+ }
110+ break ;
111+ default :
112+ unknownProjects .computeIfAbsent (projectName , k -> new LinkedList <>()).add (path );
113+ break ;
114+ }
115+ } else {
116+ if (DEBUG ) {
117+ System .out .println ("External SourceSet (" + sourceSet + "): " + path );
118+ }
119+
120+ unknownProjects .computeIfAbsent (sourceSet .project ().toString (), k -> new LinkedList <>()).add (path );
110121 }
111122 return true ;
112123 }
0 commit comments