Embed code sign configs in ios deploy, libusbmuxd etc.

Added code sign configs for ios-usb-dependencies artifacts in the same recipe file. The contents to be embedded is selected based on package name.

led run :
https://ci.chromium.org/raw/build/logs.chromium.org/flutter/led/xilaizhang_google.com/2099771ad39a79fb386b4c9deeea394356c24bb2a097fa3f92cc62020fb7ce2e/+/build.proto?server=chromium-swarm.appspot.com

Change-Id: I6e3c52795c4ed44ae3696551877395c35a48549f
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/34300
Reviewed-by: Casey Hillers <chillers@google.com>
Reviewed-by: Jenn Magder <magder@google.com>
Commit-Queue: Xilai Zhang <xilaizhang@google.com>
diff --git a/recipes/ios_usb_dependencies/ios-usb-dependencies.expected/basic.json b/recipes/ios_usb_dependencies/ios-usb-dependencies.expected/basic.json
index 43ea546..d2b1b86 100644
--- a/recipes/ios_usb_dependencies/ios-usb-dependencies.expected/basic.json
+++ b/recipes/ios_usb_dependencies/ios-usb-dependencies.expected/basic.json
@@ -80,6 +80,42 @@
   },
   {
     "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "ios-deploy\n",
+      "[START_DIR]/src/ios-deploy_output/entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing entitlements codesign list for ios-deploy",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@entitlements.txt@ios-deploy@@@",
+      "@@@STEP_LOG_END@entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "\n",
+      "[START_DIR]/src/ios-deploy_output/without_entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing the list of files to be codesigned without entitlements for ios-deploy",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@without_entitlements.txt@@@@",
+      "@@@STEP_LOG_END@without_entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
       "python",
       "RECIPE_MODULE[flutter::zip]/resources/zip.py"
     ],
@@ -168,6 +204,61 @@
   },
   {
     "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "listdir",
+      "[START_DIR]/src/libplist_output"
+    ],
+    "infra_step": true,
+    "name": "checking dylib file inside: [START_DIR]/src/libplist_output",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/libplist_output/[START_DIR]/src/libplist_output/libimobiledevice-1.0.6.dylib@@@",
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/libplist_output/[START_DIR]/src/libplist_output/libplist-2.0.3.dylib@@@",
+      "@@@STEP_LOG_END@listdir@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "\n",
+      "[START_DIR]/src/libplist_output/entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing entitlements codesign list for libplist",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@entitlements.txt@@@@",
+      "@@@STEP_LOG_END@entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "libimobiledevice-1.0.6.dylib\nlibplist-2.0.3.dylib\n",
+      "[START_DIR]/src/libplist_output/without_entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing the list of files to be codesigned without entitlements for libplist",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@without_entitlements.txt@libimobiledevice-1.0.6.dylib@@@",
+      "@@@STEP_LOG_LINE@without_entitlements.txt@libplist-2.0.3.dylib@@@",
+      "@@@STEP_LOG_END@without_entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
       "python",
       "RECIPE_MODULE[flutter::zip]/resources/zip.py"
     ],
@@ -470,6 +561,60 @@
   },
   {
     "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "listdir",
+      "[START_DIR]/src/libimobiledeviceglue_output"
+    ],
+    "infra_step": true,
+    "name": "checking dylib file inside: [START_DIR]/src/libimobiledeviceglue_output",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/libimobiledeviceglue_output/[START_DIR]/src/libimobiledeviceglue_output/libimobiledevice-1.0.6.dylib@@@",
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/libimobiledeviceglue_output/[START_DIR]/src/libimobiledeviceglue_output/libplist-2.0.3.dylib@@@",
+      "@@@STEP_LOG_END@listdir@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "\n",
+      "[START_DIR]/src/libimobiledeviceglue_output/entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing entitlements codesign list for libimobiledeviceglue",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@entitlements.txt@@@@",
+      "@@@STEP_LOG_END@entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "\n",
+      "[START_DIR]/src/libimobiledeviceglue_output/without_entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing the list of files to be codesigned without entitlements for libimobiledeviceglue",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@without_entitlements.txt@@@@",
+      "@@@STEP_LOG_END@without_entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
       "python",
       "RECIPE_MODULE[flutter::zip]/resources/zip.py"
     ],
