build(clean): allow delete proto/swig generated files in project
two minor bugs in Makefile:
make cleandoesn't clean the swig genereated filesHYBRIDSE_CMAKE_DEPS_FLAGS := -DHYBRIDSE_TESTING_ENABLE=OFF -DEXAMPLES_ENABLE=OFF -DPYSDK_ENABLE=OFF -DJAVASDK_ENABLE=OFFthese options are cached, simply overriding cannot change these values.
Expected Behavior
make cleanat least provide an option to clean the generated files, including swig, proto and so on.- By simply
make JAVASDK_ENABLE=ON, we can make the hybridse javasdk
Current Behavior
make cleanonly delete thebuildandhybridse/buildmake JAVASDK_ENABLE=ONdoes not work as expected
- Problem 1 Does it affected to proto generated files?
- Problem 2, a solution might rm
HYBRIDSE_ CMAKE_DEPS_FLAGS, but increase compile time.
What about the convention: not compile tests when hitting make, while keep test targets still available in build directory?
- Problem 1 Does it affected to proto generated files?
- Problem 2, a solution might rm
HYBRIDSE_ CMAKE_DEPS_FLAGS, but increase compile time.What about the convention: not compile tests when hitting
make, while keep test targets still available in build directory?
- Problem 1. If the .proto file or swig definition changes, does it re-compile atomically by executing
makeagain? If not, we have to delete all the generated files bymake clean. Otherwise, users have to manually find and delete if they change proto or swig. - Problem 2. Maybe we can change the default value in the
hybridse/CMakeLists.txt?
I think not compiling test by default is better? we can just keep the test target as what we currently do.
- Problem 1 Does it affected to proto generated files?
- Problem 2, a solution might rm
HYBRIDSE_ CMAKE_DEPS_FLAGS, but increase compile time.What about the convention: not compile tests when hitting
make, while keep test targets still available in build directory?
- Problem 1. If the .proto file or swig definition changes, does it re-compile atomically by executing
makeagain? If not, we have to delete all the generated files bymake clean. Otherwise, users have to manually find and delete if they change proto or swig.- Problem 2. Maybe we can change the default value in the
hybridse/CMakeLists.txt?I think not compiling test by default is better? we can just keep the test target as what we currently do.
Yes, should not compile tests but just openmldb binary and a few libraries used by java & python module. We need filter a little about test targets, some unittest, some integration test.
For problem 1, I made some work in #884, which will replace some of add_custom_command with add_custom_target, it will always re-run even the target file already exists.
there is two clean task:
- in build directory
make cleanin project root
each won't clean parent directories, only sub directories.
so for build's clean, it will only clean generated files inside build, which is *.pb.h. Other files inside source, e.g *_proto.java | *_swig.java, only cleaned in top project root
TODO
- [x] allow clean proto generated files
- [ ] allow clean swig generate files and libraries
In detail:
| file type | location | clean strategy |
|---|---|---|
| proto gen c headers | ${build_dir}/**/*.pb.h requires #1091 | make -C ${build_dir} clean / make clean |
| proto gen java classes | openmldb-(import/native/taskmanager/common) requires #1090 |
make clean |
| swig gen java classes | hybridse-native/openmldb-native | make clean |
| swig gen native libraries (after copy) | hybridse-native / openmldb-native | make clean |
| swig gen python files | TBD | TBD |
| swig gen python libraries | TBD | TBD |
@zhanghaohit any idea ?
two minor bugs in Makefile:
make cleandoesn't clean the swig genereated filesHYBRIDSE_CMAKE_DEPS_FLAGS := -DHYBRIDSE_TESTING_ENABLE=OFF -DEXAMPLES_ENABLE=OFF -DPYSDK_ENABLE=OFF -DJAVASDK_ENABLE=OFFthese options are cached, simply overriding cannot change these values.Expected Behavior
make cleanat least provide an option to clean the generated files, including swig, proto and so on.- By simply
make JAVASDK_ENABLE=ON, we can make the hybridse javasdkCurrent Behavior
make cleanonly delete thebuildandhybridse/buildmake JAVASDK_ENABLE=ONdoes not work as expected
problem 2 solved, now left 1, I'll change the title
another inconsistent behavior:
the compile_proto function in src/cmakelists.txt specify output to *.pb.cc only but the command actually produce multiple files e.g the java proto files.
custom command will skip next if *.pb.cc exists while java file not .