@@ -86,74 +86,37 @@ def main(argv):
86
86
# /scripts/gha-encrypted/auth/google-services.json.gpg turns into
87
87
# /<repo_dir>/auth/integration_test/google-services.json
88
88
api = os .path .basename (os .path .dirname (path ))
89
- # This is the primary skip for GMA. Ensure it's effective.
90
- if api == "gma" :
91
- continue
92
-
93
89
if FLAGS .apis and api not in FLAGS .apis :
94
90
print ("Skipping secret found in product api" , api )
95
91
continue
96
-
97
92
print ("Encrypted Google Service file found: %s" % path )
98
93
file_name = os .path .basename (path ).replace (".gpg" , "" )
99
-
100
- # Initialize dest_paths. It will be populated based on conditions.
101
- dest_paths = []
102
-
94
+ dest_paths = [os .path .join (repo_dir , api , "integration_test" , file_name )]
103
95
if FLAGS .artifact :
104
- # If processing for artifacts, construct artifact-specific path.
105
- # The 'api == "gma"' check above should prevent this block from executing for GMA.
106
- artifact_api_path = os .path .join (repo_dir , FLAGS .artifact , api )
107
- if "google-services" in path and os .path .isdir (artifact_api_path ):
108
- dest_paths .append (os .path .join (artifact_api_path , file_name ))
96
+ # /<repo_dir>/<artifact>/auth/google-services.json
97
+ if "google-services" in path and os .path .isdir (os .path .join (repo_dir , FLAGS .artifact , api )):
98
+ dest_paths = [os .path .join (repo_dir , FLAGS .artifact , api , file_name )]
109
99
else :
110
- # If not a google-services file or the artifact API directory doesn't exist,
111
- # skip this file for artifact processing.
112
- # This continue is vital: if no artifact path, don't fall through to default path logic for this file.
113
100
continue
114
- else :
115
- # If not processing for artifacts, use the default integration_test path.
116
- # The 'api == "gma"' check above should prevent this line from executing for GMA.
117
- dest_paths .append (os .path .join (repo_dir , api , "integration_test" , file_name ))
118
-
119
- # If dest_paths is still empty (e.g., was artifact flow but conditions not met), skip.
120
- if not dest_paths :
121
- continue
122
-
123
- # Append internal integration test path if it exists, for non-GMA APIs.
124
- # This now correctly checks 'api' before forming the path.
125
- if api != "gma" and os .path .exists (os .path .join (repo_dir , api , "integration_test_internal" )):
126
- # Only add internal path if a primary path was already added.
127
- # This ensures we don't *only* try to write to an internal path if, for instance,
128
- # the artifact conditions weren't met but an internal dir exists.
129
- if dest_paths : # Check if dest_paths has at least one path already
130
- dest_paths .append (os .path .join (repo_dir , api , "integration_test_internal" , file_name ))
131
-
132
- # If, after all checks, dest_paths is empty, skip.
133
- if not dest_paths :
134
- continue
135
101
102
+ # Some apis like Firestore also have internal integration tests.
103
+ if os .path .exists ( os .path .join (repo_dir , api , "integration_test_internal" )):
104
+ dest_paths .append (os .path .join (repo_dir , api ,
105
+ "integration_test_internal" , file_name ))
136
106
decrypted_text = _decrypt (path , passphrase )
137
- for dest_path_item in dest_paths :
138
- # Final explicit check, although redundant if above logic is correct.
139
- if "/gma/" in dest_path_item or "\\ gma\\ " in dest_path_item :
140
- continue
141
- with open (dest_path_item , "w" ) as f :
107
+ for dest_path in dest_paths :
108
+ with open (dest_path , "w" ) as f :
142
109
f .write (decrypted_text )
143
- print ("Copied decrypted google service file to %s" % dest_path_item )
144
- if dest_path_item .endswith (".plist" ):
145
- _patch_reverse_id (dest_path_item )
146
- _patch_bundle_id (dest_path_item )
147
-
148
- # The rest of the script handles non-GoogleService files (uri_prefix, app_check_token, gcs_key_file)
149
- # These are not per-API, so the GMA removal shouldn't affect them directly,
150
- # as long as their respective directories still exist if they are not GMA-specific.
110
+ print ("Copied decrypted google service file to %s" % dest_path )
111
+ # We use a Google Service file as the source of truth for the reverse id
112
+ # that needs to be patched into the Info.plist files.
113
+ if dest_path .endswith (".plist" ):
114
+ _patch_reverse_id (dest_path )
115
+ _patch_bundle_id (dest_path )
151
116
152
- # This check should be fine as FLAGS.artifact is global to the script run.
153
117
if FLAGS .artifact :
154
118
return
155
119
156
- # This part is for dynamic_links, not gma.
157
120
if not FLAGS .apis or "dynamic_links" in FLAGS .apis :
158
121
print ("Attempting to patch Dynamic Links uri prefix." )
159
122
uri_path = os .path .join (secrets_dir , "dynamic_links" , "uri_prefix.txt.gpg" )
0 commit comments