@@ -601,6 +746,61 @@
   },
   {
     "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "listdir",
+      "[START_DIR]/src/libusbmuxd_output"
+    ],
+    "infra_step": true,
+    "name": "checking dylib file inside: [START_DIR]/src/libusbmuxd_output",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/libusbmuxd_output/[START_DIR]/src/libusbmuxd_output/libimobiledevice-1.0.6.dylib@@@",
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/libusbmuxd_output/[START_DIR]/src/libusbmuxd_output/libplist-2.0.3.dylib@@@",
+      "@@@STEP_LOG_END@listdir@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "iproxy\n",
+      "[START_DIR]/src/libusbmuxd_output/entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing entitlements codesign list for libusbmuxd",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@entitlements.txt@iproxy@@@",
+      "@@@STEP_LOG_END@entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "libimobiledevice-1.0.6.dylib\nlibplist-2.0.3.dylib\n",
+      "[START_DIR]/src/libusbmuxd_output/without_entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing the list of files to be codesigned without entitlements for libusbmuxd",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@without_entitlements.txt@libimobiledevice-1.0.6.dylib@@@",
+      "@@@STEP_LOG_LINE@without_entitlements.txt@libplist-2.0.3.dylib@@@",
+      "@@@STEP_LOG_END@without_entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
       "python",
       "RECIPE_MODULE[flutter::zip]/resources/zip.py"
     ],
@@ -724,6 +924,78 @@
   },
   {
     "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "listdir",
+      "[START_DIR]/src/openssl_output"
+    ],
+    "infra_step": true,
+    "name": "checking dylib file inside: [START_DIR]/src/openssl_output",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/openssl_output/[START_DIR]/src/openssl_output/libimobiledevice-1.0.6.dylib@@@",
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/openssl_output/[START_DIR]/src/openssl_output/libplist-2.0.3.dylib@@@",
+      "@@@STEP_LOG_END@listdir@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "listdir",
+      "[START_DIR]/src/openssl_output"
+    ],
+    "infra_step": true,
+    "name": "checking dylib file inside: [START_DIR]/src/openssl_output (2)",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/openssl_output/[START_DIR]/src/openssl_output/libimobiledevice-1.0.6.dylib@@@",
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/openssl_output/[START_DIR]/src/openssl_output/libplist-2.0.3.dylib@@@",
+      "@@@STEP_LOG_END@listdir@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "\n",
+      "[START_DIR]/src/openssl_output/entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing entitlements codesign list for openssl",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@entitlements.txt@@@@",
+      "@@@STEP_LOG_END@entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "\n",
+      "[START_DIR]/src/openssl_output/without_entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing the list of files to be codesigned without entitlements for openssl",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@without_entitlements.txt@@@@",
+      "@@@STEP_LOG_END@without_entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
       "python",
       "RECIPE_MODULE[flutter::zip]/resources/zip.py"
     ],
@@ -866,6 +1138,62 @@
   },
   {
     "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "listdir",
+      "[START_DIR]/src/libimobiledevice_output"
+    ],
+    "infra_step": true,
+    "name": "checking dylib file inside: [START_DIR]/src/libimobiledevice_output",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/libimobiledevice_output/[START_DIR]/src/libimobiledevice_output/libimobiledevice-1.0.6.dylib@@@",
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/src/libimobiledevice_output/[START_DIR]/src/libimobiledevice_output/libplist-2.0.3.dylib@@@",
+      "@@@STEP_LOG_END@listdir@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "idevicescreenshot\nidevicesyslog\n",
+      "[START_DIR]/src/libimobiledevice_output/entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing entitlements codesign list for libimobiledevice",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@entitlements.txt@idevicescreenshot@@@",
+      "@@@STEP_LOG_LINE@entitlements.txt@idevicesyslog@@@",
+      "@@@STEP_LOG_END@entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "libimobiledevice-1.0.6.dylib\nlibplist-2.0.3.dylib\n",
+      "[START_DIR]/src/libimobiledevice_output/without_entitlements.txt"
+    ],
+    "infra_step": true,
+    "name": "writing the list of files to be codesigned without entitlements for libimobiledevice",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@without_entitlements.txt@libimobiledevice-1.0.6.dylib@@@",
+      "@@@STEP_LOG_LINE@without_entitlements.txt@libplist-2.0.3.dylib@@@",
+      "@@@STEP_LOG_END@without_entitlements.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
       "python",
       "RECIPE_MODULE[flutter::zip]/resources/zip.py"
     ],
diff --git a/recipes/ios_usb_dependencies/ios-usb-dependencies.py b/recipes/ios_usb_dependencies/ios-usb-dependencies.py
index d74a87b..e37158a 100644
--- a/recipes/ios_usb_dependencies/ios-usb-dependencies.py
+++ b/recipes/ios_usb_dependencies/ios-usb-dependencies.py
@@ -20,35 +20,33 @@
 BUCKET_NAME = 'flutter_infra_release'
 
 # These regex are used to detect lib paths that need to be patched.
