logo
down
shadow

Mocking Application Variants in Unit Test for Custom Gradle Plugin That Depends On Android Plugin


Mocking Application Variants in Unit Test for Custom Gradle Plugin That Depends On Android Plugin

By : user2955889
Date : November 22 2020, 10:48 AM
fixed the issue. Will look into that further When unit testing plugins using ProjectBuilder it's typically necessary to explicitly call Project.evaluate() in cases where plugins utilize Project.afterEvaluate(). Add the following just before you assertions.
code :
project.evaluate()
project.android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"
}


Share : facebook icon twitter icon
How to unit test a gradle plugin using the gradle build itself

How to unit test a gradle plugin using the gradle build itself


By : user2435894
Date : March 29 2020, 07:55 AM
wish helps you Sounds like the classes of your plugin sit under buildSrc. If that's the case you'll have to declare the dependency on TestNG in a build.gradle file under buildSrc. The contents would look as such:
code :
repositories {
    mavenCentral()
}

dependencies {
    testCompile 'org.testng.testng:6.8.8'
}
How to test android application on Circle CI with Google Services Gradle Plugin

How to test android application on Circle CI with Google Services Gradle Plugin


By : jhon toro
Date : March 29 2020, 07:55 AM
Hope this helps 1) Yes, it should - it contains sensitive information like your API key.
2) I don't think so
custom fonts failing to load during unit tests after android gradle plugin upgrade

custom fonts failing to load during unit tests after android gradle plugin upgrade


By : hnadir
Date : March 29 2020, 07:55 AM
will be helpful for those in need It's Robolectric indeed
https://github.com/robolectric/robolectric/issues/2647
code :
android.applicationVariants.all { variant ->
    def productFlavor = "${variant.productFlavors[0].name.capitalize()}"
    def buildType = "${variant.buildType.name.capitalize()}"
    tasks["compile${productFlavor}${buildType}UnitTestSources"].dependsOn(tasks["merge${productFlavor}${buildType}Assets"])
}
This creates a dependency for all compile*UnitTestSources Gradle tasks on the corresponding merge*Assets tasks. The merge tasks copy all assets to app/build/intermediates/assets, where Robolectric finds them.
In a custom gradle plugin, how to add task depends on task which is defined in other plugin?

In a custom gradle plugin, how to add task depends on task which is defined in other plugin?


By : Stephan Dannhaus
Date : March 29 2020, 07:55 AM
wish helps you You don't need to know that taskB comes from PluginB to create the dependency on taskA: you can simply reference taskB by its name, as follows:
code :
class PluginA implements Plugin<Project> {
    void apply(Project project) {

        Task taskA = project.task('taskA') {
            doLast {
                println 'Executing task A from plugin A'
            }
        }
        // create dependency from taskA to taskB
        project.tasks.matching { it.name == 'taskB'}.each {
            taskA.dependsOn it
        }
    }
}
class PluginA implements Plugin<Project> {
    void apply(Project project) {

        Task taskA = project.task('taskA') {
            doLast {
                println 'Executing task A from plugin A'
            }
        }
        project.pluginManager.withPlugin('pluginB'){                
            println "pluginB applied => adding dependency from taskA to taskB"
            project.afterEvaluate{
                taskA.dependsOn project.tasks.getByName('taskB')
            }
        }
    }
}
How to publish all flavor variants to maven with Android Gradle plugin 3.0.0?

How to publish all flavor variants to maven with Android Gradle plugin 3.0.0?


By : siddhika
Date : March 29 2020, 07:55 AM
With these it helps I am facing a similar problem. Although I don't use productFlavors, I am expecting mavenDeployer to publish three configurations (corresponding to my three build types "debug", "release", and "staging"). But it no longerd does, it only publishes an AAR to Maven for the "release" configuration.
Prior to Android Plugin for Gradle 3.0.1, the following mavenDeployer code did publish all three AAR files:
code :
uploadArchives {
    repositories.mavenDeployer {
        repository(url:"file://" + "${project.buildDir}/maven/releases")

        pom.groupId = "com.example"
        pom.artifactId = "sdk"
        pom.version = sdkName
    }
}
sdk/build/maven/releases/com/locuslabs/sdk/develop/sdk-develop-debug.aar 
sdk/build/maven/releases/com/locuslabs/sdk/develop/sdk-develop-staging.aar 
sdk/build/maven/releases/com/locuslabs/sdk/develop/sdk-develop-release.aar
sdk/build/maven/releases/com/locuslabs/sdk/develop/sdk-develop.aar
publishing {
    publications {
        impl(MavenPublication) {               // for first variant?
            groupId 'org.gradle.sample.impl'
            artifactId 'project2-impl'
            version '2.3'

            from components.java
        }
        api(MavenPublication) {                // for second variant?
            groupId 'org.gradle.sample'
            artifactId 'project2-api'
            version '2'

            artifact apiJar
        }
    }
}

