Skip to content

Commit

Permalink
CELIX-236: add dependency manager code to celix bootstrap, add projec…
Browse files Browse the repository at this point in the history
…t deployment
  • Loading branch information
bpetri committed Jan 28, 2016
1 parent 4228b99 commit 37010fb
Show file tree
Hide file tree
Showing 10 changed files with 348 additions and 656 deletions.
19 changes: 12 additions & 7 deletions celix-bootstrap/celix/bootstrap/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,20 @@ def __init__(self, gendir, erase, template_dir) :
#python3 super(Project, self).__init__(gendir, "project")

def update_cmakelists(self) :
options = ["-D", "projectFile=%s" % self.descriptor]
self.update_file("CMakeLists.txt", "CMakeLists.txt", options, "#")
options = ["-D", "projectFile=%s" % self.descriptor]
self.update_file("CMakeLists.txt", "CMakeLists.txt", options, "#")

def create(self) :
self.update_file(os.path.join(self.template_dir, self.profile, "%s.yaml" % self.profile), "%s.yaml" % self.profile, [], None)
def update_deploy_file(self) :
options = ["-D", "projectFile=%s" % self.descriptor]
self.update_file("deploy.cmake", "deploy.cmake", options, "#")

def create(self) :
self.update_file(os.path.join(self.template_dir, self.profile, "%s.yaml" % self.profile), "%s.yaml" % self.profile, [], None)