-LIBUSBMUXD_PATTERN = r'^\t(\/.*(libusbmuxd.*\.dylib)).*'
-LIBPLIST_PATTERN = r'^\t(\/.*(libplist.*\.dylib)).*'
-LIBSSL_PATTERN = r'^\t(\/.*(libssl.*\.dylib)).*'
-LIBCRYPTO_PATTERN = r'^\t(\/.*(libcrypto.*\.dylib)).*'
-LIBIMOBILEDEVICE_PATTERN = r'^\t(\/.*(libimobiledevice.*\.dylib)).*'
-LIBIMOBILEDEVICEGLUE_PATTERN = r'^\t(\/.*(libimobiledevice-glue.*\.dylib)).*'
+LIBUSBMUXD_PATTERN = r'^\t?(.*(libusbmuxd.*\.dylib)).*'
+LIBPLIST_PATTERN = r'^\t?(.*(libplist.*\.dylib)).*'
+LIBSSL_PATTERN = r'^\t?(.*(libssl.*\.dylib)).*'
+LIBCRYPTO_PATTERN = r'^\t?(.*(libcrypto.*\.dylib)).*'
+LIBIMOBILEDEVICE_PATTERN = r'^\t?(.*(libimobiledevice.*\.dylib)).*'
+LIBIMOBILEDEVICEGLUE_PATTERN = r'^\t?(.*(libimobiledevice-glue.*\.dylib)).*'
 
-DIRNAME_PATTERN_TUPLES = [
-        ('libusbmuxd', LIBUSBMUXD_PATTERN),
-        ('libplist', LIBPLIST_PATTERN),
-        ('lisbssl', LIBSSL_PATTERN),
-        ('libcrypto', LIBCRYPTO_PATTERN),
-        ('libimobiledevice', LIBIMOBILEDEVICE_PATTERN),
-        ('libimobiledevice-glue', LIBIMOBILEDEVICEGLUE_PATTERN)
-        ]
+DIRNAME_PATTERN_DICT = {
+    'libusbmuxd': LIBUSBMUXD_PATTERN, 'libplist': LIBPLIST_PATTERN,
+    'libssl': LIBSSL_PATTERN, 'libcrypto': LIBCRYPTO_PATTERN,
+    'libimobiledevice': LIBIMOBILEDEVICE_PATTERN,
+    'libimobiledeviceglue': LIBIMOBILEDEVICEGLUE_PATTERN
+}
 
 # Map between package and its artifacts that need path patch.
 BIANRY_ARTIFACT_MAP = {
-  'libusbmuxd': ['iproxy'],
-  'openssl': ['libcrypto.3.dylib'],
-  'libimobiledevice': ['idevicescreenshot', 'idevicesyslog']
+    'libusbmuxd': ['iproxy'], 'openssl': ['libcrypto.3.dylib'],
+    'libimobiledevice': ['idevicescreenshot', 'idevicesyslog']
 }
 
+
 def ParseOtoolPath(input_string):
   '''Parse paths that need to be patched to relative paths via otool.'''
   input_lines = input_string.split('\n')
   output = {}
   for input_line in input_lines:
-    for dirname, pattern in DIRNAME_PATTERN_TUPLES:
+    for dirname, pattern in DIRNAME_PATTERN_DICT.items():
       # re.match searches from beginning of string
       match = re.match(pattern, input_line)
       if match:
@@ -57,6 +55,7 @@
         output[old_path] = new_path
   return output
 
+
 def PatchLoadPath(api, ouput_path, package_name):
   '''Update dynamically linked paths in a binary'''
   if package_name not in BIANRY_ARTIFACT_MAP:
@@ -66,17 +65,21 @@
     artifact_path = ouput_path.join(artifact)
     otool_step_data = api.step(
         'Get linked paths from %s before patch' % artifact,
-        ['otool', '-L', artifact_path], stdout=api.raw_io.output_text())
+        ['otool', '-L', artifact_path],
+        stdout=api.raw_io.output_text()
+    )
     old_paths_to_new_paths = ParseOtoolPath(otool_step_data.stdout.rstrip())
     for old_path in old_paths_to_new_paths:
-        new_path = old_paths_to_new_paths[old_path]
-        api.step(
-                'Patch %s with install_name_tool' % artifact_path,
-                ['install_name_tool', '-change', old_path, new_path, artifact_path],
-                )
+      new_path = old_paths_to_new_paths[old_path]
+      api.step(
+          'Patch %s with install_name_tool' % artifact_path,
+          ['install_name_tool', '-change', old_path, new_path, artifact_path],
+      )
     api.step(
         'Get linked paths from %s after patch' % artifact_path,
-        ['otool', '-L', artifact_path])
+        ['otool', '-L', artifact_path]
+    )
+
 
 def GetCloudPath(api, package_name, commit_sha):
   """Location of cloud bucket for unsigned binaries"""
