Generating C++ code using gradle for cpp\source-generation

In gradles github repo for c, c++, swift samples of modern build automation for native languages with Gradle (Gardle/Native-Samples) there is a project in the cpp folder called source-generation. This project is supposed to generate a cpp and header file in a folder labeled build. According to the readme the correct way to generate and compile this build is:

> cd cpp/source-generation
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
Hello, World!

but that doesn’t seem so work, neither does using the lazy API build.gradle.
Any one get this to work or have any incite?

I guess you found a Gradle bug that you should report.
In the example the directory properties miss their task dependency.
If you instead make the two properties abstract getter methods, the task dependency is maintained as expected and the build works like intended.

Maybe post the issue link here too for others as reference. :slight_smile:

There are currently almost 100 different issues with C++ in the gradles issues but never the less I added this one so I hope its not a duplicate :blush:
Link to issue

1 Like