Skip to content

Commit

Permalink
Check unsupported abis. (#272)
Browse files Browse the repository at this point in the history
* Check unsupported abis.

* Improve language of warning
  • Loading branch information
ankur2136 authored May 6, 2024
1 parent ae5ac73 commit 26e2fa6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
31 changes: 31 additions & 0 deletions packages/cli/src/config/PublishDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ const getAndroidDetails = async (
);
}

checkAbis(apkPath);

return {
android_package: appPackage?.[1] ?? "",
min_sdk: parseInt(minSdk?.[1] ?? "0", 10),
Expand All @@ -343,6 +345,35 @@ const getAndroidDetails = async (
}
};

const checkAbis = async (apkPath: string) => {
try {
const { stdout } = await runExec(`zipinfo -s ${apkPath} | grep \.so$`);
const amV7libs = [...stdout.matchAll(/lib\/armeabi-v7a\/(.*)/g)].flatMap(permission => permission[1]);
const x86libs = [...stdout.matchAll(/lib\/x86\/(.*)/g)].flatMap(permission => permission[1]);
const x8664libs = [...stdout.matchAll(/lib\/x86_64\/(.*)/g)].flatMap(permission => permission[1]);
if (amV7libs.length > 0 || x86libs.length > 0 || x8664libs.length > 0) {

const messages = [
`Solana dApp Store only supports arm64-v8a abi.`,
`Your apk file contains following unsupported abis`,
... amV7libs.length > 0 ? [`\narmeabi-v7a:\n` + amV7libs] : [],
... x86libs.length > 0 ? [`\nx86:\n` + x86libs] : [],
... x8664libs.length > 0 ? [`\nx86_64:\n` + x8664libs] : [],
`\n\nAlthough your app works fine on Saga, these library files are unused and increase the size of apk file making the download and update time longer for your app.`,
`\n\nSee https://developer.android.com/games/optimize/64-bit#build-with-64-bit for how to optimize your app.`,
].join('\n')

showMessage(
`Unsupported files found in apk`,
messages,
`warning`
)
}
} catch (e) {
// Ignore this error.
}
}

export const extractCertFingerprint = async (aaptDir: string, apkPath: string): Promise<string> => {
const { stdout } = await runExec(`${aaptDir}/apksigner verify --print-certs -v "${apkPath}"`);

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/validate/CoreValidation.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import fs from "fs";
import Ajv from "ajv";

import type {
AppMetadata,
MetaplexFileReleaseJsonMetadata,
PublisherMetadata,
ReleaseJsonMetadata
} from "../types.js";

// eslint-disable-next-line require-extensions/require-extensions
Expand Down

0 comments on commit 26e2fa6

Please sign in to comment.