Commit 3d3a86a2 authored by Ben Cooksley's avatar Ben Cooksley

Introduce support for loading platform specific build-specs

parent 97dbd5ad
......@@ -13,7 +13,7 @@ parser.add_argument('--usingInstall', type=str, required=True)
arguments = parser.parse_args()
# Load our build specification, which governs how we handle this build
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup )
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup, platform=arguments.platform )
# Determine the environment we need to provide for the compilation process
buildEnvironment = EnvironmentHandler.generateFor( installPrefix=arguments.usingInstall )
......
......@@ -15,7 +15,7 @@ parser.add_argument('--usingInstall', type=str, required=True)
arguments = parser.parse_args()
# Load our build specification, which governs how we handle this build
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup )
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup, platform=arguments.platform )
# Determine the environment we need to provide for the compilation process
buildEnvironment = EnvironmentHandler.generateFor( installPrefix=arguments.usingInstall )
......
......@@ -15,7 +15,7 @@ parser.add_argument('--installTo', type=str, required=True)
arguments = parser.parse_args()
# Load our build specification, which governs how we handle this build
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup )
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup, platform=arguments.platform )
# Determine the environment we need to provide to any configure system (like CMake or Autotools)
buildEnvironment = EnvironmentHandler.generateFor( installPrefix=arguments.installTo )
......
......@@ -12,7 +12,7 @@ parser.add_argument('--usingInstall', type=str, required=True)
arguments = parser.parse_args()
# Load our build specification, which governs how we handle this build
buildSpecification = new BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup )
buildSpecification = new BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup, platform=arguments.platform )
# Determine the environment we need to provide for the compilation process
buildEnvironment = EnvironmentHandler.generateFor( installPrefix=arguments.usingInstall )
......
......@@ -6,16 +6,35 @@ from helperslib import CommonUtils
class Loader(object):
# Loads the Project's configuration, should it have one and merges it with the default configuration
def __init__(self, product, project, branchGroup):
def __init__(self, product, project, branchGroup, platform):
# Start by copying the default settings
self.mergedConfig = self.defaultOptions()
# Where should our configuration file be?
# It should be at /build-specs/<project>.yaml
# As the configuration location already contains /build-specs/ we just have to add on <project>.yaml
# It should be at /build-specs/<Product>/<project>.yaml
# As the configuration location already contains /build-specs/ we just have to add on <product> and <project>.yaml
configFileLocation = os.path.join( CommonUtils.scriptsBaseDirectory(), 'build-specs', product, project + '.yaml' )
self.loadSpecificationFile( configFileLocation, branchGroup )
# As a secondary option, we also allow for Platform specific build specs
# These will be located at /build-specs/<Product>/<project>-<platform>.yaml
# Let's make sure we load it as well
configFileLocation = os.path.join( CommonUtils.scriptsBaseDirectory(), 'build-specs', product, project + '-' + platform + '.yaml' )
self.loadSpecificationFile( configFileLocation, branchGroup )
# Allow fetching our config
def __getitem__(self, name):
# Do we know about this attribute?
if name in self.mergedConfig:
# Then return it
return self.mergedConfig[name]
# We don't know about it
raise KeyError
# Load the given specification file
def loadSpecificationFile(self, configFileLocation, branchGroup):
# Does the file exist?
# If it does not, then we don't need to do anything else
if not os.path.isfile(configFileLocation):
......@@ -31,16 +50,6 @@ class Loader(object):
# The merge it in
self.mergedConfig.update( projectConfig[branchGroup] )
# Allow fetching our config
def __getitem__(self, name):
# Do we know about this attribute?
if name in self.mergedConfig:
# Then return it
return self.mergedConfig[name]
# We don't know about it
raise KeyError
# Specifies our defaults
def defaultOptions(self):
return {
......
......@@ -16,7 +16,7 @@ parser.add_argument('--divertTo', type=str)
arguments = parser.parse_args()
# Load our build specification, which governs how we handle this build
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup )
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup, platform=arguments.platform )
# Determine the environment we need to provide for the installation process
buildEnvironment = EnvironmentHandler.generateFor( installPrefix=arguments.installTo )
......
......@@ -16,7 +16,7 @@ parser.add_argument('--installTo', type=str, required=True)
arguments = parser.parse_args()
# Load our build specification, which governs how we handle this build
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup )
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup, platform=arguments.platform )
# Initialise the dependnecy resolver
resolver = Buildable.DependencyResolver()
......
......@@ -16,7 +16,7 @@ parser.add_argument('--installTo', type=str, required=True)
arguments = parser.parse_args()
# Load our build specification, which governs how we handle this build
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup )
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup, platform=arguments.platform )
# Initialise the dependnecy resolver
resolver = Buildable.DependencyResolver()
......
......@@ -17,7 +17,7 @@ parser.add_argument('--usingInstall', type=str, required=True)
arguments = parser.parse_args()
# Load our build specification, which governs how we handle this build
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup )
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup, platform=arguments.platform )
# Determine the environment we need to provide for the installation process
buildEnvironment = EnvironmentHandler.generateFor( installPrefix=arguments.usingInstall )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment