if sys.version_info > (3, 0): print'Freeline only support Python 2.7+ now. Please use the correct version of Python for freeline.'exit()
parser = get_parser()
args = parser.parse_args()
freeline = Freeline()
freeline.call(args=args)
if 'cleanBuild' in args and args.cleanBuild:
is_build_all_projects = args.all wait_for_debugger = args.wait
self._setup_clean_build_command(is_build_all_projects, wait_for_debugger) elif 'version' in args and args.version:
version() elif 'clean' in args and args.clean:
self._command = CleanAllCacheCommand(self._config['build_cache_dir']) else:
from freeline_build import FreelineBuildCommand
self._command = FreelineBuildCommand(self._config, task_engine=self._task_engine)
if self._dispatch_policy.is_need_clean_build( self._config, file_changed_dict): self._setup_clean_builder(file_changed_dict)
from build_commands import CleanBuildCommand self._build_command = CleanBuildCommand(self._builder) else: # only flush changed list when your project need a incremental build.
Logger.debug('file changed list:')
Logger.debug(file_changed_dict) self._setup_inc_builder(file_changed_dict)
from build_commands import IncrementalBuildCommand self._build_command = IncrementalBuildCommand(self._builder) self._build_command.execute()
if last_apk_build_time == 0: Logger.debug('final apk not found, need a clean build.' return True
if file_changed_dict['build_info']['is_root_config_changed']: Logger.debug('find root build.gradle changed, need a clean build.') return True
file_count = 0 need_clean_build_projects = set()
for dir_name, bundle_dict in file_changed_dict['projects'].iteritems(): count = len(bundle_dict['src']) Logger.debug('find {} has {} java files modified.'.format(dir_name, count)) file_count += count
if len(bundle_dict['config']) > 0 or len(bundle_dict['manifest']) > 0: need_clean_build_projects.add(dir_name) Logger.debug('find {} has build.gradle or manifest file modified.'.format(dir_name))
is_need_clean_build = file_count > 20 or len(need_clean_build_projects) > 0
if is_need_clean_build: if file_count > 20: Logger.debug( 'project has {}(>20) java files modified so that it need a clean build.'.format(file_count)) else: Logger.debug('project need a clean build.') else: Logger.debug('project just need a incremental build.')