@@ -24,6 +24,18 @@ def hasChangesIn(paths)
24
24
return false
25
25
end
26
26
27
+ # Determine if any new files were added to paths matching any of the
28
+ # path patterns provided.
29
+ def hasAdditionsIn ( paths )
30
+ path_array = Array ( paths )
31
+ path_array . each do |dir |
32
+ if !git . added_files . grep ( /#{ dir } / ) . empty?
33
+ return true
34
+ end
35
+ end
36
+ return false
37
+ end
38
+
27
39
# Adds the provided labels to the current PR.
28
40
def addLabels ( label_array )
29
41
issue_number = github . pr_json [ "number" ]
@@ -118,6 +130,8 @@ has_license_changes = didModify(["LICENSE"])
118
130
@has_storage_changes = hasChangesIn ( "FirebaseStorage" )
119
131
120
132
@has_releasetooling_changes = hasChangesIn ( "ReleaseTooling/" )
133
+ @has_public_additions = hasAdditionsIn ( "Public/" )
134
+ @has_umbrella_changes = hasChangesIn ( "Firebase*.h" )
121
135
122
136
# Convenient flag for all API changes.
123
137
@has_api_changes = @has_abtesting_api_changes ||
@@ -164,6 +178,14 @@ if has_sdk_changes
164
178
end
165
179
end
166
180
181
+ # Warn if a new public header file is added but no umbrella header changes
182
+ # are detected. Prevents regression of #10301
183
+ if @has_public_additions && !@has_umbrella_changes
184
+ error = "New public headers were added, " \
185
+ "did you remember to add them to the umbrella header?"
186
+ fail ( error )
187
+ end
188
+
167
189
# Error on license edits
168
190
fail ( "LICENSE changes are explicitly disallowed." ) if has_license_changes
169
191
0 commit comments