build-apis.rb 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # Licensed to the Apache Software Foundation (ASF) under one or more
  2. # contributor license agreements. See the NOTICE file distributed with
  3. # this work for additional information regarding copyright ownership.
  4. # The ASF licenses this file to You under the Apache License, Version 2.0
  5. # (the "License"); you may not use this file except in compliance with
  6. # the License. You may obtain a copy of 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,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. require 'fileutils'
  16. include FileUtils
  17. if not (ENV['SKIP_API'] == '1')
  18. # Build Scaladoc for Scala API and Javadoc for Java API
  19. puts "Moving to scala-api module and building Scala API docs."
  20. cd("../scala-api")
  21. puts "Running 'mvn scala:doc' from " + pwd + "; this may take a few minutes..."
  22. system("mvn scala:doc") || raise("Scaladoc maven build failed")
  23. puts "Moving to api module and building Java API docs."
  24. cd("../api")
  25. puts "Running 'mvn javadoc:javadoc -Ppublic-docs' from " + pwd + "; this may take a few minutes..."
  26. system("mvn javadoc:javadoc -Ppublic-docs") || raise("Javadoc maven build failed")
  27. puts "Moving back into docs dir."
  28. cd("../docs")
  29. puts "Removing old docs"
  30. puts `rm -rf api`
  31. # Copy over the ScalaDoc for the Scala API to api/scala.
  32. # This directory will be copied over to _site when `jekyll` command is run.
  33. source = "../scala-api/target/site/scaladocs"
  34. dest = "api/scala"
  35. puts "Making directory " + dest
  36. mkdir_p dest
  37. # From the rubydoc: cp_r('src', 'dest') makes src/dest, but this doesn't.
  38. puts "cp -r " + source + "/. " + dest
  39. cp_r(source + "/.", dest)
  40. # Copy over the JavaDoc for the Java API to api/java.
  41. source = "../api/target/site/apidocs"
  42. dest = "api/java"
  43. puts "Making directory " + dest
  44. mkdir_p dest
  45. puts "cp -r " + source + "/. " + dest
  46. cp_r(source + "/.", dest)
  47. end