Skip to content

Plugin doesn't work with Kotlin gradle scripts #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ztibbitts opened this issue Jun 25, 2020 · 2 comments
Open

Plugin doesn't work with Kotlin gradle scripts #42

ztibbitts opened this issue Jun 25, 2020 · 2 comments

Comments

@ztibbitts
Copy link

ztibbitts commented Jun 25, 2020

I've been generally unsuccessful configuring this plugin with kts gradle scripts. I believe it's due to the use of a Closure instead of an Action in the devices method on FirebaseTestLabPluginExtension

For the moment, I've forked the plugin locally to make the following change in FirebaseTestLabPluginExtension:

fun devices(action: NamedDomainObjectContainer<Device>.() -> Unit) { devices.action() }

this lets me configure the plugin like this in my build.gradle.kts file:

firebaseTestLab {
    keyFile = file("asdfasdf.json")
    googleProjectId = "asdfasdf"

    devices {
        register("pixel") {
            deviceIds = listOf("sailfish")
            androidApiLevels = listOf(25)
            locales = listOf("en")
        }
    }
}

I haven't tested to see if this breaks compatibility with groovy gradle scripts, but I'm open to helping out to reach a compatible solution.

zbynek added a commit to zbynek/FirebaseTestLab-Android that referenced this issue Jun 25, 2020
@zbynek
Copy link
Contributor

zbynek commented Jun 25, 2020

You can try your changes using Jitpack

buildscript {
    repositories {
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath "com.github.zbynek:FirebaseTestLab-Android:patch-1-SNAPSHOT"
    }
}

This fails for me with Groovy

Could not find method mainDevice() for arguments [app_common_3mq6icw2x9sq2qcpsy2elmlde$_run_closure4$_closure13$_closure14@4cd9d2a0] on extension 'firebaseTestLab' of type com.appunite.firebasetestlabplugin.FirebaseTestLabPluginExtension.

for configuration

devices {
        mainDevice {
            deviceIds = ["Pixel2"]
            androidApiLevels = [28]
            timeout = 1800
            isUseOrchestrator = true
            environmentVariables = ["clearPackageData=true"]
        }
    }

@Buggaboo
Copy link

Buggaboo commented Jul 27, 2021

Solution

val deviceName = "nexusEmulator"
firebaseTestLab {
    keyFile = File("$projectDir/my-app-key.json") // TODO HOWTO github action secret?!
    googleProjectId = if (startParameter.toLowerCase().contains("acc")) { "android-mobile-app-acc" } else { "android-mobile-app-prod" }
    createDevice(deviceName) {
        com.appunite.firebasetestlabplugin.model.Device(deviceName).also {
            deviceIds = listOf("hammerhead")
            androidApiLevels = listOf(23)
            locales = listOf("nl", "en")
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants