Skip to content

Commit 6d70093

Browse files
authored
Merge pull request #15012 from apache/include-grails-gradle-groovydocs
Include sources from composite builds in Groovydoc
2 parents 581e131 + f87b9d6 commit 6d70093

File tree

3 files changed

+31
-19
lines changed

3 files changed

+31
-19
lines changed

grails-doc/build.gradle

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,34 @@ combinedGroovydoc.configure { Groovydoc gdoc ->
8282
possibleSources
8383
}
8484
.flatten()
85-
gdoc.source(sources.collect { SourceSet it -> [it.allSource.srcDirs, it.allSource.srcDirs] }.flatten().findAll { File srcDir ->
86-
if (!(srcDir.name in ['java', 'groovy'])) {
87-
return false
88-
}
8985

90-
srcDir.exists()
91-
}.unique())
86+
List<File> baseSourceDirs = sources
87+
.collect { SourceSet it -> it.allSource.srcDirs }
88+
.flatten()
89+
.findAll { File srcDir ->
90+
if (!(srcDir.name in ['java', 'groovy'])) {
91+
return false
92+
}
93+
srcDir.exists()
94+
}
95+
96+
// Collect source directories from included builds (composite builds)
97+
// Gradle will not provide the included build projects or source sets, so we inspect the file system
98+
List<File> includedBuildSourceDirs = gradle.includedBuilds
99+
.collectMany { includedBuild ->
100+
def sourceDirs = []
101+
includedBuild.projectDir.eachDir { File dir ->
102+
['src/main/java', 'src/main/groovy'].each { rel ->
103+
File sourceDir = new File(dir, rel)
104+
if (sourceDir.isDirectory()) {
105+
sourceDirs << sourceDir
106+
}
107+
}
108+
}
109+
sourceDirs
110+
}
111+
112+
gdoc.source(project.files((baseSourceDirs + includedBuildSourceDirs).unique()))
92113

93114
gdoc.classpath = files(sources.collect { SourceSet it -> it.compileClasspath.filter(File.&isDirectory) }.flatten().unique())
94115
gdoc.destinationDir = project.layout.buildDirectory.dir('combined-api/api').get().asFile

grails-doc/src/en/guide/plugins/understandingPluginLoadOrder.adoc

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,14 @@ It's not only plugin load order that you can control. You can also specify which
9999
[source,groovy]
100100
----
101101
def environments = ['development', 'test', 'myCustomEnv']
102-
def scopes = [excludes:'war']
103102
----
104103

105-
In this example, the plugin will only load in the 'development' and 'test' environments. Nor will it be packaged into the WAR file, because it's excluded from the 'war' phase. This allows `development-only` plugins to not be packaged for production use.
104+
In this example, the plugin will only load in the 'development', 'test' and 'myCustomEnv' environments.
106105

107-
The full list of available scopes are defined by the enum link:{api}grails/util/BuildScope.html[BuildScope], but here's a summary:
108-
109-
* `test` - when running tests
110-
* `functional-test` - when running functional tests
111-
* `run` - for run-app and run-war
112-
* `war` - when packaging the application as a WAR file
113-
* `all` - plugin applies to all scopes (default)
114-
115-
Both properties can be one of:
106+
The properties can be one of:
116107

117108
* a string - a sole inclusion
118-
* a list - a list of environments or scopes to include
109+
* a list - a list of environments to include
119110
* a map - for full control, with 'includes' and/or 'excludes' keys that can have string or list values
120111

121112
For example,

grails-gradle/plugins/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
Grails Gradle Plugins
1818
========
1919

20-
Latest API Docs: https://grails.github.io/grails-gradle-plugin/latest/api/
20+
Latest API Docs: https://docs.grails.org/latest/api/
2121

2222
Below are the plugins that are provided by the grails-gradle-plugin dependency.
2323

0 commit comments

Comments
 (0)