File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66from pre_commit .languages import python
77from pre_commit .languages import ruby
88from pre_commit .languages import script
9+ from pre_commit .languages import swift
910from pre_commit .languages import system
1011
1112# A language implements the following constant and two functions in its module:
4748 'python' : python ,
4849 'ruby' : ruby ,
4950 'script' : script ,
51+ 'swift' : swift ,
5052 'system' : system ,
5153}
5254
Original file line number Diff line number Diff line change 1+ from __future__ import unicode_literals
2+
3+ from pre_commit .languages import helpers
4+ from pre_commit .util import clean_path_on_failure
5+ from pre_commit .util import cwd
6+ from pre_commit .languages import helpers
7+ from pre_commit .xargs import xargs
8+
9+ ENVIRONMENT_DIR = None
10+ BUILD_DIR = '.build'
11+ BUILD_CONFIG = 'release'
12+
13+ def install_environment (
14+ repo_cmd_runner ,
15+ version = 'default' ,
16+ additional_dependencies = (),
17+ ):
18+ # Build the swift package
19+ with clean_path_on_failure (repo_cmd_runner .path (BUILD_DIR )):
20+ repo_cmd_runner .run ((
21+ 'swift' , 'build' ,
22+ '-C' , '{prefix}' ,
23+ '-c' , BUILD_CONFIG ,
24+ '--build-path' , repo_cmd_runner .path (BUILD_DIR ),
25+ ))
26+
27+ def run_hook (repo_cmd_runner , hook , file_args ):
28+ with (cwd (repo_cmd_runner .path (BUILD_DIR , BUILD_CONFIG ))):
29+ return xargs (helpers .to_cmd (hook ), file_args )
You can’t perform that action at this time.
0 commit comments