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
+ /*
18
+ * Apply this gradle script to configure maven url's and other properties in
19
+ * the root build.gradle of any rosjava project. Use alongside the api provided
20
+ * by the ros-java gradle plugin.
21
+ *
22
+ * Usage:
23
+ *
24
+ * subprojects {
25
+ * apply from: "https://github.com/rosjava/rosjava_bootstrap/raw/indigo/ros-java.gradle"
26
+ * /*
27
+ * See https://github.com/rosjava/rosjava_bootstrap (look for gradle_plugins)
28
+ * to see what is going on under the hood of this plugin.
29
+ * */
30
+ * apply plugin : ' ros-java'
31
+ * .. .
32
+ */
33
+
34
+ rootProject. subprojects {
35
+ /* **********************
36
+ * Plugins
37
+ ***********************/
38
+ if (! plugins. findPlugin(' maven' )) {
39
+ apply(plugin : ' maven' )
40
+ }
41
+ if (! plugins. findPlugin(' java' )) {
42
+ apply(plugin : ' java' )
43
+ }
44
+ if (! plugins. findPlugin(' maven-publish' )) {
45
+ apply(plugin : ' maven-publish' )
46
+ }
47
+
48
+ /* **********************
49
+ * Environment Settings
50
+ ***********************/
51
+ ros. mavenRepository = System . getenv(" ROS_MAVEN_REPOSITORY" )
52
+ ros. mavenDeploymentRepository = System . getenv(" ROS_MAVEN_DEPLOYMENT_REPOSITORY" )
53
+ String mavenPath = System . getenv(" ROS_MAVEN_PATH" )
54
+ if (mavenPath != null ) {
55
+ ros. mavenPath = mavenPath. tokenize(" :" )
56
+ }
57
+
58
+ /* **********************
59
+ * Maven Repos
60
+ ***********************/
61
+ repositories {
62
+ if (ros. mavenPath != null ) {
63
+ ros. mavenPath. each { path ->
64
+ maven {
65
+ url uri(path)
66
+ }
67
+ }
68
+ }
69
+ if (ros. mavenRepository != null ) {
70
+ maven {
71
+ url ros. mavenRepository
72
+ }
73
+ }
74
+ mavenLocal()
75
+ maven {
76
+ url " http://repository.springsource.com/maven/bundles/release"
77
+ }
78
+ maven {
79
+ url " http://repository.springsource.com/maven/bundles/external"
80
+ }
81
+ mavenCentral()
82
+ }
83
+
84
+ /* **********************
85
+ * Java
86
+ ***********************/
87
+ sourceCompatibility = 1.6
88
+ targetCompatibility = 1.6
89
+
90
+ /* **********************
91
+ * Maven Deployment
92
+ ***********************/
93
+ if ( ros. mavenDeploymentRepository != ' null' && project. ros. mavenDeploymentRepository != ' ' ) {
94
+ publishing {
95
+ publications {
96
+ mavenJava(MavenPublication ) {
97
+ from project. components. java
98
+ }
99
+ }
100
+ repositories {
101
+ maven {
102
+ url ' file://' + project. ros. mavenDeploymentRepository
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
0 commit comments