File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
src/main/java/com/ibm/cldk/utils Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -274,14 +274,14 @@ public static void cleanLibraryDependencies() {
274
274
Files .walk (libDownloadPath ).filter (Files ::isRegularFile ).map (Path ::toFile ).forEach (File ::delete );
275
275
Files .delete (libDownloadPath );
276
276
} catch (IOException e ) {
277
- Log .error ( "Error deleting library dependency directory: " + e .getMessage ());
277
+ Log .warn ( "Unable to fully delete library dependency directory: " + e .getMessage ());
278
278
}
279
279
}
280
280
if (tempInitScript != null ) {
281
281
try {
282
282
Files .delete (tempInitScript );
283
283
} catch (IOException e ) {
284
- Log .error ("Error deleting temporary Gradle init script: " + e .getMessage ());
284
+ Log .warn ("Error deleting temporary Gradle init script: " + e .getMessage ());
285
285
}
286
286
}
287
287
}
Original file line number Diff line number Diff line change 7
7
import java .util .List ;
8
8
import java .util .stream .Collectors ;
9
9
import java .util .stream .Stream ;
10
+ import java .util .zip .ZipEntry ;
11
+ import java .util .zip .ZipFile ;
10
12
11
13
public class ProjectDirectoryScanner {
12
14
public static List <Path > classFilesStream (String projectPath ) throws IOException {
@@ -37,6 +39,30 @@ public static List<Path> jarFilesStream(String projectPath) throws IOException {
37
39
return null ;
38
40
}
39
41
42
+ /**
43
+ * Returns a stream of class files inside the jars and class files in the project.
44
+ * @param projectPath
45
+ * @return
46
+ * @throws IOException
47
+ */
48
+ public static Stream <String > classesFromJarFileStream (String projectPath ) throws IOException {
49
+ List <Path > jarPaths = jarFilesStream (projectPath );
50
+
51
+ if (jarPaths == null ) {
52
+ return Stream .empty ();
53
+ }
54
+
55
+ return jarPaths .stream ().flatMap (jarPath -> {
56
+ try (ZipFile zip = new ZipFile (jarPath .toFile ())) {
57
+ return zip .stream ()
58
+ .filter (entry -> !entry .isDirectory () && entry .getName ().endsWith (".class" ))
59
+ .map (ZipEntry ::getName );
60
+ } catch (IOException e ) {
61
+ return Stream .empty ();
62
+ }
63
+ });
64
+ }
65
+
40
66
public static List <Path > sourceFilesStream (String projectPath ) throws IOException {
41
67
Path projectDir = Paths .get (projectPath );
42
68
Log .info ("Finding *.java files in " + projectDir );
You can’t perform that action at this time.
0 commit comments