Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dataconnect_demo_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
--no-daemon \
${{ (inputs.gradleInfoLog && '--info') || '' }} \
--profile \
-PdataConnect.minimalApp.firebaseCommand=${{ env.FDC_FIREBASE_COMMAND }} \
-PdataConnect.demo.firebaseCommand=${{ env.FDC_FIREBASE_COMMAND }} \
assemble test

- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
Expand Down
28 changes: 24 additions & 4 deletions firebase-dataconnect/demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ abstract class DataConnectGenerateSourcesTask : DefaultTask() {

@get:Input @get:Optional abstract val nodeExecutableDirectory: Property<String>

@get:InputFile
@get:Optional
@get:PathSensitive(PathSensitivity.ABSOLUTE)
abstract val dataConnectEmulatorExecutable: RegularFileProperty

@get:OutputDirectory abstract val outputDirectory: DirectoryProperty

@get:Internal abstract val workDirectory: DirectoryProperty
Expand All @@ -140,13 +145,15 @@ abstract class DataConnectGenerateSourcesTask : DefaultTask() {
val firebaseToolsVersion: String = firebaseToolsVersion.get()
val firebaseCommand: String = firebaseCommand.get()
val nodeExecutableDirectory: String? = nodeExecutableDirectory.orNull
val dataConnectEmulatorExecutable: File? = dataConnectEmulatorExecutable.orNull?.asFile
val outputDirectory: File = outputDirectory.get().asFile
val workDirectory: File = workDirectory.get().asFile

logger.info("inputDirectory: {}", inputDirectory.absolutePath)
logger.info("firebaseToolsVersion: {}", firebaseToolsVersion)
logger.info("firebaseCommand: {}", firebaseCommand)
logger.info("nodeExecutableDirectory: {}", nodeExecutableDirectory)
logger.info("dataConnectEmulatorExecutable: {}", dataConnectEmulatorExecutable)
logger.info("outputDirectory: {}", outputDirectory.absolutePath)
logger.info("workDirectory: {}", workDirectory.absolutePath)

Expand All @@ -170,6 +177,7 @@ abstract class DataConnectGenerateSourcesTask : DefaultTask() {
this,
firebaseCommand = firebaseCommand,
nodeExecutableDirectory = nodeExecutableDirectory,
dataConnectEmulatorExecutable = dataConnectEmulatorExecutable,
path = providerFactory.environmentVariable("PATH").orNull,
)
args("--debug", "dataconnect:sdk:generate")
Expand Down Expand Up @@ -197,6 +205,7 @@ abstract class DataConnectGenerateSourcesTask : DefaultTask() {
execSpec: ExecSpec,
firebaseCommand: String,
nodeExecutableDirectory: String?,
dataConnectEmulatorExecutable: File?,
path: String?,
) {
execSpec.setCommandLine(firebaseCommand)
Expand All @@ -215,6 +224,13 @@ abstract class DataConnectGenerateSourcesTask : DefaultTask() {
if (newPath !== null) {
execSpec.environment("PATH", newPath)
}

if (dataConnectEmulatorExecutable !== null) {
execSpec.environment(
"DATACONNECT_EMULATOR_BINARY_PATH",
dataConnectEmulatorExecutable.absolutePath,
)
}
}
}
}
Expand Down Expand Up @@ -264,15 +280,18 @@ run {
outputDirectory = layout.buildDirectory.dir("dataConnect/generatedSources")

firebaseCommand =
project.providers
.gradleProperty("dataConnect.minimalApp.firebaseCommand")
.orElse("firebase")
project.providers.gradleProperty("dataConnect.demo.firebaseCommand").orElse("firebase")

nodeExecutableDirectory =
project.providers.gradleProperty("dataConnect.minimalApp.nodeExecutableDirectory").map {
project.providers.gradleProperty("dataConnect.demo.nodeExecutableDirectory").map {
projectDirectory.dir(it).asFile.absolutePath
}

dataConnectEmulatorExecutable =
project.providers.gradleProperty("dataConnect.demo.dataConnectEmulatorExecutable").map {
projectDirectory.file(it)
}

val path = providers.environmentVariable("PATH")
firebaseToolsVersion =
providers
Expand All @@ -281,6 +300,7 @@ run {
this,
firebaseCommand = firebaseCommand.get(),
nodeExecutableDirectory = nodeExecutableDirectory.orNull,
dataConnectEmulatorExecutable = dataConnectEmulatorExecutable.orNull?.asFile,
path = path.orNull,
)
args("--version")
Expand Down
18 changes: 18 additions & 0 deletions firebase-dataconnect/demo/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,21 @@ org.gradle.caching=true
android.useAndroidX=true

org.gradle.jvmargs=-Xmx2g

// The path of the "firebase" command to use.
// If not specified, then "firebase" is used, resolved using the PATH environment variable.
// See build.gradle.kts for details.
//dataConnect.demo.firebaseCommand=/path/to/firebase

// The path of the directory containing the "node" and "npm" commands.
// This directory will be prepended to the PATH before running the "firebase" command
// and may be useful to override the "node" and "npm" executables that get used by it.
// See build.gradle.kts for details.
//dataConnect.demo.nodeExecutableDirectory=/path/to/node/bin

// The Data Connect emulator executable to use.
// If set, the `DATACONNECT_EMULATOR_BINARY_PATH` environment variable will be set before calling
// the "firebase" command to instruct it to use the specified Data Connect emulator rather than
// downloading an official version and using it.
// See build.gradle.kts for details.
//dataConnect.demo.dataConnectEmulatorExecutable=/path/to/cli
Loading