Skip to content
This repository was archived by the owner on Jan 14, 2023. It is now read-only.

Commit 5cb57c6

Browse files
committed
updated ros-java buildscript
1 parent bd097c0 commit 5cb57c6

File tree

1 file changed

+79
-67
lines changed

1 file changed

+79
-67
lines changed

ros-java.gradle

Lines changed: 79 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -15,89 +15,101 @@
1515
*/
1616

1717
/*
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:
2119
*
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:
2329
*
2430
* subprojects {
2531
* apply from: "https://github.com/rosjava/rosjava_bootstrap/raw/indigo/ros-java.gradle"
26-
* apply plugin: 'ros-java'
2732
* ...
33+
* }
2834
*/
2935

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+
}
4357

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+
}
5366

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 ->
6673
maven {
67-
url ros.mavenRepository
74+
url uri(path)
6875
}
6976
}
70-
mavenLocal()
71-
maven {
72-
url "http://repository.springsource.com/maven/bundles/release"
73-
}
77+
}
78+
if (rosMavenRepository != null) {
7479
maven {
75-
url "http://repository.springsource.com/maven/bundles/external"
80+
url rosMavenRepository
7681
}
77-
mavenCentral()
7882
}
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
8598

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
95107
}
96-
repositories {
97-
maven {
98-
url 'file://' + project.ros.mavenDeploymentRepository
99-
}
108+
}
109+
repositories {
110+
maven {
111+
url 'file://' + rosMavenDeploymentRepository
100112
}
101113
}
102-
}
103-
}
114+
}
115+
}

0 commit comments

Comments
 (0)