Android License Tools Plugin


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

Android License Tools Plugin

Gradle Plugin to check library licenses and generate license pages.

  • ./gradlew checkLicenses to check licenses in dependencies
  • ./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.0.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.

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)

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)

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.1.0
name: RxAndroid
copyrightHolder: The RxAndroid authors
license: apache2 - artifact: license-tools-plugin:example-dep:+
skip: true

Notice

For Gradle Plugin 3 users

dependencies {

  implementation project(path: ':example-dep', configuration: 'default') 
}
  • If your project's dependencies break with configuration: 'default', you can switch which implementation project() call like the following control flow.
dependencies {

  if(project.gradle.startParameter.taskNames.contains("checkLicenses")) {

implementation project(path: ':example-dep', configuration: 'default')
  
}
 else {

implementation project(path: ':example-dep')
  
}
 
}

See Also

For Developers

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. 

Resources

A simple library to add tooltips to your awesome Android application.

BannerTime creates a scheduled popup to show your personal message.

This library runs background service that is listening for shake movements in device.

Android library for material scrolling techniques.

Features:

  • Easily implement material scrolling techniques with RecyclerView.
  • Customize the behavior while scrolling.
  • Support RecyclerView in ViewPager.

This tool can retrieve dex, jar, smali, xml files, res, etc.

BatchPackApk is a tool for batch package Android apk with channel string.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes