Skip to content

Commit e4c16ae

Browse files
Merge pull request #1377 from session-foundation/release/1.27.0
Prepare for Release/1.27.0
2 parents 00078fb + 118bd06 commit e4c16ae

File tree

155 files changed

+4596
-1616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+4596
-1616
lines changed

.drone.jsonnet

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https:/
3737
image: docker_base + 'android',
3838
pull: 'always',
3939
environment: { ANDROID_HOME: '/usr/lib/android-sdk' },
40-
mem_limit: "8g",
4140
commands: [
42-
'apt-get update --allow-releaseinfo-change',
43-
'apt-get install -y ninja-build openjdk-21-jdk',
44-
'update-java-alternatives -s java-1.21.0-openjdk-amd64',
4541
'./gradlew testPlayDebugUnitTestCoverageReport'
4642
],
4743
}
@@ -73,7 +69,7 @@ local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https:/
7369
platform: { arch: 'amd64' },
7470
trigger: {
7571
event: ['push'],
76-
branch: ['master', 'dev', 'release/*']
72+
branch: ['master', 'dev', 'release/*', 'fix-ci-*']
7773
},
7874
steps: [
7975
version_info,
@@ -82,14 +78,10 @@ local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https:/
8278
name: 'Build and upload',
8379
image: docker_base + 'android',
8480
pull: 'always',
85-
mem_limit: "8g",
8681
environment: { SSH_KEY: { from_secret: 'SSH_KEY' }, ANDROID_HOME: '/usr/lib/android-sdk' },
8782
commands: [
88-
'apt-get update --allow-releaseinfo-change',
89-
'apt-get install -y ninja-build openjdk-21-jdk',
90-
'update-java-alternatives -s java-1.21.0-openjdk-amd64',
91-
'./gradlew --no-daemon assemblePlayDebug assembleWebsiteDebug',
92-
'./gradlew --no-daemon -Phuawei=1 assembleHuaweiDebug',
83+
'./gradlew assemblePlayQa',
84+
'./gradlew assemblePlayAutomaticQa',
9385
'./scripts/drone-static-upload.sh'
9486
],
9587
}

.github/workflows/build_and_test.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,40 @@ jobs:
1717
strategy:
1818
fail-fast: false # Continue with other matrix items if one fails
1919
matrix:
20-
variant: [ 'play', 'website', 'huawei' ]
21-
build_type: [ 'debug' ]
20+
variant: [ 'play', 'website', 'huawei', 'fdroid' ]
21+
build_type: [ 'qa' ]
2222
include:
2323
- variant: 'huawei'
2424
extra_build_command_options: '-Phuawei=1'
25+
- variant: 'play'
26+
run_test: true
2527
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
submodules: 'recursive'
31+
2632
- name: Cache Gradle
2733
uses: actions/cache@v4
2834
with:
2935
path: |
3036
~/.gradle/caches
3137
.gradle
32-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle.properties') }}
33-
restore-keys: |
34-
${{ runner.os }}-gradle-
38+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle.properties') }}-${{ matrix.variant }}
3539

36-
- uses: actions/checkout@v4
37-
with:
38-
submodules: 'recursive'
3940
- name: Set up JDK 21
4041
uses: actions/setup-java@v4
4142
with:
4243
distribution: 'temurin'
4344
java-version: '21'
4445

45-
- name: Build and test with Gradle
46+
- name: Build with gradle
4647
id: build
47-
run: ./gradlew assemble${{ matrix.variant }}${{ matrix.build_type }} test${{ matrix.variant }}${{ matrix.build_type }}UnitTest ${{ matrix.extra_build_command_options }}
48+
run: ./gradlew assemble${{ matrix.variant }}${{ matrix.build_type }} ${{ matrix.extra_build_command_options }}
49+
50+
- name: Run unit tests
51+
if: ${{ matrix.run_test == true }}
52+
id: test
53+
run: ./gradlew test${{ matrix.variant }}${{ matrix.build_type }}UnitTest ${{ matrix.extra_build_command_options }}
4854

4955
- name: Upload build reports regardless
5056
if: always()

app/build.gradle.kts

Lines changed: 114 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import com.android.build.api.dsl.VariantDimension
12
import com.android.build.api.variant.FilterConfiguration
23
import java.io.ByteArrayOutputStream
34

@@ -24,8 +25,8 @@ configurations.configureEach {
2425
exclude(module = "commons-logging")
2526
}
2627

27-
val canonicalVersionCode = 415
28-
val canonicalVersionName = "1.26.0"
28+
val canonicalVersionCode = 416
29+
val canonicalVersionName = "1.27.0"
2930

