145 lines
4.2 KiB
Groovy
145 lines
4.2 KiB
Groovy
apply plugin: 'com.android.library'
|
||
|
||
android {
|
||
compileSdkVersion 26
|
||
|
||
defaultConfig {
|
||
minSdkVersion 15
|
||
targetSdkVersion 26
|
||
versionCode 1
|
||
versionName "1.0"
|
||
|
||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
minifyEnabled false
|
||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
dependencies {
|
||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||
|
||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
||
testImplementation 'junit:junit:4.12'
|
||
androidTestImplementation 'com.android.support.test:runner:1.0.1'
|
||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
|
||
}
|
||
|
||
apply plugin: 'com.github.dcendents.android-maven'
|
||
apply plugin: 'com.jfrog.bintray'
|
||
|
||
//项目主页--项目的GitHub地址
|
||
def siteUrl = 'https://github.com/jiaoyaning/VerificationCodeView'
|
||
//项目的git地址
|
||
def gitUrl = 'https://github.com/jiaoyaning/VerificationCodeView.git'
|
||
|
||
//发布到JCenter上的项目名字,compile引用时的第2部分项目名
|
||
def libName = "verificationcodeview"
|
||
//compile引用时的第1部分
|
||
group = "com.jyn.verificationcodeview"
|
||
// 版本号,//compile引用时的最后部分项目名,下次更新是只需要更改版本号即可
|
||
version = "1.0.0"
|
||
|
||
//生成源文件
|
||
task sourcesJar(type: Jar) {
|
||
from android.sourceSets.main.java.srcDirs
|
||
classifier = 'sources'
|
||
}
|
||
|
||
//生成Javadoc文档
|
||
task javadoc(type: Javadoc) {
|
||
source = android.sourceSets.main.java.srcDirs
|
||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
||
}
|
||
|
||
//文档打包成jar
|
||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||
classifier = 'javadoc'
|
||
from javadoc.destinationDir
|
||
}
|
||
|
||
//拷贝javadoc文件
|
||
task copyDoc(type: Copy) {
|
||
from "${buildDir}/docs/"
|
||
into "docs"
|
||
}
|
||
|
||
//上传到JCenter所需要的源码文件
|
||
artifacts {
|
||
archives javadocJar
|
||
archives sourcesJar
|
||
}
|
||
//OM.xml文件
|
||
install {
|
||
repositories.mavenInstaller {
|
||
// This generates POM.xml with proper parameters
|
||
pom {
|
||
project {
|
||
packaging 'aar'
|
||
//项目描述,自由填写
|
||
name 'A square VerificationCodeView on Android'
|
||
url siteUrl
|
||
licenses {
|
||
license {
|
||
//开源协议
|
||
name 'The Apache Software License, Version 2.0'
|
||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||
}
|
||
}
|
||
developers {
|
||
developer {
|
||
//开发者的个人信息,根据个人信息填写
|
||
id 'jyn'
|
||
name 'jiaoyaning1210'
|
||
email 'jiaoyaning1210@gmail.com'
|
||
}
|
||
}
|
||
scm {
|
||
connection gitUrl
|
||
developerConnection gitUrl
|
||
url siteUrl
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
//上传到JCenter
|
||
Properties properties = new Properties()
|
||
properties.load(project.rootProject.file('local.properties').newDataInputStream())
|
||
|
||
bintray {
|
||
user = properties.getProperty("bintray.user") //读取 local.properties 文件里面的 bintray.user
|
||
key = properties.getProperty("bintray.apikey") //读取 local.properties 文件里面的 bintray.apikey
|
||
configurations = ['archives']
|
||
pkg {
|
||
//这里的repo值必须要和你创建Maven仓库的时候的名字一样,我们前面创建的就是maven
|
||
repo = "maven"
|
||
//发布到JCenter上的项目名字
|
||
name = libName
|
||
//项目描述
|
||
desc = 'A square VerificationCodeView on Android'
|
||
websiteUrl = siteUrl
|
||
vcsUrl = gitUrl
|
||
licenses = ["Apache-2.0"]
|
||
publish = true
|
||
}
|
||
}
|
||
|
||
javadoc {
|
||
options {
|
||
//如果你的项目里面有中文注释的话,必须将格式设置为UTF-8,不然会出现乱码
|
||
encoding "UTF-8"
|
||
charSet 'UTF-8'
|
||
author true
|
||
version true
|
||
links "http://docs.oracle.com/javase/7/docs/api"
|
||
}
|
||
} |