Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/gradle/sqldelight-2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yamilmedina authored Dec 5, 2024
2 parents 756d615 + 06c284a commit fc90b8e
Show file tree
Hide file tree
Showing 525 changed files with 23,941 additions and 3,091 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
unset REPORT_FULL_PATH_REF
- name: Install bencher
uses: bencherdev/bencher@v0.4.17
uses: bencherdev/bencher@main

- name: Run Bencher on PR
if: github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
fetch-depth: 0

- name: Cherry pick to `develop`
uses: wireapp/[email protected].0
uses: wireapp/[email protected].2
with:
target-branch: develop
pr-title-suffix: '🍒'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-dokka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy docs 🚀
uses: JamesIves/github-pages-deploy-action@v4.2.5
uses: JamesIves/github-pages-deploy-action@v4.6.9
with:
branch: gh-pages
clean: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-android-instrumented-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
./**/build/outputs/androidTest-results/**/*.xml
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2.11.0
uses: EnricoMi/publish-unit-test-result-action/composite@v2.17.1
if: always()
with:
files: |
Expand All @@ -125,7 +125,7 @@ jobs:

steps:
- name: Download tests results
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4.1.7
continue-on-error: true
with:
name: test-results
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-android-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
./**/build/test-results/**/*.xml
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2.11.0
uses: EnricoMi/publish-unit-test-result-action/composite@v2.17.1
if: always()
with:
files: |
Expand All @@ -77,7 +77,7 @@ jobs:

steps:
- name: Download tests results
uses: actions/download-artifact@v4
uses: actions/download-artifact@v4.1.7
continue-on-error: true
with:
name: test-results
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-ios-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
./**/build/test-results/**/*.xml
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2.11.0
uses: EnricoMi/publish-unit-test-result-action/composite@v2.17.1
if: always()
with:
files: |
Expand All @@ -81,7 +81,7 @@ jobs:

steps:
- name: Download tests results
uses: actions/download-artifact@v4
uses: actions/download-artifact@v4.1.7
continue-on-error: true
with:
name: test-results
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gradle-jvm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ jobs:
sudo apt-get install -y python3-pip
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2.11.0
uses: EnricoMi/publish-unit-test-result-action/composite@v2.17.1
if: always()
with:
files: |
**/build/test-results/**/*.xml
- name: Upload test report to codecov
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: "build/reports/kover/report.xml"
Expand All @@ -112,7 +112,7 @@ jobs:

steps:
- name: Download tests results
uses: actions/download-artifact@v4
uses: actions/download-artifact@v4.1.7
continue-on-error: true
- name: Display structure of downloaded files
run: ls -R
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/semantic-commit-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
# Please look up the latest version from
# https://github.com/amannn/action-semantic-pull-request/releases
- name: Run Semantic Commint Linter
uses: amannn/[email protected].2
uses: amannn/[email protected].3
with:
# Configure which types are allowed.
# Default: https://github.com/commitizen/conventional-commit-types
Expand Down
9 changes: 1 addition & 8 deletions android/src/main/kotlin/com/wire/kalium/KaliumApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import com.wire.kalium.logger.KaliumLogLevel
import com.wire.kalium.logic.CoreLogger
import com.wire.kalium.logic.CoreLogic
import com.wire.kalium.logic.featureFlags.KaliumConfigs
import com.wire.kalium.logic.sync.ForegroundNotificationDetailsProvider
import com.wire.kalium.logic.sync.WrapperWorkerFactory
import java.io.File

