Esempio n. 1
0
 def compile(self, override_config: ConfigFile or None = None) -> bool:
     if self.retry == 0:
         return False
     if super().compile(override_config):
         if not self.check_output():  # compilation was success but some files were not compiled
             warning('Retry compilation for ' + self.project_name)
             self._retry -= 1
             run_cmd(['make', 'clean'], self.project_name, self.root_path, output=None)
             return self.compile(override_config=override_config)
         return True
     return False
Esempio n. 2
0
 def __do_compile(self,
                  files: dict,
                  override: ConfigFile or None = None,
                  output=None) -> bool:
     cmd = self.__compose_compiler_call(files, output, override)
     env_vars = self.__set_env_vars()
     return run_cmd(cmd, self.project_name, self.root_path, env_vars)
Esempio n. 3
0
 def compile(self,
             override_config: ConfigFile or None = None,
             params: list or None = None,
             erts: str or None = None) -> bool:
     ensure_dir(join(self.package.path, 'rel'))
     ensure_empty(join(self.package.path, '_rel'))
     resave_relconf, relconf_path, relconf = self.__modify_resource(
         'relx.config')
     resave_vmargs, vmargs_path, vmargs = self.__modify_resource(
         'vm.args', 'rel')
     resave_sysconf, sysconf_path, sysconf = self.__modify_resource(
         'sys.config', 'rel')
     env_vars = dict(os.environ)
     if params is not None:
         cmd = [self.executable] + params
     else:
         cmd = self.executable
     if erts is not None:
         env_vars = RelxCompiler.__add_path(env_vars, erts)
     try:
         return run_cmd(cmd,
                        self.project_name,
                        self.root_path,
                        env_vars=env_vars,
                        output=None)
     finally:  # Return previous file values, if were changed.
         if resave_vmargs:
             write_file(vmargs_path, vmargs)
         if resave_relconf:
             write_file(relconf_path, relconf)
         if resave_sysconf:
             write_file(sysconf_path, sysconf)
Esempio n. 4
0
 def __do_common_test(self, log_dir: str) -> bool:
     cmd = self.__compose_ct_call(log_dir)
     env_vars = self.__set_env_vars()
     return run_cmd(cmd,
                    self.project_name,
                    self.root_path,
                    env_vars,
                    output=None)
Esempio n. 5
0
 def __do_unit_test(
         self, modules: list, test_dirs: list
 ) -> bool:  # TODO make nice output and tests result sum
     cmd = self.__compose_unit_call(modules, test_dirs)
     return run_cmd(cmd,
                    self.project_name,
                    self.root_path,
                    shell=True,
                    output=None)
Esempio n. 6
0
 def __run_test(self, test: str):
     return run_cmd([self.executable, test], self.project_name, self.root_path)
Esempio n. 7
0
 def common(self, log_dir: str) -> bool:  # TODO log_dir
     return run_cmd([self.executable, 'ct'], self.project_name,
                    self.root_path)
Esempio n. 8
0
 def unit(self) -> bool:
     return run_cmd([self.executable, 'eunit'], self.project_name,
                    self.root_path)
Esempio n. 9
0
 def compile(self, override_config: ConfigFile or None = None):
     # self as ensure_tool in builder
     info('Rebar build ' + self.project_name)
     return run_cmd([self.executable, 'compile'], self.project_name,
                    self.root_path)
Esempio n. 10
0
 def compile(self, override_config: ConfigFile or None = None) -> bool:
     ensure_dir(self.output_path)
     ensure_makefile(self.src_path)
     env_vars = self.__get_env_vars(override_config)
     return run_cmd([self.executable, '-C', 'c_src'], self.project_name,
                    self.root_path, env_vars)