Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Can I drop Jetifier?

Checks whether there are any dependencies using support library instead of AndroidX artifacts.

If you migrated to AndroidX, you probably have the Jetifier tool enabled that converts dependencies that still depend on old artifacts to operate on AndroidX classes. Since more and more libraries are migrated to AndroidX, at some point there will be no need to have this tool enabled. This plugin can be used to identify which of the libraries you are using need to be migrated to AndroidX or bumped if the new version is already there.

Setup

Build script snippet for plugins DSL for Gradle 2.1 and later:

plugins {
  id "com.github.plnice.canidropjetifier" version "0.5"
}

Build script snippet for use in older Gradle versions or where dynamic configuration is required:

buildscript {
  repositories {
    gradlePluginPortal()
  }
  dependencies {
    classpath "com.github.plnice:canidropjetifier:0.5"
  }
}

apply plugin: "com.github.plnice.canidropjetifier"

For multi-module projects, you can apply the plugin in the top-level build.gradle file. It will analyze all the modules found in the project.

Usage

The Jetifier tool must be temporarily disabled to make this plugin work correctly. It can be done when calling the plugin's task:

./gradlew -Pandroid.enableJetifier=false canIDropJetifier

Example output:

========================================
Project sample
========================================

Cannot drop Jetifier due to following module dependencies:

* sample-dependency (module)
  \-- com.android.support:cardview-v7:28.0.0
  \-- com.squareup.leakcanary:leakcanary-android:1.6.3
   \-- com.android.support:support-core-utils:26.0.0
  \-- com.squareup.leakcanary:leakcanary-android:1.6.3
   \-- com.squareup.leakcanary:leakcanary-analyzer:1.6.3
    \-- com.android.support:support-annotations:28.0.0

Cannot drop Jetifier due to following external dependencies:

* com.android.support:cardview-v7:28.0.0

* com.squareup.leakcanary:leakcanary-android:1.6.3
  \-- com.squareup.leakcanary:leakcanary-analyzer:1.6.3
   \-- com.android.support:support-annotations:28.0.0
  \-- com.android.support:support-core-utils:26.0.0

Configuration

canIDropJetifier {
  verbose = true // Default: false, set to true to print the dependencies tree down to the old artifact
  includeModules = false // Default: true, print out not only external (library) dependencies, but also module dependencies that use old artifacts
  analyzeOnlyAndroidModules = false // Default: true, analyze only modules that use com.android.application or com.android.library plugins
  configurationRegex = ".*RuntimeClasspath" // Performance optimization: checks only configurations that match provided regex
  parallelMode = true // Default: false, experimental: run analysis of modules in parallel
  parallelModePoolSize = 4 // Default: max available processors - 1, experimental: pool size for analysis in parallel
}

License

Copyright 2019 Miłosz Lewandowski

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.

About

Gradle plugin that checks if there are dependencies using support library instead of AndroidX.

Topics

Resources

License

Languages

You can’t perform that action at this time.