Skip to content

Commit ce55696

Browse files
committed
build.gradle.kts: use ?.let, which is idiomatic Kotlin, instead of !== null, which is more idiomatic Java
1 parent e82b94a commit ce55696

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

firebase-dataconnect/demo/build.gradle.kts

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ abstract class DataConnectGenerateSourcesTask : DefaultTask() {
197197
args("--debug", "dataconnect:sdk:generate")
198198
workingDir(inputDirectory)
199199
isIgnoreExitValue = false
200-
if (logStream !== null) {
201-
standardOutput = logStream
202-
errorOutput = logStream
200+
logStream?.let {
201+
standardOutput = it
202+
errorOutput = it
203203
}
204204
}
205205
}
@@ -225,31 +225,16 @@ abstract class DataConnectGenerateSourcesTask : DefaultTask() {
225225
) {
226226
execSpec.setCommandLine(firebaseCommand)
227227

228-
val newPath: String? =
229-
if (nodeExecutableDirectory === null) {
230-
null
231-
} else {
232-
if (path === null) {
233-
nodeExecutableDirectory
234-
} else {
235-
nodeExecutableDirectory + File.pathSeparator + path
236-
}
237-
}
238-
239-
if (newPath !== null) {
228+
nodeExecutableDirectory?.let {
229+
val newPath = if (path === null) it else (it + File.pathSeparator + path)
240230
execSpec.environment("PATH", newPath)
241231
}
242232

243-
if (dataConnectEmulatorExecutable !== null) {
244-
execSpec.environment(
245-
"DATACONNECT_EMULATOR_BINARY_PATH",
246-
dataConnectEmulatorExecutable.absolutePath,
247-
)
233+
dataConnectEmulatorExecutable?.let {
234+
execSpec.environment("DATACONNECT_EMULATOR_BINARY_PATH", it.absolutePath)
248235
}
249236

250-
if (dataConnectPreviewFlags !== null) {
251-
execSpec.environment("DATA_CONNECT_PREVIEW", dataConnectPreviewFlags)
252-
}
237+
dataConnectPreviewFlags?.let { execSpec.environment("DATA_CONNECT_PREVIEW", it) }
253238
}
254239
}
255240
}

0 commit comments

Comments
 (0)