• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

cookpad/license-tools-plugin: Gradle plugin to check library licenses and genera ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

cookpad/license-tools-plugin

开源软件地址(OpenSource Url):

https://github.com/cookpad/license-tools-plugin

开源编程语言(OpenSource Language):

HTML 91.1%

开源软件介绍(OpenSource Introduction):

THIS REPOSITORY WAS ARCHIVED

Attention: Development on this tool is winding down. Please consider switching to https://github.com/cookpad/LicenseToolsPlugin in the coming months.

Android License Tools Plugin

Gradle Plugin to check library licenses and generate license pages.

  • ./gradlew checkLicenses to check licenses in dependencies
  • ./gradlew updateLicenses to update library information file licenses.yml
  • ./gradlew generateLicensePage to generate a license page licenses.html
  • ./gradlew generateLicenseJson to generate a license json file licenses.json

Setup

This plugin requires JDK8 (1.8.0 or later).

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.cookpad.android.licensetools:license-tools-plugin:1.7.0'
    }
}

apply plugin: 'com.cookpad.android.licensetools'

See [example/build.gradle] for example.

How To Use

Run the checkLicenses task

You will see the following messages by ./gradlew checkLicenses:

# Libraries not listed:
- artifact: com.android.support:support-v4:+
  name: #NAME#
  copyrightHolder: #AUTHOR#
  license: No license found
- artifact: com.android.support:animated-vector-drawable:+
  name: #NAME#
  copyrightHolder: #AUTHOR#
  license: No license found
- artifact: io.reactivex:rxjava:+
  name: #NAME#
  copyrightHolder: #AUTHOR#
  license: apache2

Add library licenses to app/licenses.yml

Then, Create app/licenses.yml, and add libraries listed the above with required fields:

- artifact: com.android.support:+:+
  name: Android Support Libraries
  copyrightHolder: The Android Open Source Project
  license: apache2
- artifact: io.reactivex:rxjava:+
  name: RxJava
  copyrightHolder: Netflix, Inc.
  license: apache2

You can use wildcards in artifact names and versions. You'll know the Android support libraries are grouped in com.android.support so you use com.android.support:+:+ here.

Instead of manually appending missing libraries to licenses.yml, you can also run the updateLicenses task to update licenses.yml automatically.

Then, ./gradlew checkLicenses will passes.

Generate licenses.html by the generateLicensePage task

./gradlew generateLicensePage generates app/src/main/assets/licenses.html.

This plugin does not provide Activity nor Fragment to show licenses.html. You should add it by yourself.

example/MainActivity is an example.

Configuring the plugin

Use licenseTools in your build.gradle to add some optional configuration.

For example:

licenseTools {
    outputHtml = "licenses_output.html"
}

Available configuration fields:

Field name Default value Description
licensesYaml "licenses.yml" The name of the licenses yml file
outputHtml "licenses.html" The file name of the output of the generateLicensePage task
outputJson "licenses.json" The file name of the output of the generateLicenseJson task
ignoredGroups [] (empty array) An array of group names the plugin will ignore (useful for internal dependencies with missing .pom files)
ignoredProjects [] (empty array) An array of project names the plugin will ignore (To ignore particular internal projects like custom lint)

DataSet Format

Required Fields

  • artifact
  • name
  • Either copyrightHolder, author, authors or notice

Optional Fields

  • year to indicate copyright years
  • skip to skip generating license entries (for proprietary libraries)
  • forceGenerate to force generate the output with arbitrary items. (Read [this issue](Feature Request: feature for adding/changing licenses by hand #78) for more details.)
    • If some pom data is wrong, you can override some of them using this flag.

Example

- artifact: com.android.support:+:+
  name: Android Support Libraries
  copyrightHolder: The Android Open Source Project
  license: apache2
- artifact: org.abego.treelayout:org.abego.treelayout.core:+
  name: abego TreeLayout
  copyrightHolder: abego Software
  license: bsd_3_clauses
- artifact: io.reactivex:rxjava:+
  name: RxJava
  copyrightHolder: Netflix, Inc.
  license: apache2
- artifact: com.tunnelvisionlabs:antlr4-runtime:4.5
  name: ANTLR4
  authors:
    - Terence Parr
    - Sam Harwell
  license: bsd_3_clauses
- artifact: com.github.gfx.android.orma:+:+
  name: Android Orma
  notice: |
    Copyright (c) 2015 FUJI Goro (gfx)
    SQLite.g4 is: Copyright (c) 2014 by Bart Kiers
  license: apache_2
- artifact: io.reactivex:rxandroid:1.2.0
  name: RxAndroid
  copyrightHolder: The RxAndroid authors
  license: apache2
- artifact: license-tools-plugin:example-dep:+
  skip: true
- name: OpenCV
  copyrightHolder: OpenCV team
  license: bsd_3_clauses
  url: "https://opencv.org/"
  forceGenerate: true

See Also

For Developers

Make sure after you change codebase

Run the following Gradle tasks and app commands succeed:

./gradlew checkLicenses
./gradlew generateLicensePage
./gradlew generateLicenseJson

Release Engineering

To bump versions:

./gradlew bumpPatch
./gradlew bumpMinor
./gradlew bumpMajor

To test artifacts:

make check

To publish artifacts:

make publish

Keep CHANGES.md up-to-date.

Copyright and License

Copyright (c) 2016 Cookpad Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap