blob: 959bd0e46ef0ef81d954adad9b20022331f337aa [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2013 Willink Transformations and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* E.D.Willink - initial API and implementation
*
* Run As->MWE2 Workflow to regenerate the pivot model.
*******************************************************************************/
module GeneratePivotModel
import org.eclipse.ocl.examples.build.utilities.*
import org.eclipse.ocl.examples.build.xtend.*
import org.eclipse.emf.mwe.utils.*
import org.eclipse.emf.mwe.utils.*
import org.eclipse.emf.ecore.resource.impl.*
//import org.eclipse.uml2.uml.resource.XMI2UMLResource
//var buildProjectName = "org.eclipse.ocl.examples.build"
var ecoreSlot = "ecore"
//var umlSlot = "uml"
var pivotProjectName = "org.eclipse.ocl.pivot"
var internalProjectName = "org.eclipse.ocl.pivot"
var basePivotProject = "../../plugins/${pivotProjectName}"
//var platformURI = ".."
/**
* Generate the Pivot Model, by performing the merge to create the flattened package
* with additional MDT/OCL content, alphabeticsing the classes, reloading the genmodel
* and finally generating the model code.
*/
Workflow {
/* Bug 580755 redesignates Pivot.ecore as the model master
bean = ResourceSetImpl : pivotCreateResourceSet {}
bean = StandaloneSetup { resourceSet = pivotCreateResourceSet
uriMap = Mapping {
from = "http://www.omg.org/spec/UML/20131001/PrimitiveTypes.xmi"
to = "platform:/resource/${buildProjectName}/model/PrimitiveTypes.xmi"
}
// platformUri = ".."
// scanClassPath = true
// registerGeneratedEPackage = "org.eclipse.xtext.common.types.TypesPackage"
}
bean = ProjectMapSetup { resourceSet = pivotCreateResourceSet }
bean = UMLStandaloneSetup { resourceSet = pivotCreateResourceSet }
bean = OCLStandaloneSetup { resourceSet = pivotCreateResourceSet
dynamicPackage = Mapping {
from = "http://www.eclipse.org/ocl/2012/UML2EcoreControl"
to = "platform:/resource/${buildProjectName}/model/UML2EcoreControl.ecore#/"
}
dynamicPackage = Mapping {
from = "http://www.eclipse.org/ocl/2012/UML2EcoreMapping"
to = "platform:/resource/${buildProjectName}/model/UML2EcoreMapping.ecore#/"
}
}
// bean = SplitGenModelSetup { resourceSet = resourceSet }
bean = OCLDelegateSetup { resourceSet = pivotCreateResourceSet }
bean = CompleteOCLStandaloneSetup {}
//
// Fixup xmi:ids and convert cmof to uml
//
component = IdAssigner { resourceSet = pivotCreateResourceSet skipOnErrors = true
assignFlatIds = true
mapping = Mapping {
from = "/${buildProjectName}/model/PrimitiveTypes.xmi"
to = "/${buildProjectName}/model-gen/PrimitiveTypes.uml"
}
mapping = Mapping {
from = "/${buildProjectName}/model/UML.xmi"
to = "/${buildProjectName}/model-gen/UML.uml"
}
}
component = IdAssigner { resourceSet = pivotCreateResourceSet skipOnErrors = true
assignFlatIds = false
mapping = Mapping {
from = "/${buildProjectName}/model/OCL.uml"
to = "/${buildProjectName}/model-gen/OCL.uml"
}
mapping = Mapping {
from = "/${buildProjectName}/model/MDTOCL.uml"
to = "/${buildProjectName}/model-gen/MDTOCL.uml"
}
}
//
// Create an OclPivot.ecore that can be compared with the new.
//
component = ResourceReader { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${ecoreSlot}"
uri = "/org.eclipse.ocl.pivot/model/Pivot.ecore"
}
component = EcoreNormalizer { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${ecoreSlot}"
}
component = SetNsURI { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${ecoreSlot}"
nsURI = "http://www.eclipse.org/ocl/0.9.0/Pivot"
}
component = ResourceWriter { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${ecoreSlot}"
uri = "/${buildProjectName}/model-gen/OldPivot.ecore"
}
component = QVToTransformationExecutor { resourceSet = pivotCreateResourceSet skipOnErrors = true
uri = "platform:/resource/${buildProjectName}/src/org/eclipse/ocl/examples/build/qvto/UML2EcoreAnalyzer.qvto"
in = "platform:/resource/${buildProjectName}/model/UML2ASinEcore.xmi"
out = "platform:/resource/${buildProjectName}/model-gen/UML2ASAnalysis.xmi"
ePackageMapping = { from = "org.eclipse.emf.ecore/model/Ecore.ecore" to = "http://www.eclipse.org/emf/2002/Ecore" }
ePackageMapping = { from = "org.eclipse.uml2.types/model/Types.ecore" to = "http://www.eclipse.org/uml2/5.0.0/Types" }
ePackageMapping = { from = "org.eclipse.uml2.uml/model/UML.ecore" to = "http://www.eclipse.org/uml2/5.0.0/UML" }
uriMapping = { from = "local://www.eclipse.org/ocl/2012/UML2EcoreControl" to = "org.eclipse.ocl.examples.build/model/UML2EcoreControl.ecore" }
uriMapping = { from = "local://www.eclipse.org/ocl/2012/UML2EcoreMapping" to = "org.eclipse.ocl.examples.build/model/UML2EcoreMapping.ecore" }
}
component = QVToTransformationExecutor { resourceSet = pivotCreateResourceSet skipOnErrors = true
uri = "platform:/resource/${buildProjectName}/src/org/eclipse/ocl/examples/build/qvto/UML2EcoreSynthesizer.qvto"
in = "platform:/resource/${buildProjectName}/model-gen/UML2ASAnalysis.xmi"
in = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore"
out = "platform:/resource/${buildProjectName}/model-gen/UML2AS.ecore"
ePackageMapping = { from = "org.eclipse.emf.ecore/model/Ecore.ecore" to = "http://www.eclipse.org/emf/2002/Ecore" }
ePackageMapping = { from = "org.eclipse.uml2.types/model/Types.ecore" to = "http://www.eclipse.org/uml2/5.0.0/Types" }
ePackageMapping = { from = "org.eclipse.uml2.uml/model/UML.ecore" to = "http://www.eclipse.org/uml2/5.0.0/UML" }
uriMapping = { from = "local://www.eclipse.org/ocl/2012/UML2EcoreControl" to = "org.eclipse.ocl.examples.build/model/UML2EcoreControl.ecore" }
uriMapping = { from = "local://www.eclipse.org/ocl/2012/UML2EcoreMapping" to = "org.eclipse.ocl.examples.build/model/UML2EcoreMapping.ecore" }
}
component = ResourceReader { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${ecoreSlot}"
uri = "/${buildProjectName}/model-gen/UML2AS.ecore"
}
/ * component = ConstraintMerger { resourceSet = pivotCreateResourceSet skipOnErrors = true
projectName = "${buildProjectName}"
modelSlot = "${ecoreSlot}"
uri = "model/Pivot.ocl"
} * /
component = EPackageAlphabetizer { skipOnErrors = true
modelSlot = "${ecoreSlot}"
}
// component = PruneSuperClasses { skipOnErrors = true
// modelSlot = "${ecoreSlot}"
// }
// component = OCLDelegateActivator { skipOnErrors = true
// modelSlot = "${pivotSlot}"
// }
component = ResourceWriter { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${ecoreSlot}"
uri = "/${buildProjectName}/model-gen/RawPivot.ecore"
}
//
// Create a NewPivot.ecore that can be compared with the old.
//
component = ResourceReader { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${ecoreSlot}"
uri = "/${buildProjectName}/model-gen/RawPivot.ecore"
}
component = EcoreNormalizer { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${ecoreSlot}"
}
component = ResourceWriter { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${ecoreSlot}"
uri = "/${buildProjectName}/model-gen/NewPivot.ecore"
}
//
//
//
component = Ecore2UMLConverter { skipOnErrors = true
ecoreSlot = "${ecoreSlot}"
umlSlot = "${umlSlot}"
}
component = PackageAlphabetizer { skipOnErrors = true
modelSlot = "${umlSlot}"
}
component = ResourceWriter { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${umlSlot}"
uri = "/${buildProjectName}/model-gen/NewPivot.uml"
}
//
// Make manually copied Pivot.uml stable for diagrams
//
component = ResourceReader { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${umlSlot}"
uri = "/${buildProjectName}/model-gen/NewPivot.uml"
}
component = UMLIDAssigner { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${umlSlot}"
}
component = ResourceWriter { resourceSet = pivotCreateResourceSet skipOnErrors = true
modelSlot = "${umlSlot}"
uri = "/${buildProjectName}/model-gen/Pivot.uml"
}
*/
bean = ResourceSetImpl : pivotRenameResourceSet {}
bean = ProjectMapSetup { resourceSet = pivotRenameResourceSet }
// bean = UMLStandaloneSetup { resourceSet = pivotRenameResourceSet }
bean = OCLStandaloneSetup {}
bean = EcoreGenModelSetup { resourceSet = pivotRenameResourceSet }
component = ResourceRenamer { resourceSet = pivotRenameResourceSet skipOnErrors = true
// projectName = "${buildProjectName}"
projectName = "${internalProjectName}"
resourceRename = {
// from = "model-gen/RawPivot.ecore"
from = "model/PivotStructural.ecore"
to = "model/Pivot.ecore"
}
}
//
//
//
bean = ResourceSetImpl : pivotMergeResourceSet {}
bean = ProjectMapSetup { resourceSet = pivotMergeResourceSet }
// bean = UMLStandaloneSetup { resourceSet = pivotMergeResourceSet }
bean = OCLStandaloneSetup {}
bean = EcoreGenModelSetup { resourceSet = pivotMergeResourceSet }
component = ConstraintMerger { resourceSet = pivotMergeResourceSet skipOnErrors = true
projectName = "${internalProjectName}"
libraryURI = "http://www.eclipse.org/ocl/2015/Library"
ecoreURI = "model/Pivot.ecore"
oclURI = "model/Pivot.ocl"
invariantPrefix = "validate"
}
component = ResourceReader { resourceSet = pivotMergeResourceSet skipOnErrors = true
modelSlot = "${ecoreSlot}"
uri = "/${internalProjectName}/model/Pivot.ecore"
}
component = EPackageAlphabetizer { skipOnErrors = true
modelSlot = "${ecoreSlot}"
}
component = PruneSuperClasses { skipOnErrors = true
modelSlot = "${ecoreSlot}"
}
component = SetASmetamodel { skipOnErrors = true
modelSlot = "${ecoreSlot}"
}
component = StructuralENamedElementIdAssigner { skipOnErrors = true
modelSlot = "${ecoreSlot}"
}
component = ResourceWriter { resourceSet = pivotMergeResourceSet skipOnErrors = true
modelSlot = "${ecoreSlot}"
uri = "/${internalProjectName}/model/Pivot.ecore"
}
//
//
//
bean = ResourceSetImpl : pivotGenerateResourceSet {}
bean = ProjectMapSetup { resourceSet = pivotGenerateResourceSet }
// bean = UMLStandaloneSetup { resourceSet = pivotGenerateResourceSet }
bean = OCLStandaloneSetup {}
bean = EcoreGenModelSetup { resourceSet = pivotGenerateResourceSet }
component = GenmodelReloader { resourceSet = pivotGenerateResourceSet skipOnErrors = true
projectName = "${internalProjectName}"
genModel = "/${internalProjectName}/model/Pivot.genmodel"
ecoreFile = "/${internalProjectName}/model/Pivot.ecore"
}
component = GenerateModel { resourceSet = pivotGenerateResourceSet skipOnErrors = true
// projectName = "${internalProjectName}"
genModel = "/${internalProjectName}/model/Pivot.genmodel"
// clearResourceSet = false
// modelSlot = "${ecoreSlot}"
}
component = GenerateASVisitors { resourceSet = pivotGenerateResourceSet
projectName = "${internalProjectName}"
genModelFile = "model/Pivot.genmodel"
}
component = GenerateOCLmetamodelXtend { resourceSet = pivotGenerateResourceSet
projectName = "${internalProjectName}"
modelFile = "model/Pivot.ecore"
uri = "http://www.eclipse.org/ocl/2015/Pivot"
javaFolder = "emf-gen"
javaPackageName = "${pivotProjectName}.model"
javaClassName = "OCLmetamodel"
}
component = ConvertToUnixLineEndings {
directory = "${basePivotProject}/emf-gen"
}
}