Gradle License Plugin


Source link: https://github.com/jaredsburrows/gradle-license-plugin

Gradle License Plugin

This plugin provides a task to generate a HTML license report based on the configuration. (eg. licenseDebugReport for all debug dependencies in an Android project).

Applying this to an Android or Java project will generate a the license file( open_source_licenses.html) in the <project>/build/reports/licenses/.

Also, for Android projects the license HTML file will be copied to <project>/src/main/assets/.

Download

Release:

buildscript {

repositories {

  jcenter()

}

 dependencies {

  classpath "com.jaredsburrows:gradle-license-plugin:0.7.0"

}
 
}
  apply plugin: "com.android.application" // or "java-library" apply plugin: "com.jaredsburrows.license"

Release versions are available in the JFrog Bintray repository: https://bintray.com/jaredsburrows/maven/gradle-license-plugin

Snapshot:

buildscript {

repositories {

  maven {
 url "https://oss.jfrog.org/artifactory/oss-snapshot-local/" 
}

}

 dependencies {

  classpath "com.jaredsburrows:gradle-license-plugin:0.8.0-SNAPSHOT"

}
 
}
  apply plugin: "com.android.application" // or "java-library" apply plugin: "com.jaredsburrows.license"

Snapshot versions are available in the JFrog Artifactory repository: https://oss.jfrog.org/webapp/#/builds/gradle-license-plugin

Tasks

  • license${ variant } Report for Android
  • licenseReport for Java

Generates a HTML report of the all open source licenses. (eg. licenseDebugReport for all debug dependencies in an Android project).

Example build.gradle:

dependencies {

compile "com.android.support:design:26.1.0"
compile "pl.droidsonroids.gif:android-gif-drawable:1.2.3" 
}

HTML:

<html>
<head>
  <style>body{
font-family:sans-serif;
}
pre{
background-color:#eee;padding:1em;white-space:pre-wrap;
}
</style>
  <title>Open source licenses</title>
</head>
<body>
  <h3>Notice for libraries:</h3>
  <ul>

 <li>

<a href='#-989311426'>Android GIF Drawable Library</a>

 </li>

 <li>

<a href='#1288288048'>Design</a>

 </li>
  </ul>
  <a name='-989311426' />
  <h3>The MIT License</h3>
  <pre>The MIT License, http://opensource.org/licenses/MIT</pre>
  <a name='1288288048' />
  <h3>The Apache Software License</h3>
  <pre>The Apache Software License, http://www.apache.org/licenses/LICENSE-2.0.txt</pre>
</body> </html>

JSON:

[
{

  "project": "Android GIF Drawable Library",
  "developers": "Karol Wrótniak",
  "url": "https://github.com/koral--/android-gif-drawable.git",
  "year": null,
  "license": "The MIT License",
  "license_url": "http://opensource.org/licenses/MIT"

}
,
{

  "project": "Design",
  "developers": null,
  "url": null,
  "year": null,
  "license": "The Apache Software License",
  "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt"

}
 ]

Usage

Create an open source dialog

public static class OpenSourceLicensesDialog extends DialogFragment {

 public OpenSourceLicensesDialog() {

}

 @Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

  final WebView webView = new WebView(getActivity());

  webView.loadUrl("file:///android_asset/open_source_licenses.html");

return new AlertDialog.Builder(getActivity())

 .setTitle("Open Source Licenses")

 .setView(webView)

 .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog, int which) {

  dialog.dismiss();

}

 
}

  )
  .create();

}
 
}

How to use it

public static void showOpenSourceLicenses(Activity activity) {

final FragmentManager fm = activity.getFragmentManager();

final FragmentTransaction ft = fm.beginTransaction();

final Fragment prev = fm.findFragmentByTag("dialog_licenses");

if (prev != null) {

  ft.remove(prev);

}

ft.addToBackStack(null);

 new OpenSourceLicensesDialog().show(ft, "dialog_licenses");
 
}

Source: https://github.com/google/iosched/blob/2531cbdbe27e5795eb78bf47d27e8c1be494aad4/android/src/main/java/com/google/samples/apps/iosched/util/AboutUtils.java#L52

Source: https://www.bignerdranch.com/blog/open-source-licenses-and-android/

Resources

Play video in ListView, RecyclerView with full-screen support and different features to control video stream.

An extension for Google's AutoValue that omits @IgnoreHashEquals field values from hashCode() and equals().

A script which synchronizes all of the artifacts in your local Android SDK to a remote Maven artifact host.

ColorTextView allows to mark some phrase with colors.

Fan Layout Manager for Android by Cleveroad.

Minimalist set of classes that offers you to group a set of variables in a type safe way like java Pair does it with two variables

The library offers classes to group 3 to 10 items in the way, Java Pair does it.

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