| 17 | |
| 18 | |
| 19 | class CommandProcessor: |
| 20 | def __init__(self, bauerGlobals, generatorInfo, args, rootPath, sourceFolder, buildFolder): |
| 21 | self.args = args |
| 22 | self.logger = logging.getLogger(__name__) |
| 23 | self.bauerGlobals = bauerGlobals |
| 24 | self.generatorInfo = generatorInfo |
| 25 | self.buildFolder = buildFolder |
| 26 | self.rootPath = rootPath |
| 27 | self.sourceFolder = sourceFolder |
| 28 | self.buildExecutor = BuildExecutor(generatorInfo, rootPath, sourceFolder, buildFolder) |
| 29 | self.androidExecutor = AndroidExecutor(self.buildExecutor, generatorInfo, sourceFolder, buildFolder, rootPath) |
| 30 | |
| 31 | self.defaultLadder = { |
| 32 | ('android', None) : ('android', 'AndroidStudio'), |
| 33 | (None, 'AndroidStudio') : ('android', 'AndroidStudio'), |
| 34 | ('ios', None) : ('ios', 'Xcode'), |
| 35 | (None, 'Xcode') : ('ios', 'Xcode'), |
| 36 | ('mac', None) : ('mac', 'Xcode') |
| 37 | } |
| 38 | |
| 39 | if sys.platform == 'darwin': |
| 40 | self.defaultLadder[(None, None)] = ('ios', 'Xcode') |
| 41 | else: |
| 42 | self.defaultLadder[(None, None)] = ('android', 'AndroidStudio') |
| 43 | |
| 44 | def process(self): |
| 45 | command = self.args.command; |
| 46 | |
| 47 | self.logger.debug('Starting command: %s', command) |
| 48 | |
| 49 | selectedConfigurations = self.buildFolder.getBuildConfigurationsForCommand(); |
| 50 | self.logger.debug("Selected platform list:") |
| 51 | for config in selectedConfigurations: |
| 52 | self.logger.debug("* %s", config) |
| 53 | |
| 54 | if len(selectedConfigurations)==0: |
| 55 | defaultLadderKey = (self.args.platform, self.args.build_system) |
| 56 | architecture = self.args.arch |
| 57 | configuration = self.args.config |
| 58 | if not architecture: |
| 59 | architecture = "std" |
| 60 | |
| 61 | if defaultLadderKey in self.defaultLadder: |
| 62 | defaults = self.defaultLadder[defaultLadderKey] |
| 63 | |
| 64 | self.logger.info("Defaulting to: %s - %s" % (defaults[0], defaults[1])) |
| 65 | selectedConfigurations = [ |
| 66 | BuildConfiguration(platform=defaults[0], arch=architecture, buildsystem=defaults[1], config=configuration) |
| 67 | ] |
| 68 | else: |
| 69 | raise error.IncorrectCallError("Could not determine default platform / buildsystem ( and configuration ). Please specifiy one via -p, -b (and -c)") |
| 70 | |
| 71 | for configuration in selectedConfigurations: |
| 72 | if configuration.platform not in self.bauerGlobals.platformMap: |
| 73 | raise error.InvalidPlatformNameError(configuration.platform); |
| 74 | |
| 75 | buildDirectory = self.buildFolder.getBuildDir(configuration) |
| 76 | |