Expand All @@ -50,13 +49,7 @@ class KaliumApplication : Application(), Configuration.Provider {

override val workManagerConfiguration: Configuration
get() {
val myWorkerFactory = WrapperWorkerFactory(
coreLogic,
object : ForegroundNotificationDetailsProvider {
override fun getSmallIconResId(): Int = R.drawable.ic_launcher_foreground
}
)

val myWorkerFactory = WrapperWorkerFactory(coreLogic) { R.drawable.ic_launcher_foreground }
return Configuration.Builder()
.setWorkerFactory(myWorkerFactory)
.build()
Expand Down
79 changes: 79 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,82 @@ moduleGraphConfig {
readmePath.set("./README.md")
heading.set("#### Dependency Graph")
}

tasks.register("runAllUnitTests") {
description = "Runs all Unit Tests."

rootProject.subprojects {
if (tasks.findByName("testDebugUnitTest") != null) {
println("Adding $name to runUnitTests")
dependsOn(":$name:testDebugUnitTest")
}
if (name != "cryptography") {
if (tasks.findByName("jvmTest") != null) {
println("Adding $name to jvmTest")
dependsOn(":$name:jvmTest")
}
}
}
}

tasks.register("aggregateTestResults") {
description = "Aggregates all Unit Test results into a single report."

doLast {
val testResultsDir = rootProject.layout.buildDirectory.dir("testResults").get().asFile
testResultsDir.deleteRecursively()
testResultsDir.mkdirs()

val indexHtmlFile = File(testResultsDir, "index.html")
indexHtmlFile.writeText(
"""
<html>
<head>
<title>Aggregated Test Reports</title>
</head>
<body>
<h1>Aggregated Test Reports</h1>
<ul>
""".trimIndent()
)

rootProject.subprojects {
val testResultsParentDir = layout.buildDirectory.dir("reports/tests").get().asFile

if (testResultsParentDir.exists()) {
testResultsParentDir.listFiles()?.forEach { testDir ->
if (testDir.isDirectory) {
val subprojectDir = File(testResultsDir, "$name/${testDir.name}")
subprojectDir.mkdirs()

testDir.copyRecursively(subprojectDir, overwrite = true)

indexHtmlFile.appendText(
"""
<li><a href="./$name/${testDir.name}/index.html">$name - ${testDir.name} Report</a></li>
""".trimIndent()
)
}
}
}
}

indexHtmlFile.appendText(
"""
</ul>
</body>
</html>
""".trimIndent()
)

// Print the location of the aggregated test results directory
// relative to the current terminal working dir
val currentWorkingDir = File(System.getProperty("user.dir"))
val relativePath = testResultsDir.relativeTo(currentWorkingDir).path
println("Aggregated test reports are available at: $relativePath")
}
}

tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
}
12 changes: 12 additions & 0 deletions calling/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,15 @@ kotlin {
}
}
}

android {
defaultConfig {
ndk {
abiFilters.apply {
add("armeabi-v7a")
add("arm64-v8a")
add("x86_64")
}
}
}
}
3 changes: 3 additions & 0 deletions calling/consumer-proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
-keep class com.waz.call.CaptureDevice { *; }
-keep class com.waz.media.manager.** { *; }
-keep class com.waz.service.call.** { *; }
-dontwarn org.webrtc.CalledByNative
-dontwarn org.webrtc.JniCommon
-dontwarn org.webrtc.audio.AudioDeviceModule

# Avs SoundLink
-keep class com.waz.soundlink.SoundLinkAPI { *; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,6 @@ interface Calling : Library {
)

companion object {
val INSTANCE by lazy { Native.load("avs", Calling::class.java)!! }
val INSTANCE: Calling by lazy { Native.load("avs", Calling::class.java)!! }
}
}
2 changes: 2 additions & 0 deletions cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ kotlin {
implementation(libs.coroutines.core)
implementation(libs.ktxDateTime)
implementation(libs.mordant)
implementation(libs.ktxSerialization)
implementation(libs.ktxIO)
}
}
val jvmMain by getting {
Expand Down
4 changes: 3 additions & 1 deletion cli/src/appleMain/kotlin/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.wire.kalium.cli.CLIApplication
import com.wire.kalium.cli.commands.AddMemberToGroupCommand
import com.wire.kalium.cli.commands.CreateGroupCommand
import com.wire.kalium.cli.commands.DeleteClientCommand
import com.wire.kalium.cli.commands.GenerateEventsCommand
import com.wire.kalium.cli.commands.ListenGroupCommand
import com.wire.kalium.cli.commands.LoginCommand
import com.wire.kalium.cli.commands.MarkAsReadCommand
Expand All @@ -39,6 +40,7 @@ fun main(args: Array<String>) = CLIApplication().subcommands(
RefillKeyPackagesCommand(),
MarkAsReadCommand(),
InteractiveCommand(),
UpdateSupportedProtocolsCommand()
UpdateSupportedProtocolsCommand(),
GenerateEventsCommand()
)
).main(args)
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Wire
* Copyright (C) 2024 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.wire.kalium.cli.commands

