Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tommy Olofsson
LabComm
Commits
586eb8c2
Commit
586eb8c2
authored
Feb 06, 2015
by
Tommy Olofsson
Browse files
Made the maven plugin better.
parent
8c3bf614
Changes
3
Hide whitespace changes
Inline
Side-by-side
labcomm-compiler-plugin/pom.xml
View file @
586eb8c2
...
...
@@ -29,6 +29,12 @@
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.apache.maven
</groupId>
<artifactId>
maven-project
</artifactId>
<version>
2.2.1
</version>
</dependency>
<dependency>
<groupId>
se.lth.control
</groupId>
<artifactId>
labcomm_compiler
</artifactId>
...
...
labcomm-compiler-plugin/readme.md
0 → 100644
View file @
586eb8c2
# labcomm-compiler-plugin
Compiles labcomm files during the maven build lifecycle.
## Example
To use the plugin to compile the file
`my_types.lc`
put the following
in your maven build file (pom.xml). You can then use the types as
`import labcomm_gen.sample`
where
`sample`
is the name of the
sample(s) in the my_types.lc.
```
xml
<project>
<!-- ... -->
<dependencies>
<!-- ... -->
<!-- labcomm lib -->
<dependency>
<groupId>
se.lth.control
</groupId>
<artifactId>
labcomm
</artifactId>
<version>
2014.3.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- ... -->
<plugin>
<!-- labcomm compiler -->
<groupId>
se.lth.control
</groupId>
<artifactId>
labcomm-compiler-plugin
</artifactId>
<version>
2014.3.0-SNAPSHOT
</version>
<configuration>
<lc>
path/to/my_types.lc
</lc>
</configuration>
<executions>
<execution>
<phase>
generate-sources
</phase>
<goals>
<goal>
genjava
</goal>
</goals>
</execution>
</executions>
</plugin>
<build>
<plugins>
<repositories>
<repository>
<!-- source of dep/plugin -->
<id>
CSLTH
</id>
<name>
CS LTH maven repo
</name>
<url>
http://maven.cs.lth.se/content/repositories/public/
</url>
<releases>
<enabled>
true
</enabled>
</releases>
<snapshots>
<enabled>
true
</enabled>
<updatePolicy>
always
</updatePolicy>
</snapshots>
</repository>
</repositories>
</project>
```
labcomm-compiler-plugin/src/main/java/se/lth/control/App.java
View file @
586eb8c2
...
...
@@ -3,6 +3,7 @@ package se.lth.control;
import
org.apache.maven.plugin.AbstractMojo
;
import
org.apache.maven.plugin.MojoExecutionException
;
import
org.apache.maven.plugins.annotations.Mojo
;
import
org.apache.maven.project.MavenProject
;
import
se.lth.control.labcomm2014.compiler.LabComm
;
/**
...
...
@@ -12,26 +13,31 @@ import se.lth.control.labcomm2014.compiler.LabComm;
public
class
App
extends
AbstractMojo
{
/**
* @parameter default-value="
nota
file.lc"
* @parameter default-value="
path_to_
file.lc"
*/
private
String
lc
;
/**
* @parameter default-value="
/tmp
"
* @parameter default-value="
${project.build.directory}/labcomm_gen
"
*/
private
String
dir
;
/**
* @parameter default-value="
generated_sources
"
* @parameter default-value="
labcomm_gen
"
*/
private
String
pkg
;
public
void
execute
()
throws
MojoExecutionException
{
getLog
().
info
(
"Does not do anything!"
);
String
[]
args
=
new
String
[
3
];
args
[
0
]
=
"--java="
+
dir
;
args
[
1
]
=
"--javapackage="
+
pkg
;
args
[
2
]
=
lc
;
LabComm
.
main
(
args
);
/**
* @parameter default-value="${project}"
*/
private
MavenProject
project
;
public
void
execute
()
throws
MojoExecutionException
{
project
.
addCompileSourceRoot
(
dir
);
LabComm
.
main
(
new
String
[]
{
"--java="
+
dir
,
"--javapackage="
+
pkg
,
lc
,
});
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment