Add clean methods to many more exporters

pull/6153/head
Jimmy Brisson 2018-02-21 09:43:19 -06:00
parent bd5b34f59c
commit ed7793de65
11 changed files with 62 additions and 2 deletions

View File

@ -16,6 +16,7 @@ limitations under the License.
""" """
import uuid import uuid
from os.path import splitext, basename, dirname from os.path import splitext, basename, dirname
from os import remove
from tools.export.exporters import Exporter, deprecated_exporter from tools.export.exporters import Exporter, deprecated_exporter
@ -83,3 +84,8 @@ class AtmelStudio(Exporter):
target = self.target.lower() target = self.target.lower()
self.gen_file('atmelstudio/atsln.tmpl', ctx, '%s.atsln' % self.project_name) self.gen_file('atmelstudio/atsln.tmpl', ctx, '%s.atsln' % self.project_name)
self.gen_file('atmelstudio/cppproj.tmpl', ctx, '%s.cppproj' % self.project_name) self.gen_file('atmelstudio/cppproj.tmpl', ctx, '%s.cppproj' % self.project_name)
@staticmethod
def clean(project_name):
remove('%s.atsln' % project_name)
remove('%s.cppproj' % project_name)

View File

@ -1,7 +1,8 @@
import re import re
from os.path import join, exists from os.path import join, exists
from os import makedirs from os import makedirs, remove
import shutil
from tools.export.makefile import Makefile, GccArm, Armc5, IAR from tools.export.makefile import Makefile, GccArm, Armc5, IAR
@ -39,6 +40,12 @@ class Eclipse(Makefile):
self.gen_file('cdt/.cproject.tmpl', ctx, '.cproject') self.gen_file('cdt/.cproject.tmpl', ctx, '.cproject')
self.gen_file('cdt/.project.tmpl', ctx, '.project') self.gen_file('cdt/.project.tmpl', ctx, '.project')
@staticmethod
def clean(project_name):
shutil.rmtree("eclipse-extras")
remove(".cproject")
remove(".project")
class EclipseGcc(Eclipse, GccArm): class EclipseGcc(Eclipse, GccArm):
LOAD_EXE = True LOAD_EXE = True

View File

@ -153,3 +153,8 @@ class CMSIS(Exporter):
'date': '' 'date': ''
} }
self.gen_file('cmsis/cpdsc.tmpl', ctx, 'project.cpdsc') self.gen_file('cmsis/cpdsc.tmpl', ctx, 'project.cpdsc')
@staticmethod
def clean(_):
os.remove('project.cpdsc')

View File

@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from os.path import splitext, basename from os.path import splitext, basename
from os import remove
from tools.export.exporters import Exporter, deprecated_exporter from tools.export.exporters import Exporter, deprecated_exporter
@ -109,3 +110,7 @@ class CoIDE(Exporter):
# Project file # Project file
self.gen_file('coide/%s.coproj.tmpl' % target, ctx, '%s.coproj' % self.project_name) self.gen_file('coide/%s.coproj.tmpl' % target, ctx, '%s.coproj' % self.project_name)
@staticmethod
def clean(project_name):
remove('%s.coproj' % project_name)

View File

@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from os import remove
from tools.export.gnuarmeclipse import GNUARMEclipse from tools.export.gnuarmeclipse import GNUARMEclipse
class E2Studio(GNUARMEclipse): class E2Studio(GNUARMEclipse):
@ -39,3 +40,8 @@ class E2Studio(GNUARMEclipse):
self.gen_file('gnuarmeclipse/.project.tmpl', jinja_ctx, '.project', trim_blocks=True, lstrip_blocks=True) self.gen_file('gnuarmeclipse/.project.tmpl', jinja_ctx, '.project', trim_blocks=True, lstrip_blocks=True)
self.gen_file_nonoverwrite('gnuarmeclipse/mbedignore.tmpl', jinja_ctx, '.mbedignore') self.gen_file_nonoverwrite('gnuarmeclipse/mbedignore.tmpl', jinja_ctx, '.mbedignore')
self.gen_file('gnuarmeclipse/makefile.targets.tmpl', jinja_ctx, 'makefile.targets', trim_blocks=True, lstrip_blocks=True) self.gen_file('gnuarmeclipse/makefile.targets.tmpl', jinja_ctx, 'makefile.targets', trim_blocks=True, lstrip_blocks=True)
@staticmethod
def clean(project_name):
remove('%s OpenOCD 5x.launch' % project_name)
remove('%s OpenOCD.launch' % project_name)

View File

