@@ -6,29 +6,34 @@ SPDX-License-Identifier: Apache-2.0
6
6
<a href =" https://github.com/fosslight/fosslight_dependency/blob/main/docs/user-guide.md " >[ Eng] </a >
7
7
</p >
8
8
9
- # User Guide
9
+ # User Guide
10
10
11
11
## Contents
12
+
12
13
- [ How to analyze the dependencies] ( #-how-to-analyze-the-dependencies )
13
14
- [ 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-gradle )
18
+ - [ Pypi] ( #pypi )
19
+ - [ Maven] ( #maven-optional )
20
+ - [ Pub] ( #pub )
21
+ - [ Cocoapods] ( #cocoapods )
20
22
- [ How to install] ( #-how-to-install )
21
23
- [ How to run] ( #-how-to-run )
22
24
- [ Result] ( #-result )
23
25
24
26
<br >
25
27
26
28
## 🧐 How to analyze the dependencies
29
+
27
30
FOSSLight Dependency는 다른 오픈소스 소프트웨어를 이용하여 여러 패키지 매니저들의 dependency 분석을 수행하고 있습니다. 그 중 다음 기준에 따라 오픈소스 소프트웨어를 선택하고 있습니다.
31
+
28
32
1 . Direct dependency뿐만 아니라 transitive dependency까지 추출 가능
29
33
2 . 오픈소스 이름, 버전, License명 추출 가능
30
34
31
35
각 패키지 매니저에 따라 이용하는 오픈소스 소프트웨어는 다음과 같습니다:
36
+
32
37
- NPM : [ NPM License Checker] ( https://github.com/davglass/license-checker )
33
38
- Pypi : [ pip-licenses] ( https://github.com/raimon49/pip-licenses )
34
39
- Gradle : [ License Gradle Plugin] ( https://github.com/hierynomus/license-gradle-plugin )
@@ -40,44 +45,83 @@ FOSSLight Dependency는 다른 오픈소스 소프트웨어를 이용하여 여
40
45
<br >
41
46
42
47
## 📋 Prerequisite
48
+
43
49
### NPM
50
+
44
51
1 . Npm dependency 분석을 수행하기 위해 NPM License Checker를 설치합니다.
52
+
45
53
```
46
54
$ npm install -g license-checker
47
55
```
56
+
48
57
2 . dependency를 설치하기 위해 다음 명령어를 실행합니다. (optional)
58
+
49
59
```
50
60
$ npm install
51
61
```
62
+
52
63
> - package.json 파일이 input directory에 존재하는 경우, 해당 명령어 실행은 FOSSLight dependency에서 자동으로 수행하므로 skip 가능합니다.
53
64
> - 이미 dependency들이 설치된 node_modules 디렉토리가 존재하는 경우, node_modules폴더가 존재하는 path를 input directory로 설정하여 실행 가능합니다.
54
65
55
66
<br >
56
67
57
68
### Gradle
69
+
58
70
1 . 'build.gradle' 파일에 License Gradle Plugin을 추가합니다.
71
+
59
72
```
60
73
plugins {
61
74
id 'com.github.hierynomus.license' version '0.15.0'
62
75
}
63
-
76
+
64
77
downloadLicenses {
65
78
includeProjectDependencies = true
66
79
dependencyConfiguration = 'runtimeClasspath'
67
80
}
68
81
```
82
+
69
83
> - 사용하는 gradle 버전이 4.6 또는 더 낮은 버전인 경우에는, dependencyConfiguration에 'runtimeClasspath' 대신 'runtime'을 추가합니다.
70
84
71
85
2 . 'downloadLicenses' task를 실행합니다.
86
+
72
87
```
73
88
$ gradle downloadLicenses
74
89
```
75
90
76
91
<br >
77
92
93
+ ### Android (gradle)
94
+
95
+ 1 . 'build.gradle' 파일에 Android License Plugin을 추가합니다.
96
+
97
+ ```
98
+ buildscript {
99
+ repositories {
100
+ jcenter()
101
+ }
102
+
103
+ dependencies {
104
+ classpath 'com.lge.android.licensetools:dependency-scanning-tool:0.4.0'
105
+ }
106
+ }
107
+
108
+ apply plugin: 'com.lge.android.licensetools'
109
+ ```
110
+
111
+ 2 . 'generateLicenseTxt' task를 실행합니다.
112
+
113
+ ```
114
+ $ gradle generateLicenseTxt
115
+ ```
116
+
117
+ <br >
118
+
78
119
### Pypi
120
+
79
121
시스템 내 전역으로 설치된 파이썬 dependency로부터 분석하고자 하는 프로젝트 dependency를 분리하기 위해 가상환경을 설정하여 이용하기를 권장합니다.
122
+
80
123
1 . 가상환경을 생성하고 활성화합니다.
124
+
81
125
```
82
126
// virtualenv example
83
127
$ virtualenv -p /usr/bin/python3.6 venv
@@ -87,7 +131,9 @@ $ source venv/bin/activate
87
131
$ conda create --name {venv name}
88
132
$ conda activate {venv name}
89
133
```
134
+
90
135
2 . 가상환경 내 분석하고자 하는 프로젝트의 dependency를 설치합니다.
136
+
91
137
```
92
138
// If you install the dependencies with requirements.txt...
93
139
$ pip install -r requirements.txt
@@ -96,8 +142,11 @@ $ pip install -r requirements.txt
96
142
<br >
97
143
98
144
### Maven (optional)
145
+
99
146
> - Maven의 경우, input directory에 pom.xml 파일이 존재하는 경우, plugin 추가 및 실행을 FOSSLight dependency 내부에서 자동으로 수행하므로 다음은 skip하셔도 됩니다.
147
+
100
148
1 . pom.xml 파일에 license-maven-plugin을 추가합니다.
149
+
101
150
```
102
151
<project>
103
152
...
@@ -124,15 +173,19 @@ $ pip install -r requirements.txt
124
173
...
125
174
</project>
126
175
```
176
+
127
177
2 . license-maven-plugin task를 실행합니다.
178
+
128
179
```
129
180
$ mvn license:aggregate-download-licenses
130
181
```
131
182
132
183
<br >
133
184
134
185
### Pub
186
+
135
187
1 . 다음 명령어를 통해 flutter_oss_licenses를 실행합니다.
188
+
136
189
```
137
190
$ flutter pub get
138
191
$ flutter pub global activate flutter_oss_licenses
@@ -142,66 +195,77 @@ $ flutter pub global run flutter_oss_licenses:generate.dart
142
195
<br >
143
196
144
197
### Cocoapods
198
+
145
199
1 . Podfile을 통해 pod package를 설치합니다.
200
+
146
201
```
147
202
$ pod install
148
203
```
149
204
150
205
<br >
151
206
152
207
## 🎉 How to install
208
+
153
209
FOSSLight Dependency는 Python3.6+ 환경에서 설치할 것을 권장합니다.
210
+
154
211
### From pip
212
+
155
213
```
156
214
$ pip install fosslight-dependency
157
215
```
216
+
158
217
### From source code
218
+
159
219
```
160
220
$ git clone https://github.com/fosslight/fosslight_dependency.git
161
221
$ cd fosslight_dependency
162
- $ python setup.py install
222
+ $ pip install .
163
223
```
164
224
165
225
<br >
166
226
167
227
## 🚀 How to run
228
+
168
229
FOSSLight Dependency는 패키지 매니저에 따라 다음 option들을 이용하여 실행할 수 있습니다.
230
+
169
231
```
170
232
$ fosslight_dependency
171
233
```
172
- | Option | Argument | Description |
173
- | ------ | ------------- | ----------- |
174
- | -m | npm, maven, gradle, pip, pub, cocoapods | (optional) <br > 프로젝트의 package manager |
175
- | -p | (path) | (optional) <br > 분석하고자 하는 input directory |
176
- | -o | (path) | (optional) <br > 결과 파일이 생성되는 output directory |
177
- | -a | conda example: 'conda activate (venv name)' | (pypi only required) <br > 가상환경 activate command |
178
- | -d | conda example: 'conda deactivate' | (pypi only required) <br > 가상환경 deactivate command |
179
- | -c | (customized output directory name) | (gradle, maven only optional) <br > 커스터마이즈한 build output directory명 (default: target) |
180
- | -v | N/A | release 버전 |
234
+
235
+ | Option | Argument | Description |
236
+ | ------ | ------------------------------------------- | -------------------------------------------------------------------------------------------- |
237
+ | -m | npm, maven, gradle, pip, pub, cocoapods | (optional) <br > 프로젝트의 package manager |
238
+ | -p | (path) | (optional) <br > 분석하고자 하는 input directory |
239
+ | -o | (path) | (optional) <br > 결과 파일이 생성되는 output directory |
240
+ | -a | conda example: 'conda activate (venv name)' | (pypi only required) <br > 가상환경 activate command |
241
+ | -d | conda example: 'conda deactivate' | (pypi only required) <br > 가상환경 deactivate command |
242
+ | -c | (customized output directory name) | (gradle, maven only optional) <br > 커스터마이즈한 build output directory명 (default: target) |
243
+ | -n | (app name) | (android only optional) <br > app directory name (default: app) |
244
+ | -v | N/A | release 버전 |
181
245
182
246
이때, FOSSLight Dependency는 패키지 매니저의 manifest 파일이 존재하는 프로젝트의 top directory에서 실행되어야 합니다.
183
247
예를 들면, NPM 패키지 매니저를 이용하는 프로젝트의 경우, input directory는 'package.json' 파일이 존재하는 directory여야 합니다.
184
248
각 패키지 매니저별 manifest 파일은 다음과 같습니다.
185
249
186
- | Package manager | Npm | Pip | Maven | Gradle | Pub | Cocoapods |
187
- | --------------- | ------------ | ---------------- | ------- | ------------ | ------------ | --------- |
188
- | Manifest file | package.json | requirements.txt | pom.xml | build.gradle | pubspec.yaml | Podfile |
250
+ | Package manager | Npm | Pip | Maven | Gradle | Pub | Cocoapods | Android |
251
+ | --------------- | ------------ | ---------------- | ------- | ------------ | ------------ | --------- | ------- |
252
+ | Manifest file | package.json | requirements.txt | pom.xml | build.gradle | pubspec.yaml | Podfile | gradlew |
189
253
190
254
즉, FOSSLight Dependency 실행 시, input directory('-p' 옵션)는 위와 같이 패키지 매니저의 manifest 파일이 존재하는 프로젝트의 top directory로 지정해 주어야 합니다.
191
-
255
+ Android 프로젝트의 실제 manifest file은 다른 gradle 프로젝트와 동일한 'build.gradle' 파일이지만, 다른 java 프로젝트와 구별하기 위해 gradlew 파일로 지정하였습니다.
192
256
<br >
193
257
194
258
## 📁 Result
259
+
195
260
FOSSLight Dependency는 xlsx(Microsoft Excel file)양식의 결과 파일을 생성합니다.
196
261
197
262
결과 파일에는 transitive dependency들을 포함한 모든 분석된 dependency들의 manifest 파일을 기반으로 OSS 정보가 기록됩니다.
198
263
이때, 고유한 OSS명을 작성하기 위해, OSS명은 (패키지 매니저):(OSS명) 또는 (group id):(artifact id) 양식으로 기록됩니다.
199
264
200
- | Package manager | OSS Name | Download Location | Homepage |
201
- | --------------- | ------------------ | ----------------- | -------- |
202
- | Npm | npm:(oss name) | 우선순위1. repository in package.json <br > 우선순위2. npmjs.com/package/(oss name)/v/(oss version) | npmjs.com/package/(oss name) |
203
- | Pip | pypi:(oss name) | pypi.org/project/(oss name)/(version) | homepage in (pip show) information |
204
- | Maven<br >& Gradle | (group_id):(artifact_id) | mvnrepository.com/artifact/(group id)/(artifact id)/(version) | mvnrepository.com/artifact/(group id)/(artifact id) |
205
- | Pub | pub:(oss name) | pub.dev/packages/(oss name)/versions/(version) | homepage in (pub information) |
206
- | Cocoapods | cocoapods:(oss name) | source in (pod spec information) | cocoapods.org/(oss name) |
207
-
265
+ | Package manager | OSS Name | Download Location | Homepage |
266
+ | ------------------------------ | ------------------------ | -------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
267
+ | Npm | npm:(oss name) | 우선순위1. repository in package.json <br > 우선순위2. npmjs.com/package/(oss name)/v/(oss version) | npmjs.com/package/(oss name) |
268
+ | Pip | pypi:(oss name) | pypi.org/project/(oss name)/(version) | homepage in (pip show) information |
269
+ | Maven<br >& Gradle<br >& Android | (group_id):(artifact_id) | mvnrepository.com/artifact/(group id)/(artifact id)/(version) | mvnrepository.com/artifact/(group id)/(artifact id) |
270
+ | Pub | pub:(oss name) | pub.dev/packages/(oss name)/versions/(version) | homepage in (pub information) |
271
+ | Cocoapods | cocoapods:(oss name) | source in (pod spec information) | cocoapods.org/(oss name) |
0 commit comments