@@ -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" ]
@@ -70,6 +82,27 @@ has_changelog_changes = hasChangesIn(["CHANGELOG"])
70
82
# Whether or not the LICENSE file has been modified or deleted.
71
83
has_license_changes = didModify ( [ "LICENSE" ] )
72
84
85
+ # A list of published Firebase products.
86
+ @product_list = [
87
+ "ABTesting" ,
88
+ "AppCheck" ,
89
+ "AppDistribution" ,
90
+ "Analytics" ,
91
+ "Authentication" ,
92
+ "Core" ,
93
+ "Crashlytics" ,
94
+ "Database" ,
95
+ "DynamicLinks" ,
96
+ "Firestore" ,
97
+ "Functions" ,
98
+ "InAppMessaging" ,
99
+ "Installations" ,
100
+ "Messaging" ,
101
+ "Performance" ,
102
+ "RemoteConfig" ,
103
+ "Storage"
104
+ ]
105
+
73
106
## Product directories
74
107
@has_analytics_changes = hasChangesIn ( [
75
108
"FirebaseAnalyticsOnDeviceConversionWrapper" ,
@@ -118,6 +151,10 @@ has_license_changes = didModify(["LICENSE"])
118
151
@has_storage_changes = hasChangesIn ( "FirebaseStorage" )
119
152
120
153
@has_releasetooling_changes = hasChangesIn ( "ReleaseTooling/" )
154
+ @has_public_additions = hasAdditionsIn ( "Public/" )
155
+
156
+ @has_umbrella_changes =
157
+ @product_list . reduce ( false ) { |accum , product | accum || hasChangesIn ( "Firebase#{ product } .h" ) }
121
158
122
159
# Convenient flag for all API changes.
123
160
@has_api_changes = @has_abtesting_api_changes ||
@@ -164,6 +201,14 @@ if has_sdk_changes
164
201
end
165
202
end
166
203
204
+ # Warn if a new public header file is added but no umbrella header changes
205
+ # are detected. Prevents regression of #10301
206
+ if @has_public_additions && !@has_umbrella_changes
207
+ error = "New public headers were added, " \
208
+ "did you remember to add them to the umbrella header?"
209
+ warn ( error )
210
+ end
211
+
167
212
# Error on license edits
168
213
fail ( "LICENSE changes are explicitly disallowed." ) if has_license_changes
169
214
0 commit comments