def LightWeightCopyTree(target, source, env): if not 'EXCLUDE' in env: exclude = [] else: exclude = env['EXCLUDE'] if type(env['OUTDIR']) == types.ListType: env['OUTDIR'] = env['OUTDIR'][0] effess.lightweight_copy_tree(env['IN'], env['OUTDIR'], exclude)
def stage(self, stage_dir, bundle=False): print('Staging %s' % self.name) self.stage_dir = stage_dir contents = self.contents = self.get_contents_dir() self.env.log(u'Copying contents from %s to %s' % (self.source_dir, contents)) effess.copy_tree(self.source_dir, contents, exclude=self.env.get_excludes()) installer_source = p.join(self.sdk_dir, 'installer') self.env.log(u'Copying installer from %s to %s' % (installer_source, contents)) effess.copy_to_dir(installer_source, contents, exclude=self.env.get_excludes() + ['.dll', '.msm']) self.write_manifest(contents) self.write_tiapp(contents) if bundle: self.env.log(u'Copying runtime to %s' % self.stage_dir) effess.copy_to_dir(self.env.get_runtime_dir(self.runtime_version), contents, exclude=self.env.get_excludes()) if hasattr(self, 'sdk_version'): self.env.log(u'Copying SDK to %s' % contents) effess.copy_to_dir(self.sdk_dir, contents, exclude=self.env.get_excludes()) # We don't bundle the MobileSDK currently. #if hasattr(self, 'mobilesdk_version'): # self.env.log(u'Copying MobileSDK to %s' % contents) # effess.copy_to_dir(self.env.get_mobilesdk_dir(self.sdk_version), # contents, exclude=self.env.get_excludes()) for module in self.modules: try: source = self.env.get_module_dir(module) except Exception, e: # Couldn't find module directory. # If the module exists in the source directory, the app likely # ships with a custom module. In this case, eat the error. if not(p.exists(p.join(self.source_dir, 'modules', module[0]))): raise e target = p.join(contents, 'modules', module[0]) effess.lightweight_copy_tree(source, target, exclude=self.env.get_excludes())
def stage(self, stage_dir, bundle=False, no_install=False): print('Staging %s' % self.name) self.stage_dir = fix_path(stage_dir) contents = self.contents = self.get_contents_dir() self.env.log(u'Copying contents from %s to %s' % (self.source_dir, contents)) excludes = self.env.get_excludes() # Don't prematurely copy custom modules (we only want them if they're in the manifest) excludes.append(p.join(self.source_dir, 'modules')) # If we are staging into a subdirectory of the original # application directory (like Titanium Developer), then # ignore the immediate child of the original app directory # on the way to the stagin directory. Example: # App directory: /tmp/MyProject # Staging directory: /tmp/MyProject/dist/linux/MyProject # then we ignore: /tmp/MyProject/dist if contents.find(p.join(self.source_dir, '')) != -1: (current, child) = p.split(contents) while current != self.source_dir: (current, child) = p.split(current) excludes.append(p.join(current, child)) effess.copy_tree(self.source_dir, contents, exclude=self.env.get_excludes()) # If we are not including the installer and this is bundled, do not copy # the installer and make the app as installed. if no_install and bundle: f = open(p.join(self.get_contents_dir(), '.installed'), 'w') f.write("installed") f.close() else: installer_source = p.join(self.sdk_dir, 'installer') self.env.log(u'Copying installer from %s to %s' % (installer_source, contents)) effess.copy_to_dir(installer_source, contents, exclude=self.env.get_excludes() + ['.dll', '.msm']) self.write_manifest(contents) self.write_tiapp(contents) if bundle: self.env.log(u'Copying runtime to %s' % self.stage_dir) effess.copy_tree(self.env.get_runtime_dir(self.runtime_version), p.join(contents, "runtime", self.runtime_version), exclude=self.env.get_excludes()) if hasattr(self, 'sdk_version'): self.env.log(u'Copying SDK to %s' % contents) effess.copy_tree(self.sdk_dir, p.join(contents, "sdk", self.sdk_version), exclude=self.env.get_excludes()) # We don't bundle the MobileSDK currently. #if hasattr(self, 'mobilesdk_version'): # self.env.log(u'Copying MobileSDK to %s' % contents) # effess.copy_tree(self.sdk_dir, # p.join(contents, "mobilesdk", self.mobilesdk_version), # exclude=self.env.get_excludes()) for module in self.modules: # If this module already exists in the source directory as a bundled # module than don't overwrite it with an installed module source = p.join(self.source_dir, 'modules', module[0], module[1]) if not(p.exists(source)): source = self.env.get_module_dir(module) effess.lightweight_copy_tree(source, p.join(contents, 'modules', module[0], module[1]), exclude=self.env.get_excludes())
def stage(self, stage_dir, bundle=False, no_install=False, js_obfuscate=False, ignore_patterns=""): print('Staging %s' % self.name) self.stage_dir = fix_path(stage_dir) contents = self.contents = self.get_contents_dir() self.env.log(u'Copying contents from %s to %s' % (self.source_dir, contents)) excludes = self.env.get_excludes() # Add ignore_patterns to excludes if ignore_patterns != "": excludes.extend(ignore_patterns.split(',')) # Don't prematurely copy custom modules (we only want them if they're in the manifest) excludes.append(p.join(self.source_dir, 'modules')) # If we are staging into a subdirectory of the original # application directory (like TideSDK Developer), then # ignore the immediate child of the original app directory # on the way to the stagin directory. Example: # App directory: /tmp/MyProject # Staging directory: /tmp/MyProject/dist/linux/MyProject # then we ignore: /tmp/MyProject/dist if contents.find(p.join(self.source_dir, '')) != -1: (current, child) = p.split(contents) while current != self.source_dir: (current, child) = p.split(current) excludes.append(p.join(current, child)) effess.copy_tree(self.source_dir, contents, exclude=self.env.get_excludes()) if js_obfuscate: file_paths = [] for dir_path, dir_names, file_names in os.walk(self.source_dir): file_paths.extend( os.path.join(dir_path, f) for f in fnmatch.filter(file_names, '*.js')) for file_name in file_paths: if os.path.isfile(file_name): if "Windows" in platform.platform(): head, tail = file_name.split('Resources\\') else: head, tail = file_name.split('Resources/') compiler_jar = os.path.join(self.sdk_dir, 'closure', 'compiler.jar') output_file = os.path.join(contents, "Resources") output_file = os.path.join(output_file, tail) source_file = os.path.join(self.source_dir, file_name) exec_cmd = "java -jar " + '"' + compiler_jar + '"' + " --js " + '"' + source_file + '"' + " --compilation_level SIMPLE_OPTIMIZATIONS --js_output_file " + '"' + output_file + '"' os.system(exec_cmd) # If we are not including the installer and this is bundled, do not copy # the installer and make the app as installed. if no_install and bundle: f = open(p.join(self.get_contents_dir(), '.installed'), 'w') f.write("installed") f.close() else: installer_source = p.join(self.sdk_dir, 'installer') self.env.log(u'Copying installer from %s to %s' % (installer_source, contents)) effess.copy_to_dir(installer_source, contents, exclude=self.env.get_excludes() + ['.dll', '.msm']) self.write_manifest(contents) self.write_tiapp(contents) if bundle: self.env.log(u'Copying runtime to %s' % self.stage_dir) effess.copy_tree(self.env.get_runtime_dir(self.runtime_version), p.join(contents, "runtime", self.runtime_version), exclude=self.env.get_excludes()) if hasattr(self, 'sdk_version'): self.env.log(u'Copying SDK to %s' % contents) effess.copy_tree(self.sdk_dir, p.join(contents, "sdk", self.sdk_version), exclude=self.env.get_excludes()) # We don't bundle the MobileSDK currently. #if hasattr(self, 'mobilesdk_version'): # self.env.log(u'Copying MobileSDK to %s' % contents) # effess.copy_tree(self.sdk_dir, # p.join(contents, "mobilesdk", self.mobilesdk_version), # exclude=self.env.get_excludes()) for module in self.modules: # If this module already exists in the source directory as a bundled # module than don't overwrite it with an installed module source = p.join(self.source_dir, 'modules', module[0], module[1]) if not (p.exists(source)): source = self.env.get_module_dir(module) effess.lightweight_copy_tree(source, p.join(contents, 'modules', module[0], module[1]), exclude=self.env.get_excludes())
def stage(self, stage_dir, bundle=False, no_install=False, js_obfuscate=False): print("Staging %s" % self.name) self.stage_dir = fix_path(stage_dir) contents = self.contents = self.get_contents_dir() self.env.log(u"Copying contents from %s to %s" % (self.source_dir, contents)) excludes = self.env.get_excludes() # Don't prematurely copy custom modules (we only want them if they're in the manifest) excludes.append(p.join(self.source_dir, "modules")) # If we are staging into a subdirectory of the original # application directory (like Titanium Developer), then # ignore the immediate child of the original app directory # on the way to the stagin directory. Example: # App directory: /tmp/MyProject # Staging directory: /tmp/MyProject/dist/linux/MyProject # then we ignore: /tmp/MyProject/dist if contents.find(p.join(self.source_dir, "")) != -1: (current, child) = p.split(contents) while current != self.source_dir: (current, child) = p.split(current) excludes.append(p.join(current, child)) effess.copy_tree(self.source_dir, contents, exclude=self.env.get_excludes()) if js_obfuscate: file_paths = [] for dir_path, dir_names, file_names in os.walk(self.source_dir): file_paths.extend(os.path.join(dir_path, f) for f in fnmatch.filter(file_names, "*.js")) for file_name in file_paths: if os.path.isfile(file_name): if "Windows" in platform.platform(): head, tail = file_name.split("Resources\\") else: head, tail = file_name.split("Resources/") compiler_jar = os.path.join(self.sdk_dir, "google_closure", "compiler.jar") output_file = os.path.join(contents, "Resources") output_file = os.path.join(output_file, tail) source_file = os.path.join(self.source_dir, file_name) exec_cmd = ( "java -jar " + '"' + compiler_jar + '"' + " --js " + '"' + source_file + '"' + " --compilation_level SIMPLE_OPTIMIZATIONS --js_output_file " + '"' + output_file + '"' ) os.system(exec_cmd) # If we are not including the installer and this is bundled, do not copy # the installer and make the app as installed. if no_install and bundle: f = open(p.join(self.get_contents_dir(), ".installed"), "w") f.write("installed") f.close() else: installer_source = p.join(self.sdk_dir, "installer") self.env.log(u"Copying installer from %s to %s" % (installer_source, contents)) effess.copy_to_dir(installer_source, contents, exclude=self.env.get_excludes() + [".dll", ".msm"]) self.write_manifest(contents) self.write_tiapp(contents) if bundle: self.env.log(u"Copying runtime to %s" % self.stage_dir) effess.copy_tree( self.env.get_runtime_dir(self.runtime_version), p.join(contents, "runtime", self.runtime_version), exclude=self.env.get_excludes(), ) if hasattr(self, "sdk_version"): self.env.log(u"Copying SDK to %s" % contents) effess.copy_tree( self.sdk_dir, p.join(contents, "sdk", self.sdk_version), exclude=self.env.get_excludes() ) # We don't bundle the MobileSDK currently. # if hasattr(self, 'mobilesdk_version'): # self.env.log(u'Copying MobileSDK to %s' % contents) # effess.copy_tree(self.sdk_dir, # p.join(contents, "mobilesdk", self.mobilesdk_version), # exclude=self.env.get_excludes()) for module in self.modules: # If this module already exists in the source directory as a bundled # module than don't overwrite it with an installed module source = p.join(self.source_dir, "modules", module[0], module[1]) if not (p.exists(source)): source = self.env.get_module_dir(module) effess.lightweight_copy_tree( source, p.join(contents, "modules", module[0], module[1]), exclude=self.env.get_excludes() )
def stage(self, stage_dir, bundle=False): print('Staging %s' % self.name) self.stage_dir = fix_path(stage_dir) contents = self.contents = self.get_contents_dir() self.env.log(u'Copying contents from %s to %s' % (self.source_dir, contents)) excludes = self.env.get_excludes() # Don't prematurely copy custom modules (we only want them if they're in the manifest) excludes.append(p.join(self.source_dir, 'modules')) # If we are staging into a subdirectory of the original # application directory (like Titanium Developer), then # ignore the immediate child of the original app directory # on the way to the stagin directory. Example: # App directory: /tmp/MyProject # Staging directory: /tmp/MyProject/dist/linux/MyProject # then we ignore: /tmp/MyProject/dist if contents.find(self.source_dir) != -1 and \ contents != self.source_dir: (current, child) = p.split(contents) while current != self.source_dir: (current, child) = p.split(current) excludes.append(p.join(current, child)) effess.copy_tree(self.source_dir, contents, exclude=self.env.get_excludes()) installer_source = p.join(self.sdk_dir, 'installer') self.env.log(u'Copying installer from %s to %s' % (installer_source, contents)) effess.copy_to_dir(installer_source, contents, exclude=self.env.get_excludes() + ['.dll', '.msm']) self.write_manifest(contents) self.write_tiapp(contents) if bundle: self.env.log(u'Copying runtime to %s' % self.stage_dir) effess.copy_tree(self.env.get_runtime_dir(self.runtime_version), p.join(contents, "runtime", self.runtime_version), exclude=self.env.get_excludes()) if hasattr(self, 'sdk_version'): self.env.log(u'Copying SDK to %s' % contents) effess.copy_tree(self.sdk_dir, p.join(contents, "sdk", self.sdk_version), exclude=self.env.get_excludes()) # We don't bundle the MobileSDK currently. #if hasattr(self, 'mobilesdk_version'): # self.env.log(u'Copying MobileSDK to %s' % contents) # effess.copy_tree(self.sdk_dir, # p.join(contents, "mobilesdk", self.mobilesdk_version), # exclude=self.env.get_excludes()) for module in self.modules: # If this module already exists in the source directory as a bundled # module than don't overwrite it with an installed module source = p.join(self.source_dir, 'modules', module[0], module[1]) if not (p.exists(source)): source = self.env.get_module_dir(module) effess.lightweight_copy_tree(source, p.join(contents, 'modules', module[0], module[1]), exclude=self.env.get_excludes())