pakstr 0.8.3 → 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,32 +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
|
-
|
|
52
|
-
"Required Android verification tool not found",
|
|
53
|
-
"Android cmdline-tools directory not found",
|
|
54
|
-
"Android build-tools directory not found",
|
|
55
|
-
];
|
|
56
|
-
if (error instanceof Error &&
|
|
57
|
-
localToolErrors.some(message => error.message.startsWith(message))) {
|
|
57
|
+
if (isMissingLocalVerificationTool(error)) {
|
|
58
58
|
console.warn("⚠️ Local release verification skipped: Android verification tools are unavailable.");
|
|
59
59
|
console.warn("ℹ️ Full release verification will still run in Docker/CI.");
|
|
60
|
+
verification = undefined;
|
|
60
61
|
}
|
|
61
62
|
else {
|
|
62
63
|
throw error;
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
return {
|
|
66
|
+
return {
|
|
67
|
+
artifactPath,
|
|
68
|
+
verification,
|
|
69
|
+
};
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
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
|
+
}
|
|
69
85
|
function createLocalVerificationExecutor(signing) {
|
|
70
86
|
const androidHome = process.env.ANDROID_HOME ??
|
|
71
87
|
process.env.ANDROID_SDK_ROOT ??
|
|
@@ -75,23 +91,28 @@ function createLocalVerificationExecutor(signing) {
|
|
|
75
91
|
run(tool, args, env = {}) {
|
|
76
92
|
const command = resolveTool(tool, androidHome);
|
|
77
93
|
return (0, process_1.runProcess)(command, args, {
|
|
78
|
-
env: {
|
|
94
|
+
env: {
|
|
95
|
+
...process.env,
|
|
96
|
+
...env,
|
|
97
|
+
},
|
|
79
98
|
secrets,
|
|
80
99
|
});
|
|
81
100
|
},
|
|
82
101
|
};
|
|
83
102
|
}
|
|
84
103
|
function resolveTool(tool, androidHome) {
|
|
85
|
-
if (tool === "keytool")
|
|
104
|
+
if (tool === "keytool") {
|
|
86
105
|
return "keytool";
|
|
106
|
+
}
|
|
87
107
|
if (tool === "apkanalyzer") {
|
|
88
108
|
const cmdlineTools = path_1.default.join(androidHome, "cmdline-tools");
|
|
89
109
|
if (!fs_1.default.existsSync(cmdlineTools)) {
|
|
90
110
|
throw new Error(`Android cmdline-tools directory not found: ${cmdlineTools}`);
|
|
91
111
|
}
|
|
92
|
-
const versions = fs_1.default
|
|
93
|
-
.
|
|
94
|
-
|
|
112
|
+
const versions = fs_1.default.readdirSync(cmdlineTools)
|
|
113
|
+
.sort((a, b) => b.localeCompare(a, undefined, {
|
|
114
|
+
numeric: true,
|
|
115
|
+
}));
|
|
95
116
|
const analyzer = versions
|
|
96
117
|
.map(version => path_1.default.join(cmdlineTools, version, "bin", "apkanalyzer"))
|
|
97
118
|
.find(candidate => fs_1.default.existsSync(candidate));
|
|
@@ -104,10 +125,13 @@ function resolveTool(tool, androidHome) {
|
|
|
104
125
|
if (!fs_1.default.existsSync(buildToolsDir)) {
|
|
105
126
|
throw new Error(`Android build-tools directory not found: ${buildToolsDir}`);
|
|
106
127
|
}
|
|
107
|
-
const versions = fs_1.default
|
|
108
|
-
.
|
|
109
|
-
|
|
110
|
-
|
|
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";
|
|
111
135
|
const resolved = versions
|
|
112
136
|
.map(version => path_1.default.join(buildToolsDir, version, executable))
|
|
113
137
|
.find(candidate => fs_1.default.existsSync(candidate));
|
|
@@ -118,7 +142,8 @@ function resolveTool(tool, androidHome) {
|
|
|
118
142
|
}
|
|
119
143
|
function requireApk(androidRoot, mode) {
|
|
120
144
|
const artifactPath = path_1.default.join(androidRoot, "app", "build", "outputs", "apk", mode, `app-${mode}.apk`);
|
|
121
|
-
if (!fs_1.default.existsSync(artifactPath) ||
|
|
145
|
+
if (!fs_1.default.existsSync(artifactPath) ||
|
|
146
|
+
!fs_1.default.lstatSync(artifactPath).isFile()) {
|
|
122
147
|
throw new Error(`APK not found after Gradle build: ${artifactPath}`);
|
|
123
148
|
}
|
|
124
149
|
return artifactPath;
|