Rebuild from scratch when a build acts strangely
In a cloud Team, ask an Agent for one build without the cache, and clear the project's cache if that fixes it.
In a cloud Team, each build keeps a cache for the next one, so only what changed is compiled again. For apps built with Xcode, the cache is the project’s DerivedData, Xcode’s build folder. For the Android version (beta), it’s Gradle’s build cache and compiled build scripts. A project’s build script can keep other files between builds too, such as downloaded packages.
When a build goes wrong and no change explains it, one build without the cache tells you whether the cache is the cause.
When to try it
- A build fails with an error that the Agents can’t trace to a change in the project.
- The app in Preview doesn’t show a change the Agent says it built. First tap Reinstall (on iPhone, the app’s icon), which installs the project’s latest build again. See Run your app in Preview. If the change still isn’t there, try a build without the cache.
Signed builds for TestFlight and the App Store, and device builds such as app packages, archive the app. The help says an archive gets no DerivedData back, so for those builds DerivedData isn’t the cause. Files the build script keeps can still come back.
Build once without the cache
Ask in the project’s chat, for example:
The last build failed for no clear reason. Build again without the cache.- The Agent starts the build with
--no-cache. That build starts from empty caches and saves nothing. It’s for this one build only. - Everything is compiled again, so the build takes longer than usual.
- The Agent tells you how it went. If it worked, open the app in Preview with Reinstall (on iPhone, the app’s icon).
Test runs take the same option. Ask, for example, “Run the tests again without the cache.” See Have your Agents run your app’s tests.
If that fixed it, clear the project’s cache
A build without the cache saves nothing, so the next ordinary build gets the old cache back. To get rid of it, ask:
That worked. Clear this project's build cache.- The Agent can list what the Team has stored with
airbuild-cache list, most recently used first, with each entry’s size and when it was last used. - It deletes this project’s entries with
airbuild-cache deleteand tells you how many entries it deleted and their size. - The next build finds no cache, so it compiles everything and takes longer. It saves a new cache, which the builds after it use.
Deleting removes only the stored cache, not the project’s files. Other projects in the Team keep theirs. airbuild-cache delete can also remove every entry of the Team, other projects’ included. Ask for that only when every project needs it: then every project’s next build takes longer.
If it fails without the cache too
Then the cache isn’t the cause. Ask the Agent for the full error and a fix, for example:
It still fails without the cache. What's the error, and can you fix it?The messages runbuild itself can show are listed under Errors in runbuild.