Skip to content
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

Report is empty (Android) #174

Open
st-f opened this issue Feb 14, 2019 · 12 comments · May be fixed by #184
Open

Report is empty (Android) #174

st-f opened this issue Feb 14, 2019 · 12 comments · May be fixed by #184

Comments

@st-f
Copy link

st-f commented Feb 14, 2019

I can't see an empty message, just empty table headers. I'm using :

buildscript {
   dependencies {
        classpath 'com.github.hierynomus:license-gradle-plugin:0.15.0'
    }
}

plugins {
    id "com.github.hierynomus.license" version "0.15.0"
}

allprojects {
    apply plugin: 'com.github.hierynomus.license'
}

downloadLicenses {
    includeProjectDependencies = true
    dependencyConfiguration = 'implementation'
}

in build.gradle and ./gradlew downloadLicenses to run it.

Related: #104, #113

@asarkar
Copy link

asarkar commented Mar 11, 2019

See #113 (comment)

@emilaleborn
Copy link

@asarkar that does not solve this issue.

@asarkar
Copy link

asarkar commented Mar 13, 2019

@CEZIUM It does, I’m using it. Can you post a MCVE?

@emilaleborn
Copy link

emilaleborn commented Mar 13, 2019

@asarkar

DependencyTest.zip

unzip DependencyTest.zip 
cd DependencyTest/
 ./gradlew downloadLicenses
 cat app/build/reports/license/dependency-license.json 

Should not be an empty report

@asarkar
Copy link

asarkar commented Mar 13, 2019

@CEZIUM Your project doesn't apply the license plugin or my suggestion.

@emilaleborn
Copy link

emilaleborn commented Mar 14, 2019

@CEZIUM Your project doesn't apply the license plugin or my suggestion.

It uses the plugin syntax for Gradle 2.1 and above. Look in app/build.gradle
@asarkar

@frodo821
Copy link

frodo821 commented Mar 29, 2019

The problem appears on my project the same as @CEZIUM and @st-f 's project.
I tried to resolve the matter following the approach suggested those sources:

Unfortunately, however, the issue is still unresolved. Can you help me?

my build scripts are here: [HELP] BUILD SCRIPTS OF MY GRADLE PROJECT - GitHub Gist

@kofikofi
Copy link

Has anybody figured this out? I'm also getting empty report; just the header.

@tfelix
Copy link

tfelix commented May 24, 2019

We use a multi module build with Gradle:

Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
------------------------------------------------------------
Gradle 5.4.1
------------------------------------------------------------

Build time:   2019-04-26 08:14:42 UTC
Revision:     261d171646b36a6a28d5a19a69676cd098a4c19d

Kotlin:       1.3.21
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_212 (Oracle Corporation 25.212-b03)
OS:           Linux 4.15.0-50-generic amd64

When executing the :downloadLicences I get only an empty report. Tried to apply dependencyConfiguration = 'compileClasspath' did not change anything.

EDIT: It seems the plugin must now be manually applied to all submodules? Is this the correct behavior? If I apply it to a sub module then it will generate the reports. But I remember that once it worked even when applied to the root module.

@scotzark
Copy link

I am still seeing this same behavior. Has anybody got this to work? here is my gradle file:

buildscript {
ext.kotlin_version = '1.3.50'
ext.app_base_version = '1.3'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.sentry:sentry-android-gradle-plugin:1.7.30'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

plugins {
id "com.github.hierynomus.license-report" version "0.15.0"
}

allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
apply plugin: 'com.github.hierynomus.license'
}

downloadLicenses {
includeProjectDependencies = true
dependencyConfiguration = 'implementation'
}

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

@cromefire
Copy link

Using releaseRuntimeClasspath works.

This can help debugging:

class TestLicenseTask extends DefaultTask {
    @TaskAction
    def greet() {
        project.configurations.findAll {
            isResolvable(it)
        }.each { cfg ->
            if (project.configurations.any { it.name == cfg.name && isResolvable(it) }) {
                def configuration = project.configurations.getByName(cfg.name)
                println "${cfg.name}:"
                configuration.resolvedConfiguration.resolvedArtifacts.each { ResolvedArtifact d ->
                    String dependencyDesc = "$d.moduleVersion.id.group:$d.moduleVersion.id.name:$d.moduleVersion.id.version".toString()
                    println " - $dependencyDesc"
                }
            }
        }
    }

    static boolean isResolvable(Configuration conf) {
        return conf.metaClass.respondsTo(conf, "isCanBeResolved") ? conf.isCanBeResolved() : true
    }
}

// Create a task using the task type
task testLicense(type: TestLicenseTask)

@nic-bell nic-bell linked a pull request Apr 17, 2020 that will close this issue
@dzuluaga
Copy link

I came across a fantastic solution here that perfectly addresses the issue. To summarize, the necessary modification was to replace dependencyConfiguration with the appropriate variant, which, in this case, is debug. Additionally, it was crucial to append the suffix RuntimeClasspath to the string, resulting in debugRuntimeClasspath. I hope this information proves to be helpful.

Here's the updated code snippet:

downloadLicenses {
    includeProjectDependencies = true
    dependencyConfiguration = "debugRuntimeClasspath"
    // or
    // dependencyConfiguration = 'compileClasspath'
} 

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

Successfully merging a pull request may close this issue.

9 participants