Skip to content
This repository has been archived by the owner on Mar 14, 2022. It is now read-only.

[FEATURE] Add and improve javadoc tasks #33

Merged
merged 3 commits into from
Jun 27, 2017

Conversation

bastienpaulfr
Copy link
Contributor

Hi,

You have made a great job in creating this plugin that I was looking for !
I have made some addition to your plugin based on some experience I have.

  • First I have removed some exception throwing to be able to apply this plugin in big project containing modules that are not Android application
  • I have added an archive task
  • I have added a androidJavadoc project extension to customize task name, filter variant and specify javadoc output dir
  • I have added a javadoc option to be able to generate javadoc with comments comming from java 7 wold

Please consider my changes and feel free to comment or improve them.

Best regards,

Bastien

Copy link
Owner

@vanniktech vanniktech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the changes overall.

Could you also convert all of your comments to sentences?

Plus for the new behavior can you add unit tests?

README.md Outdated
@@ -19,7 +19,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.vanniktech:gradle-android-javadoc-plugin:0.2.1'
classpath 'com.vanniktech:gradle-android-javadoc-plugin:0.3.0'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need this to be 0.2.1 as it won't get released automatically.

title = "Documentation for Android $project.android.defaultConfig.versionName v$project.android.defaultConfig.versionCode"
description = "Generates Javadoc for $variant.name."
group = 'Documentation'
// apply a filter because use can configure javadoc for some variants but not all of them
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use can should it be you can ?

Closure outputDir = { Project project ->
"${project.buildDir}/docs/javadoc/"
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to remove this one because I would like it to be the default. By default, javadoc generated by java plugin is stored in build/docs/javadoc.

@@ -38,8 +38,8 @@ class GenerationTest {
public void testJavaProject() {
project.plugins.apply('java')

expectedException.expect(UnsupportedOperationException.class)
expectedException.expectMessage('Project is not an Android project')
//expectedException.expect(UnsupportedOperationException.class)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just remove this then

expectedException.expect(UnsupportedOperationException.class)
expectedException.expectMessage('Project is not an Android project')
//expectedException.expect(UnsupportedOperationException.class)
//expectedException.expectMessage('Project is not an Android project')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just remove this then

@@ -1,5 +1,4 @@
GROUP=com.vanniktech
VERSION_NAME=0.2.2-SNAPSHOT
VERSION_NAME=0.3.0-SNAPSHOT
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the group back

import org.gradle.api.Project
import org.gradle.api.Task
import com.vanniktech.android.javadoc.extensions.Options
import org.gradle.api.*
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't use star imports

import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.external.javadoc.JavadocMemberLevel

class Generation implements Plugin<Project> {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove

}
logger = project.getLogger()

createExtensions(project)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just inline this one

*
* @author Bastien Paul
*/
public class Options {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename it to AndroidJavaDocExtension

@bastienpaulfr bastienpaulfr force-pushed the dev-bastien branch 9 times, most recently from 7581f01 to 9682bbf Compare June 26, 2017 10:43
 - Create task for all projects and subprojects
 - Create archive task
 - Add compatibility for javadoc 7 comments
 - Add customization
@bastienpaulfr
Copy link
Contributor Author

Hi,

You can review changes I've made.

Thanks

Copy link
Owner

@vanniktech vanniktech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more small things. Once they're resolved I'll merge this

String taskName = genJavadocTaskName(project, variant)

logger.debug "Create task ${taskName} for project ${project.name}, variant ${variant.name}"
// protection if a task already exists because the name of the task is configurable
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one still needs to be transformed.

logger.debug "task $taskName already exists"
return project.tasks.findByPath(taskName)
} else {
Task t1 = createJavadocTask(project, variant, taskName)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadocTask instead of t1?

return project.tasks.findByPath(taskName)
} else {
Task t1 = createJavadocTask(project, variant, taskName)
Task t2 = createJavadocArchiveTask(project, variant, genJavadocJarTaskName(project, variant))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadocArchieveTask instead of t2

Closure outputDir = { Project project ->
"${project.buildDir}/docs/javadoc/"
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove

import org.gradle.api.Project

/**
* <p>Created on 23/06/17
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you go and remove this alltogether? No file has proper date / authors. You'll still get credited in the release notes for the feature.

class GenerationTest {
@Rule public ExpectedException expectedException = ExpectedException.none()
@Rule
public ExpectedException expectedException = ExpectedException.none()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: restore on same line

@bastienpaulfr
Copy link
Contributor Author

Hi,

I hope this one is the good one !

Thanks,

Copy link
Owner

@vanniktech vanniktech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution !

@vanniktech vanniktech merged commit 65f38de into vanniktech:master Jun 27, 2017
@bastienpaulfr bastienpaulfr deleted the dev-bastien branch June 27, 2017 11:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants