Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache the build target directory to enable Incremental building for faster build #612

Open
jacattrongnlh opened this issue Nov 17, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@jacattrongnlh
Copy link

Context

Unity has this incremental building for IL2CPP that allow faster build:

Use incremental building

When using incremental building, the C++ compiler only recompiles files that have changed since the last build. To use incremental building, build your project to a previous build location (without deleting the target directory).

So in Unity 2021, after an APK finished building, it generates some additional folders in the build target directory: (file name)_BackUpThisFolder_ButDontShipItWithYourGame and (file name)_BurstDebugInformation_DoNotShip. In subsequent build, if Unity builds to the same directory that contains files from the previous build (the APK and the 2 ...DoNotShip folders), the incremental build will only recompile files that have changed, resulting in much faster build.

Suggested solution

Please add the features that cache build directory in addition to caching the Library folder.

Considered alternatives

I don't have enough knowledge about CI to make my own solution yet.

Additional details

https://docs.unity3d.com/2020.1/Documentation/Manual/IL2CPP-OptimizingBuildTimes.html

@webbertakken
Copy link
Member

Excellent suggestion. We really need to look into this!

@jacattrongnlh
Copy link
Author

jacattrongnlh commented Nov 23, 2023

I've tried implementing the cache of the Build folder to see if it was sufficient, but in my experiment, Unity still did a full build instead of incremental build. I've checked the runner's storage with ls and the Build folder did get cached and extracted properly. I don't know if I'm missing something.

.library-cache: &library-cache
    key: "$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME"
    paths:
      - $UNITY_DIR/Library/
.builds-cache: &builds-cache
    key: "$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME-builds"
    paths:
      - $UNITY_DIR/Builds/
.cache: &cache
  cache:
    - <<: *builds-cache
    - <<: *library-cache

This is for .gitlab-ci.yml, I'm running this on a runner for a repo on gitlab

@davidmfinol davidmfinol added the enhancement New feature or request label Dec 2, 2023
@JimmyAkl
Copy link

JimmyAkl commented Dec 5, 2023

Any updates on this?

@AndrewKahr AndrewKahr transferred this issue from game-ci/unity-actions Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants