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

[autobuild] org.gradle.execution.TaskSelectionException: Task 'testClasses' not found in root project 'xx' and its subprojects. #1417

Closed
hongbo-miao opened this issue Dec 3, 2022 · 22 comments

Comments

@hongbo-miao
Copy link

hongbo-miao commented Dec 3, 2022

I have a brand new "Hello World" Android project created by Android Studio called HMMobile.
I am trying to enable CodeQL (Java).

Here is the minimum reproduction repo: https://github.com/Hongbo-Miao/bug-codeql-java

CodeQL full error log

In the CodeQL autobuild step, these lines worth mentioning:

  [2022-12-04 00:02:09] [autobuild] > ./gradlew --no-daemon -S -Dorg.gradle.dependency.verification=off --init-script "/tmp/semmleTempDir/init.gradle" testClasses
  [2022-12-04 00:02:09] [autobuild] Picked up JAVA_TOOL_OPTIONS:  -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
  [2022-12-04 00:02:10] [autobuild] To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.4/userguide/gradle_daemon.html#sec:disabling_the_daemon.
  [2022-12-04 00:02:11] [autobuild] Daemon will be stopped at the end of the build 
  [2022-12-04 00:02:18] [autobuild] FAILURE: Build failed with an exception.
  [2022-12-04 00:02:18] [autobuild] * What went wrong:
  [2022-12-04 00:02:18] [autobuild] Task 'testClasses' not found in root project 'HMMobile'.
  [2022-12-04 00:02:18] [autobuild] * Try:
  [2022-12-04 00:02:18] [autobuild] > Run gradlew tasks to get a list of available tasks.
  [2022-12-04 00:02:18] [autobuild] > Run with --info or --debug option to get more log output.
  [2022-12-04 00:02:18] [autobuild] > Run with --scan to get full insights.
  [2022-12-04 00:02:18] [autobuild] * Exception is:
  [2022-12-04 00:02:18] [autobuild] org.gradle.execution.TaskSelectionException: Task 'testClasses' not found in root project 'HMMobile'.

My code has no testClasses inside. I am wondering why does CodeQL run the command with testClasses?

./gradlew --no-daemon -S -Dorg.gradle.dependency.verification=off --init-script "/tmp/semmleTempDir/init.gradle" testClasses

(For default Android project created by Android Studio, the command to build is just ./gradlew build. The command for unit test is ./gradlew test)

Any guide to help fix would be appreciate. Thanks! 😃

@hvitved
Copy link

hvitved commented Dec 6, 2022

@github/codeql-kotlin : Can you take a look, please?

@smowton
Copy link
Contributor

smowton commented Dec 6, 2022

I've identified the change we need to make; hope to have a fix PR today.

@smowton
Copy link
Contributor

smowton commented Dec 12, 2022

The fix has been merged and will ship in the next CodeQL release after Christmas (expected mid-January). The cause was standard Android Gradle projects no longer explicitly referencing com.android.tools.build:gradle as of earlier this year, and consequently our autobuild heuristic to recognise such a project and avoid using the non-existent testClasses target no longer worked.

@smowton smowton closed this as completed Dec 12, 2022
@hongbo-miao
Copy link
Author

hongbo-miao commented Dec 15, 2022

Hi @smowton I am wondering is there any alpha/beta version we can test? Thanks!
Because if we wait until mid-January and then found still not working as expected. Then need another one or two months to test next version.

@smowton
Copy link
Contributor

smowton commented Dec 16, 2022

@hongbo-miao you could try this nightly build: https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20221216/codeql-bundle-$os.tar.gz

Where $os is linux64, osx64 or win64.

You can also use that in a Code Scanning environment by passing that URL as the tools parameter to the codeql/init action.

As always with a nightly build, there is absolutely no guarantee of quality as this is lightly tested at this stage -- you should switch back to a regular release ASAP.

@hongbo-miao
Copy link
Author

hongbo-miao commented Dec 16, 2022

Thanks @smowton ! With

jobs:
  codql:
    name: CodeQL
    runs-on: ubuntu-22.04
    timeout-minutes: 20
    steps:
      - name: Cancel previous runs
        uses: styfle/cancel-workflow-action@0.11.0
        with:
          access_token: ${{ github.token }}
      - name: Checkout
        uses: actions/checkout@v3
      - name: Initialize CodeQL
        uses: github/codeql-action/init@v2
        with:
          tools: https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20221216/codeql-bundle-linux64.tar.gz
          languages: java
      - name: Autobuild
        uses: github/codeql-action/autobuild@v2
      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v2

