Giter Site home page Giter Site logo

intransitives's Introduction

Intransitives

Download version

Banner

Gradle plugin intransitives helps to make apis of transitive children dependencies invisible from user.

Problems

When you add an dependency in build.gradle, Gradle will also compile transitive children dependencies by default. This behavior makes the dependencies manager much simpler but something we hope to hide the apis of children dependencies. For example, picasso depends on okhttp as the following

APP -> Picasso -> OkHttp

If we compile picasso, we will also compile okhttp (that is how picasso works). In another word, the apis of okhttp is visible to us though we do not compile it explictly. If we do not announce compling okhttp explictly, we should not access its apis. Because the implementaion of picasso might changes so that it does not compile okhttp any more.

Solution

If we want to avoid accessing of transitive apis, we should set transitive = false of complie while transitive = true of runtime (hide the apis in compile time and package the apis in runtime). Such as

dependencies {
    implementation ('com.squareup.picasso:picasso:latest.release') {
        transitive = false
    }
    runtimeOnly ('com.squareup.picasso:picasso:latest.release') {
        transitive = true
    }
}

And this is how intransitives works.

Getting Started

Just apply the plugin in the build.gradle file of your module.

// ~/project/build.gradle

// 1. Add dependency
buildscript {
    repositories {
        jcenter()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'com.kaedea:intransitives:latest.release'
    }
}

// 2. Apply plugin
apply plugin: 'com.kaedea.intransitives'
intransitives {
    // 3. Move your dependencies here in need
    implementation 'com.squareup.picasso:picasso:latest.release'
}

Use task :app:intransitives to dump your intransitive dependencies confinguration.

Contributing

Check CONTRIBUTING.md.

License

The project is Apache License, Version 2.0 licensed.

intransitives's People

Contributors

kaedea avatar

Stargazers

曾祥彬 avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.