1 | module de.ugoe.cs.swe.bnftools.GenerateEBNF
|
---|
2 |
|
---|
3 | import org.eclipse.emf.mwe.utils.*
|
---|
4 | import org.eclipse.xtext.generator.*
|
---|
5 | import org.eclipse.xtext.ui.generator.*
|
---|
6 |
|
---|
7 | var grammarURI = "classpath:/de/ugoe/cs/swe/bnftools/EBNF.xtext"
|
---|
8 | var fileExtensions = "bnf"
|
---|
9 | var projectName = "de.ugoe.cs.swe.bnftools.ebnf"
|
---|
10 | var runtimeProject = "../${projectName}"
|
---|
11 | var generateXtendStub = true
|
---|
12 | var encoding = "UTF-8"
|
---|
13 |
|
---|
14 | Workflow {
|
---|
15 | bean = StandaloneSetup {
|
---|
16 | scanClassPath = true
|
---|
17 | platformUri = "${runtimeProject}/.."
|
---|
18 | // The following two lines can be removed, if Xbase is not used.
|
---|
19 | registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
|
---|
20 | registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
|
---|
21 | }
|
---|
22 |
|
---|
23 | component = DirectoryCleaner {
|
---|
24 | directory = "${runtimeProject}/src-gen"
|
---|
25 | }
|
---|
26 |
|
---|
27 | component = DirectoryCleaner {
|
---|
28 | directory = "${runtimeProject}/model"
|
---|
29 | }
|
---|
30 |
|
---|
31 | component = DirectoryCleaner {
|
---|
32 | directory = "${runtimeProject}.ui/src-gen"
|
---|
33 | }
|
---|
34 |
|
---|
35 | component = DirectoryCleaner {
|
---|
36 | directory = "${runtimeProject}.tests/src-gen"
|
---|
37 | }
|
---|
38 |
|
---|
39 | component = Generator {
|
---|
40 | pathRtProject = runtimeProject
|
---|
41 | pathUiProject = "${runtimeProject}.ui"
|
---|
42 | pathTestProject = "${runtimeProject}.tests"
|
---|
43 | projectNameRt = projectName
|
---|
44 | projectNameUi = "${projectName}.ui"
|
---|
45 | encoding = encoding
|
---|
46 | language = auto-inject {
|
---|
47 | uri = grammarURI
|
---|
48 |
|
---|
49 | // Java API to access grammar elements (required by several other fragments)
|
---|
50 | fragment = grammarAccess.GrammarAccessFragment auto-inject {}
|
---|
51 |
|
---|
52 | // generates Java API for the generated EPackages
|
---|
53 | fragment = ecore.EMFGeneratorFragment auto-inject {}
|
---|
54 |
|
---|
55 | // the old serialization component
|
---|
56 | // fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {}
|
---|
57 |
|
---|
58 | // serializer 2.0
|
---|
59 | fragment = serializer.SerializerFragment auto-inject {
|
---|
60 | generateStub = false
|
---|
61 | }
|
---|
62 |
|
---|
63 | // a custom ResourceFactory for use with EMF
|
---|
64 | fragment = resourceFactory.ResourceFactoryFragment auto-inject {}
|
---|
65 |
|
---|
66 | // The antlr parser generator fragment.
|
---|
67 | fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
|
---|
68 | options = {
|
---|
69 | backtrack = true
|
---|
70 | memoize = true
|
---|
71 | }
|
---|
72 | }
|
---|
73 |
|
---|
74 | // Xtend-based API for validation
|
---|
75 | fragment = validation.ValidatorFragment auto-inject {
|
---|
76 | composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
|
---|
77 | // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
|
---|
78 | }
|
---|
79 |
|
---|
80 | // old scoping and exporting API
|
---|
81 | fragment = scoping.ImportURIScopingFragment auto-inject {}
|
---|
82 | fragment = exporting.SimpleNamesFragment auto-inject {}
|
---|
83 |
|
---|
84 | // scoping and exporting API
|
---|
85 | // fragment = scoping.ImportNamespacesScopingFragment auto-inject {}
|
---|
86 | // fragment = exporting.QualifiedNamesFragment auto-inject {}
|
---|
87 | // fragment = builder.BuilderIntegrationFragment auto-inject {}
|
---|
88 |
|
---|
89 | // generator API
|
---|
90 | fragment = generator.GeneratorFragment auto-inject {}
|
---|
91 |
|
---|
92 | // formatter API
|
---|
93 | fragment = formatting.FormatterFragment auto-inject {}
|
---|
94 |
|
---|
95 | // labeling API
|
---|
96 | fragment = labeling.LabelProviderFragment auto-inject {}
|
---|
97 |
|
---|
98 | // outline API
|
---|
99 | fragment = outline.OutlineTreeProviderFragment auto-inject {}
|
---|
100 | fragment = outline.QuickOutlineFragment auto-inject {}
|
---|
101 |
|
---|
102 | // quickfix API
|
---|
103 | fragment = quickfix.QuickfixProviderFragment auto-inject {}
|
---|
104 |
|
---|
105 | // content assist API
|
---|
106 | fragment = contentAssist.ContentAssistFragment auto-inject {}
|
---|
107 |
|
---|
108 | // generates a more lightweight Antlr parser and lexer tailored for content assist
|
---|
109 | fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {
|
---|
110 | options = {
|
---|
111 | backtrack = true
|
---|
112 | memoize = true
|
---|
113 | }
|
---|
114 | }
|
---|
115 |
|
---|
116 | // generates junit test support classes into Generator#pathTestProject
|
---|
117 | fragment = junit.Junit4Fragment auto-inject {}
|
---|
118 |
|
---|
119 | // rename refactoring
|
---|
120 | fragment = refactoring.RefactorElementNameFragment auto-inject {}
|
---|
121 |
|
---|
122 | // provides the necessary bindings for java types integration
|
---|
123 | //fragment = types.TypesGeneratorFragment auto-inject {}
|
---|
124 |
|
---|
125 | // generates the required bindings only if the grammar inherits from Xbase
|
---|
126 | fragment = xbase.XbaseGeneratorFragment auto-inject {}
|
---|
127 |
|
---|
128 | // provides a preference page for template proposals
|
---|
129 | fragment = templates.CodetemplatesGeneratorFragment auto-inject {}
|
---|
130 |
|
---|
131 | // provides a compare view
|
---|
132 | fragment = compare.CompareFragment auto-inject {}
|
---|
133 | }
|
---|
134 | }
|
---|
135 | }
|
---|
136 |
|
---|