stempler / gradle-versioneye-plugin

Plugin for Gradle to update your project's dependencies status on www.versioneye.com
MIT License
31 stars 5 forks source link

Plugin scope is missing for Android projects #22

Closed johnjohndoe closed 8 years ago

johnjohndoe commented 8 years ago

I noticed that v.1.3.0 takes Gradle plugins into account - which is great. Thanks for this feature! This works fine for pure Java projects. I can see the result on the project website. It shows the project dependencies splitted into compile scope, test scope and plugin scope.

For Android projects plugin scope is missing. I suspect this is because plugins are defined in the build.gradle file which is located in the root folder of the project. All other dependencies are defined in the build.gradle file of each module. Please check if you incorporate all build.gradle files of a project.

stempler commented 8 years ago

The VersionEye plugin is applied to a Gradle project, and accesses its dependencies and build script dependencies. The fact where (=in which file) these are defined is irrelevant, as long as the configuration is applied to the project. I don't have any experience with Android projects in Gradle. When you speak about multiple build.gradle files, are these in fact multi-project builds? To which project is the plugin applied in that case?

johnjohndoe commented 8 years ago

Good point. Here is a typical build.gradle from the root folder of a project.

// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'org.standardout.versioneye'

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0'
        classpath 'org.standardout:gradle-versioneye-plugin:1.3.0'
    }
}

allprojects {
    repositories {
        mavenCentral()
        jcenter()
    }
    apply plugin: 'org.standardout.versioneye'
}

I am trying to apply the project to both the root level and all projects. And it looks as if dependencies from the root file are ignored:

$ ./gradlew vEU
:app:versioneye-pom
:versioneye-pom
:versioneye-update
:app:versioneye-update
Updated VersionEye project Altglas successfully
com.android.support:appcompat-v7 is up-to-date
com.squareup.okhttp3:logging-interceptor is up-to-date
com.squareup.okhttp3:okhttp is up-to-date
com.squareup.okhttp3:okhttp-urlconnection is up-to-date
com.fasterxml.jackson.core:jackson-databind is up-to-date
com.novoda:sqlite-provider is up-to-date
com.androidmapsextensions:android-maps-extensions is up-to-date
Consider updating com.google.android.gms:play-services from 6.1.71 to 8.3.0
2 dependencies overall
0 outdated dependencies
:versionEyeUpdate
Updated VersionEye project Altglas successfully
com.android.support:appcompat-v7 is up-to-date
com.squareup.okhttp3:logging-interceptor is up-to-date
com.squareup.okhttp3:okhttp is up-to-date
com.squareup.okhttp3:okhttp-urlconnection is up-to-date
com.fasterxml.jackson.core:jackson-databind is up-to-date
com.novoda:sqlite-provider is up-to-date
com.androidmapsextensions:android-maps-extensions is up-to-date
Consider updating com.google.android.gms:play-services from 6.1.71 to 8.3.0
info.metadude.android:typed-preferences is up-to-date
de.cketti.library.changelog:ckchangelog is up-to-date
com.squareup.retrofit2:retrofit is up-to-date
com.squareup.retrofit2:converter-jackson is up-to-date
junit:junit is up-to-date
Consider updating org.assertj:assertj-core from 1.7.1 to 3.4.1
com.squareup.okhttp3:mockwebserver is up-to-date
2 dependencies overall
0 outdated dependencies
:app:versionEyeUpdate

When I add it in the first line of the file it looks like this:

:versioneye-pom
:versioneye-update
Updated VersionEye project Altglas successfully
com.android.tools.build:gradle is up-to-date
org.standardout:gradle-versioneye-plugin is up-to-date
2 dependencies overall
0 outdated dependencies
:versionEyeUpdate
stempler commented 8 years ago

I'm not quite sure what you mean with the last thing about the first line. What exactly did you change?

Anyway, regarding the first output, the problem is probably that the all projects have the same VersionEye project configured and they all update it, and in that override each others dependencies. The tasks are execute for each project, there is no aggregation taking place.

If that's indeed the problem, the solution I would have in mind would be applying the plugin to the root project only, and it would hopefully be able, if configured that way, to aggregate the dependencies of all projects.

johnjohndoe commented 8 years ago

I agree. Configuring the plugin for the root project should aggregate the dependencies of all the sub projects aka. modules. This is what I tried here:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'org.standardout.versioneye' // this is what I meant with 1st line

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0'
        classpath 'org.standardout:gradle-versioneye-plugin:1.3.0'
    }
}

allprojects {
    repositories {
        mavenCentral()
        jcenter()
    }
}

This produces the following output as stated before:

:versioneye-pom
:versioneye-update
Updated VersionEye project Altglas successfully
com.android.tools.build:gradle is up-to-date
org.standardout:gradle-versioneye-plugin is up-to-date
2 dependencies overall
0 outdated dependencies
:versionEyeUpdate

As you can see the sub project(s) are ignored.

stempler commented 8 years ago

I updated the snapshot, could you try it with your project? The plugin should only be applied to the root project and configured to include sub-projects.

johnjohndoe commented 8 years ago

Looks good. :+1: