Skip to content

Commit bf0a543

Browse files
authored
Merge branch 'main' into add_interrupt_support
2 parents 61090c4 + 909dd43 commit bf0a543

File tree

7 files changed

+137
-67
lines changed

7 files changed

+137
-67
lines changed

.github/workflows/changelog.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
with:
1818
fetch-depth: 100
1919
submodules: true
20-
- uses: ruby/setup-ruby@1a615958ad9d422dd932dc1d5823942ee002799f # v1.227.0
20+
- uses: ruby/setup-ruby@0481980f17b760ef6bca5e8c55809102a0af1e5a # v1.263.0
2121
with:
22-
ruby-version: '2.7'
22+
ruby-version: '3.4'
2323
- name: Setup Bundler
2424
run: ./ci/danger/setup_bundler.sh
2525
- name: Danger CHANGELOG verifier

ci/danger/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# commit Gemfile and Gemfile.lock.
33
source 'https://rubygems.org'
44

5-
gem 'danger', '8.4.5'
5+
gem 'danger', '9.5.3'

ci/danger/Gemfile.lock

Lines changed: 67 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,102 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
addressable (2.8.1)
5-
public_suffix (>= 2.0.2, < 6.0)
4+
activesupport (8.0.3)
5+
base64
6+
benchmark (>= 0.3)
7+
bigdecimal
8+
concurrent-ruby (~> 1.0, >= 1.3.1)
9+
connection_pool (>= 2.2.5)
10+
drb
11+
i18n (>= 1.6, < 2)
12+
logger (>= 1.4.2)
13+
minitest (>= 5.1)
14+
securerandom (>= 0.3)
15+
tzinfo (~> 2.0, >= 2.0.5)
16+
uri (>= 0.13.1)
17+
addressable (2.8.7)
18+
public_suffix (>= 2.0.2, < 7.0)
19+
base64 (0.3.0)
20+
benchmark (0.4.1)
21+
bigdecimal (3.3.0)
622
claide (1.1.0)
723
claide-plugins (0.9.2)
824
cork
925
nap
1026
open4 (~> 1.3)
1127
colored2 (3.1.2)
28+
concurrent-ruby (1.3.5)
29+
connection_pool (2.5.4)
1230
cork (0.3.0)
1331
colored2 (~> 3.1)
14-
danger (8.4.5)
32+
danger (9.5.3)
33+
base64 (~> 0.2)
1534
claide (~> 1.0)
1635
claide-plugins (>= 0.9.2)
17-
colored2 (~> 3.1)
36+
colored2 (>= 3.1, < 5)
1837
cork (~> 0.1)
19-
faraday (>= 0.9.0, < 2.0)
38+
faraday (>= 0.9.0, < 3.0)
2039
faraday-http-cache (~> 2.0)
21-
git (~> 1.7)
22-
kramdown (~> 2.3)
40+
git (>= 1.13, < 3.0)
41+
kramdown (>= 2.5.1, < 3.0)
2342
kramdown-parser-gfm (~> 1.0)
24-
no_proxy_fix
25-
octokit (~> 4.7)
26-
terminal-table (>= 1, < 4)
27-
faraday (1.10.1)
28-
faraday-em_http (~> 1.0)
29-
faraday-em_synchrony (~> 1.0)
30-
faraday-excon (~> 1.1)
31-
faraday-httpclient (~> 1.0)
32-
faraday-multipart (~> 1.0)
33-
faraday-net_http (~> 1.0)
34-
faraday-net_http_persistent (~> 1.0)
35-
faraday-patron (~> 1.0)
36-
faraday-rack (~> 1.0)
37-
faraday-retry (~> 1.0)
38-
ruby2_keywords (>= 0.0.4)
39-
faraday-em_http (1.0.0)
40-
faraday-em_synchrony (1.0.0)
41-
faraday-excon (1.1.0)
42-
faraday-http-cache (2.4.1)
43+
octokit (>= 4.0)
44+
pstore (~> 0.1)
45+
terminal-table (>= 1, < 5)
46+
drb (2.2.3)
47+
faraday (2.14.0)
48+
faraday-net_http (>= 2.0, < 3.5)
49+
json
50+
logger
51+
faraday-http-cache (2.5.1)
4352
faraday (>= 0.8)
44-
faraday-httpclient (1.0.1)
45-
faraday-multipart (1.0.4)
46-
multipart-post (~> 2)
47-
faraday-net_http (1.0.1)
48-
faraday-net_http_persistent (1.2.0)
49-
faraday-patron (1.0.0)
50-
faraday-rack (1.0.0)
51-
faraday-retry (1.0.3)
52-
git (1.13.1)
53+
faraday-net_http (3.4.1)
54+
net-http (>= 0.5.0)
55+
git (2.3.3)
56+
activesupport (>= 5.0)
5357
addressable (~> 2.8)
58+
process_executer (~> 1.1)
5459
rchardet (~> 1.8)
55-
kramdown (2.4.0)
56-
rexml
60+
i18n (1.14.7)
61+
concurrent-ruby (~> 1.0)
62+
json (2.15.1)
63+
kramdown (2.5.1)
64+
rexml (>= 3.3.9)
5765
kramdown-parser-gfm (1.1.0)
5866
kramdown (~> 2.0)
59-
multipart-post (2.2.3)
67+
logger (1.7.0)
68+
minitest (5.25.5)
6069
nap (1.1.0)
61-
no_proxy_fix (0.1.2)
62-
octokit (4.25.1)
70+
net-http (0.6.0)
71+
uri
72+
octokit (10.0.0)
6373
faraday (>= 1, < 3)
6474
sawyer (~> 0.9)
6575
open4 (1.3.4)
66-
public_suffix (5.0.1)
67-
rchardet (1.8.0)
68-
rexml (3.2.8)
69-
strscan (>= 3.0.9)
70-
ruby2_keywords (0.0.5)
76+
process_executer (1.3.0)
77+
pstore (0.2.0)
78+
public_suffix (6.0.2)
79+
rchardet (1.10.0)
80+
rexml (3.4.4)
7181
sawyer (0.9.2)
7282
addressable (>= 2.3.5)
7383
faraday (>= 0.17.3, < 3)
74-
strscan (3.1.0)
75-
terminal-table (3.0.2)
76-
unicode-display_width (>= 1.1.1, < 3)
77-
unicode-display_width (2.2.0)
84+
securerandom (0.4.1)
85+
terminal-table (4.0.0)
86+
unicode-display_width (>= 1.1.1, < 4)
87+
tzinfo (2.0.6)
88+
concurrent-ruby (~> 1.0)
89+
unicode-display_width (3.2.0)
90+
unicode-emoji (~> 4.1)
91+
unicode-emoji (4.1.0)
92+
uri (1.0.4)
7893

