Package: Vdm2JavaBaseMojo

Vdm2JavaBaseMojo

nameinstructionbranchcomplexitylinemethod
Vdm2JavaBaseMojo()
M: 24 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
getProjectJavaSrcDirectory()
M: 14 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getProjectOutputDirectory()
M: 29 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package org.overture.codegen.mojocg;
2:
3: import java.io.File;
4: import java.util.List;
5: import java.util.Properties;
6:
7: import org.apache.maven.plugin.AbstractMojo;
8: import org.apache.maven.plugin.MojoExecutionException;
9: import org.apache.maven.plugin.MojoFailureException;
10:
11: /**
12: * The VDM-to-Java code generator base mojo.
13: *
14: * @phase generate-sources
15: * @requiresDependencyResolution compile
16: */
17: public abstract class Vdm2JavaBaseMojo extends AbstractMojo
18: {
19:         /**
20:          * The package of the generated classes.
21:          *
22:          * @parameter
23:          * @required
24:          */
25:         protected String packageName;
26:
27:         /**
28:          * The name of the folder under resources where the specification is stored.
29:          *
30:          * @parameter
31:          * @required
32:          */
33:         protected File specificationDir;
34:
35:         /**
36:          * Name of the directory into which the astCreatorPlugin should dump the ast files.
37:          *
38:          * @parameter property="outputDirectory" default-value="${project.build.directory}/generated-sources/javacode"
39:          */
40:         protected File outputDirectory;
41:
42:         /**
43:          * Dialect to use. Can be either 'sl' or 'pp'
44:          *
45:          * @parameter
46:          * @required
47:          */
48:         protected String dialect;
49:
50:         /**
51:          * VDM version to use to use. Can be either 'vdm10' or 'classic'
52:          *
53:          * @parameter
54:          * @required
55:          */
56:         protected String release;
57:
58:         /**
59:          * A flag to configure formatting of the generated code
60:          *
61:          * @parameter
62:          */
63:         protected boolean formatCode = true;
64:
65:         /**
66:          * Generate VDM location information for code generated constructs
67:          *
68:          * @parameter
69:          */
70:         protected boolean printVdmLocations = false;
71:
72:         /**
73:          * Print detailed information about the code generation process
74:          *
75:          * @parameter
76:          */
77:         protected boolean verbose = true;
78:
79:         /**
80:          * @parameter property="project" default-value="${project}"
81:          * @required
82:          * @readonly
83:          */
84:         protected org.apache.maven.project.MavenProject project;
85:
86:         /**
87:          * default-value="${project.reporting.outputDirectory}"
88:          *
89:          * @parameter
90:          */
91:         private File projectOutputDirectory;
92:
93:         /**
94:          * @parameter
95:          */
96:         protected Properties delegates;
97:         
98:         /**
99:          * Modules (or classes) that should not be code generated
100:          *
101:          * @parameter
102:          */
103:         protected List<String> modulesToSkip;
104:
105:         /**
106:          * @parameter
107:          */
108:         protected boolean genJUnit4Tests = false;
109:
110:         /**
111:          * @parameter
112:          */
113:         protected boolean separateTestCode = false;
114:         
115:         /**
116:          * VDMPP and VDMRT exclusive feature: Code generate the concurrency constructs
117:          *
118:          * @parameter
119:          */
120:         protected boolean genConcurrency = false;
121:         
122:         /**
123:          * Code generate the VDM-RT system class
124:          *
125:          * @parameter
126:          */
127:         protected boolean genSystemClass = false;
128:
129:         protected File getProjectOutputDirectory()
130:         {
131:•                if (projectOutputDirectory == null
132:•                                || projectOutputDirectory.length() == 0)
133:                 {
134:                         File output = new File(project.getFile().getParentFile(), "target");
135:•                        if (!output.exists())
136:                         {
137:                                 output.mkdirs();
138:                         }
139:
140:                         return output;
141:
142:                 } else
143:                 {
144:                         return projectOutputDirectory;
145:                 }
146:         }
147:
148:         protected File getProjectJavaSrcDirectory()
149:         {
150:                 File output = new File(project.getFile().getParentFile(), "src/main/java".replace('/', File.separatorChar));
151:                 return output;
152:         }
153:
154:         public abstract void execute()
155:                         throws MojoExecutionException, MojoFailureException;
156:
157: }