pakstr 0.8.2 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/commands/build.js
CHANGED
|
@@ -69,7 +69,8 @@ async function buildCommand(args) {
|
|
|
69
69
|
signing,
|
|
70
70
|
});
|
|
71
71
|
if (mode === "release" && !result.verification) {
|
|
72
|
-
|
|
72
|
+
console.warn("⚠️ Release verification evidence unavailable locally.");
|
|
73
|
+
console.warn("ℹ️ CI/Docker release verification will be used.");
|
|
73
74
|
}
|
|
74
75
|
stagedPath = stageArtifact(result.artifactPath, finalPath);
|
|
75
76
|
}
|
|
@@ -25,12 +25,17 @@ class LocalGradleRunner {
|
|
|
25
25
|
env: (0, releaseSigning_1.removeSigningVariables)(process.env),
|
|
26
26
|
streamOutput: true,
|
|
27
27
|
});
|
|
28
|
-
return {
|
|
28
|
+
return {
|
|
29
|
+
artifactPath: requireApk(androidRoot, "debug"),
|
|
30
|
+
};
|
|
29
31
|
}
|
|
30
32
|
const signing = requireSigning(request.signing);
|
|
31
33
|
const secrets = signingSecrets(signing);
|
|
32
34
|
const gradleEnv = (0, releaseSigning_1.createGradleSigningEnvironment)(signing);
|
|
33
|
-
(0, process_1.runProcess)(gradlewPath, [
|
|
35
|
+
(0, process_1.runProcess)(gradlewPath, [
|
|
36
|
+
"assembleRelease",
|
|
37
|
+
"--no-daemon",
|
|
38
|
+
], {
|
|
34
39
|
cwd: androidRoot,
|
|
35
40
|
env: gradleEnv,
|
|
36
41
|
secrets,
|
|
@@ -40,27 +45,43 @@ class LocalGradleRunner {
|
|
|
40
45
|
let verification;
|
|
41
46
|
try {
|
|
42
47
|
const executor = createLocalVerificationExecutor(signing);
|
|
43
|
-
verification =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
verification =
|
|
49
|
+
(0, releaseVerification_1.verifyReleaseApk)({
|
|
50
|
+
artifactPath,
|
|
51
|
+
expectedMetadata: request.expectedMetadata,
|
|
52
|
+
signing,
|
|
53
|
+
executor,
|
|
54
|
+
});
|
|
49
55
|
}
|
|
50
56
|
catch (error) {
|
|
51
|
-
if (error
|
|
52
|
-
|
|
53
|
-
console.warn("
|
|
54
|
-
|
|
57
|
+
if (isMissingLocalVerificationTool(error)) {
|
|
58
|
+
console.warn("⚠️ Local release verification skipped: Android verification tools are unavailable.");
|
|
59
|
+
console.warn("ℹ️ Full release verification will still run in Docker/CI.");
|
|
60
|
+
verification = undefined;
|
|
55
61
|
}
|
|
56
62
|
else {
|
|
57
63
|
throw error;
|
|
58
64
|
}
|
|
59
65
|
}
|
|
60
|
-
return {
|
|
66
|
+
return {
|
|
67
|
+
artifactPath,
|
|
68
|
+
verification,
|
|
69
|
+
};
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
72
|
exports.LocalGradleRunner = LocalGradleRunner;
|
|
73
|
+
function isMissingLocalVerificationTool(error) {
|
|
74
|
+
if (!(error instanceof Error)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
const messages = [
|
|
78
|
+
"verification tool",
|
|
79
|
+
"cmdline-tools",
|
|
80
|
+
"build-tools directory",
|
|
81
|
+
"Required Android verification tool",
|
|
82
|
+
];
|
|
83
|
+
return messages.some(message => error.message.includes(message));
|
|
84
|
+
}
|
|
64
85
|
function createLocalVerificationExecutor(signing) {
|
|
65
86
|
const androidHome = process.env.ANDROID_HOME ??
|
|
66
87
|
process.env.ANDROID_SDK_ROOT ??
|
|
@@ -70,23 +91,28 @@ function createLocalVerificationExecutor(signing) {
|
|
|
70
91
|
run(tool, args, env = {}) {
|
|
71
92
|
const command = resolveTool(tool, androidHome);
|
|
72
93
|
return (0, process_1.runProcess)(command, args, {
|
|
73
|
-
env: {
|
|
94
|
+
env: {
|
|
95
|
+
...process.env,
|
|
96
|
+
...env,
|
|
97
|
+
},
|
|
74
98
|
secrets,
|
|
75
99
|
});
|
|
76
100
|
},
|
|
77
101
|
};
|
|
78
102
|
}
|
|
79
103
|
function resolveTool(tool, androidHome) {
|
|
80
|
-
if (tool === "keytool")
|
|
104
|
+
if (tool === "keytool") {
|
|
81
105
|
return "keytool";
|
|
106
|
+
}
|
|
82
107
|
if (tool === "apkanalyzer") {
|
|
83
108
|
const cmdlineTools = path_1.default.join(androidHome, "cmdline-tools");
|
|
84
109
|
if (!fs_1.default.existsSync(cmdlineTools)) {
|
|
85
110
|
throw new Error(`Android cmdline-tools directory not found: ${cmdlineTools}`);
|
|
86
111
|
}
|
|
87
|
-
const versions = fs_1.default
|
|
88
|
-
.
|
|
89
|
-
|
|
112
|
+
const versions = fs_1.default.readdirSync(cmdlineTools)
|
|
113
|
+
.sort((a, b) => b.localeCompare(a, undefined, {
|
|
114
|
+
numeric: true,
|
|
115
|
+
}));
|
|
90
116
|
const analyzer = versions
|
|
91
117
|
.map(version => path_1.default.join(cmdlineTools, version, "bin", "apkanalyzer"))
|
|
92
118
|
.find(candidate => fs_1.default.existsSync(candidate));
|
|
@@ -99,10 +125,13 @@ function resolveTool(tool, androidHome) {
|
|
|
99
125
|
if (!fs_1.default.existsSync(buildToolsDir)) {
|
|
100
126
|
throw new Error(`Android build-tools directory not found: ${buildToolsDir}`);
|
|
101
127
|
}
|
|
102
|
-
const versions = fs_1.default
|
|
103
|
-
.
|
|
104
|
-
|
|
105
|
-
|
|
128
|
+
const versions = fs_1.default.readdirSync(buildToolsDir)
|
|
129
|
+
.sort((a, b) => b.localeCompare(a, undefined, {
|
|
130
|
+
numeric: true,
|
|
131
|
+
}));
|
|
132
|
+
const executable = tool === "aapt"
|
|
133
|
+
? "aapt"
|
|
134
|
+
: "apksigner";
|
|
106
135
|
const resolved = versions
|
|
107
136
|
.map(version => path_1.default.join(buildToolsDir, version, executable))
|
|
108
137
|
.find(candidate => fs_1.default.existsSync(candidate));
|
|
@@ -113,7 +142,8 @@ function resolveTool(tool, androidHome) {
|
|
|
113
142
|
}
|
|
114
143
|
function requireApk(androidRoot, mode) {
|
|
115
144
|
const artifactPath = path_1.default.join(androidRoot, "app", "build", "outputs", "apk", mode, `app-${mode}.apk`);
|
|
116
|
-
if (!fs_1.default.existsSync(artifactPath) ||
|
|
145
|
+
if (!fs_1.default.existsSync(artifactPath) ||
|
|
146
|
+
!fs_1.default.lstatSync(artifactPath).isFile()) {
|
|
117
147
|
throw new Error(`APK not found after Gradle build: ${artifactPath}`);
|
|
118
148
|
}
|
|
119
149
|
return artifactPath;
|