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

How can I make multiple "prebuild_config" for different schemas? #18

Closed
mefilt opened this issue Aug 27, 2020 · 8 comments
Closed

How can I make multiple "prebuild_config" for different schemas? #18

mefilt opened this issue Aug 27, 2020 · 8 comments

Comments

@mefilt
Copy link

mefilt commented Aug 27, 2020

How can I make multiple "prebuild_config" for different schemas?

@trinhngocthuyen
Copy link
Contributor

Hi @mefilt, Could you please help describe your use case in more detail?

@mefilt
Copy link
Author

mefilt commented Sep 3, 2020

There are many configurations in my project.
And I need to have a cache for each configuration
How can I do this?
image

@mefilt
Copy link
Author

mefilt commented Sep 3, 2020

I came up with this option, but it doesn't work either, since the cache in the repository is also shared
`plugin "cocoapods-binary-cache"
if ENV["CI_ENABLE"].nil?

config_cocoapods_binary_cache(
prebuild_config: "Dev-Debug",
dev_pods_enabled: false,
prebuild_all_vendor_pods: true
)
else

config_cocoapods_binary_cache(
prebuild_config: "Release-Prod",
dev_pods_enabled: false,
prebuild_all_vendor_pods: true
)
end
`
Is it possible to do it automatically? And save caches in different folders?

@trinhngocthuyen
Copy link
Contributor

@mefilt Thanks for the clarification. You are correct about the fact that the cache repo is currently shared and cannot support multiple configurations.

Moving forward, I would like to propose a multi-cache-repo support to solve this problem as follows:

  • The configuration file (PodBinaryCacheConfig.json) would look like this:
{
  "prebuild_path": "_Prebuild",
  "cache_repos": {
    "default": {
      "remote": "<url/to/cache/repo>",
      "local": "<path/to/cache/dir>"
    },
    "another": { # 👈  <--- Use this repo for another configuration
      "remote": "<url/to/cache/repo>",
      "local": "<path/to/cache/dir>"
    }
  }
}
  • When running the CLI, you can specify the repo (if not specified, use default). For example:
bundle exec pod binary fetch --repo=another
  • The prebuild_config will stay in the Podfile. You can alternate it by ENV like you mentioned
config_cocoapods_binary_cache(
  prebuild_config: ENV["CI"] ? "Test" : "Debug"
)

In the meantime, you can try out a workaround by having a script to dynamically generate the PodBinaryCacheConfig.json file.

@mefilt
Copy link
Author

mefilt commented Sep 10, 2020

Oooyyee! Thx man.
Json looks confy.

@mefilt
Copy link
Author

mefilt commented Sep 10, 2020

You can add a "remote url" field to "config_cocoapods_binary_cache".

And you still need to store binaries for the simulator and devices in the repository at the same time

@trinhngocthuyen
Copy link
Contributor

1/ About the cache for simulators & devices

Currently, we do support prebuilt frameworks for devices. However, we don't store cache for simulators & devices separately. Rather, the binary of a prebuilt framework is a fat binary with architectures used for both simulator and devices.
Kindly refer to the device_build_enabled option in this doc to enable device support.

2/ About the suggestion to have the remote_url option in config_cocoapods_binary_cache

That would be best.

Originally, we had those cache-repo-related configurations in the json file instead of config_cocoapods_binary_cache to make the cache fetch/push step independent of Podfile (which requires loading the Podfile). With this given use case and more similar cases in the future, we probably consider migrating these options to config_cocoapods_binary_cache as suggested. We'll discuss this approach among the team. Thanks for the suggestion!

@trinhngocthuyen
Copy link
Contributor

@mefilt The support has been implemented in 0.1.7.

Kindly refer to the cache_repo option in this doc for the configuration: https://github.com/grab/cocoapods-binary-cache/blob/0.1.7/docs/configure_cocoapods_binary_cache.md

Thanks for reporting the issue and the suggestion.

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