ros-java.gradle 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * Copyright (C) 2014 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. /*
  17. * *************************** ABORTED ***************************
  18. *
  19. * See discussion in https://github.com/rosjava/rosjava_bootstrap/issues/41
  20. *
  21. * I've left this lying around as a useful reference.
  22. * ***************************************************************
  23. /*
  24. * ABOUT:
  25. *
  26. * Configures a single gradle project (or subproject) to utilise ros-java settings.
  27. *
  28. * USAGE:
  29. *
  30. * Generally:
  31. *
  32. * apply from: "https://github.com/rosjava/rosjava_bootstrap/raw/indigo/ros-java.gradle"
  33. *
  34. * In the root build.gradle file of a multiproject build:
  35. *
  36. * subprojects {
  37. * apply from: "https://github.com/rosjava/rosjava_bootstrap/raw/indigo/ros-java.gradle"
  38. * ...
  39. * }
  40. */
  41. /*
  42. * Some notes: don't force the user to apply this to every subproject...let them choose
  43. * when and where it gets applied. This usually means applying this script redundantly
  44. * for every subproject. To be smarter (but force the user to do it this way) would
  45. * be to separate the components in this script to put subproject specific commands in a
  46. * rootProject.subprojects {}
  47. * closure and general ones in no closure...then call it from the root.gradle (not inside
  48. * any allprojects/subprojects closures.
  49. */
  50. /***********************
  51. * Plugins
  52. ***********************/
  53. if (!plugins.findPlugin('maven')) {
  54. apply(plugin: 'maven')
  55. }
  56. if (!plugins.findPlugin('java')) {
  57. apply(plugin: 'java')
  58. }
  59. if (!plugins.findPlugin('maven-publish')) {
  60. apply(plugin: 'maven-publish')
  61. }
  62. /***********************
  63. * Environment Settings
  64. ***********************/
  65. ext {
  66. rosMavenRepository = System.getenv("ROS_MAVEN_REPOSITORY")
  67. rosMavenDeploymentRepository = System.getenv("ROS_MAVEN_DEPLOYMENT_REPOSITORY")
  68. rosMavenPath = System.getenv("ROS_MAVEN_PATH")
  69. }
  70. /***********************
  71. * Maven Repos
  72. ***********************/
  73. repositories {
  74. if (rosMavenPath != null) {
  75. rosMavenPath.tokenize(":").each { path ->
  76. maven {
  77. url uri(path)
  78. }
  79. }
  80. }
  81. if (rosMavenRepository != null) {
  82. maven {
  83. url rosMavenRepository
  84. }
  85. }
  86. mavenLocal()
  87. maven {
  88. url "http://repository.springsource.com/maven/bundles/release"
  89. }
  90. maven {
  91. url "http://repository.springsource.com/maven/bundles/external"
  92. }
  93. mavenCentral()
  94. }
  95. /***********************
  96. * Java
  97. ***********************/
  98. sourceCompatibility = 1.7
  99. targetCompatibility = 1.7
  100. /***********************
  101. * Maven Deployment
  102. ***********************/
  103. if ( rosMavenDeploymentRepository != 'null' && rosMavenDeploymentRepository != '' ) {
  104. publishing {
  105. publications {
  106. mavenJava(MavenPublication) {
  107. from components.java
  108. }
  109. }
  110. repositories {
  111. maven {
  112. url 'file://' + rosMavenDeploymentRepository
  113. }
  114. }
  115. }
  116. }