Skip to content

Instantly share code, notes, and snippets.

@qrtt1
Last active May 19, 2020 16:09

Revisions

  1. qrtt1 revised this gist Jan 26, 2016. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions aar-deps.gradle
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,17 @@ project.afterEvaluate {
    def isAndroidLibraryProject = project.plugins.hasPlugin('com.android.library')
    if(isAndroidLibraryProject) {
    task copyDeps(type:Copy) {
    from configurations.compile
    from configurations.compile {
    include '**/*.jar'
    }
    into "./build/intermediates/bundles/release/libs/"
    }
    bundleRelease.dependsOn copyDeps

    task copyDebugDeps(type:Copy) {
    from configurations.compile
    from configurations.compile {
    include '**/*.jar'
    }
    into "./build/intermediates/bundles/debug/libs/"
    }
    bundleDebug.dependsOn copyDebugDeps
  2. qrtt1 revised this gist Jan 25, 2016. 1 changed file with 3 additions and 15 deletions.
    18 changes: 3 additions & 15 deletions build.gradle
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    apply plugin: 'com.android.library'
    apply from: 'https://gist.githubusercontent.com/qrtt1/25a44fa29e46a5ec7f5b/raw/6dd82dd03f8386c40e41e4d0721c4b7dff88577f/aar-deps.gradle'

    android {
    compileSdkVersion 23
    @@ -20,21 +21,8 @@ android {

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.squareup.okhttp3:okhttp:3.0.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    }

    gradle.projectsEvaluated {

    ["", "Debug"].each { taskId ->
    task "copy${taskId}Deps"(type:Copy) {
    from configurations.compile
    def target = "copyDeps" == name ? "release" : "debug"
    def dir = "./build/intermediates/bundles/$target/libs/"
    into dir
    }
    tasks["pre${taskId}Build"].dependsOn "copy${taskId}Deps"
    }
    compile 'com.squareup.okhttp3:okhttp:3.0.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    }
  3. qrtt1 revised this gist Jan 25, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions aar-deps.gradle
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,16 @@
    project.projectsEvaluated {
    project.afterEvaluate {
    def isAndroidLibraryProject = project.plugins.hasPlugin('com.android.library')
    if(isAndroidLibraryProject) {
    task copyDeps(type:Copy) {
    from configurations.compile
    into "./build/intermediates/bundles/release/libs/"
    }
    preBuild.dependsOn copyDeps
    bundleRelease.dependsOn copyDeps

    task copyDebugDeps(type:Copy) {
    from configurations.compile
    into "./build/intermediates/bundles/debug/libs/"
    }
    preDebugBuild.dependsOn copyDebugDeps
    bundleDebug.dependsOn copyDebugDeps
    }
    }
  4. qrtt1 revised this gist Jan 25, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion aar-deps.gradle
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    gradle.projectsEvaluated {
    project.projectsEvaluated {
    def isAndroidLibraryProject = project.plugins.hasPlugin('com.android.library')
    if(isAndroidLibraryProject) {
    task copyDeps(type:Copy) {
  5. qrtt1 revised this gist Jan 25, 2016. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions aar-deps.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    gradle.projectsEvaluated {
    def isAndroidLibraryProject = project.plugins.hasPlugin('com.android.library')
    if(isAndroidLibraryProject) {
    task copyDeps(type:Copy) {
    from configurations.compile
    into "./build/intermediates/bundles/release/libs/"
    }
    preBuild.dependsOn copyDeps

    task copyDebugDeps(type:Copy) {
    from configurations.compile
    into "./build/intermediates/bundles/debug/libs/"
    }
    preDebugBuild.dependsOn copyDebugDeps
    }
    }
  6. qrtt1 created this gist Jan 25, 2016.
    40 changes: 40 additions & 0 deletions build.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    apply plugin: 'com.android.library'

    android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
    minSdkVersion 18
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    }
    buildTypes {
    release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
    }

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.squareup.okhttp3:okhttp:3.0.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    }

    gradle.projectsEvaluated {

    ["", "Debug"].each { taskId ->
    task "copy${taskId}Deps"(type:Copy) {
    from configurations.compile
    def target = "copyDeps" == name ? "release" : "debug"
    def dir = "./build/intermediates/bundles/$target/libs/"
    into dir
    }
    tasks["pre${taskId}Build"].dependsOn "copy${taskId}Deps"
    }
    }