@@ -119,6 +122,93 @@
     env_prefixes['PKG_CONFIG_PATH'] = pkg_config_path
 
 
+def GetDylibFilenames(api, dir, package_name):
+  """Returns a list of file names that matches dylib file regex in given directory.
+
+  A package_name maps to a regex pattern based on DIRNAME_PATTERN_DICT(dict). All 
+  file names in the current dir that matches this regex pattern are returned.
+
+  Args:
+
+      dir(Path): The directory in which to search for dylib files.
+      package_name(str): Name of the ios usb dependency passed in. 
+  """
+  directory_paths = api.file.listdir(
+      "checking dylib file inside: %s" % dir,
+      dir,
+      test_data=[
+          dir.join("libimobiledevice-1.0.6.dylib"),
+          dir.join("libplist-2.0.3.dylib")
+      ]
+  )
+  directory_string_paths = [('%s' % path) for path in directory_paths]
+  matched_dylib_names = []
+
+  pattern = DIRNAME_PATTERN_DICT[package_name]
+  for dylib_path in directory_string_paths:
+    # re.match searches from beginning of string
+    match = re.match(pattern, dylib_path)
+    if match:
+      matched_dylib_names.append(dylib_path.split("/")[-1])
+  return matched_dylib_names
+
+
+def EmbedCodesignConfiguration(api, package_out_dir, package_name):
+  """Embed metadata file for Mac code signing into ios usb dependency artifacts.
+
+  Two files are embedded into the generated artifact.
+  entitlements.txt: The list of binaries that need to be code signed with entitlements.
+  without_entitlements.txt: Filenames of binaries in artifacts that should be code signed, but not with entitlements.
+
+  Args:
+
+      package_out_dir(Path): The directory in which ios usb dependency artifact is generated.
+      package_name(str): Name of the ios usb dependency passed in. 
+  """
+  entitlement_file_contents = []
+  without_entitlement_file_contents = []
+  if package_name == "ios-deploy":
+    entitlement_file_contents = ["ios-deploy"]
+  elif package_name == "libimobiledevice":
+    entitlement_file_contents = [
+        "idevicescreenshot",
+        "idevicesyslog",
+    ]
+    without_entitlement_file_contents = GetDylibFilenames(
+        api, package_out_dir, package_name
+    )
+  elif package_name == "libplist":
+    without_entitlement_file_contents = GetDylibFilenames(
+        api, package_out_dir, package_name
+    )
+  elif package_name == "libusbmuxd":
+    entitlement_file_contents = [
+        "iproxy",
+    ]
+    without_entitlement_file_contents = GetDylibFilenames(
+        api, package_out_dir, package_name
+    )
+  elif package_name == "openssl":
+    without_entitlement_file_contents = GetDylibFilenames(
+        api, package_out_dir, "libssl"
+    ) + GetDylibFilenames(api, package_out_dir, "libcrypto")
+  elif package_name == "libimobiledeviceglue":
+    without_entitlement_file_contents = GetDylibFilenames(
+        api, package_out_dir, package_name
+    )
+
+  api.file.write_text(
+      "writing entitlements codesign list for %s" % package_name,
+      package_out_dir.join("entitlements.txt"),
+      '\n'.join(entitlement_file_contents) + '\n'
+  )
+  api.file.write_text(
+      "writing the list of files to be codesigned without entitlements for %s" %
+      package_name, package_out_dir.join("without_entitlements.txt"),
+      '\n'.join(without_entitlement_file_contents) + '\n'
+  )
+
+
 def UploadPackage(
     api, package_name, work_dir, package_out_dir, upload, commit_sha
 ):
@@ -134,6 +224,7 @@
   """
   if not upload:
     return
+  EmbedCodesignConfiguration(api, package_out_dir, package_name)
   package_zip_file = work_dir.join('%s.zip' % package_name)
   api.zip.directory(
       'zipping %s dir' % package_name, package_out_dir, package_zip_file
@@ -254,6 +345,9 @@
       ),
       api.step_data(
           'Get linked paths from iproxy before patch',
-          stdout=api.raw_io.output_text('\t/opt/s/w/ir/x/w/src/libusbmuxd_install/lib/libusbmuxd-2.0.6.dylib (compatibility version 7.0.0, current version 7.0.0)'),
-          retcode=0)
+          stdout=api.raw_io.output_text(
+              '\t/opt/s/w/ir/x/w/src/libusbmuxd_install/lib/libusbmuxd-2.0.6.dylib (compatibility version 7.0.0, current version 7.0.0)'
+          ),
+          retcode=0
+      )
   )