I can confirm in my minimum reproduction repo, it succeed using nightly build version:

However, same source code and same GitHub Actions CodeQL config, in my original repo, it still failed:

Copy of failure log
Run github/codeql-action/autobuild@v2
Attempting to automatically build java code
/opt/hostedtoolcache/CodeQL/0.0.0-20221216/x64/codeql/codeql version --format=terse
2.11.6+202212151926
/opt/hostedtoolcache/CodeQL/0.0.0-20221216/x64/codeql/java/tools/autobuild.sh
Picked up JAVA_TOOL_OPTIONS:  -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
[2022-12-16 18:47:09] Build directory is /home/runner/work/hongbomiao.com/hongbomiao.com/./mobile-android
[2022-12-16 18:47:09] [autobuild] > chmod +x gradlew
[2022-12-16 18:47:09] [autobuild] > ./gradlew --no-daemon -S -Dorg.gradle.dependency.verification=off --init-script "/tmp/semmleTempDir/init.gradle" clean
[2022-12-16 18:47:09] [autobuild] Picked up JAVA_TOOL_OPTIONS:  -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
[2022-12-16 18:47:10] [autobuild] Downloading https://services.gradle.org/distributions/gradle-7.6-bin.zip
[2022-12-16 18:47:12] [autobuild] ...........10%............20%...........30%............40%............50%...........60%............70%............80%...........90%............100%
[2022-12-16 18:47:13] [autobuild] Welcome to Gradle 7.6!
[2022-12-16 18:47:13] [autobuild] Here are the highlights of this release:
[2022-12-16 18:47:13] [autobuild]  - Added support for Java 19.
[2022-12-16 18:47:13] [autobuild]  - Introduced `--rerun` flag for individual task rerun.
    '[2022-12-16 18:48:26] [autobuild] Picked up JAVA_TOOL_OPTIONS:  -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false\n' +
    '[2022-12-16 18:48:27] [autobuild] To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.6/userguide/gradle_daemon.html#sec:disabling_the_daemon.\n' +
    '[2022-12-16 18:48:28] [autobuild] Daemon will be stopped at the end of the build \n' +
    '[2022-12-16 18:48:[35](https://github.com/Hongbo-Miao/hongbomiao.com/actions/runs/3715712302/jobs/6301195064#step:5:36)] [autobuild] FAILURE: Build failed with an exception.\n' +
    '[2022-12-16 18:48:35] [autobuild] * What went wrong:\n' +
    "[2022-12-16 18:48:35] [autobuild] Task 'testClasses' not found in root project 'HMMobile' and its subprojects.\n" +
    '[2022-12-16 18:48:35] [autobuild] * Try:\n' +
    '[2022-12-16 18:48:35] [autobuild] > Run gradlew tasks to get a list of available tasks.\n' +
    '[2022-12-16 18:48:35] [autobuild] > Run with --info or --debug option to get more log output.\n' +
    '[2022-12-16 18:48:35] [autobuild] > Run with --scan to get full insights.\n' +
    '[2022-12-16 18:48:35] [autobuild] * Exception is:\n' +
    "[2022-12-16 18:48:35] [autobuild] org.gradle.execution.TaskSelectionException: Task 'testClasses' not found in root project 'HMMobile' and its subprojects.\n" +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.execution.DefaultTaskSelector.getSelection(DefaultTaskSelector.java:86)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.execution.selection.DefaultBuildTaskSelector.resolveTaskName(DefaultBuildTaskSelector.java:97)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.execution.commandline.CommandLineTaskParser.parseTasks(CommandLineTaskParser.java:49)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.execution.TaskNameResolvingBuildTaskScheduler.scheduleRequestedTasks(TaskNameResolvingBuildTaskScheduler.java:50)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.execution.DefaultTasksBuildTaskScheduler.scheduleRequestedTasks(DefaultTasksBuildTaskScheduler.java:72)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.initialization.DefaultTaskExecutionPreparer.lambda$scheduleRequestedTasks$0(DefaultTaskExecutionPreparer.java:46)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.Factories$1.create(Factories.java:31)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.work.DefaultWorkerLeaseService.withReplacedLocks(DefaultWorkerLeaseService.java:345)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.api.internal.project.DefaultProjectStateRegistry$DefaultBuildProjectRegistry.withMutableStateOfAllProjects(DefaultProjectStateRegistry.java:205)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.api.internal.project.DefaultProjectStateRegistry$DefaultBuildProjectRegistry.withMutableStateOfAllProjects(DefaultProjectStateRegistry.java:198)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.initialization.DefaultTaskExecutionPreparer.scheduleRequestedTasks(DefaultTaskExecutionPreparer.java:45)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.initialization.VintageBuildModelController.lambda$scheduleRequestedTasks$0(VintageBuildModelController.java:76)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.model.StateTransitionController.lambda$inState$1(StateTransitionController.java:110)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.model.StateTransitionController.lambda$inState$2(StateTransitionController.java:125)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.model.StateTransitionController.inState(StateTransitionController.java:121)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.model.StateTransitionController.inState(StateTransitionController.java:109)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.initialization.VintageBuildModelController.scheduleRequestedTasks(VintageBuildModelController.java:76)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.build.DefaultBuildLifecycleController$DefaultWorkGraphBuilder.addRequestedTasks(DefaultBuildLifecycleController.java:255)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.buildtree.DefaultBuildTreeWorkPreparer.lambda$scheduleRequestedTasks$0(DefaultBuildTreeWorkPreparer.java:[38](https://github.com/Hongbo-Miao/hongbomiao.com/actions/runs/3715712302/jobs/6301195064#step:5:39))\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.build.DefaultBuildLifecycleController.lambda$populateWorkGraph$3(DefaultBuildLifecycleController.java:143)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.build.DefaultBuildWorkPreparer.populateWorkGraph(DefaultBuildWorkPreparer.java:42)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.build.BuildOperationFiringBuildWorkPreparer$PopulateWorkGraph.populateTaskGraph(BuildOperationFiringBuildWorkPreparer.java:120)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.build.BuildOperationFiringBuildWorkPreparer$PopulateWorkGraph.run(BuildOperationFiringBuildWorkPreparer.java:91)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.build.BuildOperationFiringBuildWorkPreparer.populateWorkGraph(BuildOperationFiringBuildWorkPreparer.java:68)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.build.DefaultBuildLifecycleController.lambda$populateWorkGraph$4(DefaultBuildLifecycleController.java:143)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.model.StateTransitionController.lambda$inState$1(StateTransitionController.java:110)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.model.StateTransitionController.lambda$inState$2(StateTransitionController.java:125)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.model.StateTransitionController.inState(StateTransitionController.java:121)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.model.StateTransitionController.inState(StateTransitionController.java:109)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.build.DefaultBuildLifecycleController.populateWorkGraph(DefaultBuildLifecycleController.java:143)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.build.DefaultBuildWorkGraphController$DefaultBuildWorkGraph.populateWorkGraph(DefaultBuildWorkGraphController.java:148)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.composite.internal.DefaultBuildController.populateWorkGraph(DefaultBuildController.java:73)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.composite.internal.DefaultIncludedBuildTaskGraph$DefaultBuildTreeWorkGraphBuilder.withWorkGraph(DefaultIncludedBuildTaskGraph.java:150)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.buildtree.DefaultBuildTreeWorkPreparer.lambda$scheduleRequestedTasks$1(DefaultBuildTreeWorkPreparer.java:38)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.composite.internal.DefaultIncludedBuildTaskGraph$DefaultBuildTreeWorkGraph$1.run(DefaultIncludedBuildTaskGraph.java:197)\n' +
    '[2022-12-16 18:48:35] [autobuild] \tat org.gradle.internal.operations.DefaultBuildOperationRunner$1.execu'... 1[40](https://github.com/Hongbo-Miao/hongbomiao.com/actions/runs/3715712302/jobs/6301195064#step:5:41)00 more characters
}

The only difference is my original repo is a mono repo. The same Android source code is under a folder /mobile-android.

@smowton
Copy link
Contributor

smowton commented Dec 16, 2022

Hah, well, when I wrote my original fix I said "huh, I notice we only seem to consider Groovy build scripts when checking if the user's project looks like a Droid project, and we should consider Kotlin scripts too. There are a few other places where this applies too though; we should address the Groovy/Kotlin issue properly at a later date"

Well it looks like that later date came pretty quickly! I will take a look at this soon, though at this point I'm away for Christmas, so I'll come back to the question on Jan 3rd.

@hongbo-miao
Copy link
Author

Thanks @smowton ! Happy holidays! 🎄
(Worth keeping the ticket open to avoid forgetting though)

@hongbo-miao
Copy link
Author

Hi @smowton just in case you forget. Can we reopen this ticket? 😃

@smowton
Copy link
Contributor

smowton commented Jan 6, 2023

I've written a candidate fix -- if it passes review it'll get into the release after next, ETA ~24th January

@bcarterterp
Copy link

Is there any way to link the PR for visibility? Excited that there is a fix in the works for this issue!

@smowton
Copy link
Contributor

smowton commented Jan 11, 2023

The fix is in a private repo I'm afraid -- if you have the rights to see it, you'll see a mention; otherwise I'm afraid this issue is the place to watch :)

@smowton
Copy link
Contributor

smowton commented Jan 23, 2023

@hongbo-miao @bcarterterp support for Android project detection when Kotlin build scripts are used has been merged; it should begin to roll out publicly in the next-but-one release, expected in roughly 2.5 weeks.

@kevalpatel2106
Copy link

kevalpatel2106 commented Feb 25, 2023

Hi @smowton, any update on the release? Is this fix released? Still getting the error on AGP 7.4.1 .

On that note, I notice that my codeQL workflow from 12th Feb was using assemble task in auto build and now, it started using testClasses task. I tried downgrading the action to the previous release, but still it didn't work. Did auto build change the task it runs because of some reason??

@smowton
Copy link
Contributor

smowton commented Feb 27, 2023

The heuristic to spot an Android project is to look for a reference to the Android build tools in the root build.gradle file, which as of kevalpatel2106/pocket-ci@a609ba0#diff-49a96e7eea8a94af862798a45174e6ac43eb4f8b4bd40759b5da63ba31ec3ef7 is no longer true.

You will need instead to replace the autobuild step with a manual build command, such as ./gradlew --no-daemon assemble (or anything that builds the Java you want to analyse, and ideally spends as little time as possible doing extraneous things such as building other code, running tests, etc). Note the need for --no-daemon because this can inhibit the build tracing that CodeQL uses to determine how your code fits together.

@kevalpatel2106
Copy link

kevalpatel2106 commented Feb 27, 2023

@smowton Is it possible to change this to use an android application or android library plugins to identify the Android project as I see this is now the standard template from AS to generate a new project!

@smowton
Copy link
Contributor

smowton commented Feb 27, 2023

It does look for those plugins, but since your top-level file uses the alias libs.plugins.android.application you side-step the heuristic :)

There are more ambitious things we can do of course like tap into Gradle's actual plugin resolution mechanism, but the number of relevant projects gets smaller and the effort larger as we tackle increasingly niche use cases.

@hongbo-miao
Copy link
Author

hongbo-miao commented Feb 28, 2023

Hi @smowton I just tested again, and it still didn't fix 🥲
Would you mind reopening this ticket until it confirmed fixed or if you prefer we opening a new ticket? Thank you!

The latest build log

Run github/codeql-action/autobuild@v2
Attempting to automatically build java code
  /opt/hostedtoolcache/CodeQL/2.12.2-20230207/x64/codeql/codeql version --format=terse
  2.12.2
  /opt/hostedtoolcache/CodeQL/2.12.2-20230207/x64/codeql/java/tools/autobuild.sh
  Picked up JAVA_TOOL_OPTIONS:  -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
  [2023-02-28 09:07:22] Build directory is /home/runner/work/hongbomiao.com/hongbomiao.com/./mobile-android
  [2023-02-28 09:07:22] [autobuild] > chmod +x gradlew
  [2023-02-28 09:07:22] [autobuild] > ./gradlew --no-daemon -S -Dorg.gradle.dependency.verification=off --init-script "/tmp/semmleTempDir/init.gradle" clean
  [2023-02-28 09:07:22] [autobuild] Picked up JAVA_TOOL_OPTIONS:  -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
  [2023-02-28 09:07:24] [autobuild] Downloading https://services.gradle.org/distributions/gradle-7.6.1-bin.zip
  [2023-02-28 09:07:27] [autobuild] ...........10%............20%...........30%............40%............50%...........60%............70%............80%...........90%............100%
  [2023-02-28 09:07:28] [autobuild] Welcome to Gradle 7.6.1!
  [2023-02-28 09:07:28] [autobuild] Here are the highlights of this release:
  [2023-02-28 09:07:28] [autobuild]  - Added support for Java 19.
  [2023-02-28 09:07:28] [autobuild]  - Introduced `--rerun` flag for individual task rerun.
  [2023-02-28 09:07:28] [autobuild]  - Improved dependency block for test suites to be strongly typed.
  [2023-02-28 09:07:28] [autobuild]  - Added a pluggable system for Java toolchains provisioning.
  [2023-02-28 09:07:28] [autobuild] For more details see https://docs.gradle.org/7.6.1/release-notes.html
  [2023-02-28 09:07:29] [autobuild] To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.6.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
  [2023-02-28 09:07:30] [autobuild] Daemon will be stopped at the end of the build 
  [2023-02-28 09:08:57] [autobuild] > Task :app:clean UP-TO-DATE
  [2023-02-28 09:08:57] [autobuild] BUILD SUCCESSFUL in 1m 33s
  [2023-02-28 09:08:57] [autobuild] 1 actionable task: 1 up-to-date
  [2023-02-28 09:08:57] [autobuild] > ./gradlew --no-daemon -S -Dorg.gradle.dependency.verification=off --init-script "/tmp/semmleTempDir/init.gradle" assemble
  [2023-02-28 09:08:57] [autobuild] Picked up JAVA_TOOL_OPTIONS:  -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
  [2023-02-28 09:08:58] [autobuild] To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.6.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
  [2023-02-28 09:09:00] [autobuild] Daemon will be stopped at the end of the build 
  [2023-02-28 09:09:12] [autobuild] > Task :app:preBuild UP-TO-DATE
  [2023-02-28 09:09:12] [autobuild] > Task :app:preDebugBuild UP-TO-DATE
  [2023-02-28 09:09:12] [autobuild] > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
  [2023-02-28 09:09:12] [autobuild] > Task :app:compileDebugAidl NO-SOURCE
  [2023-02-28 09:09:12] [autobuild] > Task :app:compileDebugRenderscript NO-SOURCE
  [2023-02-28 09:09:12] [autobuild] > Task :app:generateDebugBuildConfig
  [2023-02-28 09:09:24] [autobuild] > Task :app:generateDebugResValues
  [2023-02-28 09:09:24] [autobuild] > Task :app:checkDebugAarMetadata
  [2023-02-28 09:09:25] [autobuild] > Task :app:mapDebugSourceSetPaths
  [2023-02-28 09:09:25] [autobuild] > Task :app:generateDebugResources
  [2023-02-28 09:09:27] [autobuild] > Task :app:packageDebugResources
  [2023-02-28 09:09:28] [autobuild] > Task :app:mergeDebugResources
  [2023-02-28 09:09:29] [autobuild] > Task :app:createDebugCompatibleScreenManifests
  [2023-02-28 09:09:29] [autobuild] > Task :app:extractDeepLinksDebug
  [2023-02-28 09:09:29] [autobuild] > Task :app:parseDebugLocalResources
  [2023-02-28 09:09:30] [autobuild] > Task :app:processDebugMainManifest
  [2023-02-28 09:09:30] [autobuild] > Task :app:processDebugManifest
  [2023-02-28 09:09:30] [autobuild] > Task :app:javaPreCompileDebug
  [2023-02-28 09:09:30] [autobuild] > Task :app:processDebugManifestForPackage
  [2023-02-28 09:09:31] [autobuild] > Task :app:mergeDebugShaders
  [2023-02-28 09:09:31] [autobuild] > Task :app:compileDebugShaders NO-SOURCE
  [2023-02-28 09:09:31] [autobuild] > Task :app:generateDebugAssets UP-TO-DATE
  [2023-02-28 09:09:32] [autobuild] > Task :app:mergeDebugAssets
  [2023-02-28 09:09:32] [autobuild] > Task :app:compressDebugAssets
  [2023-02-28 09:09:32] [autobuild] > Task :app:processDebugJavaRes NO-SOURCE
  [2023-02-28 09:09:33] [autobuild] > Task :app:processDebugResources
  [2023-02-28 09:09:33] [autobuild] > Task :app:checkDebugDuplicateClasses
  [2023-02-28 09:09:[38](https://github.com/Hongbo-Miao/hongbomiao.com/actions/runs/4291275133/jobs/7476261655#step:4:39)] [autobuild] > Task :app:desugarDebugFileDependencies
  [2023-02-28 09:09:42] [autobuild] e: com.semmle.extractor.java.interceptors.KotlinInterceptor$KotlinVersionTooRecentError: Kotlin version 1.8.10 is too recent. CodeQL currently supports versions below 1.8.10
  [2023-02-28 09:09:42] [autobuild] 	at com.semmle.extractor.java.interceptors.KotlinInterceptor.getExtractorJarPath(KotlinInterceptor.java:148)
  [2023-02-28 09:09:42] [autobuild] 	at com.semmle.extractor.java.interceptors.KotlinInterceptor.beforeKotlinExecute(KotlinInterceptor.java:[39](https://github.com/Hongbo-Miao/hongbomiao.com/actions/runs/4291275133/jobs/7476261655#step:4:40)8)
  [2023-02-28 09:09:[42](https://github.com/Hongbo-Miao/hongbomiao.com/actions/runs/4291275133/jobs/7476261655#step:4:43)] [autobuild] 	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.SEMMLE_INTERCEPT$0(K2JVMCompiler.kt)
  [2023-02-28 09:09:42] [autobuild] 	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt)
  [2023-02-28 09:09:42] [autobuild] 	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:53)
  [2023-02-28 09:09:42] [autobuild] 	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:101)
  [2023-02-28 09:09:42] [autobuild] 	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:[47](https://github.com/Hongbo-Miao/hongbomiao.com/actions/runs/4291275133/jobs/7476261655#step:4:48))
      '[2023-02-28 09:10:26] [autobuild] FAILURE: Build failed with an exception.\n' +
      '[2023-02-28 09:10:26] [autobuild] * What went wrong:\n' +
      "[2023-02-28 09:10:26] [autobuild] Execution failed for task ':app:compileDebugKotlin'.\n" +
      '[2023-02-28 09:10:26] [autobuild] > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction\n' +
      '[2023-02-28 09:10:26] [autobuild]    > Internal compiler error. See log for more details\n' +
      '[2023-02-28 09:10:26] [autobuild] * Try:\n' +
      '[2023-02-28 09:10:26] [autobuild] > Run with --info or --debug option to get more log output.\n' +
      '[2023-02-28 09:10:26] [autobuild] > Run with --scan to get full insights.\n' +
      '[2023-02-28 09:10:26] [autobuild] * Exception is:\n' +
      "[2023-02-28 09:10:26] [autobuild] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugKotlin'.\n" +
      '[2023-02-28 09:10:26] [autobuild] \tat org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:142)\n' +
      '[2023-02-28 09:10:26] [autobuild] \tat org.gradle.internal.T'... 3[58](https://github.com/Hongbo-Miao/hongbomiao.com/actions/runs/4291275133/jobs/7476261655#step:4:59)15 more characters
  }

@smowton
Copy link
Contributor

smowton commented Feb 28, 2023

@hongbo-miao this is an unrelated problem that you're using a very recently-released Kotlin version:

Kotlin version 1.8.10 is too recent. CodeQL currently supports versions below 1.8.10

Thankfully CodeQL 2.12.3, released last Thursday, introduces support. If you add tools: latest to your CodeQL init step (like this: https://github.com/JarLob/Orchard/blob/1d3cdbccc251c3db5d83f104017ae660adb332a4/.github/workflows/codeql.yml#L79) then you should pick up the very latest CodeQL release.

If that works for you, set a reminder to remove tools: latest in a couple of weeks, as that option causes an extra package download during the init step.

@hongbo-miao
Copy link
Author

hongbo-miao commented Mar 1, 2023

Confirmed it has been fixed, thank you so much @smowton ! 🚀

@vorburger
Copy link

Is this really fixed? FYI we're seeing this exact same problem (org.gradle.execution.TaskSelectionException: Task 'testClasses' not found in root project 'android-fhir' and its subprojects.) on google/android-fhir#2205, for google/android-fhir#2185 with uses: github/codeql-action/autobuild@v2.

@smowton
Copy link
Contributor

smowton commented Sep 27, 2023

For most users, yes -- we look for one of com.android.tools.build:gradle, com.android.application or com.android.library in your top-level build file, which is typical of Droid projects. Your project is configured differently though so its use of Android is not noticed. In this instance the right thing is to specify a manual build command, as I see you have done in the interim.

icrc-fdeniger added a commit to icrc-fdeniger/android-fhir that referenced this issue Nov 22, 2024
icrc-fdeniger added a commit to icrc-fdeniger/android-fhir that referenced this issue Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants