Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading source context build failure #692

Closed
ShmuelCammebys opened this issue Mar 25, 2024 · 2 comments · Fixed by #705
Closed

Uploading source context build failure #692

ShmuelCammebys opened this issue Mar 25, 2024 · 2 comments · Fixed by #705

Comments

@ShmuelCammebys
Copy link

ShmuelCammebys commented Mar 25, 2024

Platform

Android

Installed

None

Version

0.5.0

Steps to Reproduce

  1. Create a KMP project using this template (iOS, Android, Desktop).
  2. Add Sentry Multiplatform dependency to commonMain (still builds fine)
  3. Add Sentry Android Plugin to plugins block in build.gradle.kts (:composeApp)
  4. Add sentry block to build.gradle.kts (:composeApp):
sentry {
    // Enables more detailed log output, e.g. for sentry-cli.
    //
    // Default is false.
    debug.set(true)

    // Generates a JVM (Java, Kotlin, etc.) source bundle and uploads your source code to Sentry.
    // This enables source context, allowing you to see your source
    // code as part of your stack traces in Sentry.
    //
    // Default is disabled.
    includeSourceContext.set(true)

    // Includes additional source directories into the source bundle.
    // These directories are resolved relative to the project directory.
//    additionalSourceDirsForSourceContext.set(setOf("mysrc/java", "other-source-dir/main/kotlin"))

    val orgSlug = "org.slug"
    val project = "project.slug"
    val auth = "auth.token"
    org.set(orgSlug)
    projectName.set(project)
    authToken.set(auth)
}
  1. Build Android app. Compilation fails. Setting includeSourceContext to false: compilation succeeds.

Expected Result

Compilation succeeds and source context/debug symbols get uploaded to Sentry automatically.

Actual Result

Build fails:

org.gradle.internal.execution.WorkValidationException: Some problems were found with the configuration of task ':composeApp:generateSentryBundleIdDebug' (type 'GenerateBundleIdTask').
  - Gradle detected a problem with the following location: '/Users/me/Developer/KotlinMultiplatformProjects/SentryErrorReproduction/composeApp/build/generated/sources/buildConfig/androidMain'.
    
    Reason: Task ':composeApp:generateSentryBundleIdDebug' uses this output of task ':composeApp:generateAndroidMainNonAndroidBuildConfig' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':composeApp:generateAndroidMainNonAndroidBuildConfig' as an input of ':composeApp:generateSentryBundleIdDebug'.
      2. Declare an explicit dependency on ':composeApp:generateAndroidMainNonAndroidBuildConfig' from ':composeApp:generateSentryBundleIdDebug' using Task#dependsOn.
      3. Declare an explicit dependency on ':composeApp:generateAndroidMainNonAndroidBuildConfig' from ':composeApp:generateSentryBundleIdDebug' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.5/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
  - Gradle detected a problem with the following location: '/Users/me/Developer/KotlinMultiplatformProjects/SentryErrorReproduction/composeApp/build/generated/sources/buildConfig/androidDebug'.
    
    Reason: Task ':composeApp:generateSentryBundleIdDebug' uses this output of task ':composeApp:generateAndroidDebugNonAndroidBuildConfig' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':composeApp:generateAndroidDebugNonAndroidBuildConfig' as an input of ':composeApp:generateSentryBundleIdDebug'.
      2. Declare an explicit dependency on ':composeApp:generateAndroidDebugNonAndroidBuildConfig' from ':composeApp:generateSentryBundleIdDebug' using Task#dependsOn.
      3. Declare an explicit dependency on ':composeApp:generateAndroidDebugNonAndroidBuildConfig' from ':composeApp:generateSentryBundleIdDebug' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.5/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
	at org.gradle.internal.execution.WorkValidationException$BuilderWithSummary.build(WorkValidationException.java:137)
	at org.gradle.internal.execution.WorkValidationException$BuilderWithSummary.get(WorkValidationException.java:119)
	at org.gradle.internal.execution.steps.ValidateStep.throwValidationException(ValidateStep.java:178)
	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:100)
	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:55)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:71)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:45)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.executeWithNonEmptySources(SkipEmptyWorkStep.java:177)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:81)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:53)
	at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:32)
	at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:21)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
	at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:36)
	at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:23)
	at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:75)
	at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:41)
	at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.lambda$execute$2(ExecuteWorkBuildOperationFiringStep.java:66)
	at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.execute(ExecuteWorkBuildOperationFiringStep.java:66)
	at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.execute(ExecuteWorkBuildOperationFiringStep.java:38)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:32)
	at org.gradle.api.internal.tasks.execution.TaskExecution$4.withWorkspace(TaskExecution.java:293)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:21)
	at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
	at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
	at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:47)
	at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:34)
	at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:64)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:145)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:134)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:331)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:318)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.lambda$execute$0(DefaultTaskExecutionGraph.java:314)
	at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:80)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:314)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)

Sentry Build Tool Telemetry

  • Event ID: b10473389d0344a1902fa1a61b513b50
  • Timestamp: 2024-03-25T20:44:52.695Z
  • Trace ID: 601abab12825438caabeed75dde13f97
  • Span ID: 058384f5dbb24cc9
  • Relevant SID: f6033b2e-e163-468f-9ebd-ade0f1f97d8a
@romtsn
Copy link
Member

romtsn commented Apr 3, 2024

hi @ShmuelCammebys sorry for the late reply. I haven't downloaded the template project, but I can see the problem is that we depend on BuildConfig generation which might not be available at the time our gradle plugin is configured. I think it's closely related to #683, and we're planning to investigate into this soon

@buenaflor buenaflor transferred this issue from getsentry/sentry-kotlin-multiplatform Apr 11, 2024
@romtsn
Copy link
Member

romtsn commented May 16, 2024

hey @ShmuelCammebys the issue has been addressed in the version 4.6.0, which just has been published. I have not managed to reproduce the issue after the fix on the provided sample project, so I believe this works now. Please give it a try and let us know. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants