PodToBUILD icon indicating copy to clipboard operation
PodToBUILD copied to clipboard

prepare_command not converted

Open joprice opened this issue 6 years ago • 2 comments

I'm trying to make use of https://cocoapods.org/pods/OpenSSL, but the generated build doesn't produce an artifact. Looking at the BUILD file, it seems to be missing something that corresponds to the s.prepare_command directive.

joprice avatar Jun 26 '18 12:06 joprice

Hey @joprice - thanks for filling this! You're right, it doesn't automatically run the prepare_command. The tradeoff is made for reproducibility and security reasons.

The current convention is to run prepare_command's via the install_script attribute of new_pod_repository, for example:

new_pod_repository(
  name = "OpenSSL",
  ...
  install_script = """
    # Run the `prepare_command` of OpenSSL
    VERSION=\"1.0.2j\"\nSDKVERSION=`xcrun --sdk iphoneos --show-sdk-version 2> ....

     # Generate the `BUILD` file
     __INIT_REPO__
  """
)

I took a look at the podspec and it seems like it should work. Based on the popularity of this pod, it could be a good fit for a test case example.

As a follow up to this issue, I think we should add a note about prepare_command's in the README in addition to install_script usage.

jerrymarino avatar Jun 26 '18 17:06 jerrymarino

This need...Some adoption. Espacially for large project.

The podspec.prepare_command may be different in different Pods. So we can not write in hand to change each Pods (for example, large project may have 300+ Pods). So we have to use scripts to generate the new_pod_repository template BUILD file.

Not a big pain because we already customize the PodToBuild and surrounding tools. But I think, supports prepare_command may be a better idea.

dreampiggy avatar Mar 16 '21 07:03 dreampiggy