Skip to content
Snippets Groups Projects
Commit 6a750113 authored by al.schwinn's avatar al.schwinn
Browse files

Bug 1445 - move generated code for fesa-class into "generated" folder

parent a264f98f
No related branches found
No related tags found
No related merge requests found
...@@ -32,15 +32,18 @@ class Migration(MigrationBase): ...@@ -32,15 +32,18 @@ class Migration(MigrationBase):
def migrateClass(self, context, projectDir ): def migrateClass(self, context, projectDir ):
modified = fesaClassIncludeHeaderMigrator(context,self.silecsDocument) modified = fesaClassIncludeHeaderMigrator(context,self.silecsDocument)
removeSilecsDesignGenCode(context, self.silecsDocument) removeSilecsDesignGenCode(context, self.silecsDocument)
modified |= fesaClassMakeSpecificMigrator(self.silecsDocument)
self.updateFESAMakeSpecific()
return modified return modified
def migrateDeployUnit(self, context, projectDir ): def migrateDeployUnit(self, context, projectDir ):
modified = False modified = False
removeSilecsDeployGenCode(context, projectDir) removeSilecsDeployGenCode(context, projectDir)
self.updateFESAMakeSpecific()
return modified return modified
if __name__ == "__main__": if __name__ == "__main__":
migration = Migration(sys.argv) migration = Migration(sys.argv)
migration.migrate() migration.migrate()
migration.updateFESAMakeSpecific()
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import libxml2 import libxml2
import FileUtils from migration import FileUtils
import os import os
import shutil import shutil
def fesaClassIncludeHeaderMigrator(context,silecsDocument): def fesaClassIncludeHeaderMigrator(context,silecsDocument):
print("Info: The include calls in all FESA source files will be updated to use the new 'generated-silecs' folder") print("Migration-Info: The include calls in all FESA source files will be updated to use the new 'generated-silecs' folder")
modified = False modified = False
silecsClassNodes = context.xpathEval("//SILECS-Class") silecsClassNodes = context.xpathEval("//SILECS-Class")
if not silecsClassNodes: if not silecsClassNodes:
...@@ -37,8 +37,19 @@ def fesaClassIncludeHeaderMigrator(context,silecsDocument): ...@@ -37,8 +37,19 @@ def fesaClassIncludeHeaderMigrator(context,silecsDocument):
modified = True modified = True
return modified return modified
def fesaClassMakeSpecificMigrator(silecsDocument):
print("Migration-Info: Compiler flags for new codegen-folder will be added into the Makefile.specific of your FESA class")
modified = False
projectDir = FileUtils.getProjectDir(silecsDocument)
makeSpecific = os.path.join(projectDir,"myProject","Makefile.specific")
if os.path.isfile(makeSpecific):
with open(makeSpecific, "a") as myfile:
myfile.write("\nCOMPILER_FLAGS += -I./generated-silecs/cpp")
modified = True
return modified
def removeSilecsDesignGenCode(context, silecsDocument): def removeSilecsDesignGenCode(context, silecsDocument):
print("Info: The silecs generated C++ code which was located in 'Common' moved to 'generated-silecs' in the root directory. The old code will be removed") print("Migration-Info: The silecs generated C++ code which was located in 'Common' moved to 'generated-silecs' in the root directory. The old code will be removed")
silecsClassNodes = context.xpathEval("//SILECS-Class") silecsClassNodes = context.xpathEval("//SILECS-Class")
if not silecsClassNodes: if not silecsClassNodes:
raise Exception('Node "SILECS-Class" not found') raise Exception('Node "SILECS-Class" not found')
...@@ -54,7 +65,7 @@ def removeSilecsDesignGenCode(context, silecsDocument): ...@@ -54,7 +65,7 @@ def removeSilecsDesignGenCode(context, silecsDocument):
os.remove(hppFile) os.remove(hppFile)
def removeSilecsDeployGenCode(context, projectDir): def removeSilecsDeployGenCode(context, projectDir):
print("Info: the silecsdeploy folder 'generated' will be named 'generated-silecs' to be consistant with silecsdesign. The old folder will be removed.") print("Migration-Info: the silecsdeploy folder 'generated' will be named 'generated-silecs' to be consistant with silecsdesign. The old folder will be removed.")
clientFolder = os.path.join(projectDir,"generated","client") clientFolder = os.path.join(projectDir,"generated","client")
controllerFolder = os.path.join(projectDir,"generated","controller") controllerFolder = os.path.join(projectDir,"generated","controller")
wrapperFolder = os.path.join(projectDir,"generated","wrapper") wrapperFolder = os.path.join(projectDir,"generated","wrapper")
......
# Include SILECS library path
SILECS_PATH ?= /home/schwinn/git/silecs-base/silecs-communication-cpp/build
# Additional compiler warning flags
override WARNFLAGS +=
# Additional compiler flags
COMPILER_FLAGS += -I$(SILECS_PATH)/include -I$(SILECS_PATH)/include/silecs-communication/interface/core
COMPILER_FLAGS +=
LINKER_FLAGS +=
# Additional headers (Custom.h Specific.h ...) which need to be installed
EXTRA_HEADERS +=
COMPILER_FLAGS += -I./generated-silecs/cpp
\ No newline at end of file
# Include SILECS library path
SILECS_PATH ?= /home/schwinn/git/silecs-base/silecs-communication-cpp/build
# Additional compiler warning flags
override WARNFLAGS +=
# Additional compiler flags
COMPILER_FLAGS += -I$(SILECS_PATH)/include -I$(SILECS_PATH)/include/silecs-communication/interface/core
COMPILER_FLAGS +=
LINKER_FLAGS +=
# Additional headers (Custom.h Specific.h ...) which need to be installed
EXTRA_HEADERS +=
COMPILER_FLAGS += -I./generated-silecs/cpp
\ No newline at end of file
# Include SILECS library path
SILECS_PATH ?= /home/schwinn/git/silecs-base/silecs-communication-cpp/build
# Additional compiler warning flags
override WARNFLAGS +=
# Additional compiler flags
COMPILER_FLAGS += -I$(SILECS_PATH)/include -I$(SILECS_PATH)/include/silecs-communication/interface/core
COMPILER_FLAGS +=
LINKER_FLAGS +=
# Additional headers (Custom.h Specific.h ...) which need to be installed
EXTRA_HEADERS +=
...@@ -18,10 +18,21 @@ from test.testBase import * ...@@ -18,10 +18,21 @@ from test.testBase import *
import libxml2 import libxml2
from migration.migration2_0_Xto2_1_X.migrators import * from migration.migration2_0_Xto2_1_X.migrators import *
import inspect #get caller name import inspect # get caller name
from shutil import copyfile
import os
def testFesaClassMakeSpecificMigrator():
currentDirectory = os.path.dirname(os.path.abspath(__file__))
makefileSpecific = os.path.join(currentDirectory, "myProject", "Makefile.specific")
makefileSpecificOriginal = os.path.join(currentDirectory, "myProject", "Makefile.specific.original")
makefileSpecificCorrect = os.path.join(currentDirectory, "myProject", "Makefile.specific.correct")
if os.path.isfile(makefileSpecific):
os.remove(makefileSpecific)
copyfile(makefileSpecificOriginal, makefileSpecific)
fesaClassMakeSpecificMigrator(makefileSpecific)
assertFileEqual(makefileSpecific,makefileSpecificCorrect)
def runTests(): def runTests():
print("nothing so far") testFesaClassMakeSpecificMigrator()
#testdesignValueTypeMigrator()
#testdesignBlockRegisterMigrator()
# print deployDoc # for debugging # print deployDoc # for debugging
...@@ -54,6 +54,7 @@ class MigrationBase(object): ...@@ -54,6 +54,7 @@ class MigrationBase(object):
def updateFESAMakeSpecific(self): def updateFESAMakeSpecific(self):
projectDir = FileUtils.getProjectDir(self.silecsDocument) projectDir = FileUtils.getProjectDir(self.silecsDocument)
makeSpecific = os.path.join(projectDir,"Makefile.specific") makeSpecific = os.path.join(projectDir,"Makefile.specific")
print("Migration-Info: Old Version-Strings in '" + makeSpecific + "' will be replaced\n")
if os.path.isfile(makeSpecific): if os.path.isfile(makeSpecific):
oldComm = "silecs-communication-cpp/" + self.versionOld oldComm = "silecs-communication-cpp/" + self.versionOld
newComm = "silecs-communication-cpp/" + self.versionNew newComm = "silecs-communication-cpp/" + self.versionNew
...@@ -64,6 +65,7 @@ class MigrationBase(object): ...@@ -64,6 +65,7 @@ class MigrationBase(object):
def removeGenCode(self): def removeGenCode(self):
projectDir = FileUtils.getProjectDir(self.silecsDocument) projectDir = FileUtils.getProjectDir(self.silecsDocument)
print("Migration-Info: Generated-code folder of '" + projectDir + "' will be removed\n")
clientFolder = projectDir + "/generated/client" clientFolder = projectDir + "/generated/client"
controllerFolder = projectDir + "/generated/controller" controllerFolder = projectDir + "/generated/controller"
wrapperFolder = projectDir + "/generated/wrapper" wrapperFolder = projectDir + "/generated/wrapper"
......
...@@ -18,6 +18,7 @@ from test.testBase import * ...@@ -18,6 +18,7 @@ from test.testBase import *
import migration.migration_0_9_0to0_10_0.testMigration import migration.migration_0_9_0to0_10_0.testMigration
import migration.migration0_10_0to1_0_0.testMigration import migration.migration0_10_0to1_0_0.testMigration
import migration.migration1_0_Xto2_0_0.testMigration import migration.migration1_0_Xto2_0_0.testMigration
import migration.migration2_0_Xto2_1_X.testMigration
SilecsDeployOld = '''<?xml version="1.0" encoding="UTF-8"?> SilecsDeployOld = '''<?xml version="1.0" encoding="UTF-8"?>
<SILECS-Deploy silecs-version="oldVersion" created="03/04/16" updated="03/04/16" <SILECS-Deploy silecs-version="oldVersion" created="03/04/16" updated="03/04/16"
...@@ -48,4 +49,5 @@ def runAllTests(): ...@@ -48,4 +49,5 @@ def runAllTests():
migration.migration_0_9_0to0_10_0.testMigration.runTests() migration.migration_0_9_0to0_10_0.testMigration.runTests()
migration.migration0_10_0to1_0_0.testMigration.runTests() migration.migration0_10_0to1_0_0.testMigration.runTests()
migration.migration1_0_Xto2_0_0.testMigration.runTests() migration.migration1_0_Xto2_0_0.testMigration.runTests()
migration.migration2_0_Xto2_1_X.testMigration.runTests()
allTestsOk() allTestsOk()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment