Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Rosjava Bootstrap Gradle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CeTI
ROS
ROS Java Packages
Rosjava Bootstrap Gradle
Commits
181d987b
Commit
181d987b
authored
Sep 8, 2013
by
Daniel Stonier
Browse files
Options
Downloads
Patches
Plain Diff
package information passing back to gradle build via plugin extensions.
parent
f67f9706
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.classpath
+1
-0
1 addition, 0 deletions
.classpath
src/main/groovy/com/github/rosjava/rosjava_gradle_plugins/CatkinPlugin.groovy
+85
-9
85 additions, 9 deletions
...github/rosjava/rosjava_gradle_plugins/CatkinPlugin.groovy
with
86 additions
and
9 deletions
.classpath
+
1
−
0
View file @
181d987b
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpath>
<classpathentry
kind=
"src"
path=
"src/main/groovy"
/>
<classpathentry
kind=
"lib"
path=
"gradle/wrapper/gradle-wrapper.jar"
/>
<classpathentry
kind=
"lib"
path=
"gradle/wrapper/gradle-wrapper.jar"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
...
...
This diff is collapsed.
Click to expand it.
src/main/groovy/com/github/rosjava/rosjava_gradle_plugins/CatkinPlugin.groovy
+
85
−
9
View file @
181d987b
...
@@ -5,21 +5,97 @@ import org.gradle.api.Plugin;
...
@@ -5,21 +5,97 @@ import org.gradle.api.Plugin;
import
org.gradle.api.Task
;
import
org.gradle.api.Task
;
import
org.gradle.api.*
;
import
org.gradle.api.*
;
/*
* Provides catkin information to the gradle build, defining properties for
* use by the project:
*
* - project.catkin.rosPackagePath
* - project.catkin.packages
*
* The latter can be iterated over for information:
*
* project.catkin.packages.each { pair ->
* pkg = pair.value
* println pkg.name
* println pkg.version
* pkg.dependencies.each { d ->
* println d
* }
* }
*
* Use this only once in the root of a multi-project gradle build - it will
* only generate the properties once and share them this way.
*/
class
CatkinPlugin
implements
Plugin
<
Project
>
{
class
CatkinPlugin
implements
Plugin
<
Project
>
{
/*
* Possibly should check for existence of these properties and
* be lazy if they're already defined.
*/
def
void
apply
(
Project
project
)
{
def
void
apply
(
Project
project
)
{
project
.
ext
.
ROS_PACKAGE_PATH
=
"$System.env.ROS_PACKAGE_PATH"
.
split
(
":"
)
project
.
extensions
.
create
(
"catkin"
,
CatkinPluginExtension
)
project
.
ext
.
ROS_PACKAGE_TREES
=
[]
project
.
catkin
.
packages
=
[:]
project
.
ext
.
ROS_PACKAGE_PATH
.
each
{
rosPackageRoot
->
project
.
catkin
.
rosPackagePath
=
[]
println
(
"Ros Package Root: "
+
rosPackageRoot
)
project
.
catkin
.
rosPackagePath
=
"$System.env.ROS_PACKAGE_PATH"
.
split
(
":"
)
project
.
catkin
.
rosPackagePath
.
each
{
rosPackageRoot
->
println
(
"RosPackageRoot.........${rosPackageRoot}"
)
def
manifestTree
=
project
.
fileTree
(
dir:
rosPackageRoot
,
include:
'**/package.xml'
)
def
manifestTree
=
project
.
fileTree
(
dir:
rosPackageRoot
,
include:
'**/package.xml'
)
manifestTree
.
each
{
file
->
manifestTree
.
each
{
file
->
println
(
"File: "
+
file
)
def
pkg
=
new
CatkinPackage
(
file
)
project
.
catkin
.
packages
.
put
(
pkg
.
name
,
pkg
)
}
}
}
}
println
(
"
We are
happy, you should be too."
)
println
(
"
CatkinPlugin is
happy, you should be too."
)
project
.
task
(
'
happy
'
)
<<
{
project
.
task
(
'
catkinPackageInfo
'
)
<<
{
println
"I'll teach your grandmother to suck eggs!"
println
"I'll teach your grandmother to suck eggs!"
println
(
"ROS_PACKAGE_PATH........."
+
project
.
ROS_PACKAGE_PATH
)
println
(
"rosPackagePath........."
+
project
.
catkin
.
rosPackagePath
)
println
(
"Catkin Packages"
)
project
.
catkin
.
packages
.
each
{
pkg
->
print
pkg
.
value
.
toString
()
}
}
}
}
}
}
}
class
CatkinPluginExtension
{
Map
<
String
,
CatkinPackage
>
packages
List
<
String
>
rosPackagePath
}
/*
* Use this to establish methods that can be used by the project.
* Currently don't have any.
*/
class
CatkinPluginConvention
{
private
Project
project
public
CatkinPluginConvention
(
Project
project
)
{
this
.
project
=
project
}
}
class
CatkinPackage
{
def
name
def
version
def
dependencies
def
CatkinPackage
(
File
packageXmlFilename
)
{
def
packageXml
=
new
XmlParser
().
parse
(
packageXmlFilename
)
name
=
packageXml
.
name
.
text
()
version
=
packageXml
.
version
.
text
()
dependencies
=
[]
packageXml
.
build_depend
.
each
{
d
->
dependencies
.
add
(
d
.
text
())
}
}
def
String
toString
()
{
def
out
=
new
String
()
out
+=
name
+
"\n"
out
+=
" version: "
+
version
+
"\n"
out
+=
" dependencies:"
+
"\n"
dependencies
.
each
{
d
->
out
+=
" "
+
d
+
"\n"
}
return
out
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment