All Projects → wbonnefond → Licensechecker

wbonnefond / Licensechecker

Licence: mit
Gradle plugin to check that all Open Source Libraries in a project have been attributed

Programming Languages

groovy
2714 projects

Projects that are alternatives of or similar to Licensechecker

Img Optimizer Gradle Plugin
一款用于优化png图片的gradle插件,有效减少APK体积,支持极限压缩和无损压缩。
Stars: ✭ 718 (+1280.77%)
Mutual labels:  gradle-plugin
Gradle Kotlin Aspectj Weaver
A Gradle plugin that allows you to weave your compiled Java and Kotlin files with AspectJ
Stars: ✭ 14 (-73.08%)
Mutual labels:  gradle-plugin
Hunter
A fast, incremental, concurrent framework to develop compile plugin for android project to manipulate bytecode
Stars: ✭ 999 (+1821.15%)
Mutual labels:  gradle-plugin
Typescript Generator
Generates TypeScript from Java - JSON declarations, REST service client
Stars: ✭ 729 (+1301.92%)
Mutual labels:  gradle-plugin
Gradle Defaults
Plugin providing opinionated defaults for Gradle projects.
Stars: ✭ 7 (-86.54%)
Mutual labels:  gradle-plugin
Gradle Teamcity Plugin
Gradle plugin for developing TeamCity plugins
Stars: ✭ 30 (-42.31%)
Mutual labels:  gradle-plugin
Gogradle
A Gradle Plugin Providing Full Support for Go
Stars: ✭ 712 (+1269.23%)
Mutual labels:  gradle-plugin
Onesignal Gradle Plugin
Use with OneSignal-Android-SDK to help integrate it into your Android Studio or Gradle project. https://onesignal.com
Stars: ✭ 49 (-5.77%)
Mutual labels:  gradle-plugin
Rust Android Gradle
Stars: ✭ 14 (-73.08%)
Mutual labels:  gradle-plugin
Gradle Docker Plugin
Gradle plugin for managing Docker images and containers.
Stars: ✭ 994 (+1811.54%)
Mutual labels:  gradle-plugin
Gradle Release
gradle-release is a plugin for providing a Maven-like release process for projects using Gradle
Stars: ✭ 731 (+1305.77%)
Mutual labels:  gradle-plugin
Plantuml Gradle Plugin
Gradle plugin to build PlantUML diagrams from code (for living and up-to-date documentation)
Stars: ✭ 27 (-48.08%)
Mutual labels:  gradle-plugin
Codeanalysis
Android静态代码分析
Stars: ✭ 31 (-40.38%)
Mutual labels:  gradle-plugin
Kotless
Kotlin Serverless Framework
Stars: ✭ 721 (+1286.54%)
Mutual labels:  gradle-plugin
Prefiller
Prefiller is a Gradle plugin that generates pre-filled Room databases at compile time.
Stars: ✭ 43 (-17.31%)
Mutual labels:  gradle-plugin
Ktlint Gradle
A ktlint gradle plugin
Stars: ✭ 713 (+1271.15%)
Mutual labels:  gradle-plugin
Soapui Gradle Plugin
SoapUI Gradle Plugin
Stars: ✭ 14 (-73.08%)
Mutual labels:  gradle-plugin
Auto Manifest
Generates AndroidManifest.xml in simple libraries so that you don't have to
Stars: ✭ 51 (-1.92%)
Mutual labels:  gradle-plugin
Enigma
Gradle Plugin - Obfuscator String Encryption (Android/Java)
Stars: ✭ 43 (-17.31%)
Mutual labels:  gradle-plugin
Gradle Xjc Plugin
A Gradle plugin to run the XJC binding compiler during a build
Stars: ✭ 38 (-26.92%)
Mutual labels:  gradle-plugin

LicenseChecker

LicenseChecker is a gradle plugin for Android that ensures all Open Source Libraries are properly attributed and will even generate a formatted HTML file that can be used to display the licenses in your app.

LicenseChecker was created as a sanity check to prevent me from releasing an app with unattributed Open Source Libraries. It is especially powerful for big teams where it is hard as an individual to manage all the dependencies.

Installation

Add the following to your build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.wardbonnefond:license-checker:0.1.6'
    }
}

apply plugin: 'com.android.application'

// Apply after the Android plugin
apply plugin: 'com.wardbonnefond.licensechecker'

Usage

Input

Provide an attributions.json file in your app module's directory. This file is compared against all libraries (with the compile prefix) in your app's build.gradle file. The final HTML output is generated using the data in this file. Any library in the licenses section will be added to the final HTML output. The excludedLibraries section is for libraries that don't need attribution (your own library, closed source, etc.).

I use this tool for escaping strings in JSON: http://bernhardhaeussner.de/odd/json-escape/

{
  "libraries": [
    {
      "name": "Fake Library",
      "legalText": "Text to display about the license",
      "gradlePackage": "com.fake.fakest:myFakeLibrary"
    },
    {
      "name": "Jane's Awesome Library",
      "legalText": "Text to display about the license",
      "gradlePackage": "com.jdoe:janes-awesome-library"
    }
  ],
  "excludedLibraries": [
    {
      "gradlePackage": "com.android.support:appcompat-v7"
    },
    {
      "gradlePackage": "com.android.support:support-v4"
    }
  ]
}

LicenseChecker supports .jar and .aar libraries added from you /libs folder. For instance, to include a library called my-awesome-library.aar in your attributions.json just remove the .aar extension:

{
  "libraries": [
    {
      "name": "My Awesome Library",
      "legalText": "Text to display about the license",
      "gradlePackage": "my-awesome-library"
    }
  ]
}

attributions.json should be kept in-sync with your app's libraries. You'll still need to provide the attributions, LicenseChecker won't do this, it will just verify they exist and then provide a formatted output file.

By default LicenseChecker won't fail builds for missing attributions.In order to take advantage of this functionality you can specify the following property on your variants.

android {
    buildTypes {
        release {
            ext.failOnMissingAttributions = true
        }
    }
}

LicenseChecker supports assemble tasks that build multiple variants. If any variant has set ext.failOnMissingAttributions = true and there are missing attributions, then the entire build will fail.

Output

By default the final HTML file will be output to /{app}/build/intermediates/assets/{flavor}/{buildType}/

Here's a sample output HTML file. And here's a screenshot of what it looks like in the app.

Contributing

Feel free to open an issue or pull request if you feel something is missing or can be improved upon!

License

MIT License

Copyright (c) 2017 Ward Bonnefond

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].