Skip to main content
aboutsummaryrefslogblamecommitdiffstats
blob: 2384c19f491fecc408f7be635a6d2de5b969d739 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                               

                                  
                                                


                                       
                                
 




                                               
 
                                                                                              
                                                                        
 

































































































                                                                                                  
 
/*****************************************************************************
 * Copyright (c) 2014 CEA LIST.
 *
 *    
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * 	Ed Seidewitz
 *  Jeremie Tatibouet
 *****************************************************************************/
module org.eclipse.papyrus.uml.alf.GenerateAlf

import org.eclipse.emf.mwe.utils.*
import org.eclipse.emf.mwe2.ecore.EcoreGenerator
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*

/*Variables used in the script*/

var fileExtensions = "alf"
var projectname = "org.eclipse.papyrus.uml.alf"
var projectname.ui = "${projectname}.ui"
var runtimeProject = "../${projectname}"
var generateXtendStub = true

var grammarURI = "platform:/resource/${projectname}/src/org/eclipse/papyrus/uml/alf/Alf.xtext"
var genmodelURI = "platform:/resource/${projectname}/model/alf.genmodel"

Workflow {
    bean = StandaloneSetup {
    	scanClassPath = true
    	platformUri = "${runtimeProject}/.."
    	registerGeneratedEPackage = "org.eclipse.papyrus.uml.alf.AlfPackage"
        registerGenModelFile = genmodelURI
   }

    /*Clean specified directory*/
    component = DirectoryCleaner {
    	directory = "${runtimeProject}/src-gen"
    }
    
    /*Generate other artifacts (validation, quickfix, etc.)*/
    component = Generator {
    	pathRtProject = runtimeProject
    	pathUiProject = "${runtimeProject}.ui"
    	projectNameRt = projectname
    	projectNameUi = projectname.ui
    	
    	language = auto-inject {
    		uri = grammarURI
    
    		// Java API to access grammar elements (required by several other fragments)
    		fragment = grammarAccess.GrammarAccessFragment auto-inject {}
    
    		// generates Java API for the generated EPackages
    		fragment = ecore.EMFGeneratorFragment auto-inject {}
    
    		// serializer 2.0
    		fragment = serializer.SerializerFragment auto-inject {
    			generateStub = false
    		}
    
    		// a custom ResourceFactory for use with EMF
    		fragment = resourceFactory.ResourceFactoryFragment auto-inject {}
    
    		// The antlr parser generator fragment.
    		fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
    		  options = {
    		      backtrack = true
    		  }
    		}
    
    		// Xtend-based API for validation
    		fragment = validation.ValidatorFragment auto-inject {}
    
    		// scoping and exporting API
    		fragment = scoping.ImportNamespacesScopingFragment auto-inject {}
    		fragment = exporting.QualifiedNamesFragment auto-inject {}
    		fragment = builder.BuilderIntegrationFragment auto-inject {}
    
    		// generator API
    		fragment = generator.GeneratorFragment auto-inject {}
    
    		// formatter API
    		fragment = formatting.FormatterFragment auto-inject {}
    
    		// labeling API
    		fragment = labeling.LabelProviderFragment auto-inject {}
    
    		// outline API
    		fragment = outline.OutlineTreeProviderFragment auto-inject {}
    		fragment = outline.QuickOutlineFragment auto-inject {}
    
    		// quickfix API
    		fragment = quickfix.QuickfixProviderFragment auto-inject {}
    
    		// content assist API
    		fragment = contentAssist.ContentAssistFragment auto-inject {}
    
    		// generates a more lightweight Antlr parser and lexer tailored for content assist
    		fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {
	          options = {
	              backtrack = true
	          }
    		}
    
    		// generates junit test support classes into Generator#pathTestProject
    		//fragment = junit.Junit4Fragment auto-inject {}
    
    		// rename refactoring
    		fragment = refactoring.RefactorElementNameFragment auto-inject {}
    
    		// provides the necessary bindings for java types integration
    		fragment = types.TypesGeneratorFragment auto-inject {}
    
    		// generates the required bindings only if the grammar inherits from Xbase
    		fragment = xbase.XbaseGeneratorFragment auto-inject {}
    
    		// provides a preference page for template proposals
    		fragment = templates.CodetemplatesGeneratorFragment auto-inject {}
    
    		// provides a compare view
    		fragment = compare.CompareFragment auto-inject {}
    	}
    }
}

Back to the top