Skip to content

Commit fde7545

Browse files
committed
[GR-41030] Clean output dir in GraalpythonCAPIBuildTask.
PullRequest: graalpython/2441
2 parents d8aa2ce + e252c02 commit fde7545

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,6 +2037,13 @@ def src_dir(self):
20372037
def newestOutput(self):
20382038
return None
20392039

2040+
def needsBuild(self, newestInput):
2041+
if self.args.force:
2042+
return True, 'forced build'
2043+
if not os.path.exists(self.subject.get_output_root()):
2044+
return True, 'inexisting output dir'
2045+
return False, 'unimplemented'
2046+
20402047
def clean(self, forBuild=False):
20412048
if forBuild == "reallyForBuild":
20422049
try:
@@ -2086,8 +2093,12 @@ def clean(self, forBuild=False):
20862093
result = 0
20872094
if not forBuild:
20882095
try:
2089-
shutil.rmtree(self._dev_headers_dir())
2090-
except BaseException:
2096+
mx.logv('Cleaning {0}...'.format(self._dev_headers_dir()))
2097+
shutil.rmtree(self._dev_headers_dir(), ignore_errors=True)
2098+
mx.logv('Cleaning {0}...'.format(self.subject.get_output_root()))
2099+
shutil.rmtree(self.subject.get_output_root(), ignore_errors=True)
2100+
except BaseException as e:
2101+
mx.logv('Error while cleaning: {0}'.format(e))
20912102
result = 1
20922103
return max(result, super().clean(forBuild=forBuild))
20932104

0 commit comments

Comments
 (0)