upload-dev.gradle 2.7 KB
Newer Older
J
jackjintai 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
def publishArchivesType = rootProject.ext.config["publishArchivesType"]
apply plugin: 'maven'
if (publishArchivesType == 1) {
    uploadArchives {
        repositories {
            mavenDeployer {
                pom.project {
                    groupId "com.didichuxing.doraemonkit"
                    artifactId "dokit-okhttp-api"
                    version rootProject.ext.android["jcenterArchivesVersionName"]
                }

                pom.withXml {
                    def node = it.asElement()
                    def nodeList = node.getElementsByTagName('dependency')
                    nodeList.each { dependency ->
                        dependency?.each { config ->
                            if (config?.textContent == 'the-one-sdk') {
                                config.parentNode.parentNode.removeChild(config.parentNode)
                            }
                            if (config?.textContent == 'onecar') {
                                config.parentNode.parentNode.removeChild(config.parentNode)
                            }
                        }
                    }
                }


                repository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/") {
                    authentication(userName: "deployment", password: "deployment123")
                }
                snapshotRepository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/") {
                    authentication(userName: "deployment", password: "deployment123")
                }
            }
        }
    }
} else if (publishArchivesType == 0) {
    def localRepoURL = uri(rootProject.ext.config["localRepoURL"])
    uploadArchives {
        repositories {
            mavenDeployer {
                pom.project {
                    groupId "com.didichuxing.doraemonkit"
                    artifactId "dokit-okhttp-api"
                    version rootProject.ext.android["jcenterArchivesVersionName"]
                }
                pom.withXml {
                    def node = it.asElement()
                    def nodeList = node.getElementsByTagName('dependency')
                    nodeList.each { dependency ->
                        dependency?.each { config ->
                            if (config?.textContent == 'the-one-sdk') {
                                config.parentNode.parentNode.removeChild(config.parentNode)
                            }
                            if (config?.textContent == 'onecar') {
                                config.parentNode.parentNode.removeChild(config.parentNode)
                            }
                        }
                    }
                }

                repository(url: localRepoURL)
            }
        }
    }
}