djl icon indicating copy to clipboard operation
djl copied to clipboard

Gradle Kotlin script plus other stuff

Open elect86 opened this issue 1 year ago • 10 comments
trafficstars

Description

This PR convert Gradle Groovy scripts to Kotlin, which is also recommended by Gradle, being a statically typed language

this change is backward compatible

Interesting edge cases to note here:

There a couple of TODOs which I still have to figure it out, but the 95% work is done and there for you to start looking at it so that I can already get some early feedbacks from you, folks

Also, why are you disabling the Gradle Metadata generation?

elect86 avatar May 08 '24 12:05 elect86

Let's focus on gradle changes in this PR. Would you please remove these Kotlin tests?

Absolutely, sorry, I already meant to do that, but I forgot

elect86 avatar May 13 '24 13:05 elect86

I re-sync'ed with the upstream and re-ordered the versions in libs.versions.toml alphabetically

elect86 avatar May 13 '24 14:05 elect86

Addressed last wishes plus re-sync

elect86 avatar May 14 '24 08:05 elect86

I really appreciate your contribution. But I ran into several failures:

  1. not able to compile on Mac M1 machine and windows: https://github.com/deepjavalibrary/djl/actions/runs/9076365418/job/24956766906?pr=3167#step:6:42
  2. Not able compile bom project:
cd bom
gradle build

> Configure project :
e: file:///Users/lufen/source/djl/bom/build.gradle.kts:18:13: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public val TaskContainer.projects: TaskProvider<ProjectReportTask> defined in org.gradle.kotlin.dsl
...
  1. continuous build failed: https://github.com/deepjavalibrary/djl/actions/runs/9076365418/job/24956767288?pr=3167#step:15:29

frankfliu avatar May 14 '24 15:05 frankfliu

@elect86

Still facing a few issues:

  1. Usage of layout.buildDirectory is wrong, it point to DirectoryProperty instead of Directory
  2. still got invalid flag: --release error

frankfliu avatar May 14 '24 18:05 frankfliu

the sourceCompatibility issue is fixed now, I switched from the toolchain to release option and seems fine (more here)

the error we are seeing now it's another one, which I'm gonna hunt down next

elect86 avatar May 14 '24 21:05 elect86

so, I can reproduce locally

interesting to notice, I ran gradlew clean, then ./gradlew -Dai.djl.default_engine=OnnxRuntime :integration:test

same error:

elect@elect-NUC11PHi7:~/IdeaProjects/djl$ ./gradlew -Dai.djl.default_engine=OnnxRuntime :integration:test

Task :extensions:tokenizers:processResources prebuilt or cached file found for win-x86_64/libwinpthread-1.dll prebuilt or cached file found for win-x86_64/libgcc_s_seh-1.dll prebuilt or cached file found for win-x86_64/libstdc%2B%2B-6.dll prebuilt or cached file found for win-x86_64/tokenizers.dll prebuilt or cached file found for linux-x86_64/libtokenizers.so prebuilt or cached file found for linux-aarch64/libtokenizers.so prebuilt or cached file found for osx-x86_64/libtokenizers.dylib prebuilt or cached file found for osx-aarch64/libtokenizers.dylib Downloading PyTorch model zoo metadata: fill_mask Downloading PyTorch model zoo metadata: question_answer Downloading PyTorch model zoo metadata: text_classification Downloading PyTorch model zoo metadata: text_embedding Downloading Rust model zoo metadata: text_embedding Downloading PyTorch model zoo metadata: token_classification

Task :engines:ml:xgboost:processResources Downloading https://publish.djl.ai/xgboost/2.0.3/jnilib/linux/aarch64/libxgboost4j.so

Task :engines:ml:xgboost:jar FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':engines:ml:xgboost:jar'. Cannot expand ZIP '/home/elect/IdeaProjects/djl/api/build/classes/java/main' as it is not a file.

I ran the test one another time and now I get

elect@elect-NUC11PHi7:~/IdeaProjects/djl$ ./gradlew -Dai.djl.default_engine=OnnxRuntime :integration:test

Task :engines:mxnet:jnarator:compileJava /home/elect/IdeaProjects/djl/engines/mxnet/jnarator/build/generated-src/antlr/main/ai/djl/mxnet/jnarator/parser/CParser.java:190: warning: [this-escape] possible 'this' escape before subclass is fully initialized _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); ^ /home/elect/IdeaProjects/djl/engines/mxnet/jnarator/build/generated-src/antlr/main/ai/djl/mxnet/jnarator/parser/CLexer.java:160: warning: [this-escape] possible 'this' escape before subclass is fully initialized _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); ^ 2 warnings

Task :engines:onnxruntime:onnxruntime-engine:processResources Downloading model zoo metadata: fill_mask Downloading model zoo metadata: question_answer Downloading model zoo metadata: text_classification Downloading model zoo metadata: text_embedding Downloading model zoo metadata: token_classification

Task :engines:pytorch:pytorch-jni:processResources Downloading https://publish.djl.ai/pytorch/2.2.2/jnilib/0.28.0/linux-x86_64/cpu/libdjl_torch.so Downloading https://publish.djl.ai/pytorch/2.2.2/jnilib/0.28.0/linux-x86_64/cpu-precxx11/libdjl_torch.so Downloading https://publish.djl.ai/pytorch/2.2.2/jnilib/0.28.0/linux-aarch64/cpu-precxx11/libdjl_torch.so Downloading https://publish.djl.ai/pytorch/2.2.2/jnilib/0.28.0/osx-aarch64/cpu/libdjl_torch.dylib Downloading https://publish.djl.ai/pytorch/2.2.2/jnilib/0.28.0/win-x86_64/cpu/djl_torch.dll Downloading https://publish.djl.ai/pytorch/2.2.2/jnilib/0.28.0/linux-x86_64/cu121/libdjl_torch.so Downloading https://publish.djl.ai/pytorch/2.2.2/jnilib/0.28.0/linux-x86_64/cu121-precxx11/libdjl_torch.so Downloading https://publish.djl.ai/pytorch/2.2.2/jnilib/0.28.0/win-x86_64/cu121/djl_torch.dll Downloading https://publish.djl.ai/pytorch/2.2.2/jnilib/0.28.0/osx-x86_64/cpu/libdjl_torch.dylib

Task :integration:test FAILED

Gradle suite > Gradle test > ai.djl.CoverageTest > test FAILED java.lang.NoClassDefFoundError at CoverageTest.java:34 Caused by: java.lang.ClassNotFoundException at CoverageTest.java:34

Gradle suite > Gradle test > ai.djl.integration.IntegrationTests > runIntegrationTests FAILED java.lang.NoClassDefFoundError at IntegrationTests.java:56 Caused by: java.lang.ClassNotFoundException at IntegrationTests.java:56

elect86 avatar May 15 '24 10:05 elect86

running ml:xgboost:jar after a clean lead to the same not a file error

elect86 avatar May 15 '24 10:05 elect86

Ok, I fixed the first error

now I have both local and CI crashing with the same last error above

elect86 avatar May 15 '24 10:05 elect86

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 63.53%. Comparing base (5c691c0) to head (f9abfc2). Report is 20 commits behind head on master.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3167      +/-   ##
============================================
- Coverage     68.41%   63.53%   -4.89%     
+ Complexity     7027     6451     -576     
============================================
  Files           697      697              
  Lines         32759    32790      +31     
  Branches       3406     3416      +10     
============================================
- Hits          22413    20833    -1580     
- Misses         8737    10380    +1643     
+ Partials       1609     1577      -32     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 20 '24 16:05 codecov-commenter