bytedeco / gradle-javacpp

Gradle plugins to automate the build process of JavaCPP and JavaCV
Other
56 stars 20 forks source link

Not possible to build with newer Gradle #23

Closed ghost closed 1 year ago

ghost commented 2 years ago

Trying with latest Gradle...

javacppBuildCommand {
    // typically set here the buildCommand to the script that fills up includePath and linkPath
}

javacppBuildParser {
    // typically set here the classOrPackageNames to class names implementing InfoMap
}

javacppBuildCompiler {
    // typically set here boolean flags like copyLibs
}

tasks.withType(org.bytedeco.gradle.javacpp.BuildTask) {
    // set here default values for all build tasks below, typically just includePath and linkPath,
    // but also properties to set the path to the NDK and its compiler in the case of Android
    generate = true;
    compile = false;
    outputDirectory = new File("src/main/cpp");
}

Result:

> Task :javacppBuildParser FAILED
Execution optimizations have been disabled for task ':javacppBuildParser' to ensure correctness due to the following reasons:
  - Additional action of task ':javacppBuildParser' was implemented by the Java lambda 'org.bytedeco.gradle.javacpp.BuildPlugin$$Lambda$814/0x00000008012f1af0'. Reason: Using Java lambdas is not supported as task inputs. Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#implementation_unknown for more details about this problem.

Execution failed for task ':javacppBuildParser'.
> net/fabricmc/api/ModInitializer

* 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.
saudet commented 2 years ago

It looks like Gradle doesn't like lambda expressions, so I've removed them in commit https://github.com/bytedeco/gradle-javacpp/commit/f80b2f3cdffeb468a88ae1cbd10d4ef838f94d89. Please give it a try with the snapshots: http://bytedeco.org/builds/

ghost commented 2 years ago
Could not find javacpp-1.5.8-SNAPSHOT-android-arm.jar (org.bytedeco:javacpp:1.5.8-SNAPSHOT:20220604.134533-338).
Searched in the following locations:
    https://oss.sonatype.org/content/repositories/snapshots/org/bytedeco/javacpp/1.5.8-SNAPSHOT/javacpp-1.5.8-20220604.134533-338-android-arm.jar

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
saudet commented 2 years ago

The builds haven't finished, you'll need to wait until they do.

ghost commented 2 years ago

I had to make some edits to my project. The thing is that I'm developing a mod for Minecraft. JavaCpp doesn't know about the existence of net.fabricmc.api.ModInitializer; or any other third-party libraries.

tasks.withType(org.bytedeco.gradle.javacpp.BuildTask).configureEach {
    // set here default values for all build tasks below, typically just includePath and linkPath,
    // but also properties to set the path to the NDK and its compiler in the case of Android
    generate = true;
    compile = false;
    outputDirectory = file("$buildDir/../src/main/cpp");
    classOrPackageNames = ['org.helixd2s.yavulkanmod.alter.*'];
}
saudet commented 2 years ago

If it's having problems finding a class you need, you'll need to add those to the class path with the buildscript { } block: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies

saudet commented 2 years ago

We can have multiple BuildTask, that's not a problem.

saudet commented 2 years ago

You'll need to create those tasks.

saudet commented 2 years ago

You probably won't be able to target the same files with more than one BuildTask, if that's what you're asking, that's normal.

saudet commented 1 year ago

The fix for this issue has been released with version 1.5.8. Thanks for reporting!