Skip to content

Commit

Permalink
Fix when both javadoc and groovydoc
Browse files Browse the repository at this point in the history
  • Loading branch information
ypujante committed Apr 27, 2021
1 parent 939939a commit a0360ea
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ In order to use the plugins you need to add this to your build script:

buildscript {
dependencies {
classpath 'org.pongasoft:org.pongasoft.gradle-plugins:3.0.0'
classpath 'org.pongasoft:org.pongasoft.gradle-plugins:3.0.1'
}
}

Expand Down
6 changes: 5 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
3.0.0 (2021/04/27)
3.0.1 (2021/04/27)
------------------
* Fix when both javadoc and groovydoc

3.0.0 (2021/04/26)
------------------
* Removed jcenter
* use of `gradle 6.8`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,40 +102,46 @@ class ReleasePlugin implements Plugin<Project>
* Look for java/groovy to add javadoc/groovydoc and sources
*/
private void addSourcesAndDocs(ReleasePluginExtension extension) {
boolean hasSources = false
def javaSources = project.tasks.findByName('javadoc')?.source
if (javaSources && !javaSources.isEmpty()) {
/********************************************************
* task: javadocJar
********************************************************/
project.task([type: Jar, dependsOn: "javadoc"], 'javadocJar') {
archiveClassifier.set('javadoc')
from project.javadoc.destinationDir
}

hasSources = true
}
def javaSources = project.tasks.findByName('javadoc')?.source
boolean hasJavaSources = javaSources && !javaSources.isEmpty()

def groovySources = project.tasks.findByName('groovydoc')?.source
if (groovySources && !groovySources.isEmpty()) {
/********************************************************
* task: groovydocJar
********************************************************/
project.task([type: Jar, dependsOn: "groovydoc"], 'groovydocJar') {
archiveClassifier.set('javadoc')
from project.groovydoc.destinationDir
}
boolean hasGroovySources = groovySources && !groovySources.isEmpty()

hasSources = true
}
boolean hasSources = hasJavaSources || hasGroovySources

if (hasSources) {

if(hasJavaSources && !project.tasks.findByName('javadocJar')) {
/********************************************************
* task: javadocJar
********************************************************/
project.task([type: Jar, dependsOn: 'javadoc'], 'javadocJar') {
archiveClassifier.set('javadoc')
from project.javadoc.destinationDir
}
}

if(hasGroovySources && !project.tasks.findByName('groovydocJar')) {
/********************************************************
* task: groovydocJar
********************************************************/
project.task([type: Jar, dependsOn: 'groovydoc'], 'groovydocJar') {
// maven central requires javadoc so if only groovy we need to rename it
archiveClassifier.set(hasJavaSources ? 'groovydoc' : 'javadoc')
from project.groovydoc.destinationDir
}
}

/********************************************************
* task: sourcesJar
********************************************************/
project.task([type: Jar, dependsOn: "classes"], 'sourcesJar') {
archiveClassifier.set('sources')
from project.sourceSets.main.allSource
if(!project.tasks.findByName('sourcesJar')) {
project.task([type: Jar, dependsOn: "classes"], 'sourcesJar') {
archiveClassifier.set('sources')
from project.sourceSets.main.allSource
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion project-spec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
spec = [
name: 'gradle-plugins',
group: 'org.pongasoft',
version: '3.0.0',
version: '3.0.1',

versions: [
jdk: '8'
Expand Down

0 comments on commit a0360ea

Please sign in to comment.