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

Restore cache after install step so submodule build directories can be cached #1149

Closed
matthargett opened this issue Nov 2, 2016 · 2 comments

Comments

@matthargett
Copy link

In http://github.com/ReactWindows/react-native-windows , we have ChakraCore as a submodule and we delegate to its build in our project.

Since we don't update the hash of the submodule often, we'd like to cache ChakraCore's Build/VcBuild/bin directory so we don't re-build it unnecessarily.

Currently, we can't do that because the cache restore happens before the install step where we do our 'git submodules update --init' command. The command fails when the ChakraCore submodule directory isn't empty, and --force doesn't push past the issue.

@IlyaFinkelshteyn
Copy link
Contributor

IlyaFinkelshteyn commented Nov 3, 2016

Hi Matt,

Could you please try to use custom git clone scriopt (clone_script in YAML, or Settings > Clone script in UI). In this script you can do both git clone and git submodules commands and all will happen before cache is restored.

Please let us know if this helps.

Thank you,
Ilya.

@matthargett
Copy link
Author

matthargett commented Nov 7, 2016

  • That

    worked! For reference, here's the excerpt from my appveyor.yml:

cache:
- ReactWindows\packages -> ReactWindows\**\packages.config
- '%USERPROFILE%\.nuget\packages -> ReactWindows\**\project.json'
- ChakraCore\Build\VcBuild -> ChakraCore\lib\Common\*.h

clone_script:
- cmd: >-
    git clone -q --branch=%APPVEYOR_REPO_BRANCH% https://github.com/%APPVEYOR_REPO_NAME%.git %APPVEYOR_BUILD_FOLDER%

    cd %APPVEYOR_BUILD_FOLDER%

    git checkout -qf %APPVEYOR_REPO_COMMIT%

    git submodule update --init --recursive

before_build:
- ps: >-
    Get-ChildItem .\ChakraCore\Build\VcBuild * -recurse | ForEach-Object{$_.LastWriteTime = get-date}

It looks like the cached files don't get their timestamp updated on restore, so the submodule update would get files that appeared to be newer and still kick off the ChakraCore build. So I added the before_build line to set the timestamp on all files in the cache-restored directories, which short-circuited more of the submodule's build like I was hoping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants