@@ -15,13 +15,19 @@ package nebula.plugin.clojuresque.tasks
1515import nebula.plugin.clojuresque.Util
1616
1717import org.gradle.api.file.ConfigurableFileCollection
18+ import org.gradle.api.file.DirectoryProperty
19+ import org.gradle.api.model.ObjectFactory
20+ import org.gradle.api.provider.MapProperty
1821import org.gradle.api.provider.Property
1922import org.gradle.api.tasks.CacheableTask
2023import org.gradle.api.tasks.Classpath
2124import org.gradle.api.tasks.Input
25+ import org.gradle.api.tasks.InputDirectory
2226import org.gradle.api.tasks.InputFiles
2327import org.gradle.api.tasks.Optional
2428import org.gradle.api.tasks.OutputDirectory
29+ import org.gradle.api.tasks.PathSensitive
30+ import org.gradle.api.tasks.PathSensitivity
2531import org.gradle.api.tasks.StopExecutionException
2632import org.gradle.api.tasks.TaskAction
2733import org.gradle.process.ExecOperations
@@ -40,13 +46,32 @@ abstract class ClojureDoc extends ClojureSourceTask {
4046
4147 @Input
4248 @Optional
43- def codox = [:]
49+ abstract MapProperty<String , Object > getCodox ()
50+
51+ @Input
52+ abstract Property<String > getProjectName ()
53+
54+ @Input
55+ abstract Property<String > getProjectDescription ()
56+
57+ @Input
58+ abstract Property<String > getProjectVersion ()
59+
60+ @InputDirectory
61+ @PathSensitive (PathSensitivity .RELATIVE )
62+ abstract DirectoryProperty getProjectDirectory ()
4463
4564 private final ExecOperations execOperations
65+ private final ObjectFactory objectFactory
4666
4767 @Inject
48- ClojureDoc (ExecOperations execOperations ) {
68+ ClojureDoc (ExecOperations execOperations , ObjectFactory objectFactory ) {
4969 this . execOperations = execOperations
70+ this . objectFactory = objectFactory
71+ codox. convention([:])
72+ projectName. convention(" " )
73+ projectDescription. convention(" " )
74+ projectVersion. convention(" " )
5075 }
5176
5277 @TaskAction
@@ -60,13 +85,13 @@ abstract class ClojureDoc extends ClojureSourceTask {
6085 def options = [
6186 destinationDir : destDir. path,
6287 project : [
63- name : project . name ?: " " ,
64- description : project . description ?: " " ,
65- version : project . version ?: " "
88+ name : projectName . get() ,
89+ description : projectDescription . get() ,
90+ version : projectVersion . get()
6691 ],
67- codox : codox,
92+ codox : codox. get() ,
6893 sourceDirs : srcDirs. files. collect {
69- relativize(it, project . projectDir )
94+ relativize(it, projectDirectory . get() . asFile )
7095 },
7196 sourceFiles : source* . path
7297 ]
@@ -89,7 +114,7 @@ abstract class ClojureDoc extends ClojureSourceTask {
89114 execOperations. javaexec {
90115 setMainClass(" clojure.main" )
91116 args(' -' )
92- classpath = project . files (
117+ classpath = objectFactory . fileCollection() . from (
93118 this . srcDirs,
94119 this . classpath
95120 )
@@ -108,7 +133,7 @@ abstract class ClojureDoc extends ClojureSourceTask {
108133 " js/page_effects.js" ,
109134 " js/jquery.min.js"
110135 ]. each { f ->
111- def dest = project . file( " ${ destinationDir} / ${ f } " )
136+ def dest = new File ( destinationDir. get(), f )
112137 println " ${ f} "
113138 if (! dest. exists()) {
114139 dest. parentFile. mkdirs()
0 commit comments