@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from os.path import splitext, basename from os.path import splitext, basename
from os import remove
from tools.targets import TARGET_MAP from tools.targets import TARGET_MAP
from tools.export.exporters import Exporter, apply_supported_whitelist from tools.export.exporters import Exporter, apply_supported_whitelist
@ -87,3 +88,7 @@ class EmBitz(Exporter):
} }
self.gen_file('embitz/eix.tmpl', ctx, '%s.eix' % self.project_name) self.gen_file('embitz/eix.tmpl', ctx, '%s.eix' % self.project_name)
@staticmethod
def clean(project_name):
remove("%s.eix" % project_name)

View File

@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from os.path import splitext, basename from os.path import splitext, basename
from os import remove
from tools.export.exporters import Exporter, deprecated_exporter from tools.export.exporters import Exporter, deprecated_exporter
@ -47,3 +48,7 @@ class KDS(Exporter):
self.gen_file('kds/%s_project.tmpl' % self.target.lower(), ctx, '.project') self.gen_file('kds/%s_project.tmpl' % self.target.lower(), ctx, '.project')
self.gen_file('kds/%s_cproject.tmpl' % self.target.lower(), ctx, '.cproject') self.gen_file('kds/%s_cproject.tmpl' % self.target.lower(), ctx, '.cproject')
self.gen_file('kds/launch.tmpl', ctx, '%s.launch' % self.project_name) self.gen_file('kds/launch.tmpl', ctx, '%s.launch' % self.project_name)
@staticmethod
def clean(project_name):
remove('%s.launch' % project_name)

View File

@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from os.path import splitext, basename from os.path import splitext, basename
from os import remove
from tools.targets import TARGET_MAP from tools.targets import TARGET_MAP
from tools.export.exporters import Exporter from tools.export.exporters import Exporter
from tools.export.makefile import GccArm from tools.export.makefile import GccArm
@ -63,3 +64,8 @@ class QtCreator(GccArm):
# finally, generate the Makefile # finally, generate the Makefile
super(QtCreator, self).generate() super(QtCreator, self).generate()
@staticmethod
def clean(project_name):
for ext in ['creator', 'files', 'includes', 'config']:
remove("%s.%s" % (project_name, ext))

View File

@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
from os.path import split,splitext, basename from os.path import split,splitext, basename
from os import remove
from tools.export.exporters import Exporter, deprecated_exporter from tools.export.exporters import Exporter, deprecated_exporter
@ -194,3 +195,7 @@ class SimplicityV3(Exporter):
''' '''
self.gen_file('simplicity/slsproj.tmpl', ctx, '%s.slsproj' % self.project_name) self.gen_file('simplicity/slsproj.tmpl', ctx, '%s.slsproj' % self.project_name)
@staticmethod
def clean(project_name):
remove('%s.slsproj' % project_name)

View File

@ -16,6 +16,7 @@ limitations under the License.
""" """
from os.path import splitext, basename, join from os.path import splitext, basename, join
import shutil
from tools.utils import mkdir from tools.utils import mkdir
from tools.export.gnuarmeclipse import GNUARMEclipse from tools.export.gnuarmeclipse import GNUARMEclipse
from tools.export.gnuarmeclipse import UID from tools.export.gnuarmeclipse import UID
@ -557,3 +558,7 @@ class Sw4STM32(GNUARMEclipse):
'makefile.targets', trim_blocks=True, lstrip_blocks=True) 'makefile.targets', trim_blocks=True, lstrip_blocks=True)
self.gen_file('sw4stm32/launch.tmpl', ctx, self.project_name + self.gen_file('sw4stm32/launch.tmpl', ctx, self.project_name +
' ' + options['debug']['name'] + '.launch') ' ' + options['debug']['name'] + '.launch')
@staticmethod
def clean(_):
shutil.rmtree(".settings")

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
from os.path import join, exists, realpath, relpath, basename, isfile, splitext from os.path import join, exists, realpath, relpath, basename, isfile, splitext
from os import makedirs, listdir from os import makedirs, listdir, remove, rmdir
import json import json
from tools.export.makefile import Makefile, GccArm, Armc5, IAR from tools.export.makefile import Makefile, GccArm, Armc5, IAR
@ -83,6 +83,11 @@ class VSCode(Makefile):
with open(join(self.export_dir, '.vscode', 'c_cpp_properties.json'), 'w') as outfile: with open(join(self.export_dir, '.vscode', 'c_cpp_properties.json'), 'w') as outfile:
json.dump(cpp_props, outfile, indent=4, separators=(',', ': ')) json.dump(cpp_props, outfile, indent=4, separators=(',', ': '))
@staticmethod
def clean(_):
for f in ['launch', 'settings', 'tasts', 'c_cpp_properties']:
remove(".vscode/%s.json" % f)
rmdir(".vscode")
class VSCodeGcc(VSCode, GccArm): class VSCodeGcc(VSCode, GccArm):
LOAD_EXE = True LOAD_EXE = True