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