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

Build error caused by Lint rule ktlintMainSourceSetCheck #720

Open
jayshah123 opened this issue Aug 30, 2024 · 3 comments
Open

Build error caused by Lint rule ktlintMainSourceSetCheck #720

jayshah123 opened this issue Aug 30, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@jayshah123
Copy link

jayshah123 commented Aug 30, 2024

Describe the bug

Android build is affected by lint during RN build.
Ideally check tasks do not make sense to run on a shipped library? esp like RN.
We see build error on check tasks and that too of test files.

Reproduction steps

Run android build via npx react-native run-android

SDK logs

> Task :datadog_mobile-react-native:ktlintMainSourceSetCheck FAILED
/Users/jshah/workstuff/my-sample-app/node_modules/@datadog/mobile-react-native/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt:19:1 Unexpected indentation (4) (should be 2)
/Users/jshah/workstuff/my-sample-app/node_modules/@datadog/mobile-react-native/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt:20:1 Unexpected indentation (8) (should be 4)

...

> Task :app:bundleReleaseJsAndAssets
Execution optimizations have been disabled for task ':app:bundleReleaseJsAndAssets' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/jshah/workstuff/my-sample-app'. Reason: Task ':app:bundleReleaseJsAndAssets' uses this output of task ':datadog_mobile-react-native:bundleDebugAar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: '/Users/jshah/workstuff/my-sample-app'. Reason: Task ':app:bundleReleaseJsAndAssets' uses this output of task ':datadog_mobile-react-native:bundleLibCompileToJarDebug' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.

...

> Task :datadog_mobile-react-native:ktlintTestSourceSetCheck FAILED
/Users/jshah/workstuff/my-sample-app/node_modules/@datadog/mobile-react-native/android/src/test/kotlin/com/datadog/reactnative/DdLogsTest.kt:38:1 Unexpected indentation (4) (should be 2)
/Users/jshah/workstuff/my-sample-app/node_modules/@datadog/mobile-react-native/android/src/test/kotlin/com/datadog/reactnative/DdLogsTest.kt:39:1 Unexpected indentation (4) (should be 2)

...
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':datadog_mobile-react-native:ktlintMainSourceSetCheck'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.ConsoleReportWorkAction
   > KtLint found code style violations. Please see the following reports:
     - /Users/jshah/workstuff/my-sample-app/node_modules/@datadog/mobile-react-native/android/build/reports/ktlint/ktlintMainSourceSetCheck/ktlintMainSourceSetCheck.txt

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

Expected behavior

No build error should be present

Affected SDK versions

"@datadog/[email protected]"

Latest working SDK version

"@datadog/[email protected]"

Did you confirm if the latest SDK version fixes the bug?

No, cannot easily upgrade

Integration Methods

Yarn

React Native Version

0.68.2

Package.json Contents

No response

iOS Setup

No response

Android Setup

No response

Device Information

Android emulator

Other relevant information

No response

@jayshah123 jayshah123 added the bug Something isn't working label Aug 30, 2024
@jayshah123 jayshah123 changed the title Build error caused by Lint rule Build error caused by Lint rule ktlintMainSourceSetCheck Aug 30, 2024
@marco-saia-datadog
Copy link
Member

Hi @jayshah123 👋

Thank you for reaching out! I see that you are using @datadog/[email protected], which was released on Jun 8, 2023.

I would suggest updating to the latest version, where the problem should not persist. We will double check the issue in the meantime.

Is there anything blocking you from updating the SDK?

@jayshah123
Copy link
Author

I believe an RN upgrade might be needed. Is there a compatibility table available? Or all versions of your lib compatible with older versions of RN?

@marco-saia-datadog
Copy link
Member

Our latest release supports v0.68.2, you can try updating and reach out if you encounter any issues.

If you have other Datadog packages installed, please make sure they have matching versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants