Will I ever have problems if I don’t clean before building?

I wrote a pre-commit git hook that aborts the commit if my xcode project fails to compile.

He does this by running xcodebuild with the appropriate settings for my project. If xcodebuild returns a non-zero status, you cannot commit your changes.

Here is the xcodebuild command that I run:

xcodebuild -project MYPROJ/MYPROJ.xcodeproj -target MYPROJ -configuration Debug clean build CODE_SIGN_IDENTITY='iPhone Developer' >/dev/null 2>&1 

What do I want to know, what problems will I carry out if I remove "clean" from the build command? I have a vague understanding of what “clean” does: delete previously compiled objects that will invoke the next build command in order to assemble the entire project from scratch.

However, the complete assembly takes a lot of time on our project, whereas if we do not clean and change a lot, it will only take a few seconds. I would like our pre-commit-hooks to be quick and easy, but I'm worried that the assembly will be in some strange state and will not allow the developer to complete, even if their code is ok.

Will I encounter problems if I do not clean before each assembly for my pre-hook? Perhaps, in some cases, it will incorrectly report a build error or fail if I do not clear it?

+4
source share
1 answer

If you want to be sure that your commits are commit, you must flush them before building. Libraries and resources can sometimes be confusing, so a clean command exists. You want to make sure that someone who checks this revision can compile the project without any problems. You cannot guarantee that if you can have the remains of previous collections, for example, old resources.

Imagine using an image for your GUI. You compile your application and it works. Then you rebuild your resources a bit and somehow remove the image from the project. If you run the application again, it may load the old image if you do not clear the project. So this will work for you, but not for someone with a clean build.

+2
source

Source: https://habr.com/ru/post/1486413/


All Articles