Skip to content

Commit

Permalink
apache: how to add 3rd-party dependency in project (#263)
Browse files Browse the repository at this point in the history
* Update contribute.md

---------

Co-authored-by: imbajin <[email protected]>
  • Loading branch information
simon824 and imbajin authored Jun 26, 2023
1 parent 625437b commit d62608a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions content/cn/docs/contribution-guidelines/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ mvn test -Pcore-test,memory
```
Note: In order to be consistent with the code style easily, if you use [IDEA](https://www.jetbrains.com/idea/) as your IDE, you can directly [import](https://www.jetbrains.com/help/idea/configuring-code-style.html) our code style [configuration file](./hugegraph-style.xml).

##### 3.2.1 添加第三方依赖

如果我们要在 `HugeGraph` 项目中添加新的第三方依赖, 我们需要做下面的几件事情:
1. 找到第三方依赖的仓库,将依赖的 `license` 文件放到 [./hugegraph-dist/release-docs/licenses/](https://github.com/apache/incubator-hugegraph/tree/master/hugegraph-dist/release-docs/licenses) 路径下。
2.[./hugegraph-dist/release-docs/LICENSE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/release-docs/LICENSE) 中声明该依赖的 `LICENSE` 信息。
3. 找到仓库里的 NOTICE 文件,将其追加到 [./hugegraph-dist/release-docs/NOTICE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/release-docs/NOTICE) 文件后面(如果没有NOTICE文件则跳过这一步)。
4. 本地执行[./hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh) 脚本来更新依赖列表[known-dependencies.txt](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/scripts/dependency/known-dependencies.txt) (或者手动更新)。

**例如**:在项目中引入了第三方新依赖 -> `ant-1.9.1.jar`
- 项目源码位于:https://github.com/apache/ant/tree/rel/1.9.1
- LICENSE 文件:https://github.com/apache/ant/blob/rel/1.9.1/LICENSE
- NOTICE 文件:https://github.com/apache/ant/blob/rel/1.9.1/NOTICE

`ant-1.9.1.jar` 的 license 信息需要在 LICENSE 文件中指定,notice 信息需要在 NOTICE 文件中指定。 ant-1.9.1.jar 对应的详细 LICENSE 文件需要复制到我们的 licenses/ 目录下。最后更新 known-dependencies.txt 文件。

#### 3.3 Commit changes to git repo

After the code has been completed, we submit them to the local git repo:
Expand Down
14 changes: 14 additions & 0 deletions content/en/docs/contribution-guidelines/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ mvn test -Pcore-test,memory
```
Note: In order to be consistent with the code style easily, if you use [IDEA](https://www.jetbrains.com/idea/) as your IDE, you can directly [import](https://www.jetbrains.com/help/idea/configuring-code-style.html) our code style [configuration file](./hugegraph-style.xml).

##### 3.2.1 Check licenses
If we want to add new third-party dependencies to the `HugeGraph` project, we need to do the following things:
1. Find the third-party dependent repository, put the dependent `license` file into [./hugegraph-dist/release-docs/licenses/](https://github.com/apache/incubator-hugegraph/tree/master/hugegraph-dist/release-docs/licenses) path.
2. Declare the dependency in [./hugegraph-dist/release-docs/LICENSE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/release-docs/LICENSE) `LICENSE` information.
3. Find the NOTICE file in the repository and append it to [./hugegraph-dist/release-docs/NOTICE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/release-docs/NOTICE) file (skip this step if there is no NOTICE file).
4. Execute locally [./hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh) to update the dependency list [known-dependencies.txt](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/scripts/dependency/known-dependencies.txt) (or manually update) .

**Example**: A new third-party dependency is introduced into the project -> `ant-1.9.1.jar`
- The project source code is located at: https://github.com/apache/ant/tree/rel/1.9.1
- LICENSE file: https://github.com/apache/ant/blob/rel/1.9.1/LICENSE
- NOTICE file: https://github.com/apache/ant/blob/rel/1.9.1/NOTICE

The license information of `ant-1.9.1.jar` needs to be specified in the LICENSE file, and the notice information needs to be specified in the NOTICE file. The detailed LICENSE file corresponding to ant-1.9.1.jar needs to be copied to our licenses/ directory. Finally update the known-dependencies.txt file.

#### 3.3 Commit changes to git repo

After the code has been completed, we submit them to the local git repo:
Expand Down

0 comments on commit d62608a

Please sign in to comment.