def get_kroll_utils(self, dir, unzip=True): effess.copy_to_dir(self.kroll_utils_dir, dir) sources = Glob('%s/utils/*.cpp' % dir) + \ Glob('%s/utils/poco/*.cpp' % dir) + \ Glob('%s/utils/%s/*.cpp' % (dir, self.os)) if self.is_win32() and unzip: sources.extend(Glob('%s/utils/unzip/*.cpp' % dir)) if self.is_osx(): sources.extend(Glob('%s/utils/%s/*.mm' % (dir, self.os))) if self.is_osx() or self.is_linux(): sources.extend(Glob('%s/utils/posix/*.cpp' % dir)) return sources
def stage(self, stage_dir, bundle, no_install, js_obfuscate): if not stage_dir.endswith('.app'): stage_dir += '.app' App.stage(self, stage_dir, bundle=bundle, no_install=no_install, js_obfuscate=js_obfuscate) defaults_exec = "defaults write " + self.id + " WebKitDeveloperExtras -bool true" os.system(defaults_exec) self.env.log(u'Copying kboot to %s' % self.contents) self.executable_path = p.join(self.contents, 'MacOS', self.name) effess.copy(p.join(self.sdk_dir, 'kboot'), self.executable_path) self.env.log(u'Copying Mac resources to %s' % self.contents) # Copy Info.plist to Contents plist_file = p.join(self.contents, 'Info.plist') effess.copy(p.join(self.sdk_dir, 'Info.plist'), plist_file) effess.replace_vars( plist_file, { 'APPEXE': self.name, 'APPNAME': self.name, 'APPICON': 'titanium.icns', 'APPID': self.id, 'APPNIB': 'MainMenu', 'APPVER': self.version, 'APPVERSHORT': self.version }) lproj_dir = p.join(self.contents, 'Resources', 'English.lproj') effess.copy_to_dir(p.join(self.sdk_dir, 'MainMenu.nib'), lproj_dir) # If there is an icon defined, create a custom titanium.icns file if hasattr(self, 'image'): self.env.run([ p.join(self.sdk_dir, 'makeicns'), '-in', p.join(self.contents, 'Resources', self.image), '-out', p.join(lproj_dir, 'titanium.icns') ]) else: effess.copy_to_dir(p.join(self.sdk_dir, 'titanium.icns'), lproj_dir) # The installer also needs to have the application icon as well. if no_install is False: effess.copy_to_dir( p.join(lproj_dir, 'titanium.icns'), p.join(self.contents, 'installer', ' Installer App.app', 'Contents', 'Resources', 'English.lproj'))
def stage(self, stage_dir, bundle, no_install, js_obfuscate): if not stage_dir.endswith('.app'): stage_dir += '.app' App.stage(self, stage_dir, bundle=bundle, no_install=no_install, js_obfuscate=js_obfuscate) defaults_exec = "defaults write " + self.id + " WebKitDeveloperExtras -bool true"; os.system(defaults_exec); self.env.log(u'Copying kboot to %s' % self.contents) self.executable_path = p.join(self.contents, 'MacOS', self.name) effess.copy(p.join(self.sdk_dir, 'kboot'), self.executable_path) self.env.log(u'Copying Mac resources to %s' % self.contents) # Copy Info.plist to Contents plist_file = p.join(self.contents, 'Info.plist') effess.copy(p.join(self.sdk_dir, 'Info.plist'), plist_file) effess.replace_vars(plist_file, { 'APPEXE': self.name, 'APPNAME': self.name, 'APPICON': 'titanium.icns', 'APPID': self.id, 'APPNIB': 'MainMenu', 'APPVER': self.version, 'APPVERSHORT': self.version }) lproj_dir = p.join(self.contents, 'Resources', 'English.lproj') effess.copy_to_dir(p.join(self.sdk_dir, 'MainMenu.nib'), lproj_dir) # If there is an icon defined, create a custom titanium.icns file if hasattr(self, 'image'): self.env.run([ p.join(self.sdk_dir, 'makeicns'), '-in', p.join(self.contents, 'Resources', self.image), '-out', p.join(lproj_dir, 'titanium.icns') ]) else: effess.copy_to_dir(p.join(self.sdk_dir, 'titanium.icns'), lproj_dir) # The installer also needs to have the application icon as well. if no_install is False: effess.copy_to_dir(p.join(lproj_dir, 'titanium.icns'), p.join(self.contents, 'installer',' Installer App.app', 'Contents', 'Resources', 'English.lproj'))
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): if not stage_dir.endswith('.app'): stage_dir += '.app' App.stage(self, stage_dir, bundle=bundle) self.env.log(u'Copying kboot to %s' % self.contents) effess.copy(p.join(self.sdk_dir, 'kboot'), p.join(self.contents, 'MacOS', self.name)) self.env.log(u'Copying Mac resources to %s' % self.contents) # Copy Info.plist to Contents plist_file = p.join(self.contents, 'Info.plist') effess.copy(p.join(self.sdk_dir, 'Info.plist'), plist_file) effess.replace_vars(plist_file, { 'APPEXE': self.name, 'APPNAME': self.name, 'APPICON': 'titanium.icns', 'APPID': self.id, 'APPNIB': 'MainMenu', 'APPVER': self.version }) lproj_dir = p.join(self.contents, 'Resources', 'English.lproj') effess.copy_to_dir(p.join(self.sdk_dir, 'MainMenu.nib'), lproj_dir) # If there is an icon defined, create a custom titanium.icns file if hasattr(self, 'image'): self.env.run('"%s" -in "%s" -out "%s"' % ( p.join(self.sdk_dir, 'makeicns'), p.join(self.contents, 'Resources', self.image), p.join(lproj_dir, 'titanium.icns'))) else: effess.copy_to_dir(p.join(self.sdk_dir, 'titanium.icns'), lproj_dir) # The installer also needs to have the application icon as well. effess.copy_to_dir(p.join(lproj_dir, 'titanium.icns'), p.join(self.contents, 'installer',' Installer App.app', 'Contents', 'Resources', 'English.lproj'))
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())