rainyl / opencv_dart

OpenCV bindings for Dart language and Flutter. Support Asynchronous Now!
https://pub.dev/packages/opencv_dart
Apache License 2.0
136 stars 18 forks source link

Android Plugin gradle task error: without declaring an explicit or implicit dependency. #225

Closed einsitang closed 2 months ago

einsitang commented 2 months ago

https://github.com/rainyl/opencv_dart/blob/e87c1af0db204b07ca06d288022c52a33ecd6586/android/build.gradle#L107-L116

you may add mustRunAfter on this task , code like :

    task(extractTaskName, type: Copy) {
        mustRunAfter "downloadLibs"   // <- here
        onlyIf {
          ABI_ACCEPTED.contains(arch) && !file("${targetDir}/libopencv_dart.so").exists()
        }
        doFirst {
            println "[opencv_dart] Extracting libraries for ${arch}..."
        }
        from tarTree(resources.gzip("${CACHE_DIR}/libopencv_dart-android-${arch}.tar.gz"))
        into targetDir
    }

I'am just upgrade opencv_dart 1.2.2

flutter run or build will output error message :

Task ':opencv_dart:opencv_dart_extract_libs_arm64-v8a' uses this output of task ':opencv_dart:downloadLibs' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

rainyl commented 2 months ago

oh, i am not very familiar with gradle.

@einsitang I noticed that you have fixed it on your fork, so could you please open a PR for that? thx~

einsitang commented 2 months ago

oh, i am not very familiar with gradle.

so am I , hahah ~~~

I can open PR to fix that .

but I'm worried not doing a wide enough test . this issue is occurred when I upgraded the gradle plugin (7.5 => 8.1) and jdk versions(11 => 17) . but I check the gradle api document (7.5)already existed : https://docs.gradle.org/7.5/dsl/org.gradle.api.Task.html#org.gradle.api.Task:mustRunAfter(java.lang.Object[])

to be on the safe side , try it in a flutter project that uses opencv_dart to test build and run :

# pubspec.yaml :
...
dependencies:
#  opencv_dart: 1.2.2
  opencv_dart:
    git:
      url: https://github.com/einsitang/opencv_dart.git
      ref: 452994e8868b4d1f547d515cb89b53f0037840ec

ensure that no other compatibility issues arise then merge this PR again

rainyl commented 2 months ago

v1.2.3 has been published, I think it's time to close this issue.

@einsitang Thanks for your contributions!