Open alex116 opened 5 years ago
I couldn't let this otherwise good project go to waste so I hacked away at it... I probably did a terrible job and caused many incompatibilities with other setups/configurations but I'm putting ruby on my CV from now on.
I use:
#include "strings/mock_utils.h"
#include "time/mock_utils.h"
in my test file.
I now generate the mocks to:
build/test/mocks/src/helpers/strings/mock_utils.*
build/test/mocks/src/helpers/time/mock_utils.*
I #include "src/helpers/time/utils.h"
in time/mock_utils.h and
#include "src/helpers/strings/utils.h"
in strings/mock_utils.h when they get generated.
They build to
build/test/out/c/src/helpers/**/mock_utils.o
I added something to the project.yml ./. to the src path - because of the new #include in the mock (it's relative to "src") build/test/mocks/** so we can find the newly generated files in the subfolders
@alex116 any chance you could share the changes you had to make for this to work? Thanks in advance!
indeed. this is an often-requested feature. If I don't have to start from scratch, that would be great.
I edited my projects' ceedling installation how would I best share this? Uploading the vendor folder would probably be easiest on my part. What do you think?
If you have any diff tools on your machine, you could compare your version to the last released version and create a patch file? If not, zipping it up and putting it somewhere for one of us to grab would be great.
git clone --recursive https://github.com/throwtheswitch/ceedling.git
mkdir /tmp/vendor
cp -r ceedling /tmp/vendor/
cp -r myprojectsvendorfolder /tmp/vendor_modified
diff -ruN /tmp/vendor/ceedling/lib/ /tmp/vendor_modified/ceedling/lib/ > mypatch.txt
I hope I got everything in that patch. And yes, sometimes I have to run ceedling test:my_unit twice so that it generates the correct files. This is my fault but I can live with that :)
I can look into making a pull request out of this. I may ping you alex when it's ready.
I'm sorry, I forgot to diff CMock. Here it is. Please also consider that I hacked around cmock for this issue: https://github.com/ThrowTheSwitch/CMock/issues/213 so it may be affecting the diff as well.
Although I'm flattered you want to merge this, I think this needs a complete rework.
My project does not have a flat directory structure.
/src/helpers/strings/utils.c
/src/helpers/strings/utils.h
/src/helpers/time/utils.c
/src/helpers/time/utils.h
When I use both
#include "strings/utils.h"
#include "time/utils.h"
in my code I get linker errors because ceedling compiles both to:build/test/out/c/utils.o
can't you just build to
build/test/out/c/helpers/time/utils.o
build/test/out/c/helpers/strings/utils.o
and add those folders to the -L flag when linking?Is there a workaround for this? I don't want to rename my files, my coworkers would not appreciate this.