-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CM-41217 - Implement SBT restore support for SCA (#259)
- Loading branch information
Showing
8 changed files
with
80 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
25 changes: 25 additions & 0 deletions
25
cycode/cli/files_collector/sca/sbt/restore_sbt_dependencies.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
from typing import List, Optional | ||
|
||
from cycode.cli.files_collector.sca.base_restore_dependencies import BaseRestoreDependencies | ||
from cycode.cli.models import Document | ||
|
||
SBT_PROJECT_FILE_EXTENSIONS = ['sbt'] | ||
SBT_LOCK_FILE_NAME = 'build.sbt.lock' | ||
|
||
|
||
class RestoreSbtDependencies(BaseRestoreDependencies): | ||
def is_project(self, document: Document) -> bool: | ||
return any(document.path.endswith(ext) for ext in SBT_PROJECT_FILE_EXTENSIONS) | ||
|
||
def get_command(self, manifest_file_path: str) -> List[str]: | ||
return ['sbt', 'dependencyLockWrite', '--verbose'] | ||
|
||
def get_lock_file_name(self) -> str: | ||
return SBT_LOCK_FILE_NAME | ||
|
||
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool: | ||
return os.path.isfile(restore_file_path) | ||
|
||
def get_working_directory(self, document: Document) -> Optional[str]: | ||
return os.path.dirname(document.absolute_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters