@@ -68,29 +68,13 @@ public void addEntries(Collection entries, ZipFileSet zf) throws IOException {
6868 DirectoryScanner scanner = zf .getDirectoryScanner (project );
6969 scanner .setIncludes (ObfuscatorTask .toNativePattern (ps .getIncludePatterns (project )));
7070 scanner .setExcludes (ObfuscatorTask .toNativePattern (ps .getExcludePatterns (project )));
71- String [] matches = ZipScannerTool .getMatches (zf , scanner );
72- for (int i = 0 ; i < matches .length ; i ++) {
73- String match = matches [i ];
74- int slashIndex = match .lastIndexOf ('/' );
75- if (match .endsWith (".class" ) || match .endsWith ("/" ) && slashIndex > 0 ) {
76- match = match .substring (0 , slashIndex );
77- packages .add (match );
78- }
79- }
71+ collectPackages (ZipScannerTool .getMatches (zf , scanner ), packages );
8072 }
8173 if (patternSets .isEmpty () && allowMatchAllPatternSet && name == null ) {
8274 DirectoryScanner scanner = zf .getDirectoryScanner (project );
8375 scanner .setIncludes (new String []{"**/*.class" });
8476 scanner .setExcludes (new String [0 ]);
85- String [] matches = ZipScannerTool .getMatches (zf , scanner );
86- for (int i = 0 ; i < matches .length ; i ++) {
87- String match = matches [i ];
88- int slashIndex = match .lastIndexOf ('/' );
89- if (match .endsWith (".class" ) || match .endsWith ("/" ) && slashIndex > 0 ) {
90- match = match .substring (0 , slashIndex );
91- packages .add (match );
92- }
93- }
77+ collectPackages (ZipScannerTool .getMatches (zf , scanner ), packages );
9478 }
9579
9680 for (Iterator iterator = packages .iterator (); iterator .hasNext ();) {
@@ -114,4 +98,15 @@ public void addMapEntries(Collection entries) {
11498 entry .obfName = ObfuscatorTask .toNativeClass (mapTo );
11599 entries .add (entry );
116100 }
101+
102+ private static void collectPackages ( final String [] matches , final Set packages ) {
103+ for (int i = 0 ; i < matches .length ; ++i ) {
104+ String match = matches [i ];
105+ int slashIndex = match .lastIndexOf ('/' );
106+ if ((match .endsWith (".class" ) || match .endsWith ("/" )) && slashIndex > 0 ) {
107+ match = match .substring (0 , slashIndex );
108+ packages .add (match );
109+ }
110+ }
111+ }
117112}
0 commit comments