gradle引用外部的库模块

有些通用的功能会抽到df_lib_gradle模块中,方便以后的JAVA代码公用。


比如我现在的工程要引用上上级目录下的df_lib_gradle/lib_core模块

在本工程setting.gradle目录下引入lib_core模块。

include ':gdx-pay', ':lib_core'
include ':gdx-pay-client'
//include ':gdx-pay-android'
//include ':gdx-pay-android-openiab'
//include ':gdx-pay-android-ouya'
//include ':gdx-pay-android-amazon'
//include ':gdx-pay-android-googleplay'
include ':gdx-pay-desktop-apple'
//include ':gdx-pay-gwt-googlewallet'
//include ':gdx-pay-iosrobovm-apple'
include ':gdx-pay-iosmoe-apple'
//include ':gdx-pay-server'
include ':gdx-pay-tests'
//include ':gdx-pay-tests-android'
//include ':gdx-pay-tests-iosrobovm'
include ':gdx-pay-tests-iosmoe'

rootProject.name = "gdx-pay-root"

include ':com.badlogic.gdx.pay.tests'

include 'df_lib_gradle'
project(':df_lib_gradle').projectDir = new File(settingsDir, "../../df_lib_gradle")

include 'lib_core'
project(':lib_core').projectDir = new File(settingsDir, "../../df_lib_gradle/lib_core")


在本工程主目录下build.gradle中加入lib_core模块

apply plugin: "java"

sourceCompatibility = 1.7
[compileJava, compileTestJava]*.options*.encoding = 'GBK'


buildscript {
    repositories {
//        mavenLocal()

        maven { url "http://maven.aliyun.com/nexus/content/groups/public"}
        maven { url "http://repository.jboss.org/nexus/content/groups/public/"}
        maven { url "https://repository.jboss.org/nexus/content/repositories/releases/"}
        maven { url "http://repo2.maven.org/maven2/"}
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
//        jcenter()
//        mavenCentral()
    }
    dependencies {
//        classpath 'com.android.tools.build:gradle:2.1.3'
//        classpath 'org.multi-os-engine:moe-gradle:1.2.0'
        classpath 'com.android.tools.build:gradle:1.5.0'
        classpath 'org.multi-os-engine:moe-gradle:1.2.3'
    }
}


allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = '1.0'
    ext {
        appName = "dy_cike_cikechuanshuo_init_init"
//        gdxVersion = '1.9.4'
//        gdxVersion = '1.9.5-SNAPSHOT'
        gdxVersion = '1.9.5'
        roboVMVersion = '2.3.0'
        box2DLightsVersion = '1.4'
        ashleyVersion = '1.7.0'
        aiVersion = '1.8.0'

//        wulong: gdxpay 经查证,gradle库里只有0.10.4-SNAPSHOT版本
//        gdxPayVersion = '0.10.3'
        gdxPayVersion = '0.10.4-SNAPSHOT'
    }

    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "http://repo2.maven.org/maven2/" }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    }
}


project(":desktop") {
    apply plugin: "java"

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
//        compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
//        compile "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
//        compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
//        compile "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion"
//        compile "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop"
    }
}

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile fileTree(dir: '../core/libs', include: '*.jar')
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
//wulong: gdx频繁更新,为了加快下载库的速度,屏蔽掉部分不用的库
//        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
//        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
//        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
//        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
//        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
//        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
//        compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
//        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi"
//        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi-v7a"
//        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-arm64-v8a"
//        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86"
//        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86_64"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
//        compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
//        compile "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
//        compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
//        compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
//        compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"

//        wulong: gdxpay
        compile "com.badlogicgames.gdxpay:gdx-pay-android:$gdxPayVersion"
        compile "com.badlogicgames.gdxpay:gdx-pay-android-googleplay:${gdxPayVersion}@aar"
    }
}

project(":core") {
    apply plugin: "java"

    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
//        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
//        compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
//        compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
//        compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
//        compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
//        compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
        compile fileTree(dir: 'libs', include: '*.jar')
//        todo: wulong
        compile project(':lib_core')
//        wulong: gdxpay
        compile "com.badlogicgames.gdxpay:gdx-pay-client:$gdxPayVersion"
    }
}

project(":ios-moe") {
    apply plugin: "moe"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-moe:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
//        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios"
//        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-ios"

//        wulong: gdxpay
        compile "com.badlogicgames.gdxpay:gdx-pay-iosmoe-apple:$gdxPayVersion"
    }
}


tasks.eclipse.doLast {
    delete ".project"
}



  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值