Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
run.api.SkiaStepApi Class Reference
Inheritance diagram for run.api.SkiaStepApi:

Public Member Functions

 __init__ (self, *args, **kwargs)
 
 check_failure (self)
 
 failed_steps (self)
 
 run_once (self, fn, *args, **kwargs)
 
 readfile (self, filename, *args, **kwargs)
 
 writefile (self, filename, contents)
 
 rmtree (self, path)
 
 asset_version (self, asset_name, skia_dir, test_data=None)
 
 __call__ (self, steptype, name, abort_on_failure=True, fail_build_on_failure=True, **kwargs)
 
 with_retry (self, steptype, name, attempts, between_attempts_fn=None, abort_on_failure=True, fail_build_on_failure=True, **kwargs)
 

Protected Attributes

 _already_ran
 
 _ccache
 
 _checked_for_ccache
 
 _failed
 

Detailed Description

Definition at line 14 of file api.py.

Constructor & Destructor Documentation

◆ __init__()

run.api.SkiaStepApi.__init__ (   self,
args,
**  kwargs 
)
Initialize the recipe module.

Definition at line 16 of file api.py.

16 def __init__(self, *args, **kwargs):
17 """Initialize the recipe module."""
18 super(SkiaStepApi, self).__init__(*args, **kwargs)
19
20 self._already_ran = {}
21 self._ccache = None
22 self._checked_for_ccache = False
23 self._failed = []
24

Member Function Documentation

◆ __call__()

run.api.SkiaStepApi.__call__ (   self,
  steptype,
  name,
  abort_on_failure = True,
  fail_build_on_failure = True,
**  kwargs 
)
Run a step. If it fails, keep going but mark the build status failed.

Definition at line 69 of file api.py.

70 fail_build_on_failure=True, **kwargs):
71 """Run a step. If it fails, keep going but mark the build status failed."""
72 try:
73 with self.m.env(self.m.vars.default_env):
74 return steptype(name=name, **kwargs)
75 except self.m.step.StepFailure as e:
76 if fail_build_on_failure:
77 self._failed.append(e)
78 if abort_on_failure:
79 raise
80
static void append(char **dst, size_t *count, const char *src, size_t n)
Definition editor.cpp:211
Definition __init__.py:1

◆ asset_version()

run.api.SkiaStepApi.asset_version (   self,
  asset_name,
  skia_dir,
  test_data = None 
)
Return the contents of VERSION for the given asset as a string.

If test_data is not specified, reads the property
'test_<asset_name>_version' or if not present, uses
TEST_DEFAULT_ASSET_VERSION.

Definition at line 54 of file api.py.

54 def asset_version(self, asset_name, skia_dir, test_data=None):
55 """Return the contents of VERSION for the given asset as a string.
56
57 If test_data is not specified, reads the property
58 'test_<asset_name>_version' or if not present, uses
59 TEST_DEFAULT_ASSET_VERSION."""
60 version_file = skia_dir.join(
61 'infra', 'bots', 'assets', asset_name, 'VERSION')
62 if not test_data:
63 test_data = self.m.properties.get(
64 'test_%s_version' % asset_name, TEST_DEFAULT_ASSET_VERSION)
65 return self.m.file.read_text('Get %s VERSION' % asset_name,
66 version_file,
67 test_data=test_data).rstrip()
68

◆ check_failure()

run.api.SkiaStepApi.check_failure (   self)
Raise an exception if any step failed.

Definition at line 25 of file api.py.

25 def check_failure(self):
26 """Raise an exception if any step failed."""
27 if self._failed:
28 raise self.m.step.StepFailure('Failed build steps: %s' %
29 ', '.join([f.name for f in self._failed]))
30

◆ failed_steps()

run.api.SkiaStepApi.failed_steps (   self)

Definition at line 32 of file api.py.

32 def failed_steps(self):
33 return self._failed[:]
34

◆ readfile()

run.api.SkiaStepApi.readfile (   self,
  filename,
args,
**  kwargs 
)
Convenience function for reading files.

Definition at line 40 of file api.py.

40 def readfile(self, filename, *args, **kwargs):
41 """Convenience function for reading files."""
42 name = kwargs.pop('name', 'read %s' % self.m.path.basename(filename))
43 return self.m.file.read_text(name, filename, *args, **kwargs)
44

◆ rmtree()

run.api.SkiaStepApi.rmtree (   self,
  path 
)
Wrapper around api.file.rmtree.

Definition at line 50 of file api.py.

50 def rmtree(self, path):
51 """Wrapper around api.file.rmtree."""
52 self.m.file.rmtree('rmtree %s' % self.m.path.basename(path), path)
53

◆ run_once()

run.api.SkiaStepApi.run_once (   self,
  fn,
args,
**  kwargs 
)

Definition at line 35 of file api.py.

35 def run_once(self, fn, *args, **kwargs):
36 if not fn.__name__ in self._already_ran:
37 self._already_ran[fn.__name__] = fn(*args, **kwargs)
38 return self._already_ran[fn.__name__]
39

◆ with_retry()

run.api.SkiaStepApi.with_retry (   self,
  steptype,
  name,
  attempts,
  between_attempts_fn = None,
  abort_on_failure = True,
  fail_build_on_failure = True,
**  kwargs 
)

Definition at line 81 of file api.py.

82 abort_on_failure=True, fail_build_on_failure=True, **kwargs):
83 for attempt in range(attempts):
84 step_name = name
85 if attempt > 0:
86 step_name += ' (attempt %d)' % (attempt + 1)
87 try:
88 res = self(steptype, name=step_name, abort_on_failure=True,
89 fail_build_on_failure=fail_build_on_failure, **kwargs)
90 if attempt > 0 and fail_build_on_failure:
91 del self._failed[-attempt:]
92 return res
93 except self.m.step.StepFailure:
94 if between_attempts_fn:
95 between_attempts_fn(attempt+1)
96 if (attempt == attempts - 1) and abort_on_failure:
97 raise

◆ writefile()

run.api.SkiaStepApi.writefile (   self,
  filename,
  contents 
)
Convenience function for writing files.

Definition at line 45 of file api.py.

45 def writefile(self, filename, contents):
46 """Convenience function for writing files."""
47 return self.m.file.write_text('write %s' % self.m.path.basename(filename),
48 filename, contents)
49

Member Data Documentation

◆ _already_ran

run.api.SkiaStepApi._already_ran
protected

Definition at line 20 of file api.py.

◆ _ccache

run.api.SkiaStepApi._ccache
protected

Definition at line 21 of file api.py.

◆ _checked_for_ccache

run.api.SkiaStepApi._checked_for_ccache
protected

Definition at line 22 of file api.py.

◆ _failed

run.api.SkiaStepApi._failed
protected

Definition at line 23 of file api.py.


The documentation for this class was generated from the following file: