All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sentry.android.gradle.sourcecontext.SourceContext.kt Maven / Gradle / Ivy

There is a newer version: 4.11.0
Show newest version
package io.sentry.android.gradle.sourcecontext

import io.sentry.android.gradle.extensions.SentryPluginExtension
import io.sentry.android.gradle.telemetry.SentryTelemetryService
import io.sentry.gradle.common.SentryVariant
import org.gradle.api.Project
import org.gradle.api.file.Directory
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.TaskProvider

class SourceContext {
    companion object {
        fun register(
            project: Project,
            extension: SentryPluginExtension,
            sentryTelemetryProvider: Provider?,
            variant: SentryVariant,
            paths: OutputPaths,
            sourceFiles: Provider>?,
            cliExecutable: Provider,
            sentryOrg: String?,
            sentryProject: String?,
            taskSuffix: String
        ): SourceContextTasks {
            val generateBundleIdTask = GenerateBundleIdTask.register(
                project,
                extension,
                sentryTelemetryProvider,
                sourceFiles,
                output = paths.bundleIdDir,
                extension.includeSourceContext,
                taskSuffix
            )

            val collectSourcesTask = CollectSourcesTask.register(
                project,
                extension,
                sentryTelemetryProvider,
                sourceFiles,
                output = paths.sourceDir,
                extension.includeSourceContext,
                taskSuffix
            )

            val bundleSourcesTask = BundleSourcesTask.register(
                project,
                extension,
                sentryTelemetryProvider,
                variant,
                generateBundleIdTask,
                collectSourcesTask,
                output = paths.bundleDir,
                extension.debug,
                cliExecutable,
                sentryOrg?.let { project.provider { it } } ?: extension.org,
                sentryProject?.let { project.provider { it } } ?: extension.projectName,
                extension.authToken,
                extension.url,
                extension.includeSourceContext,
                taskSuffix
            )

            val uploadSourceBundleTask = UploadSourceBundleTask.register(
                project,
                extension,
                sentryTelemetryProvider,
                variant,
                bundleSourcesTask,
                extension.debug,
                cliExecutable,
                extension.autoUploadSourceContext,
                sentryOrg?.let { project.provider { it } } ?: extension.org,
                sentryProject?.let { project.provider { it } } ?: extension.projectName,
                extension.authToken,
                extension.url,
                extension.includeSourceContext,
                taskSuffix
            )

            return SourceContextTasks(
                generateBundleIdTask,
                collectSourcesTask,
                bundleSourcesTask,
                uploadSourceBundleTask
            )
        }
    }

    class SourceContextTasks(
        val generateBundleIdTask: TaskProvider,
        val collectSourcesTask: TaskProvider,
        val bundleSourcesTask: TaskProvider,
        val uploadSourceBundleTask: TaskProvider
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy