Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Belle2018-09-07 08:35:29 -0400
committerJan Belle2018-09-07 08:35:29 -0400
commit1666772afdd130805a7b8bed005b197e541a9f5c (patch)
treed9fb305e3e9783785731a71fef11c59cad72a3c9 /plugins/org.eclipse.etrice.generator.cpp
parent12589012c83db9f2e5a3e995e4717025b17b549f (diff)
downloadorg.eclipse.etrice-1666772afdd130805a7b8bed005b197e541a9f5c.tar.gz
org.eclipse.etrice-1666772afdd130805a7b8bed005b197e541a9f5c.tar.xz
org.eclipse.etrice-1666772afdd130805a7b8bed005b197e541a9f5c.zip
[generator] Use single output directory for generated files
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.cpp')
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend9
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend14
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend3
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend7
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend7
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend11
6 files changed, 21 insertions, 30 deletions
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
index f0fbb97cc..626746a6b 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
@@ -50,11 +50,10 @@ class ActorClassGen extends GenericActorClassGenerator {
for (xpac: root.actorClasses.filter[isValidGenerationLocation].map[root.getExpandedActorClass(it)]) {
val wired = ac2wired.get(xpac.actorClass)
val manualBehavior = xpac.actorClass.isBehaviorAnnotationPresent("BehaviorManual")
- val path = xpac.actorClass.generationTargetPath+xpac.actorClass.getPath
- val infopath = xpac.actorClass.generationInfoPath+xpac.actorClass.getPath
+ val path = xpac.actorClass.getPath
var file = if (manualBehavior) 'Abstract' else ''
- fileIO.generateFile("generating ActorClass declaration", path, infopath, file + xpac.actorClass.getCppHeaderFileName, root.generateHeaderFile(xpac, wired, manualBehavior))
- fileIO.generateFile("generating ActorClass implementation", path, infopath, file + xpac.actorClass.getCppSourceFileName, root.generateSourceFile(xpac, wired, manualBehavior))
+ fileIO.generateFile("generating ActorClass declaration", path + file + xpac.actorClass.getCppHeaderFileName, root.generateHeaderFile(xpac, wired, manualBehavior))
+ fileIO.generateFile("generating ActorClass implementation", path + file + xpac.actorClass.getCppSourceFileName, root.generateSourceFile(xpac, wired, manualBehavior))
}
}
@@ -91,7 +90,7 @@ class ActorClassGen extends GenericActorClassGenerator {
#include "«dc.path»«dc.name».h"
«ENDFOR»
- «IF ac.actorBase==null»
+ «IF ac.actorBase===null»
#include "common/modelbase/ActorClassBase.h"
«ELSE»
#include "«ac.actorBase.path»«ac.actorBase.name».h"
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
index 4946431d3..da261eacf 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
@@ -24,12 +24,12 @@ import org.eclipse.etrice.core.room.ComplexType
import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
-import org.eclipse.xtext.generator.JavaIoFileSystemAccess
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
@Singleton
class DataClassGen {
- @Inject extension JavaIoFileSystemAccess fileAccess
+ @Inject extension IGeneratorFileIO fileIO
@Inject extension CppExtensions stdExt
@Inject extension RoomExtensions roomExt
@Inject extension CppProcedureHelpers helpers
@@ -41,17 +41,13 @@ class DataClassGen {
def doGenerate(Root root) {
logger.logInfo("generating code")
for (dc: root.dataClasses) {
- var path = dc.generationTargetPath + dc.getPath
+ var path = dc.getPath
// header file
- logger.logInfo("generating DataClass header '"+dc.getCppHeaderFileName+"' in '"+path+"'")
- fileAccess.setOutputPath(path)
- fileAccess.generateFile(dc.getCppHeaderFileName, root.generateHeaderFile(dc))
+ fileIO.generateFile("generating DataClass header", path + dc.getCppHeaderFileName, root.generateHeaderFile(dc))
// source file
- logger.logInfo("generating DataClass source '"+dc.getCppSourceFileName+"' in '"+path+"'")
- fileAccess.setOutputPath(path)
- fileAccess.generateFile(dc.getCppSourceFileName, root.generateSourceFile(dc))
+ fileIO.generateFile("generating DataClass source", path + dc.getCppSourceFileName, root.generateSourceFile(dc))
}
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend
index 6027b9358..f5c5bcf89 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend
@@ -32,8 +32,7 @@ class MainGen {
@Inject PrepareFileSystem prepFS
def void doGenerate(Resource resource) {
- prepFS.prepareCodeTargetPaths(resource)
- prepFS.prepareInfoTargetPaths(resource)
+ prepFS.prepare
for (e: resource.contents){
if (e instanceof Root) {
doGenerate(e as Root)
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend
index 0389ca8df..bea58540a 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend
@@ -56,15 +56,14 @@ class NodeGen {
val ssi = root.getInstance(instpath) as SubSystemInstance
if (ssi!=null && ssi.subSystemClass.validGenerationLocation) {
val wired = sscc2wired.get(ssi.subSystemClass)
- val path = ssi.subSystemClass.generationTargetPath+ssi.subSystemClass.getPath
- val infopath = ssi.subSystemClass.generationInfoPath+ssi.subSystemClass.getPath
+ val path = ssi.subSystemClass.getPath
//checkDataPorts(ssi)
val usedThreads = ETMapUtil::getUsedThreads(nr, ssi)
- fileIO.generateFile("generating Node declaration", path, infopath, getCppHeaderFileName(nr, ssi), root.generateHeaderFile(ssi, wired, usedThreads))
- fileIO.generateFile("generating Node implementation", path, infopath, getCppSourceFileName(nr, ssi), root.generateSourceFile(ssi, wired, usedThreads))
+ fileIO.generateFile("generating Node declaration", path + getCppHeaderFileName(nr, ssi), root.generateHeaderFile(ssi, wired, usedThreads))
+ fileIO.generateFile("generating Node implementation", path + getCppSourceFileName(nr, ssi), root.generateSourceFile(ssi, wired, usedThreads))
}
}
}
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend
index 3b5eed7e3..4ae998776 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend
@@ -40,10 +40,9 @@ class NodeRunnerGen {
for (instpath : ETMapUtil::getSubSystemInstancePaths(nr)) {
val ssi = root.getInstance(instpath) as SubSystemInstance
if (ssi!=null && ssi.subSystemClass.validGenerationLocation) {
- val filepath = ssi.subSystemClass.generationTargetPath+ssi.subSystemClass.getPath
- val infopath = ssi.subSystemClass.generationInfoPath+ssi.subSystemClass.getPath
- fileIO.generateFile("generating SubSystemRunner declaration", filepath, infopath, nr.getCppClassName(ssi)+"Runner.h", root.generateHeaderFile(ssi))
- fileIO.generateFile("generating SubSystemRunner implementation", filepath, infopath, nr.getCppClassName(ssi)+"Runner.cpp", root.generateSourceFile(ssi))
+ val filepath = ssi.subSystemClass.getPath
+ fileIO.generateFile("generating SubSystemRunner declaration", filepath + nr.getCppClassName(ssi)+"Runner.h", root.generateHeaderFile(ssi))
+ fileIO.generateFile("generating SubSystemRunner implementation", filepath + nr.getCppClassName(ssi)+"Runner.cpp", root.generateSourceFile(ssi))
}
}
}
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
index 769d5b825..9cb81b539 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
@@ -53,16 +53,15 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
def doGenerate(Root root) {
for (pc: root.protocolClasses.filter(cl|cl.isValidGenerationLocation)) {
- val path = pc.generationTargetPath+pc.getPath
- val infopath = pc.generationInfoPath+pc.getPath
+ val path = pc.getPath
switch (pc.commType) {
case CommunicationType::EVENT_DRIVEN:{
- fileIO.generateFile("generating ProtocolClass declaration", path, infopath, pc.cppHeaderFileName, root.generateHeaderFile(pc))
- fileIO.generateFile("generating ProtocolClass implementation", path, infopath, pc.cppSourceFileName, root.generateSourceFile(pc))
+ fileIO.generateFile("generating ProtocolClass declaration", path + pc.cppHeaderFileName, root.generateHeaderFile(pc))
+ fileIO.generateFile("generating ProtocolClass implementation", path + pc.cppSourceFileName, root.generateSourceFile(pc))
}
case CommunicationType::DATA_DRIVEN:{
- fileIO.generateFile("generating ProtocolClass declaration", path, infopath, pc.cppHeaderFileName, root.generateDataDrivenHeaderFile(pc))
- fileIO.generateFile("generating ProtocolClass implementation", path, infopath, pc.cppSourceFileName, root.generateDataDrivenSourceFile(pc))
+ fileIO.generateFile("generating ProtocolClass declaration", path + pc.cppHeaderFileName, root.generateDataDrivenHeaderFile(pc))
+ fileIO.generateFile("generating ProtocolClass implementation", path + pc.cppSourceFileName, root.generateDataDrivenSourceFile(pc))
}
case CommunicationType::SYNCHRONOUS:
diagnostician.error("synchronous protocols not supported yet", pc, null)

Back to the top