@@ -37,13 +37,14 @@ public static void main(String[] args) throws Exception {
37
37
public void work (String [] args ) throws Exception {
38
38
CompileOptions ops = new CompileOptions (args );
39
39
40
- Path outputJar = Paths .get (ops .outputName );
40
+ Path outputJarPath = Paths .get (ops .outputName );
41
41
42
- Path workdir = ensureEmptyWorkDirectory ( outputJar , ops .currentTarget );
43
- ensureEmptySemanticDBDirectory ( outputJar , ops .currentTarget );
42
+ Path scalacOutPath = clearWorkDirectory ( outputJarPath , ops .currentTarget , "_scalac" );
43
+ clearWorkDirectory ( outputJarPath , ops .currentTarget , "_semanticdb" );
44
44
45
- Path classes = Files .createDirectories (workdir .resolve ("classes" ));
46
- Path sources = Files .createDirectories (workdir .resolve ("sources" ));
45
+ Files .createDirectories (scalacOutPath );
46
+ Path classes = Files .createDirectories (scalacOutPath .resolve ("classes" ));
47
+ Path sources = Files .createDirectories (scalacOutPath .resolve ("sources" ));
47
48
48
49
List <File > jarFiles = extractSourceJars (ops , sources );
49
50
List <File > scalaJarFiles = filterFilesByExtension (jarFiles , ".scala" );
@@ -83,29 +84,20 @@ public void work(String[] args) throws Exception {
83
84
84
85
/** Now build the output jar */
85
86
String [] jarCreatorArgs = {
86
- "-m" , ops .manifestPath , "-t" , ops .stampLabel , outputJar .toString (), classes .toString ()
87
+ "-m" , ops .manifestPath , "-t" , ops .stampLabel , outputJarPath .toString (), classes .toString ()
87
88
};
88
89
JarCreator .main (jarCreatorArgs );
89
90
}
90
91
91
- private static Path ensureEmptyWorkDirectory (Path output , String label ) throws IOException {
92
+ private static Path clearWorkDirectory (Path output , String label , String folderName ) throws IOException {
92
93
String base = label .substring (label .lastIndexOf (':' ) + 1 );
93
- Path dir = output .resolveSibling ("_scalac" ).resolve (base );
94
+ Path dir = output .resolveSibling (folderName ).resolve (base );
94
95
95
96
if (Files .exists (dir )) {
96
97
deleteRecursively (dir );
97
98
}
98
99
99
- return Files .createDirectories (dir );
100
- }
101
-
102
- private static void ensureEmptySemanticDBDirectory (Path output , String label ) throws IOException {
103
- String base = label .substring (label .lastIndexOf (':' ) + 1 );
104
- Path dir = output .resolveSibling ("_semanticdb" ).resolve (base );
105
-
106
- if (Files .exists (dir )) {
107
- deleteRecursively (dir );
108
- }
100
+ return dir ;
109
101
}
110
102
111
103
private static String [] collectSrcJarSources (
0 commit comments