def update(self) :
descriptor = self.read_descriptor()
if descriptor is None :
print("%s does not exist or does not contain a project.yaml file" % self.gendir)
else :
self.update_cmakelists()
print("%s does not exist or does not contain a project.yaml file" % self.gendir)
else :
self.update_cmakelists()
self.update_deploy_file()
15 changes: 10 additions & 5 deletions celix-bootstrap/celix/bootstrap/templates/bundle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ SET(
SET(BUNDLE_VERSION "0.0.1")

include_directories(
"private/include"
"public/include"
${CELIX_INCLUDE_DIR}/dependency_manager
"private/include"
"public/include"
#{{
#for comp in bundle['components'] :
# for service in comp['serviceDependencies']:
# cog.outl("\t\"%s\"" % os.path.dirname(service['include']))
# for service in comp['serviceDependencies']:
# cog.outl("\t\"%s\"" % os.path.abspath(os.path.dirname(service['include'])))
#}}
"org.example.mybundle" #do not edit, generated code
#{{end}}
Expand All @@ -68,4 +69,8 @@ mybundle SOURCES #do not edit, generated code
SET(BUNDLE_LIB "mybundle") #do not edit, generated code
#{{end}}

target_link_libraries(${BUNDLE_LIB} ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY})
IF(APPLE)
target_link_libraries(${BUNDLE_LIB} ${CELIX_FRAMEWORK_LIBRARY} -Wl,-all_load dependency_manager ${CELIX_UTILS_LIBRARY})
else()
target_link_libraries(${BUNDLE_LIB} -Wl,--whole-archive dependency_manager -Wl,--no-whole-archive ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY})
ENDIF()
62 changes: 33 additions & 29 deletions celix-bootstrap/celix/bootstrap/templates/bundle/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,44 @@ components:
# componentName = checkInput('\nPlease enter componentName', '([a-zA-Z_][a-zA-Z0-9_]*)', 'example')
# cog.outl('- name: \'%s\'' % componentName )
# cog.outl(' providedServices:')
# while yn('Should component \'%s\' provide %s service?' % (componentName, 'a' if 'psInclude' not in vars() else 'another')):
# psServiceName1 = checkInput('(1) Please enter a name, which can be used for the filename and the include guards', '([a-zA-Z_][a-zA-Z0-9_]*)');
# psServiceName2 = checkInput('(2) Please enter a name, which is used to register and lookup the service', '([a-zA-Z_][a-zA-Z0-9_]*)', (psServiceName1.lower() + ('_service' if not psServiceName1.endswith('_service') else '')));
# psServiceType = checkInput('(3) Please enter a type', '([a-zA-Z_][a-zA-Z0-9_]*)', (psServiceName1.lower() + ('_service_pt' if not psServiceName1.endswith('_service_pt') else '')) );
# psInclude = checkInput('(4) Please enter the name of the include file', '(.+?)(\.[^.]*$|$)', psServiceName1.lower() + '.h');
# while yn('Should component \'%s\' provide %s service?' % (componentName, 'a' if 'psInclude' not in vars() else 'another')):
# psServiceName1 = checkInput('(1) Please enter a name, which can be used for the filename and the include guards', '([a-zA-Z_][a-zA-Z0-9_]*)');
# psServiceName2 = checkInput('(2) Please enter a name, which is used to register and lookup the service', '([a-zA-Z_][a-zA-Z0-9_]*)', (psServiceName1.lower() + ('_service' if not psServiceName1.endswith('_service') else '')));
# psServiceVersion = checkInput('(3) Please enter a version number', '(\d+\.)?(\d+\.)?(\d+\.)?(\*|\d+)', '1.0.0.0');
# psServiceType = checkInput('(4) Please enter a type', '([a-zA-Z_][a-zA-Z0-9_]*)', (psServiceName1.lower() + ('_service_t' if not psServiceName1.endswith('_service_t') else '')) );
# psInclude = checkInput('(5) Please enter the name of the include file', '(.+?)(\.[^.]*$|$)', psServiceName1.lower() + '.h');
#
# print("\n Summary:")
# print("\tname :\t%s" % (psServiceName1))
# print("\tservice_name:\t%s" % (psServiceName2))
# print("\tservice_type:\t%s" % (psServiceType))
# print("\tinclude file:\t%s" % (psInclude))
# if yn('Are those information correct?'):
# cog.outl(' - {include: \'%s\', name: \'%s\', service_name: \'%s\', type: \'%s\'}' % (psInclude, psServiceName1, psServiceName2, psServiceType))
# else:
# print("Service was not added.")
# print("\n Summary:")
# print("\tname :\t%s" % (psServiceName1))
# print("\tservice_name:\t%s" % (psServiceName2))
# print("\tservice_version:\t%s" % (psServiceVersion))
# print("\tservice_type:\t%s" % (psServiceType))
# print("\tinclude file:\t%s" % (psInclude))
# if yn('Are those information correct?'):
# cog.outl(' - {include: \'%s\', name: \'%s\', service_name: \'%s\', service_version: \'%s\', type: \'%s\'}' % (psInclude, psServiceName1, psServiceName2, psServiceVersion, psServiceType))
# else:
# print("Service was not added.")
#
# cog.outl(' serviceDependencies:')
# while yn('Should component \'%s\' depend on %s service?' % (componentName, 'a' if 'sdInclude' not in vars() else 'another')):
# sdInclude = checkInclude('(1) Please enter the include filename, which describes the service', '(.+?)(\.[^.]*$|$)');
# sdServiceName1 = checkInput('(2) Please enter a name, which is used to generate the code', '([a-zA-Z_][a-zA-Z0-9_]*)');
# sdServiceName2 = checkIncludeContent('(3) Please enter the variable/constants, which is used to register the service within the framework', sdInclude);
# sdServiceType = checkIncludeContent('(4) Please enter the type of the service', sdInclude);
# sdCardinality = checkInput('(5) Please enter the cardinality (one|many|optional)', '(one)|(many)|(optional)');
# sdInclude = checkInclude('(1) Please enter the include filename, which describes the service', '(.+?)(\.[^.]*$|$)');
# sdServiceName1 = checkInput('(2) Please enter a name, which is used to generate the code', '([a-zA-Z_][a-zA-Z0-9_]*)');
# sdServiceName2 = checkIncludeContent('(3) Please enter the variable/constants, which is used to register the service within the framework', sdInclude);
# sdServiceRange = checkIncludeContent('(4) Please enter the variable/constants, which contains the version range', sdInclude);
# sdServiceType = checkIncludeContent('(5) Please enter the type of the service', sdInclude);
# sdCardinality = checkInput('(6) Please enter the cardinality (one|many|optional)', '(one)|(many)|(optional)');
#
# print("\n Summary:")
# print("\tname :\t%s" % (sdServiceName1))
# print("\tservice_name:\t%s" % (sdServiceName2))
# print("\tservice_type:\t%s" % (sdServiceType))
# print("\tcardinality:\t%s" % (sdCardinality))
# print("\tinclude file:\t%s" % (sdInclude))
# if yn('Are those information correct?'):
# cog.outl(' - {include: \'%s\', name: \'%s\', service_name: \'%s\', type: \'%s\', cardinality: \'%s\'}' % (sdInclude, sdServiceName1, sdServiceName2, sdServiceType, sdCardinality))
# else:
# print("Service dependency was not added.")
# print("\n Summary:")
# print("\tname :\t%s" % (sdServiceName1))
# print("\tservice_name:\t%s" % (sdServiceName2))
# print("\tservice_range:\t%s" % (sdServiceRange))
# print("\tservice_type:\t%s" % (sdServiceType))
# print("\tcardinality:\t%s" % (sdCardinality))
# print("\tinclude file:\t%s" % (sdInclude))
# if yn('Are those information correct?'):
# cog.outl(' - {include: \'%s\', name: \'%s\', service_name: \'%s\', service_versionrange: \'%s\', type: \'%s\', cardinality: \'%s\'}' % (sdInclude, sdServiceName1, sdServiceName2, sdServiceRange, sdServiceType, sdCardinality))
# else:
# print("Service dependency was not added.")
#}}
#{{end}}

Expand Down
Loading

0 comments on commit 37010fb

Please sign in to comment.