Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check unsupported abis. #272

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading