myZipFile.close()
return rsrc_zip
- def build_native(self, source, rootstrap=None, arch=None, conf='Release'):
+ def build_native(self, source, rootstrap=None, arch=None, conf='Debug'):
"""SDK CLI build command"""
_rootstrap = self.check_rootstrap(rootstrap)
if rootstrap is None and arch is None:
rootstrap = _rootstrap
- arch = 'x86'
+ self.arch = 'x86'
elif arch is None:
- if 'emulator' in rootstrap: arch = 'x86'
- elif 'device' in rootstrap: arch = 'arm'
+ if 'emulator' in rootstrap: self.arch = 'x86'
+ elif 'device' in rootstrap: self.arch = 'arm'
elif rootstrap is None:
if arch not in ['x86', 'arm']:
raise LocalError('Architecture and rootstrap mismatch')
if arch == 'arm': rootstrap = rootstrap.replace('emulator', 'device')
for x in source.project_list:
- out = self._run('build-native', ['-r', rootstrap, '-a', arch, '-C', conf, '--' , x['path']], checker=True)
+ out = self._run('build-native', ['-r', rootstrap, '-a', self.arch, '-C', conf, '--' , x['path']], checker=True)
logpath = os.path.join(source.output_dir, \
'build_%s_%s' % (rootstrap, os.path.basename(x['path'])))
if not os.path.isdir(source.output_dir):
#Copy tpk to output directory
shutil.copy(final_app, source.output_dir)
+ def package_new(self, source, cert=None, pkg_type=None, conf=None, manual_strip=False):
+ """SDK CLI package command
+ IF Debug + Manual Strip off then generate package-name-debug.tpk
+ IF Debug + Manual Strip on then generate package-name.tpk with custom strip
+ IF Release then generate package-name.tpk with strip option
+ """
+
+ if cert is None: cert = 'ABS'
+ if pkg_type is None: pkg_type = 'tpk'
+ if conf is None: conf = 'Debug'
+
+ final_app = ''
+ main_args = ['-t', pkg_type, '-s', cert]
+ out = '' #logfile
+
+ # remove tpk or zip file on project path
+ package_list = []
+ for i, x in enumerate(source.project_list):
+ package_list.extend(list_files(os.path.join(x['path'], conf), ext='tpk'))
+ package_list.extend(list_files(os.path.join(x['path'], conf), ext='zip'))
+
+ for k in package_list :
+ print ' package list ' + k;
+ os.remove(k)
+
+ # Manual strip
+ if manual_strip == True :
+ strip_cmd='';
+ if self.arch == None:
+ raise LocalError('Architecture is Noen')
+ elif self.arch == 'x86' :
+ strip_cmd = os.path.join(os.path.dirname(self.tizen), '../../i386-linux-gnueabi-gcc-4.9/bin/i386-linux-gnueabi-strip')
+ elif self.arch == 'arm' :
+ strip_cmd = os.path.join(os.path.dirname(self.tizen), '../../arm-linux-gnueabi-gcc-4.9/bin/arm-linux-gnueabi-strip')
+
+ print strip_cmd
+
+ for i, x in enumerate(source.project_list):
+ dir = os.path.join(x['path'], conf)
+ files = [os.path.join(dir,f) for f in os.listdir(dir) if os.path.isfile(os.path.join(dir,f))]
+ for k in files:
+ cmdline = strip_cmd + ' ' + k;
+ #print 'my command line ' + cmdline;
+ Executor().run(cmdline, show=False)
+ elif conf == 'Release':
+ main_args.extend(['--strip', 'on'])
+
+ for i, x in enumerate(source.project_list):
+ if x['type'] == 'app':
+ out = '%s\n%s' % (out, \
+ self._run('package', main_args + ['--',os.path.join(x['path'],conf)]))
+ try:
+ final_app = list_files(os.path.join(x['path'], conf), ext='tpk')[0]
+ except:
+ raise LocalError('TPK file not generated for %s.' % x['APPNAME'])
+ x['out_package'] = final_app
+ elif x['type'] == 'sharedLib':
+ self._package_sharedlib(x['path'], conf, x['APPNAME'])
+ x['out_package'] = list_files(os.path.join(x['path'], conf), ext='zip')[0]
+ else:
+ raise LocalError('Not supported project type %s' % x['type'])
+
+ if source.b_multi == True:
+ extra_args=[]
+ print 'THIS IS MULTI PROJECT'
+ for i, x in enumerate(source.project_list):
+ if x['out_package'] != final_app and x['type'] == 'app':
+ extra_args.extend(['-r', x['out_package']])
+ elif x['type'] == 'sharedLib':
+ extra_args.extend(['-r', x['out_package']])
+
+ extra_args.extend(['--', final_app])
+ out = self._run('package', main_args + extra_args)
+
+ #TODO: signature validation check failed : Invalid file reference. An unsigned file was found.
+ print 'Packaging final step again!'
+ out = self._run('package', main_args + ['--', final_app])
+
+ #Copy tpk to output directory
+ if conf == 'Debug' and manual_strip == False :
+ basename = os.path.splitext(final_app)[0]
+ newname = basename +'-debug.tpk'
+ os.rename(final_app, newname)
+ shutil.copy(newname, source.output_dir)
+ else :
+ shutil.copy(final_app, source.output_dir)
+
def clean(self, source):
"""SDK CLI clean command"""
build.add_argument('-s', '--cert', action='store', dest='cert', \
help='(ex, ABS) Certificate profile name')
build.add_argument('-c', '--conf', action='store',default='Release', dest='conf', \
- help='(Debug|Release) Build configuration')
+ help='(ex, Debug|Release) Build Configuration')
build.add_argument('--sdkpath', action='store', dest='sdkpath', \
help='Specify Tizen SDK installation root (one time init).' \
' ex) /home/yours/tizen-sdk/')
my_sdk = Sdk(sdkpath=args.sdkpath)
my_sdk.clean(my_source)
my_sdk.build_native(my_source, rootstrap=args.rootstrap, arch=args.arch, conf=args.conf)
- my_sdk.package(my_source, pkg_type=args.type, cert=args.cert, conf=args.conf)
+ if args.conf == 'Debug' :
+ my_sdk.package_new(my_source, pkg_type=args.type, cert=args.cert, conf=args.conf)
+ my_sdk.package_new(my_source, pkg_type=args.type, cert=args.cert, conf=args.conf, manual_strip=True)
+ else :
+ my_sdk.package_new(my_source, pkg_type=args.type, cert=args.cert, conf=args.conf)
def main(argv):
"""Script entry point."""
+ print 'ABS SCRIPT FROM GIT'
+
args = argument_parsing(argv)
if args.subcommands == 'build':