Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

Commit 0538bec

Browse files
Update output filenames (#335)
Co-authored-by: Álison Fernandes <vvolkgang@users.noreply.github.com>
1 parent 2ae3d5e commit 0538bec

4 files changed

Lines changed: 79 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,27 +221,27 @@ jobs:
221221
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
222222
with:
223223
name: com.bitwarden.authenticator.aab
224-
path: authenticator/build/outputs/bundle/release/com.bitwarden.authenticator-release.aab
224+
path: authenticator/build/outputs/bundle/release/com.bitwarden.authenticator.aab
225225
if-no-files-found: error
226226

227227
- name: Upload release .apk artifact
228228
if: ${{ matrix.variant == 'apk' }}
229229
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
230230
with:
231231
name: com.bitwarden.authenticator.apk
232-
path: authenticator/build/outputs/apk/release/com.bitwarden.authenticator-release.apk
232+
path: authenticator/build/outputs/apk/release/com.bitwarden.authenticator.apk
233233
if-no-files-found: error
234234

235235
- name: Create checksum file for Release AAB
236236
if: ${{ matrix.variant == 'aab' }}
237237
run: |
238-
sha256sum "authenticator/build/outputs/bundle/release/com.bitwarden.authenticator-release.aab" \
238+
sha256sum "authenticator/build/outputs/bundle/release/com.bitwarden.authenticator.aab" \
239239
> ./authenticator-android-aab-sha256.txt
240240
241241
- name: Create checksum for release .apk artifact
242242
if: ${{ matrix.variant == 'apk' }}
243243
run: |
244-
sha256sum "authenticator/build/outputs/apk/release/com.bitwarden.authenticator-release.apk" \
244+
sha256sum "authenticator/build/outputs/apk/release/com.bitwarden.authenticator.apk" \
245245
> ./authenticator-android-apk-sha256.txt
246246
247247
- name: Upload .apk SHA file for release

authenticator/build.gradle.kts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
12
import com.google.protobuf.gradle.proto
3+
import dagger.hilt.android.plugin.util.capitalize
24
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
35

46
plugins {
@@ -54,6 +56,7 @@ android {
5456

5557
buildTypes {
5658
debug {
59+
applicationIdSuffix = ".dev"
5760
manifestPlaceholders["targetBitwardenAppId"] = "com.x8bit.bitwarden.dev"
5861
buildConfigField(
5962
type = "com.bitwarden.authenticatorbridge.manager.model.AuthenticatorBridgeConnectionType",
@@ -81,6 +84,32 @@ android {
8184
buildConfigField(type = "boolean", name = "HAS_DEBUG_MENU", value = "false")
8285
}
8386
}
87+
applicationVariants.all {
88+
val bundlesDir = "${layout.buildDirectory.get()}/outputs/bundle"
89+
outputs
90+
.mapNotNull { it as? BaseVariantOutputImpl }
91+
.forEach { output ->
92+
// Set the APK output filename.
93+
output.outputFileName = "$applicationId.apk"
94+
95+
val variantName = name
96+
val renameTaskName = "rename${variantName.capitalize()}AabFiles"
97+
tasks.register(renameTaskName) {
98+
group = "build"
99+
description = "Renames the bundle files for $variantName variant"
100+
doLast {
101+
renameFile(
102+
"$bundlesDir/$variantName/$namespace-${buildType.name}.aab",
103+
"$applicationId.aab",
104+
)
105+
}
106+
}
107+
// Force renaming task to execute after the variant is built.
108+
tasks
109+
.getByName("bundle${variantName.capitalize()}")
110+
.finalizedBy(renameTaskName)
111+
}
112+
}
84113
compileOptions {
85114
sourceCompatibility(libs.versions.jvmTarget.get())
86115
targetCompatibility(libs.versions.jvmTarget.get())
@@ -285,3 +314,18 @@ tasks {
285314
dependsOn("check")
286315
}
287316
}
317+
318+
private fun renameFile(path: String, newName: String) {
319+
val originalFile = File(path)
320+
if (!originalFile.exists()) {
321+
println("File $originalFile does not exist!")
322+
return
323+
}
324+
325+
val newFile = File(originalFile.parentFile, newName)
326+
if (originalFile.renameTo(newFile)) {
327+
println("Renamed $originalFile to $newFile")
328+
} else {
329+
throw RuntimeException("Failed to rename $originalFile to $newFile")
330+
}
331+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"project_info": {
3+
"project_number": "867301491091",
4+
"project_id": "bitwarden-authenticator",
5+
"storage_bucket": "bitwarden-authenticator.firebasestorage.app"
6+
},
7+
"client": [
8+
{
9+
"client_info": {
10+
"mobilesdk_app_id": "1:867301491091:android:3ee369dedcd20f6551e866",
11+
"android_client_info": {
12+
"package_name": "com.bitwarden.authenticator.dev"
13+
}
14+
},
15+
"oauth_client": [],
16+
"api_key": [
17+
{
18+
"current_key": "AIzaSyDDXnnBuWzuh8rlihiMWRPif_sqkGk3fxw"
19+
}
20+
],
21+
"services": {
22+
"appinvite_service": {
23+
"other_platform_oauth_client": []
24+
}
25+
}
26+
}
27+
],
28+
"configuration_version": "1"
29+
}

fastlane/Fastfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ platform :android do
123123
firebase_app_distribution(
124124
app: "1:867301491091:android:50b626dba42a361651e866",
125125
android_artifact_type: "AAB",
126-
android_artifact_path: "authenticator/build/outputs/bundle/release/com.bitwarden.authenticator-release.aab",
126+
android_artifact_path: "authenticator/build/outputs/bundle/release/com.bitwarden.authenticator.aab",
127127
service_credentials_file: options[:serviceCredentialsFile],
128128
groups: "internal-prod-group, livefront",
129129
release_notes: release_notes,
@@ -136,7 +136,7 @@ platform :android do
136136
package_name: "com.bitwarden.authenticator",
137137
json_key: options[:serviceCredentialsFile],
138138
track: "internal",
139-
aab: "authenticator/build/outputs/bundle/release/com.bitwarden.authenticator-release.aab",
139+
aab: "authenticator/build/outputs/bundle/release/com.bitwarden.authenticator.aab",
140140
mapping: "authenticator/build/outputs/mapping/release/mapping.txt",
141141
)
142142
end

0 commit comments

Comments
 (0)