7994
PLATFORMS
95+
arm64-darwin-24
8096
ruby
8197

8298
DEPENDENCIES
83-
danger (= 8.4.5)
99+
danger (= 9.5.3)
84100

85101
BUNDLED WITH
86-
1.17.2
102+
2.7.2

firebase-crashlytics-ndk/CHANGELOG.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- [changed] Bumped internal dependencies.
4+
35
# 20.0.2
46

57
- [changed] Bumped internal dependencies.
@@ -107,7 +109,7 @@
107109
<aside class="caution">This version of <code>firebase-crashlytics-ndk</code> can
108110
cause a nondeterministic crash on startup. For more information, see
109111
<a href="https://github.com/firebase/firebase-android-sdk/issues/4683"
110-
class="external">GitHub Issue #4683</a>. We recommend updating to the
112+
class="external">GitHub Issue #4683</a>. We recommend updating to the
111113
latest version (v18.3.5+) which contains a fix.
112114
</aside>
113115

@@ -294,16 +296,16 @@ the new SDK.
294296
<aside class="note"><p>The changes in these release notes are only relevant to
295297
[crashlytics] NDK users who are upgrading from the legacy Fabric SDK.</p>
296298
<ul>
297-
<li>If you're using [crashlytics] for NDK crash reporting in your app for
298-
the first time, follow the
299-
<a href="/docs/crashlytics/get-started-new-sdk?platform=android">getting
300-
started instructions</a>.
301-
</li>
302-
<li>If you're upgrading from the legacy Fabric SDK to the
303-
[firebase_crashlytics] SDK for NDK crash reporting, follow the
304-
<a href="/docs/crashlytics/upgrade-sdk?platform=android">upgrade
305-
instructions</a> to update your app with the following SDK changes.
306-
</li>
299+
<li>If you're using [crashlytics] for NDK crash reporting in your app for
300+
the first time, follow the
301+
<a href="/docs/crashlytics/get-started-new-sdk?platform=android">getting
302+
started instructions</a>.
303+
</li>
304+
<li>If you're upgrading from the legacy Fabric SDK to the
305+
[firebase_crashlytics] SDK for NDK crash reporting, follow the
306+
<a href="/docs/crashlytics/upgrade-sdk?platform=android">upgrade
307+
instructions</a> to update your app with the following SDK changes.
308+
</li>
307309
</ul>
308310
</aside>
309311

