aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-11-03 18:39:42 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-11-03 21:53:40 +0300
commit487dba687ad0891eebe61433c83c9ad5bf529b7b (patch)
tree972a405e5edb0e064bcbbb4f99ae195ff13817ce
parentc14f3b06788df7309ba7034b030598b111540cb2 (diff)
downloaddokka-487dba687ad0891eebe61433c83c9ad5bf529b7b.tar.gz
dokka-487dba687ad0891eebe61433c83c9ad5bf529b7b.tar.bz2
dokka-487dba687ad0891eebe61433c83c9ad5bf529b7b.zip
Fix pom generation for dokka-android-plugin
Workaround for johnrengelman/shadow#334
-rw-r--r--buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy39
-rw-r--r--runners/android-gradle-plugin/build.gradle7
2 files changed, 44 insertions, 2 deletions
diff --git a/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy b/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy
new file mode 100644
index 00000000..3e1d2106
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy
@@ -0,0 +1,39 @@
+package org.jetbrains
+
+import org.gradle.api.Project
+import org.gradle.api.artifacts.ModuleVersionIdentifier
+import org.gradle.api.artifacts.ProjectDependency
+import org.gradle.api.artifacts.SelfResolvingDependency
+import org.gradle.api.publish.internal.ProjectDependencyPublicationResolver
+import org.gradle.api.publish.maven.MavenPom
+import org.gradle.api.publish.maven.MavenPublication
+
+static void configure(MavenPublication publication, Project project) {
+ publication.artifact(project.tasks.shadowJar)
+
+ publication.pom { MavenPom pom ->
+ pom.withXml { xml ->
+ def dependenciesNode = xml.asNode().appendNode('dependencies')
+
+ project.configurations.shadow.allDependencies.each {
+ //if (! (it instanceof SelfResolvingDependency)) {
+ if (it instanceof ProjectDependency) {
+ def projectDependencyResolver = project.gradle.services.get(ProjectDependencyPublicationResolver)
+ ModuleVersionIdentifier identifier = projectDependencyResolver.resolve(it)
+ addDependency(dependenciesNode, identifier)
+ } else if (!(it instanceof SelfResolvingDependency)) {
+ addDependency(dependenciesNode, it)
+ }
+
+ }
+ }
+ }
+}
+
+private static void addDependency(Node dependenciesNode, dep) {
+ def dependencyNode = dependenciesNode.appendNode('dependency')
+ dependencyNode.appendNode('groupId', dep.group)
+ dependencyNode.appendNode('artifactId', dep.name)
+ dependencyNode.appendNode('version', dep.version)
+ dependencyNode.appendNode('scope', 'runtime')
+} \ No newline at end of file
diff --git a/runners/android-gradle-plugin/build.gradle b/runners/android-gradle-plugin/build.gradle
index 8e97d9d9..193b8eee 100644
--- a/runners/android-gradle-plugin/build.gradle
+++ b/runners/android-gradle-plugin/build.gradle
@@ -1,3 +1,5 @@
+import org.jetbrains.CorrectShadowPublishing
+
apply plugin: 'java'
apply plugin: 'kotlin'
@@ -47,13 +49,14 @@ apply plugin: 'maven-publish'
publishing {
publications {
- dokkaAndroidGradlePlugin(MavenPublication) { publication ->
+ dokkaAndroidGradlePlugin(MavenPublication) { MavenPublication publication ->
artifactId = 'dokka-android-gradle-plugin'
artifact sourceJar {
classifier "sources"
}
- project.shadow.component(publication)
+
+ CorrectShadowPublishing.configure(publication, project)
}
}
}