gradle / gradle-native

The home of Gradle's support for natively compiled languages
https://blog.gradle.org/introducing-the-new-cpp-plugins
Apache License 2.0
93 stars 8 forks source link

Defect in Native-Samples/Cpp/Source-generation - Gradle is not generating the files #1095

Open noam1360 opened 2 years ago

noam1360 commented 2 years ago

Expected Behavior

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!

There is also a Lazy API build.gradle that is supposed to generate the files

Current Behavior

Though when built the logs show that build was successful, no files are generated and cannot be compiled

Context

These example in Native-Samples are some of the only current online C/C++ codes that use gradle and are the base for understanding and learning how to use gradle with C/C++ for most people

Steps to Reproduce (for bugs)

  1. clone this repo
  2. cd cpp/source-generation
  3. gradle clean assemble build.gradle

Your Environment

Extra Info

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. (Based on information in gradle forum)

Vampire commented 2 years ago

Here the thread for reference: https://discuss.gradle.org/t/generating-c-code-using-gradle-for-cpp-source-generation/42188