Skip to content

Commit f06fc76

Browse files
authored
Merge pull request #21 from fosslight/develop
add android dependency scanning
2 parents 58b5ce2 + af11596 commit f06fc76

File tree

5 files changed

+155
-44
lines changed

5 files changed

+155
-44
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,30 @@
22
Copyright (c) 2021 LG Electronics
33
SPDX-License-Identifier: Apache-2.0
44
-->
5-
# FOSSLight Dependency
65

7-
<img src="https://img.shields.io/pypi/l/fosslight_dependency" alt="License" /> <img src="https://img.shields.io/pypi/v/fosslight_dependency" alt="Current python package version." /> <img src="https://img.shields.io/pypi/pyversions/fosslight_dependency" /> [![REUSE status](https://api.reuse.software/badge/github.com/fosslight/fosslight_dependency)](https://api.reuse.software/info/github.com/fosslight/fosslight_dependency)
6+
# FOSSLight Dependency
87

8+
<img src="https://img.shields.io/pypi/l/fosslight_dependency" alt="License" /> <img src="https://img.shields.io/pypi/v/fosslight_dependency" alt="Current python package version." /> <img src="https://img.shields.io/pypi/pyversions/fosslight_dependency" /> [![REUSE status](https://api.reuse.software/badge/github.com/fosslight/fosslight_dependency)](https://api.reuse.software/info/github.com/fosslight/fosslight_dependency)
99

1010
## 💡 Introduction
11+
1112
This is the tool that supports the analysis of dependencies for multiple package managers. It detects the manifest file of package managers automatically and analyzes the dependencies with using open source tools. Then, it generates the report file that contains OSS information of dependencies.
1213

1314
Currently, it supports the following package managers.
14-
* [Gradle](https://gradle.org/) (Java)
15-
* [Maven](http://maven.apache.org/) (Java)
16-
* [NPM](https://www.npmjs.com/) (Node.js)
17-
* [PIP](https://pip.pypa.io/) (Python)
18-
* [Pub](https://pub.dev/) (Dart with flutter)
19-
* [Cocoapods](https://cocoapods.org/) (Swift/Obj-C)
2015

16+
- [Gradle](https://gradle.org/) (Java)
17+
- [Maven](http://maven.apache.org/) (Java)
18+
- [NPM](https://www.npmjs.com/) (Node.js)
19+
- [PIP](https://pip.pypa.io/) (Python)
20+
- [Pub](https://pub.dev/) (Dart with flutter)
21+
- [Cocoapods](https://cocoapods.org/) (Swift/Obj-C)
2122

2223
## 📖 User Guide
23-
Please see the [**User Guide**](https://github.com/fosslight/fosslight_dependency/blob/main/docs/user-guide.md) for more information on how to install and run it.
2424

25+
Please see the [**User Guide**](https://github.com/fosslight/fosslight_dependency/blob/main/docs/user-guide.md) for more information on how to install and run it.
2526

2627
## 👏 Contributing Guide
28+
2729
We always welcome your contributions.
2830
Please see the [CONTRIBUTING guide](https://github.com/fosslight/fosslight_dependency/blob/main/CONTRIBUTING.md) for how to contribute.
2931

docs/user-guide.md

Lines changed: 92 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,31 @@ SPDX-License-Identifier: Apache-2.0
66
<a href="https://github.com/fosslight/fosslight_dependency/blob/main/docs/user-guide_Kor.md">[Kor]</a>
77
</p>
88

9-
# User Guide
9+
# User Guide
1010

1111
## Contents
12+
1213
- [How to analyze the dependencies](#-how-to-analyze-the-dependencies)
1314
- [Prerequisite](#-prerequisite)
14-
- [NPM](#npm)
15-
- [Gradle](#gradle)
16-
- [Pypi](#pypi)
17-
- [Maven](#maven-optional)
18-
- [Pub](#pub)
19-
- [Cocoapods](#cocoapods)
15+
- [NPM](#npm)
16+
- [Gradle](#gradle)
17+
- [Gradle - Android](#Android)
18+
- [Pypi](#pypi)
19+
- [Maven](#maven-optional)
20+
- [Pub](#pub)
21+
- [Cocoapods](#cocoapods)
2022
- [How to install](#-how-to-install)
2123
- [How to run](#-how-to-run)
2224
- [Result](#-result)
2325

2426
<br>
2527

2628
## 🧐 How to analyze the dependencies
29+
2730
FOSSLight Dependency utilizes the open source software for analyzing each package manager dependencies. We choose the open source software for each package manager that shows not only the direct dependencies but also the transitive dependencies including the information of dependencies such as oss name, oss version and license name.
2831

2932
Each package manager uses the results of the following software:
33+
3034
- NPM : [NPM License Checker](https://github.com/davglass/license-checker)
3135
- Pypi : [pip-licenses](https://github.com/raimon49/pip-licenses)
3236
- Gradle : [License Gradle Plugin](https://github.com/hierynomus/license-gradle-plugin)
@@ -38,44 +42,83 @@ Because we utilizes the different open source software to analyze the dependenci
3842
<br>
3943

4044
## 📋 Prerequisite
45+
4146
### NPM
47+
4248
1. Install the NPM License Checker to ananlyze the npm dependencies.
49+
4350
```
4451
$ npm install -g license-checker
4552
```
53+
4654
2. Run the command to install the dependencies. (optional)
55+
4756
```
4857
$ npm install
4958
```
59+
5060
> - If the 'package.json' file exists in the input directory, it will be executed automatically by FOSSLight Dependency. So you can skip it.
5161
> - If the 'node_modules' directory already exists, you can run FOSSLight dependency by setting the input directory to the path where node_modules is located.
5262
5363
<br>
5464

5565
### Gradle
66+
5667
1. Add the License Gradle Plugin in build.gradle file.
68+
5769
```
5870
plugins {
5971
id 'com.github.hierynomus.license' version '0.15.0'
6072
}
61-
73+
6274
downloadLicenses {
6375
includeProjectDependencies = true
6476
dependencyConfiguration = 'runtimeClasspath'
6577
}
6678
```
79+
6780
> - If the gradle version is 4.6 or lower, then add the 'runtime' instead of 'runtimeClasspath' in the dependencyConfiguration.
6881
6982
2. Run the 'downloadLicenses' task.
83+
7084
```
7185
$ gradle downloadLicenses
7286
```
7387

7488
<br>
7589

90+
### Android (gradle)
91+
92+
1. Add the Android License Plugin in build.gradle file.
93+
94+
```
95+
buildscript {
96+
repositories {
97+
jcenter()
98+
}
99+
100+
dependencies {
101+
classpath 'com.lge.android.licensetools:dependency-scanning-tool:0.4.0'
102+
}
103+
}
104+
105+
apply plugin: 'com.lge.android.licensetools'
106+
```
107+
108+
2. Run the 'generateLicenseTxt' task.
109+
110+
```
111+
$ gradle generateLicenseTxt
112+
```
113+
114+
<br>
115+
76116
### Pypi
117+
77118
You can run this tool with virtual environment for separating the project dependencies from system global dependencies.
119+
78120
1. Create and activate the virtual environment
121+
79122
```
80123
// virtualenv example
81124
$ virtualenv -p /usr/bin/python3.6 venv
@@ -85,7 +128,9 @@ $ source venv/bin/activate
85128
$ conda create --name {venv name}
86129
$ conda activate {venv name}
87130
```
131+
88132
2. Install the dependencies in the virtual environment.
133+
89134
```
90135
// If you install the dependencies with requirements.txt...
91136
$ pip install -r requirements.txt
@@ -94,8 +139,11 @@ $ pip install -r requirements.txt
94139
<br>
95140

96141
### Maven (optional)
142+
97143
> - If the 'pom.xml' is located in the input directory, FOSSLight dependency will automatically add and execute the license-maven-plugin. So you can skip the prerequisites below.
144+
98145
1. Add the license-maven-plugin into pom.xml file.
146+
99147
```
100148
<project>
101149
...
@@ -122,15 +170,19 @@ $ pip install -r requirements.txt
122170
...
123171
</project>
124172
```
173+
125174
2. Run the license-maven-plugin task.
175+
126176
```
127177
$ mvn license:aggregate-download-licenses
128178
```
129179

130180
<br>
131181

132182
### Pub
183+
133184
1. Run the flutter_oss_licenses.
185+
134186
```
135187
$ flutter pub get
136188
$ flutter pub global activate flutter_oss_licenses
@@ -140,20 +192,27 @@ $ flutter pub global run flutter_oss_licenses:generate.dart
140192
<br>
141193

142194
### Cocoapods
195+
143196
1. Install the pod package through Podfile.
197+
144198
```
145199
$ pod install
146200
```
147201

148202
<br>
149203

150204
## 🎉 How to install
205+
151206
It is recommended to install in Python3.6+.
207+
152208
### From pip
209+
153210
```
154211
$ pip install fosslight-dependency
155212
```
213+
156214
### From source code
215+
157216
```
158217
$ git clone https://github.com/fosslight/fosslight_dependency.git
159218
$ cd fosslight_dependency
@@ -163,44 +222,48 @@ $ python setup.py install
163222
<br>
164223

165224
## 🚀 How to run
225+
166226
You can run the FOSSLight Dependency with options based on your package manager.
227+
167228
```
168229
$ fosslight_dependency
169230
```
170-
| Option | Argument | Description |
171-
| ------ | ------------- | ----------- |
172-
| -m | npm, maven, gradle, pip, pub, cocoapods | (optional) <br> package manager for your project |
173-
| -p | (path) |(optional) <br> input directory |
174-
| -o | (path) |(optional) <br> output file directory |
175-
| -a | conda example: 'conda activate (venv name)' |(pypi only required) <br> virtual environment activate command |
176-
| -d | conda example: 'conda deactivate' |(pypi only required) <br> virtual environment deactivate command |
177-
| -c | (customized output directory name) |(gradle, maven only optional) <br> customized build output directory name (default: target) |
178-
| -v | N/A | release version |
231+
232+
| Option | Argument | Description |
233+
| ------ | ------------------------------------------------ | ------------------------------------------------------------------------------------------- |
234+
| -m | npm, maven, gradle, pip, pub, cocoapods, android | (optional) <br> package manager for your project |
235+
| -p | (path) | (optional) <br> input directory |
236+
| -o | (path) | (optional) <br> output file directory |
237+
| -a | conda example: 'conda activate (venv name)' | (pypi only required) <br> virtual environment activate command |
238+
| -d | conda example: 'conda deactivate' | (pypi only required) <br> virtual environment deactivate command |
239+
| -c | (customized output directory name) | (gradle, maven only optional) <br> customized build output directory name (default: target) |
240+
| -n | (app name) | (android only optional) <br> app directory name (default: app) |
241+
| -v | N/A | release version |
179242

180243
Note that input directory should be the top directory of the project where the manifest file of the package manager is located.
181244
For example, if your project uses the NPM package manager, then the input directory should be the path where 'package.json' file is located.
182245
The manifest file of each package manager is as follows:
183246

184-
185-
| Package manager | Npm | Pip | Maven | Gradle | Pub | Cocoapods |
186-
| --------------- | ------------ | ---------------- | ------- | ------------ | ------------ | --------- |
187-
| Manifest file | package.json | requirements.txt | pom.xml | build.gradle | pubspec.yaml | Podfile |
247+
| Package manager | Npm | Pip | Maven | Gradle | Pub | Cocoapods | Android |
248+
| --------------- | ------------ | ---------------- | ------- | ------------ | ------------ | --------- | ------- |
249+
| Manifest file | package.json | requirements.txt | pom.xml | build.gradle | pubspec.yaml | Podfile | gradlew |
188250

189251
In other words, the input directory('-p' option) should be designated as the top directory of the project where the package manager's manifest file exists as above.
252+
The manifest file of android project is 'build.gradle' as same as the gradle project. But for differenciating with other java projects, it checks 'gradlew' files.
190253

191254
<br>
192255

193256
## 📁 Result
257+
194258
FOSSLight Dependency creates the result file that has xlsx extension (Microsoft Excel file).
195259

196260
It prints the OSS information based on manifest file(package.json, pom.xml) of dependencies (including transitive dependenices).
197261
For a unique OSS name, OSS name is printed such as (package_manager):(oss name) or (group id):(artifact id).
198262

199-
| Package manager | OSS Name | Download Location | Homepage |
200-
| --------------- | ------------------ | ----------------- | -------- |
201-
| Npm | npm:(oss name) | Priority1. repository in package.json <br> Priority2. npmjs.com/package/(oss name)/v/(oss version) | npmjs.com/package/(oss name) |
202-
| Pip | pypi:(oss name) | pypi.org/project/(oss name)/(version) | homepage in (pip show) information |
203-
| Maven<br>& Gradle | (group_id):(artifact_id) | mvnrepository.com/artifact/(group id)/(artifact id)/(version) | mvnrepository.com/artifact/(group id)/(artifact id) |
204-
| Pub | pub:(oss name) | pub.dev/packages/(oss name)/versions/(version) | homepage in (pub information) |
205-
| Cocoapods | cocoapods:(oss name) | source in (pod spec information) | cocoapods.org/(oss name) |
206-
263+
| Package manager | OSS Name | Download Location | Homepage |
264+
| ------------------------------ | ------------------------ | -------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
265+
| Npm | npm:(oss name) | Priority1. repository in package.json <br> Priority2. npmjs.com/package/(oss name)/v/(oss version) | npmjs.com/package/(oss name) |
266+
| Pip | pypi:(oss name) | pypi.org/project/(oss name)/(version) | homepage in (pip show) information |
267+
| Maven<br>& Gradle<br>& Android | (group_id):(artifact_id) | mvnrepository.com/artifact/(group id)/(artifact id)/(version) | mvnrepository.com/artifact/(group id)/(artifact id) |
268+
| Pub | pub:(oss name) | pub.dev/packages/(oss name)/versions/(version) | homepage in (pub information) |
269+
| Cocoapods | cocoapods:(oss name) | source in (pod spec information) | cocoapods.org/(oss name) |

src/fosslight_dependency/_help.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
Optional
2323
-h\t\t\t\t Print help message.
2424
-v\t\t\t\t Print the version of the script.
25-
-m <package_manager>\t Enther the package manager(npm, maven, gradle, pip, pub, cocoapods).
25+
-m <package_manager>\t Enther the package manager(npm, maven, gradle, pip, pub, cocoapods, android).
2626
-p <input_path>\t\t Enter the path where the script will be run.
2727
-o <output_path>\t\t Enter the path where the result file will be generated.
2828
@@ -32,6 +32,9 @@
3232
3333
Optional only for gradle, maven
3434
-c <dir_name>\t\t Enter the customized build output directory name(default: target)
35+
36+
Optional only for android
37+
-n <app_name>\t\t Enter the application directory name where the plugin output file is located(default: app)
3538
"""
3639

3740

src/fosslight_dependency/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# -*- coding: utf-8 -*-
33
# Copyright (c) 2021 LG Electronics Inc.
44
# SPDX-License-Identifier: Apache-2.0
5-
__version__ = "3.1.0"
5+
__version__ = "3.2.0"

0 commit comments

Comments
 (0)