https://kotlinlang.org logo
#javascript
Title
# javascript
b

Bence Boros

11/02/2023, 11:53 AM
Is there a way to exclude js from the lint task? I'm getting the following error on running the
check
task for the root project
Copy code
A problem was found with the configuration of task ':core-data:common:lintAnalyzeDebug' (type 'AndroidLintAnalysisTask').
  - Gradle detected a problem with the following location: '/Users/benboros/Documents/Projects/skyhighprofits/core-data/common/build/generated/ksp/js'.
    
    Reason: Task ':core-data:common:lintAnalyzeDebug' uses this output of task ':core-data:common:kspKotlinJs' 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 ':core-data:common:kspKotlinJs' as an input of ':core-data:common:lintAnalyzeDebug'.
      2. Declare an explicit dependency on ':core-data:common:kspKotlinJs' from ':core-data:common:lintAnalyzeDebug' using Task#dependsOn.
      3. Declare an explicit dependency on ':core-data:common:kspKotlinJs' from ':core-data:common:lintAnalyzeDebug' using Task#mustRunAfter.
    
    Please refer to <https://docs.gradle.org/8.0/userguide/validation_problems.html#implicit_dependency> for more details about this problem.
* 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.
==============================================================================
And I'm getting the same exact error for every module that has android + js targets in the project. Any clues anyone?
a

Artem Kobzar

11/02/2023, 1:39 PM
@Ilya Goncharov [JB] is that our specific tasks that we could fix?
i

Ilya Goncharov [JB]

11/02/2023, 1:41 PM
I guess it is issue of interference of KSP and linter. Do you have reproducing project? And which linter do you use?
b

Bence Boros

11/02/2023, 1:58 PM
I don't have time to give you a repro project but I can share buildconfigs, etc. if that helps. I'm already blocking several people's work with this stuff. I'm using spotless with ktlint. Is there a way to just exclude kotlin/js resources from linting?
For comparison I had a similar issue with
kotlinx-resources
. Different tasks but same problem. I have (simplified) a
test-module
that depends on
main-module
, that in turn depends on
test-module
in the test classpath. I had the plugin applied to both the projects, and I was getting the same kind of error. After removing the plugin from
test-module
, no more error. https://kotlinlang.slack.com/archives/C0B8L3U69/p1696426623798019
b

Bence Boros

11/02/2023, 3:53 PM
that means you created separate modules for src / testSrc sources inside your feature/core/etc.. modules? so the structure is like: feature module -- sources module ---- commonMain/src -- test module ---- commonTest/src ? @Edoardo Luppi
e

Edoardo Luppi

11/02/2023, 4:13 PM
No I have this structure:
Copy code
modules/
  module-1/
  module-2/
  test-utils/
test-utils
is a standard module that contains
commonMain
sources. It is then imported into the other modules through
Copy code
commonTest {
  dependencies {
    ...
    implementation(projects.testUtils)
  }
}
b

Bence Boros

11/02/2023, 4:47 PM
I don't really get how it's affecting our builds tbh
i

Ilya Goncharov [JB]

11/02/2023, 6:23 PM
I don’t have time to give you a repro project but I can share buildconfigs, etc. if that helps.
Yes, it may help