Skip to content

Commit f9660f6

Browse files
authored
Merge pull request #47 from fosslight/develop
Fix the gradle license parsing error
2 parents f4aac89 + b235251 commit f9660f6

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

src/fosslight_dependency/_help.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,34 @@
77
_HELP_MESSAGE_DEPENDENCY = """
88
Usage: fosslight_dependency [option1] <arg1> [option2] <arg2>...
99
10-
FOSSLight Dependency utilizes the open source software for analyzing each package manager dependencies.
11-
We choose the open source software for each package manager that shows not only the direct dependencies
12-
but also the transitive dependencies including the information of dependencies such as oss name, oss version and license name.
13-
14-
Each package manager uses the results of the following software:
15-
NPM : NPM License Checker
16-
Pypi : Pip-licenses
17-
Gradle : License Gradle Plugin
18-
Maven : License-maven-plugin
19-
Pub : Flutter_oss_licenses
20-
Android : android-dependency-scanning
10+
FOSSLight Dependency Scanner is the tool that supports the analysis of dependencies for multiple package managers.
11+
It detects the manifest file of package managers automatically and analyzes the dependencies with using open source tools.
12+
Then, it generates the report file that contains OSS information of dependencies.
13+
14+
Currently, it supports the following package managers:
15+
Gradle (Java)
16+
Maven (Java)
17+
NPM (Node.js)
18+
PIP (Python)
19+
Pub (Dart with flutter)
20+
Cocoapods (Swift/Obj-C)
21+
Swift (Swift)
2122
2223
Options:
2324
Optional
2425
-h\t\t\t\t Print help message.
2526
-v\t\t\t\t Print the version of the script.
26-
-m <package_manager>\t Enter the package manager(npm, maven, gradle, pip, pub, cocoapods, android).
27+
-m <package_manager>\t Enter the package manager(npm, maven, gradle, pip, pub, cocoapods, android, swift).
2728
-p <input_path>\t\t Enter the path where the script will be run.
2829
-o <output_path>\t\t Enter the path where the result file will be generated.
2930
3031
Required only for pypi
3132
-a <activate_cmd>\t\t Virtual environment activate command(ex, 'conda activate (venv name)')
3233
-d <deactivate_cmd>\t\t Virtual environment deactivate command(ex, 'conda deactivate')
3334
35+
Required only for swift
36+
-t <token>\t\t Enter the github personal access token.
37+
3438
Optional only for gradle, maven
3539
-c <dir_name>\t\t Enter the customized build output directory name
3640
\t\t-Default name : 'build' for gradle, 'target' for maven

src/fosslight_dependency/analyze_dependency.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -761,9 +761,13 @@ def parse_and_generate_output_gradle(input_fp):
761761
oss_version = version_refine(oss_ini_version)
762762

763763
license_names = []
764-
for licenses in d['licenses']:
765-
license_names.append(licenses['name'].replace(",", ""))
766-
license_name = ', '.join(license_names)
764+
try:
765+
for licenses in d['licenses']:
766+
if licenses['name'] != '':
767+
license_names.append(licenses['name'].replace(",", ""))
768+
license_name = ', '.join(license_names)
769+
except Exception:
770+
logger.info("Cannot find the license name")
767771

768772
if used_filename == "true" or group_id == "":
769773
dn_loc = 'Unknown'

0 commit comments

Comments
 (0)