OneSignal-Gradle-Plugin icon indicating copy to clipboard operation
OneSignal-Gradle-Plugin copied to clipboard

OneSignal plugin increases gradle build time by a considerable amount

Open ubarua123 opened this issue 2 years ago • 8 comments

Please Add The Following

Project Setup

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.5.0'
    apply from: 'versions.gradle'
    ext {
        ....
    }

    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.3'
        classpath deps.kotlin.plugin
        classpath deps.apollo.plugin
        classpath deps.google_android.googleServices_plugin
        classpath deps.firebase.crashlytics_plugin
        classpath(deps.firebase.performance_metrics_plugin) {
            exclude group: 'com.google.guava', module: 'guava-jdk5'
        }
        classpath deps.custom.aboutLibraries_plugin
        classpath 'com.project.starter:easylauncher:3.9.0'
        classpath deps.push.onesignal_plugin
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        mavenLocal()
        maven { url "https://jitpack.io" }
        maven { url "https://dl.bintray.com/unsplash/unsplash-photopicker-android" }
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }

        flatDir {
            dirs 'libs'
        }
    }
    afterEvaluate {
        tasks.withType(JavaCompile.class) {
            options.compilerArgs << "-Xmaxerrs" << "1000"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

// Define versions in a single place


//When there is an error in code generation you will may see
//lots of errors due too missing generated code in your logs, we increase
//how many errors are shown here so that the real error is visible when it is near the end
allprojects {

}

app/build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'
apply plugin: 'com.apollographql.apollo'
// Apply the Crashlytics Gradle plugin
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.mikepenz.aboutlibraries.plugin'
apply plugin: 'com.starter.easylauncher'

android {
    compileSdkVersion Integer.parseInt(build_versions.compile_sdk)
    buildToolsVersion build_versions.build_tools

    defaultConfig {
        applicationId rootProject.ext.APPLICATION_ID
        minSdkVersion build_versions.min_sdk
        targetSdkVersion build_versions.target_sdk
.
.
.
.
}

Full Error

No Error. However, on each build, the full build is executed even for small layout updates. Which wasn't the case till I added the plugin. I can't give any concrete timings and stats, I'll have to run tests for that. This was an observation. Getting stuck on Download maven-metadata.xml

Dependency Tree

Run ./gradlew app:dependencies

OUTPUT HERE

OneSignal plugin version

0.13.4

OneSignal SDK version

4.4.0

ubarua123 avatar Jul 19 '21 12:07 ubarua123

@ubarua123 We will need details on the time differences you are seeing to investigate.

Can you run ./gradlew build --scan? This will provide a report on time it takes for each task. Please provide one without the OneSignal Gradle Plugin and another with it to compare.

More details on this on Gradle's documentation: https://scans.gradle.com/

jkasten2 avatar Jul 20 '21 18:07 jkasten2

I ran a ./gradlew build --scan without the OneSignal plugin and SDK - It took 2m 34s to complete

With the plugin and SDK - 6m 50s

It takes a lot of time in these tasks like

:app > Resolve dependencies of :app:developmentDebugImplementationCopy > maven-metadata.xml`
:app:developmentReleaseRuntimeClasspathCopy > maven-metadata.xml
:app:developmentReleaseRuntimeElementsCopy > maven-metadata.xml
:app:developmentStagingRuntimeElementsCopy > maven-metadata.xml
:app:productionDebugImplementationDependenciesMetadataCopy > maven-metadata.xml
:app:productionDebugRuntimeElementsCopy > maven-metadata.xml
:app:productionReleaseRuntimeClasspathCopy > maven-metadata.xml
:app:productionReleaseRuntimeElementsCopy > maven-metadata.xml
:app:productionStagingImplementationDependenciesMetadataCopy > maven-metadata.xml

and so on .. These tasks are not executed without including OneSignal. I believe it's trying to sync the dependancies each time One workaround is I run Gradle on offline mode which prevents these tasks. But again, its a workaround.

ubarua123 avatar Jul 21 '21 11:07 ubarua123

Same for me. No better options were other than using the offline mode. One Signal plugin increases the build time of the app by several minutes.

Actually, it is executed before every gradle task. For example, even ./gradlew clean that was taking like 6s to be executed, now it takes 2m 48s. Removing OneSignal everything goes back to normal.

Any plan to have a look at this issue?

llollox avatar Oct 25 '21 09:10 llollox

They went completely silent on it. Guess they aren't looking into it.

ubarua123 avatar Oct 25 '21 10:10 ubarua123

Same for me. The plugin increases execution time for every Gradle task. Is it going to be fixed someday?

StanKuzmenok avatar Oct 25 '21 14:10 StanKuzmenok

Any update on this? To be honest it's really annoying, it's significantly slows down the development process.

MargaritaAva avatar Oct 26 '21 10:10 MargaritaAva

Same here, this plugin only adds up 45 seconds average to the build time

matteinn avatar Dec 13 '21 16:12 matteinn

Any updates on this issue? We are having same problem, build times increased enormously.

whoisiswhowhois avatar Feb 11 '22 08:02 whoisiswhowhois