-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Identify interesting Jars to decomp and improve decomp performance (#…
…352) Fixes #317 Fixes #319 Summary of changes: * When decompiling binaries, for every JAR we find, we attempt to look at its metadata to get artifact and group. If we dont find metadata, we look it up on maven central using its sha. For all such JARs that we find accurate information about, we add them to java project's pom as dependencies. For all other JARs, we send them to decompile. * In decompile, we are running concurrently. Also, instead of decompiling each class file individually, we are now decompiling whole JAR using fernflower and then exploding it (this is faster than individual .class file decompile) * Prior to initing Java provider, we are now downloading sources for all dependencies. If we find any that don't have sources, we are passing them to decompile. * When getting dependencies for a binary, we are now using same logic from step 1 to get more fine grained info for a JAR. --------- Signed-off-by: David Zager <[email protected]> Signed-off-by: Pranav Gaikwad <[email protected]> Co-authored-by: David Zager <[email protected]>
- Loading branch information
1 parent
3b536c0
commit 199aed0
Showing
6 changed files
with
640 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package java | ||
|
||
import ( | ||
"reflect" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func Test_parseUnresolvedSources(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
mvnOutput string | ||
wantErr bool | ||
wantList []javaArtifact | ||
}{ | ||
{ | ||
name: "valid sources output", | ||
mvnOutput: ` | ||
The following files have been resolved: | ||
org.springframework.boot:spring-boot:jar:sources:2.5.0:compile | ||
The following files have NOT been resolved: | ||
io.konveyor.demo:config-utils:jar:sources:1.0.0:compile | ||
`, | ||
wantErr: false, | ||
wantList: []javaArtifact{ | ||
{ | ||
packaging: JavaArchive, | ||
GroupId: "io.konveyor.demo", | ||
ArtifactId: "config-utils", | ||
Version: "1.0.0", | ||
}, | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
outputReader := strings.NewReader(tt.mvnOutput) | ||
gotList, gotErr := parseUnresolvedSources(outputReader) | ||
if (gotErr != nil) != tt.wantErr { | ||
t.Errorf("parseUnresolvedSources() gotErr = %v, wantErr %v", gotErr, tt.wantErr) | ||
} | ||
if !reflect.DeepEqual(gotList, tt.wantList) { | ||
t.Errorf("parseUnresolvedSources() gotList = %v, wantList %v", gotList, tt.wantList) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.