Skip to content

Commit

Permalink
Fix detekt issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzybinary committed Feb 8, 2024
1 parent 71e285f commit 851894e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ abstract class DdFileUploadTask @Inject constructor(
* Uploads the files retrieved from `getFilesList` to Datadog.
*/
@TaskAction
@Suppress("TooGenericExceptionCaught")
fun applyTask() {
datadogCiFile?.let {
applyDatadogCiConfig(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import kotlin.reflect.full.memberProperties
* A Gradle task to upload NDK symbol files to Datadog servers.
*/
internal abstract class DdNdkSymbolFileUploadTask @Inject constructor(
objects: ObjectFactory,
objectFactory: ObjectFactory,
providerFactory: ProviderFactory
) : DdFileUploadTask(providerFactory) {

@get:InputFiles
val searchDirectories: ConfigurableFileCollection = objects.fileCollection()
val searchDirectories: ConfigurableFileCollection = objectFactory.fileCollection()

init {
description =
Expand Down Expand Up @@ -66,7 +66,7 @@ internal abstract class DdNdkSymbolFileUploadTask @Inject constructor(
.filter { it.extension == "so" }
.toSet()
} else {
return emptySet()
emptySet()
}
}

Expand Down Expand Up @@ -114,13 +114,19 @@ internal abstract class DdNdkSymbolFileUploadTask @Inject constructor(
return currentMajor >= major && currentMinor >= minor && currentPatch >= patch
}

private fun getSearchDirs(buildTask: TaskProvider<ExternalNativeBuildTask>, providerFactory: ProviderFactory): Provider<File?> {
private fun getSearchDirs(
buildTask: TaskProvider<ExternalNativeBuildTask>,
providerFactory: ProviderFactory
): Provider<File?> {
return buildTask.flatMap { task ->
// var soFolder: Provider
@Suppress("MagicNumber")
if (isAgpAbove(8, 0, 0)) {
task.soFolder.map { it.asFile }
} else {
val soFolder = ExternalNativeBuildTask::class.memberProperties.find { it.name == "objFolder" }?.get(task)
val soFolder = ExternalNativeBuildTask::class.memberProperties.find {
it.name == "objFolder"
}?.get(task)
when (soFolder) {
is File -> providerFactory.provider { soFolder }
is DirectoryProperty -> soFolder.map { it.asFile }
Expand Down Expand Up @@ -151,8 +157,9 @@ internal abstract class DdNdkSymbolFileUploadTask @Inject constructor(
DdNdkSymbolFileUploadTask::class.java
) { task ->
val roots = mutableListOf<File>()
variant.sourceSets.forEach { it ->
variant.sourceSets.forEach {
roots.addAll(it.javaDirectories)
@Suppress("MagicNumber")
if (isAgpAbove(7, 0, 0)) {
roots.addAll(it.kotlinDirectories)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ internal class DdAndroidGradlePluginFunctionalTest {
// region NDK Symbol Upload

@Test
fun `M not try to upload the symbol file W no cmake dependencies { using a fake API_KEY }`(forge: Forge) {
fun `M not try to upload the symbol file W no cmake dependencies { using a fake API_KEY }`() {
// Given
stubGradleBuildFromResourceFile(
"build_with_datadog_dep.gradle",
Expand Down

0 comments on commit 851894e

Please sign in to comment.