diff --git a/packages/app-mobile/android/app/build.gradle b/packages/app-mobile/android/app/build.gradle index 708fcfb85..f97ba9f5f 100644 --- a/packages/app-mobile/android/app/build.gradle +++ b/packages/app-mobile/android/app/build.gradle @@ -139,16 +139,6 @@ def reactNativeArchitectures() { } android { - flavorDimensions "version" - - productFlavors { - mod { - dimension "version" - applicationIdSuffix ".mod" - versionNameSuffix = "-mod" - } - } - compileSdkVersion rootProject.ext.compileSdkVersion compileOptions { @@ -166,8 +156,8 @@ android { applicationId "net.cozic.joplin" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 2097702 - versionName "2.11.17" + versionCode 2097705 + versionName "2.11.20" // ndk { // abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64" // } diff --git a/packages/tools/release-android.ts b/packages/tools/release-android.ts index 1ab57f8a3..3db03e961 100644 --- a/packages/tools/release-android.ts +++ b/packages/tools/release-android.ts @@ -94,11 +94,6 @@ function gradleVersionName(content: string) { return matches[1]; } -const assembleCommandName = (releaseName: string) => { - if (releaseName === 'vosk') return 'assembleMod'; - return 'assembleRelease'; -}; - async function createRelease(projectName: string, name: string, tagName: string, version: string): Promise { const suffix = version + (name === 'main' ? '' : `-${name}`); @@ -119,15 +114,22 @@ async function createRelease(projectName: string, name: string, tagName: string, return readFile(`${rnDir}/services/voiceTyping/vosk.dummy.ts`, 'utf8'); }); - // await patcher.updateFileContent(`${rnDir}/android/app/build.gradle`, async (content: string) => { - // content = content.replace(/\s+"react-native-vosk": ".*",/, ''); - // content = content.replace(/(\s+)"applicationId "net.cozic.joplin"/, '$1"applicationId "net.cozic.joplin-mod"'); - // return content; - // }); + await patcher.updateFileContent(`${rnDir}/android/app/build.gradle`, async (content: string) => { + content = content.replace(/\s+"react-native-vosk": ".*",/, ''); + return content; + }); await patcher.removeFile(`${rnDir}/android/app/src/main/assets/model-fr-fr`); } + if (name === 'vosk') { + await patcher.updateFileContent(`${rnDir}/android/app/build.gradle`, async (content: string) => { + content = content.replace(/(\s+)applicationId "net.cozic.joplin"/, '$1applicationId "net.cozic.joplin.mod"'); + content = content.replace(/(\s+)versionName "(\d+\.\d+\.\d+)"/, '$1versionName "$2-mod"'); + return content; + }); + } + const apkFilename = `joplin-v${suffix}.apk`; const apkFilePath = `${releaseDir}/${apkFilename}`; const downloadUrl = `https://github.com/laurent22/${projectName}/releases/download/${tagName}/${apkFilename}`; @@ -148,7 +150,7 @@ async function createRelease(projectName: string, name: string, tagName: string, let restoreDir = null; let apkBuildCmd = ''; let apkCleanBuild = ''; - const apkBuildCmdArgs = [assembleCommandName(name), `-PbuildDir=${buildDirName}`]; + const apkBuildCmdArgs = ['assembleRelease', `-PbuildDir=${buildDirName}`]; if (await fileExists('/mnt/c/Windows/System32/cmd.exe')) { await execCommandWithPipes('/mnt/c/Windows/System32/cmd.exe', ['/c', `cd packages\\app-mobile\\android && gradlew.bat ${apkBuildCmd}`]); apkBuildCmd = ''; @@ -253,6 +255,9 @@ async function main() { releaseFiles[releaseName] = await createRelease(projectName, releaseName, tagName, version); } + console.info('Created releases:'); + console.info(releaseFiles); + const voskRelease = releaseFiles['vosk']; delete releaseFiles['vosk'];