3031
val postFixSize = 10
3132
val abiPostFix = mapOf(
@@ -44,6 +45,39 @@ val getGitHash = providers
4445
.asText
4546
.map { it.trim() }
4647

48+
val firebaseEnabledVariants = listOf("play", "fdroid")
49+
val nonPlayVariants = listOf("fdroid", "website") + if (huaweiEnabled) listOf("huawei") else emptyList()
50+
51+
fun VariantDimension.devNetDefaultOn(defaultOn: Boolean) {
52+
val fqEnumClass = "org.session.libsession.utilities.Environment"
53+
buildConfigField(
54+
fqEnumClass,
55+
"DEFAULT_ENVIRONMENT",
56+
if (defaultOn) "$fqEnumClass.DEV_NET" else "$fqEnumClass.MAIN_NET"
57+
)
58+
}
59+
60+
fun VariantDimension.enablePermissiveNetworkSecurityConfig(permissive: Boolean) {
61+
manifestPlaceholders["network_security_config"] = if (permissive) {
62+
"@xml/network_security_configuration_permissive"
63+
} else {
64+
"@xml/network_security_configuration"
65+
}
66+
}
67+
68+
fun VariantDimension.setAlternativeAppName(alternative: String?) {
69+
if (alternative != null) {
70+
manifestPlaceholders["app_name"] = alternative
71+
} else {
72+
manifestPlaceholders["app_name"] = "@string/app_name"
73+
}
74+
}
75+
76+
fun VariantDimension.setAuthorityPostfix(postfix: String) {
77+
manifestPlaceholders["authority_postfix"] = postfix
78+
buildConfigField("String", "AUTHORITY_POSTFIX", "\"$postfix\"")
79+
}
80+
4781
kotlin {
4882
compilerOptions {
4983
jvmToolchain(21)
@@ -110,27 +144,73 @@ android {
110144
}
111145
}
112146

113-
sourceSets {
114-
val sharedTestDir = "src/sharedTest/java"
115-
getByName("test").java.srcDirs(sharedTestDir)
116-
getByName("androidTest").java.srcDirs(sharedTestDir)
117-
118-
getByName("test").resources.srcDirs("$projectDir/src/main/assets")
119-
}
120-
121147
buildTypes {
122148
getByName("release") {
123149
isMinifyEnabled = false
150+
151+
devNetDefaultOn(false)
152+
enablePermissiveNetworkSecurityConfig(false)
153+
setAlternativeAppName(null)
154+
setAuthorityPostfix("")
155+
}
156+
157+
create("qa") {
158+
initWith(getByName("release"))
159+
160+
matchingFallbacks += "release"
161+
162+
signingConfig = signingConfigs.getByName("debug")
163+
applicationIdSuffix = ".$name"
164+
165+
devNetDefaultOn(false)
166+
enablePermissiveNetworkSecurityConfig(true)
167+
168+
setAlternativeAppName("Session QA")
169+
setAuthorityPostfix(".qa")
170+
}
171+
172+
create("automaticQa") {
173+
initWith(getByName("qa"))
174+
175+
devNetDefaultOn(true)
176+
setAlternativeAppName("Session AQA")
124177
}
125178

126179
getByName("debug") {
127180
isDefault = true
128181
isMinifyEnabled = false
129182
enableUnitTestCoverage = false
130183
signingConfig = signingConfigs.getByName("debug")
184+
185+
applicationIdSuffix = ".${name}"
186+
enablePermissiveNetworkSecurityConfig(true)
187+
devNetDefaultOn(false)
188+
setAlternativeAppName("Session Debug")
189+
setAuthorityPostfix(".debug")
131190
}
132191
}
133192

193+
sourceSets {
194+
getByName("test").apply {
195+
java.srcDirs("$projectDir/src/sharedTest/java")
196+
resources.srcDirs("$projectDir/src/main/assets")
197+
}
198+
199+
val firebaseCommonDir = "src/firebaseCommon"
200+
firebaseEnabledVariants.forEach { variant ->
201+
maybeCreate(variant).java.srcDirs("$firebaseCommonDir/kotlin")
202+
}
203+
204+
val nonPlayCommonDir = "src/nonPlayCommon"
205+
nonPlayVariants.forEach { variant ->
206+
maybeCreate(variant).apply {
207+
java.srcDirs("$nonPlayCommonDir/kotlin")
208+
resources.srcDirs("$nonPlayCommonDir/resources")
209+
}
210+
}
211+
}
212+
213+
134214
signingConfigs {
135215
create("play") {
136216
if (project.hasProperty("SESSION_STORE_FILE")) {
@@ -160,39 +240,38 @@ android {
160240
}
161241
}
162242

243+
163244
flavorDimensions += "distribution"
164245
productFlavors {
165246
create("play") {
166247
isDefault = true
167248
dimension = "distribution"
168-
ext["websiteUpdateUrl"] = "null"
169249
buildConfigField("boolean", "PLAY_STORE_DISABLED", "false")
170250
buildConfigField("org.session.libsession.utilities.Device", "DEVICE", "org.session.libsession.utilities.Device.ANDROID")
171-
buildConfigField("String", "NOPLAY_UPDATE_URL", ext["websiteUpdateUrl"] as String)
172251
buildConfigField("String", "PUSH_KEY_SUFFIX", "\"\"")
173252
signingConfig = signingConfigs.getByName("play")
174253
}
175254

255+
create("fdroid") {
256+
initWith(getByName("play"))
257+
}
258+
176259
if (huaweiEnabled) {
177260
create("huawei") {
178261
dimension = "distribution"
179-
ext["websiteUpdateUrl"] = "null"
180262
buildConfigField("boolean", "PLAY_STORE_DISABLED", "true")
181263
buildConfigField("org.session.libsession.utilities.Device", "DEVICE", "org.session.libsession.utilities.Device.HUAWEI")
182-
buildConfigField("String", "NOPLAY_UPDATE_URL", ext["websiteUpdateUrl"] as String)
183264
buildConfigField("String", "PUSH_KEY_SUFFIX", "\"_HUAWEI\"")
184265
signingConfig = signingConfigs.getByName("huawei")
185266
}
186267
}
187268

188269
create("website") {
189-
dimension = "distribution"
190-
ext["websiteUpdateUrl"] = "https://github.com/session-foundation/session-android/releases"
270+
initWith(getByName("play"))
271+
191272
buildConfigField("boolean", "PLAY_STORE_DISABLED", "true")
192-
buildConfigField("org.session.libsession.utilities.Device", "DEVICE", "org.session.libsession.utilities.Device.ANDROID")
193-
buildConfigField("String", "NOPLAY_UPDATE_URL", "\"${ext["websiteUpdateUrl"]}\"")
194-
buildConfigField("String", "PUSH_KEY_SUFFIX", "\"\"")
195273
}
274+
196275
}
197276

198277
testOptions {
@@ -251,13 +330,20 @@ dependencies {
251330
implementation(libs.androidx.fragment.ktx)
252331
implementation(libs.androidx.core.ktx)
253332

254-
val playImplementation = configurations.maybeCreate("playImplementation")
255-
playImplementation(libs.firebase.messaging) {
256-
exclude(group = "com.google.firebase", module = "firebase-core")
257-
exclude(group = "com.google.firebase", module = "firebase-analytics")
258-
exclude(group = "com.google.firebase", module = "firebase-measurement-connector")
333+
// Add firebase dependencies to specific variants
334+
for (variant in firebaseEnabledVariants) {
335+
val configuration = configurations.maybeCreate("${variant}Implementation")
336+
configuration(libs.firebase.messaging) {
337+
exclude(group = "com.google.firebase", module = "firebase-core")
338+
exclude(group = "com.google.firebase", module = "firebase-analytics")
339+
exclude(group = "com.google.firebase", module = "firebase-measurement-connector")
340+
}
259341
}
260342

343+
val playImplementation = configurations.maybeCreate("playImplementation")
344+
playImplementation(libs.google.play.review)
345+
playImplementation(libs.google.play.review.ktx)
346+
261347
if (huaweiEnabled) {
262348
val huaweiImplementation = configurations.maybeCreate("huaweiImplementation")
263349
huaweiImplementation(libs.huawei.push)
@@ -267,7 +353,6 @@ dependencies {
267353
implementation(libs.androidx.media3.ui)
268354
implementation(libs.conscrypt.android)
269355
implementation(libs.android)
270-
implementation(libs.shortcutbadger)
271356
implementation(libs.photoview)
272357
implementation(libs.glide)
273358
implementation(libs.compose)
@@ -357,7 +442,6 @@ dependencies {
357442
implementation(libs.androidx.navigation.compose)
358443

359444
implementation(libs.accompanist.permissions)
360-
implementation(libs.accompanist.drawablepainter)
361445

362446
implementation(libs.androidx.camera.camera2)
363447
implementation(libs.androidx.camera.lifecycle)
@@ -393,10 +477,12 @@ androidComponents {
393477
}
394478
}
395479

396-
// Disable google services for non-google variants
480+
// Only enable google services tasks for firebase-enabled variants
397481
androidComponents {
398482
finalizeDsl {
399483
tasks.named { it.contains("GoogleServices") }
400-
.configureEach { enabled = name.contains("play", true) }
484+
.configureEach {
485+
enabled = firebaseEnabledVariants.any { name.contains(it, true) }
486+
}
401487
}
402488
}

0 commit comments

Comments
 (0)