PageRenderTime 52ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/build-support/trunk/ci/copy_properties.groovy

#
Groovy | 53 lines | 43 code | 4 blank | 6 comment | 3 complexity | b3deed8fac0f9a95d6390a87caec3837 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. #!/usr/bin/env groovy
  2. /* This script copies properties provided as System properties in Hudson into actual properties files used by jEdit's
  3. * Build process.
  4. */
  5. def props = System.properties
  6. def env = System.env
  7. String workspace = props.get("user.dir")
  8. String storeComment = "## THIS FILE IS GENERATED BASED ON SYSTEM PROPERTIES SUPPLIED TO HUDSON, AND IS USUALLY REPLACED ON EACH BUILD."
  9. println "Copying properties over to appropriate directories"
  10. def coreProps = new Properties()
  11. def pluginProps = new Properties()
  12. props.each { key, value ->
  13. if(key.startsWith("je.ci.")) {
  14. println "jEdit CI prop found - ${key}: ${value}"
  15. if(key.startsWith("je.ci.pl.")) {
  16. def cleanKey = key - 'je.ci.pl.'
  17. println " clean key: ${cleanKey}"
  18. pluginProps.setProperty(cleanKey, value)
  19. } else {
  20. def cleanKey = key - 'je.ci.'
  21. println " clean key: ${cleanKey}"
  22. coreProps.setProperty(cleanKey, value)
  23. }
  24. }
  25. }
  26. File corePropsFile = new File(workspace, "jedit/build.properties")
  27. // make sure stuff exists.
  28. corePropsFile.parentFile.exists() ?: corePropsFile.parentFile.mkdirs() ?: {
  29. System.err.println("'${corePropsFile.parentFile}' did not exist, and could not be created. Exiting.")
  30. System.exit(1)
  31. }()
  32. corePropsFile.exists() ?: corePropsFile.createNewFile() ?: {
  33. System.err.println("'${corePropsFile}' did not exist, and could not be created. Exiting.")
  34. System.exit(1)
  35. }()
  36. coreProps.store(corePropsFile.newWriter(), storeComment)
  37. File pluginPropsFile = new File(workspace, "jedit/jars/build.properties")
  38. // make sure stuff exists.
  39. pluginPropsFile.parentFile.exists() ?: pluginPropsFile.parentFile.mkdirs() ?: {
  40. System.err.println("'${pluginPropsFile.parentFile}' did not exist, and could not be created. Exiting.")
  41. System.exit(1)
  42. }()
  43. pluginPropsFile.exists() ?: pluginPropsFile.createNewFile() ?: {
  44. System.err.println("'${pluginPropsFile}' did not exist, and could not be created. Exiting.")
  45. System.exit(1)
  46. }()
  47. pluginProps.putAll(coreProps)
  48. pluginProps.store(pluginPropsFile.newWriter(), storeComment)
  49. /* ::mode=groovy:noTabs=true:maxLineLen=120:wrap=soft:: */