build.gradle 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (C) 2011 Google Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. import org.apache.tools.ant.filters.ReplaceTokens
  17. task javadoc(type: Javadoc) {
  18. def javaProjects = rootProject.subprojects.findResults {
  19. (it.name != 'docs') ? it : null
  20. }
  21. source javaProjects.collect { fileTree(dir: "${it.projectDir}/src") }
  22. classpath = files(javaProjects.collect { it.configurations.compile })
  23. destinationDir = new File("${buildDir}/html", 'javadoc')
  24. }
  25. task copySphinxConf(type: Copy) {
  26. from('src/main/sphinx/conf.py.in') {
  27. filter(ReplaceTokens, tokens: ['version': rootProject.version])
  28. }
  29. into 'src/main/sphinx'
  30. rename 'conf.py.in', 'conf.py'
  31. }
  32. task docs(type: Exec, dependsOn: [copySphinxConf, javadoc]) {
  33. commandLine 'make', 'html'
  34. }
  35. task clean << {
  36. ant.delete dir: 'build'
  37. ant.delete file: 'src/main/sphinx/conf.py'
  38. }