firebase-crashlytics/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- [fixed] Made creating DataStore files more resilient [#7440]
4+
35
# 20.0.2
46

57
- [changed] Bumped internal dependencies.

firebase-sessions/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- [fixed] Made creating DataStore files more resilient (#7440)
4+
35
# 3.0.2
46

57
- [changed] Bumped internal dependencies.

firebase-sessions/src/main/kotlin/com/google/firebase/sessions/FirebaseSessionsComponent.kt

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.google.firebase.sessions
1818

1919
import android.content.Context
20+
import android.os.Build
2021
import android.util.Log
2122
import androidx.datastore.core.DataMigration
2223
import androidx.datastore.core.DataStore
@@ -48,6 +49,8 @@ import dagger.Component
4849
import dagger.Module
4950
import dagger.Provides
5051
import java.io.File
52+
import java.io.IOException
53+
import java.nio.file.Files
5154
import javax.inject.Qualifier
5255
import javax.inject.Singleton
5356
import kotlin.coroutines.CoroutineContext
@@ -146,7 +149,11 @@ internal interface FirebaseSessionsComponent {
146149
SessionConfigsSerializer.defaultValue
147150
},
148151
scope = CoroutineScope(blockingDispatcher),
149-
produceFile = { appContext.dataStoreFile("aqs/sessionConfigsDataStore.data") },
152+
produceFile = {
153+
appContext.dataStoreFile("firebaseSessions/sessionConfigsDataStore.data").also {
154+
prepDataStoreFile(it)
155+
}
156+
},
150157
)
151158

152159
@Provides
@@ -164,7 +171,11 @@ internal interface FirebaseSessionsComponent {
164171
sessionDataSerializer.defaultValue
165172
},
166173
scope = CoroutineScope(blockingDispatcher),
167-
produceFile = { appContext.dataStoreFile("aqs/sessionDataStore.data") },
174+
produceFile = {
175+
appContext.dataStoreFile("firebaseSessions/sessionDataStore.data").also {
176+
prepDataStoreFile(it)
177+
}
178+
},
168179
)
169180

170181
private fun <T> createDataStore(
@@ -197,6 +208,43 @@ internal interface FirebaseSessionsComponent {
197208
} catch (_: SecurityException) {
198209
false
199210
}
211+
212+
/**
213+
* Prepares the DataStore file by ensuring its parent directory exists. Throws [IOException]
214+
* if the directory could not be created, or if a conflicting file could not be removed.
215+
*/
216+
private fun prepDataStoreFile(dataStoreFile: File) {
217+
val parentDir = dataStoreFile.parentFile ?: return
218+
219+
// Check if something exists at the path, but isn't a directory
220+
if (parentDir.exists() && !parentDir.isDirectory) {
221+
// Only delete it if it's the specific file we know we can safely remove
222+
if (parentDir.name == "firebaseSessions") {
223+
if (!parentDir.delete()) {
224+
throw IOException("Failed to delete conflicting file: $parentDir")
225+
}
226+
}
227+
}
228+
229+
if (parentDir.isDirectory) {
230+
return
231+
}
232+
233+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
234+
try {
235+
Files.createDirectories(parentDir.toPath())
236+
} catch (ex: Exception) {
237+
throw IOException("Failed to create directory: $parentDir", ex)
238+
}
239+
} else {
240+
if (!parentDir.mkdirs()) {
241+
// It's possible another thread created it in the meantime, so we double-check
242+
if (!parentDir.isDirectory) {
243+
throw IOException("Failed to create directory: $parentDir")
244+
}
245+
}
246+
}
247+
}
200248
}
201249
}
202250
}

0 commit comments

Comments
 (0)