Skip to content
Open
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
29 changes: 23 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,8 @@ function getAppVersion (callback) {
} else {
const buildVersion = parseInt(getProperty(data, 'version.app'));
const creationDate = parseInt(getProperty(data, 'version.creation'));
const ndkPrimary = parseInt(getProperty(data, 'version.ndk_primary'));
const ndkLegacy = parseInt(getProperty(data, 'version.ndk_legacy'));
if (!creationDate) {
callback('#' + buildVersion);
return;
Expand All @@ -616,7 +618,14 @@ function getAppVersion (callback) {
const buildDate = new Date(commitDate * 1000);
const fromDate = new Date(creationDate);
const minorVersion = monthYears(buildDate, fromDate);
callback({code: buildVersion, name: majorVersion + '.' + minorVersion + '.' + buildVersion});
callback({
code: buildVersion,
name: majorVersion + '.' + minorVersion + '.' + buildVersion,
ndk: {
legacy: ndkLegacy,
primary: ndkPrimary
}
});
});
}
});
Expand Down Expand Up @@ -1175,7 +1184,10 @@ function uploadToTelegram (bot, task, build, sdkVariant, abiVariant, onDone) {

const onApkUploaded = (apkMessage) => {
files.apkFile.remote_id = apkMessage.document.file_id;
modifyNativeDebugSymbolsArchive(files.nativeDebugSymbolsFile.path).then((nativeDebugSymbolsPath) => {
modifyNativeDebugSymbolsArchive(
files.nativeDebugSymbolsFile.path,
build.version.ndk[sdkVariant === 'legacy' ? 'legacy' : 'primary']
).then((nativeDebugSymbolsPath) => {
attemptAction(maxUploadAttemptCount, (accept, reject) => {
const nativeDebugSymbolsStream = fs.createReadStream(nativeDebugSymbolsPath);
bot.sendDocument(build.serviceChatId, nativeDebugSymbolsStream, {
Expand Down Expand Up @@ -1280,13 +1292,15 @@ async function fetchAvailableLanguageCodes () {
return ['en'];
}

async function modifyNativeDebugSymbolsArchive (filePath) {
async function modifyNativeDebugSymbolsArchive (filePath, ndkVersion) {
let allowExtraDebugSymbols = false;

const tdlibPath = path.join(settings.TGX_SOURCE_PATH, 'tdlib');
const extraNativeDebugSymbolsPath = settings.TDLIB_SYMBOLS_PATH || path.join(tdlibPath, 'source', 'build', 'native-debug-symbols');
const extraNativeDebugSymbolsPath = settings.TDLIB_SYMBOLS_PATH ?
path.join(settings.TDLIB_SYMBOLS_PATH, ndkVersion, 'native-debug-symbols') :
path.join(tdlibPath, 'source', 'build', ndkVersion, 'native-debug-symbols');
if (settings.add_tdlib_debug_symbols === true && fs.existsSync(extraNativeDebugSymbolsPath)) {
// Make sure tdlib/version.txt and tdlib/source/build/native-debug-symbols/version.txt match
// Make sure tdlib/version.txt and tdlib/source/build/$ndkVersion/native-debug-symbols/version.txt match
const tdlibVersionPath = path.join(tdlibPath, 'version.txt');
const extraNativeDebugSymbolsVersionPath = path.join(extraNativeDebugSymbolsPath, 'version.txt');
if (fs.existsSync(tdlibVersionPath) && fs.existsSync(extraNativeDebugSymbolsVersionPath)) {
Expand Down Expand Up @@ -1580,7 +1594,10 @@ function uploadToGooglePlay (task, build, draftOnly, onDone) {
return;
}
uploadedVersionCodes.push(uploadedApk.data.versionCode);
modifyNativeDebugSymbolsArchive(files.nativeDebugSymbolsFile.path).then((nativeDebugSymbolsPath) => {
modifyNativeDebugSymbolsArchive(
files.nativeDebugSymbolsFile.path,
build.version.ndk[variant.name === 'legacy' ? 'legacy' : 'primary']
).then((nativeDebugSymbolsPath) => {
attemptAction(5, (accept, reject) => {
const nativeDebugSymbolsStream = fs.createReadStream(nativeDebugSymbolsPath);
play.edits.deobfuscationfiles.upload({
Expand Down
2 changes: 1 addition & 1 deletion settings.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
},
"youtube": {
"api_key": "YouTube api key"
"api_key": "<YouTube API key, e.g. from environment variable or secret manager>"
},
"huawei": {
"app_id": "<AppGallery App ID>",
Expand Down