import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.PrintMessage
import com.github.ajalt.clikt.core.requireObject
import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
import com.github.ajalt.clikt.parameters.types.int
import com.wire.kalium.logic.data.conversation.ClientId
import com.wire.kalium.logic.data.id.ConversationId
import com.wire.kalium.logic.data.id.QualifiedClientID
import com.wire.kalium.logic.data.user.UserId
import com.wire.kalium.logic.feature.UserSessionScope
import com.wire.kalium.logic.data.event.EventGenerator
import com.wire.kalium.logic.functional.getOrFail
import com.wire.kalium.network.api.authenticated.notification.NotificationResponse
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import kotlinx.datetime.Clock
import kotlinx.io.Buffer
import kotlinx.io.buffered
import kotlinx.io.files.Path
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import kotlinx.io.files.SystemFileSystem
import kotlinx.io.writeString

class GenerateEventsCommand : CliktCommand(name = "generate-events") {

private val userSession by requireObject<UserSessionScope>()
private val targetUserId: String by option(help = "Target User which events will be generator for.").required()
private val targetClientId: String by option(help = "Target Client which events will be generator for.").required()
private val conversationId: String by option(help = "Target conversation which which will receive the events").required()
private val eventLimit: Int by argument("Number of events to generate").int()
private val outputFile: String by argument("Output file for the generated events")

private var json = Json {
prettyPrint = true
}

override fun run() = runBlocking {
val selfUserId = userSession.users.getSelfUser().first().id
val selfClientId = userSession.clientIdProvider().getOrFail { throw PrintMessage("No self client is registered") }
val targetUserId = UserId(value = targetUserId, domain = selfUserId.domain)
val targetClientId = ClientId(targetClientId)

userSession.debug.establishSession(
userId = targetUserId,
clientId = targetClientId
)
val generator = EventGenerator(
selfClient = QualifiedClientID(
clientId = selfClientId,
userId = selfUserId
),
targetClient = QualifiedClientID(
clientId = targetClientId,
userId = targetUserId
),
proteusClient = userSession.proteusClientProvider.getOrCreate()
)
val events = generator.generateEvents(
limit = eventLimit,
conversationId = ConversationId(conversationId, domain = selfUserId.domain)
)
val response = NotificationResponse(
time = Clock.System.now().toString(),
hasMore = false,
notifications = events.toList()
)

val sink = SystemFileSystem.sink(Path(outputFile)).buffered()
val buffer = Buffer()
buffer.writeString(json.encodeToString(response))
sink.write(buffer, buffer.size)
sink.close()

echo("Generated $eventLimit event(s) written into $outputFile")
}
}
4 changes: 3 additions & 1 deletion cli/src/jvmMain/kotlin/com/wire/kalium/cli/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.wire.kalium.cli.commands.ListenGroupCommand
import com.wire.kalium.cli.commands.LoginCommand
import com.wire.kalium.cli.commands.MarkAsReadCommand
import com.wire.kalium.cli.commands.ConsoleCommand
import com.wire.kalium.cli.commands.GenerateEventsCommand
import com.wire.kalium.cli.commands.RefillKeyPackagesCommand
import com.wire.kalium.cli.commands.RemoveMemberFromGroupCommand
import com.wire.kalium.cli.commands.UpdateSupportedProtocolsCommand
Expand All @@ -40,6 +41,7 @@ fun main(args: Array<String>) = CLIApplication().subcommands(
ConsoleCommand(),
RefillKeyPackagesCommand(),
MarkAsReadCommand(),
UpdateSupportedProtocolsCommand()
UpdateSupportedProtocolsCommand(),
GenerateEventsCommand()
)
).main(args)
Loading

0 comments on commit fc90b8e

Please sign in to comment.