Use objdump on Android to check static native libraries#746
Use objdump on Android to check static native libraries#746jperedadnr merged 4 commits intogluonhq:masterfrom
Conversation
|
|
||
| public class AndroidTargetConfiguration extends PosixTargetConfiguration { | ||
|
|
||
| private static final String ANDROID_TRIPLET = "aarch64-linux-android"; |
There was a problem hiding this comment.
shouldn't this be in Constants.Profile (full name)
There was a problem hiding this comment.
We have Constants.PROFILE_ANDROID, but that is only for android. The target triplet is created with Triplet(Constants.Profiles.ANDROID), based on three constants, so probably we could have all possible triplets names as constants?
There was a problem hiding this comment.
@johanvos Your suggestion of doing Constants.Profile (full name) brings back this PR: #229, where TripletProfile was created precisely.
I guess this is a big refactoring that should be tackled in a follow-up PR?
For now, what if we just do:
private static final String ANDROID_TRIPLET = new Triplet(Constants.Profile.ANDROID).toString();
| this.sdk = fileDeps.getAndroidSDKPath().toString(); | ||
| this.ndk = fileDeps.getAndroidNDKPath().toString(); | ||
| this.hostPlatformFolder = configuration.getHostTriplet().getOs() + "-x86_64"; | ||
| this.hostPlatformFolder = configuration.getHostTriplet().getOs() + "-" + Constants.ARCH_AMD64; |
There was a problem hiding this comment.
isn't this Triplet.getOsArch() ?
There was a problem hiding this comment.
using configuration.getHostTriplet() we get the Linux triplet, right, I'll change it
| pr.showSevereMessage(false); | ||
| int op = pr.runProcess("objdump"); | ||
| if (op == 0) { | ||
| return pr.getResponses().stream().anyMatch(line -> line.contains("architecture: " + Constants.ARCH_AARCH64)); |
There was a problem hiding this comment.
better to replace with the getArch() on the targetTriplet (e.g. when we support x86-64 emulator/devices)
|
Complexity increasing per file
==============================
- src/main/java/com/gluonhq/substrate/target/AndroidTargetConfiguration.java 1
See the complete overview on Codacy |
Fixes #744, checking static native libraries.
Since we are testing with ProcessRunner, any invalid *.a file in the jar will log a severe message. To avoid this, I've added
showSevereto ProcessRunner. In any case, the process result itself is logged to the usual log file, and if the process fails, (due to invalid format for instance), a file is logged and the message is visible