module com.minres.rdl.GenerateRDL

import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*

var rootPath = ".."

Workflow {
	
	component = XtextGenerator {
		configuration = {
			project = StandardProjectConfig {
				baseName = "com.minres.rdl"
				rootPath = rootPath
				runtimeTest = {
					enabled = true
				}
				eclipsePlugin = {
					enabled = true
				}
				eclipsePluginTest = {
					enabled = true
				}
				web = {
					enabled = true
				}
				createEclipseMetaData = true
			}
			code = {
				encoding = "UTF-8"
				lineDelimiter = "\n"
				fileHeader = "/*\n * generated by Xtext \${version}\n */"
				preferXtendStubs = true
			}
		}
		language = StandardLanguage {
			name = "com.minres.rdl.RDL"
			fileExtensions = "rdl"

			fragment = exporting.SimpleNamesFragment2 auto-inject {}

    		parserGenerator = {
                options = {
					backtrack = true
        		}
			}

			formatter = {
				generateStub = true
			}
			serializer = {
				generateStub = false
			}
			validator = {
				composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
				// Generates checks for @Deprecated grammar annotations, an IssueProvider and a corresponding PropertyPage
				generateDeprecationValidation = true
			}
			generator = {
                		generateXtendMain = true
			}
			projectWizard = {
		            	generate = true
			}
			generator = {
				generateXtendStub = true
			}
			junitSupport = {
				junitVersion = "5"
			}
		}
	}
}
