Fix getting licenses on Android.#184
Conversation
|
Hi. Any chance on replaying the job on CI, and merging? We tested the changes here, and it works on our Android project. We got 403 dependencies vs 0 with previous versions. |
jakubvimn
left a comment
There was a problem hiding this comment.
This is a great work and fixed the plugin for my Android project. All my comments are rather minor improvements that can be done in the code. I haven't found any serious problems.
build.gradle
Outdated
| } | ||
| dependencies { | ||
| classpath "com.gradle.publish:plugin-publish-plugin:0.9.1" | ||
| classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:2.2.+' |
There was a problem hiding this comment.
don't use "+", specify concrete version
build.gradle
Outdated
| url "https://plugins.gradle.org/m2/" | ||
| jcenter() | ||
| repositories { | ||
| maven { url "https://plugins.gradle.org/m2/" } |
There was a problem hiding this comment.
can be replaced with gradlePluginPortal()
build.gradle
Outdated
| jcenter() | ||
| repositories { | ||
| maven { url "https://plugins.gradle.org/m2/" } | ||
| maven { url "https://dl.google.com/dl/android/maven2/" } |
| * @return whether conf is resolvable | ||
| * | ||
| * @see <a href="https://docs.gradle.org/3.4/release-notes.html#configurations-can-be-unresolvable">Gradle 3.4 release notes</a> | ||
| * @see <ahref="https://docs.gradle.org/3.4/release-notes.html#configurations-can-be-unresolvable" > Gradle 3.4 release notes</a> |
| */ | ||
| protected boolean isTest(Configuration configuration) { | ||
| boolean isTestConfiguration = (configuration.name.startsWith(TEST_PREFIX) || configuration.name.startsWith(ANDROID_TEST_PREFIX)) | ||
| configuration.hierarchy.each { isTestConfiguration |= TEST_COMPILE.contains(it.name) } |
There was a problem hiding this comment.
most of the time there's no need to check the full hierarchy
return isTestConfiguration || configuration.hierarchy.any { TEST_COMPILE.contains(it.name) }
| boolean isPackagedDependency = PACKAGED_DEPENDENCIES_PREFIXES.any { | ||
| configuration.name.startsWith(it) | ||
| } | ||
| configuration.hierarchy.each { |
There was a problem hiding this comment.
isPackagedDependency |= configuration.hierarchy.any ...
|
|
||
|
|
||
| boolean isDependencyIncluded(String depName) { | ||
| for (Pattern pattern : this.patternsToIgnore) { |
There was a problem hiding this comment.
return !patternsToIgnore.any { it.matcher(depName).matches() }
|
@jakubvimn I've made some changes based on your feedback. |
|
|
||
| animalsniffer { | ||
| excludeJars 'gradle-api-*' | ||
| ignoreFailures true |
There was a problem hiding this comment.
I have no idea what it doesn't work. I've created an issue for Animals Sniffer
xvik/gradle-animalsniffer-plugin#22
There was a problem hiding this comment.
There's a response
xvik/gradle-animalsniffer-plugin#22 (comment)
There was a problem hiding this comment.
I guess that after animal sniffer update, this should not be needed anymore.
| * @return whether conf is resolvable | ||
| * | ||
| * @see <a href="https://docs.gradle.org/3.4/release-notes.html#configurations-can-be-unresolvable">Gradle 3.4 release notes</a> | ||
| * @see <ahref="https://docs.gradle.org/3.4/release-notes.html#configurations-can-be-unresolvable" > Gradle 3.4 release notes</a> |
|
@nic-bell will you look into the failed build? Do you need any support? |
|
@michallaskowski How did you get this running from the fork? Can you maybe provide some instructions and gradle code how you integrated it? Couldn't do it using jitpack following these instructions as this is not a library but a plugin. Some help would be much appreciated! @nic-bell |
|
@Jeehut I didn't, @jakubvimn did (we work together). I will ensure tomorrow he saw this message, in case he didn't get the notification. Afaik, he published a build from this PR's branch to our internal artifacts repository. I think we all count on this PR being merged, though. |
I gave up after I ran into the animal sniffer issue. I am not even sure this repo is actively maintained. |
Hey the instructions to try it out are in the original PR description but here they are again anyway. I am using it in Android project as a library. buildscript {
...
dependencies {
...
repositories {
...
maven { url "https://jitpack.io" }
}
classpath "com.github.nic-bell:license-gradle-plugin:a1215e995d"
}
allprojects {
...
apply plugin: "com.github.hierynomus.license-report"
}
downloadLicenses {
includeProjectDependencies = true
dependencyConfiguration = 'releaseRuntimeClasspath'
}For the latest build look here: |
|
Okay guys, taking back what I just said, it actually works now after I found the issue with @nic-bell's instructions: In my project, I don't have a |
|
Any update on that? Do you need any help to move it forward? |
| def configuration = project.configurations.getByName(dependencyConfiguration) | ||
| configuration.resolvedConfiguration.resolvedArtifacts.each { ResolvedArtifact d -> | ||
| String dependencyDesc = "$d.moduleVersion.id.group:$d.moduleVersion.id.name:$d.moduleVersion.id.version".toString() | ||
| if(isDependencyIncluded(dependencyDesc)) { |
There was a problem hiding this comment.
This line does not work in new code, so it's not possible to exclude any project dependency
|
May I know what is the status of this PR? Thanks and looking forward to it. |
|
Do we have any chance to look this PR merged? Because I faced with this issue too.. Thanks |
Use this version: https://github.com/openkin/license-gradle-plugin |
|
I tried get it this way: Could you provide more details to implement it? Thanks for your time |
|
@Mepfic Try this: buildscript {
repositories {
...
maven { url 'https://jitpack.io' }
}
dependencies {
classpath "com.github.openkin:license-gradle-plugin:0d9582e233"
}
}And then in your module apply plugin: 'com.github.hierynomus.license-report' |
In this case I get a error: Should I use some special repository? |
|
@Mepfic Yes, use the jitpack. I've just updated the comment above |
Cool, I got license report, btw, in my case (for android) works fine only with next parameters: |
|
@Mepfic Could you try |
yea, it works too (from fork version). In release version 0.16.1 'all' didn't work, only 'releaseRuntimeClasspath' and 'debugRuntimeClasspath' - by my build variants. |
|
Hi, |
|
Hello, Any updates on this pull request? |
|
The forked version worked for me on a test java project (not android). Any chance of this PR being merged? |
Licenses were always coming up blank on Android used some logic from oss-licenses-plugin.
Tested with following config in root
build.gradle.Should fix #174 #182