task apiJar(type: Jar) {
    baseName "publishing-api"
    from sourceSets.main.output
    exclude '**/impl/**'
}
publishing {
    publications {
        android.libraryVariants.all { variant ->

            "maven${variant.name.capitalize()}Aar"(MavenPublication) {
                from components.findByName("android${variant.name.capitalize()}")
                groupId 'digital.wup.test-publish'
                artifactId 'test-publish'
                version "1.0.0-${variant.name}"
            }
        }
    }
}
Related Posts Related Posts :
  • Stream corrupted exception - invalid code type AC [java]
  • Routing Sysout values to JTextArea
  • GWT RPC serialization for Dynamic Host Page
  • Best Approch of Returning Value from 'getter' Method
  • Understanding xml schemalocation
  • Checking if a PDF is PDF/A 1-a format or not using PDFBOX in java
  • Difference Between Variable and Identifier
  • How to compute two aggregate functions with Java streams?
  • Parse the value of the json to baseadapter in android?
  • JavaFX animation on raspberry pi
  • Solve "unchecked warning" in Java avoiding @suppressWarnings
  • How to specify a new name for a file while moving it to another directory in Java?
  • Popup window not showing up with spinner item selection?
  • how to iterate through json objects in java
  • Caused by: java.lang.NoClassDefFoundError: org/springframework/aop/framework/AbstractAdvisingBeanPostProcessor
  • Getting NoClassDefFoundError while running PMD task from Gradle
  • Matlab drag and drop file from windows explorer to figure (gui)
  • How does scala's actor model make use of C threads and native system threads?
  • Store java.util.Date as key in a Map based on reference equality instead of "value" equality
  • Error when logging into FTP from AsyncTask class using org.apache.commons.net.ftp.FTPClient
  • creating unique index in mongoDB
  • hibernate Query to find record based on substring
  • How many strings are in jvm string pool intern
  • Unable to initialize native-platform. on Jenkins
  • How to create a list of dummy files in Java?
  • Docker: Which approach is better? WAR embedded in image or base image + war?
  • java.lang.InternalError: CallerSensitive annotation expected at frame 1
  • How to write a method to read JSON files of different structures and return different POJO objects in Java?
  • Reference to Classes in Java
  • Unable to call function via companion object
  • REST: convert XML content passed with POST to a java object, attribute inside the element
  • Device not receive message from GCM
  • How to increase Openfire concurrent connection limit?
  • Android send custom parameter on AsyncTask
  • GWT - Get dom element's value from another page
  • How can i initialize an array in Java?
  • Is it possible to increase a java process's(when is running) size?
  • Getting Node Address instead of Value in Binary Search Tree
  • PdfByteContent not adding in iText pdf
  • Spring JpaRepository: delete() with subsequent save() in the same transaction
  • producer-consumer using arraydeque working only in breakpoint
  • Adding a JPanel to another JPanel
  • Comparison with operator ==, how does it work?
  • Error buildling with maven for openshift
  • What is the java equivilant to MySQL's smallint
  • proxy trouble on eclipse with https
  • Spring-Jdbc Template and Prepared statement
  • Mule - exception in Outbound endpoint Message payload is of type: byte[]
  • Modify package names for java classes generated from wsdl
  • How to download multiple images and have one progressBar using AsynTask (Android)
  • Implementing Service Provider, IdP and user in java with SAML (POC)
  • Why does my scanner repeat?
  • Can I forget ResultSetFuture in Cassandra java driver without facing memory leak?
  • XML to JAXB binding having nested elements?
  • Java: ToString() prints the same hashcode each time
  • Why am I getting a thread exception in my graphics program?
  • Can we read 4th byte from hexadecimal value?
  • How to create watermark in image just like Google maps watermarks
  • how come Thread class called inside another class?
  • AssertionError: Unexpected schema version 0: Unexpected schema version 0
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org