mirror of
https://gitee.com/replugin/RePlugin.git
synced 2024-12-05 05:08:15 +08:00
109 lines
2.8 KiB
Groovy
109 lines
2.8 KiB
Groovy
/*
|
|
* Copyright (C) 2005-2017 Qihoo 360 Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
* use this file except in compliance with the License. You may obtain a copy of
|
|
* the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed To in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
* License for the specific language governing permissions and limitations under
|
|
* the License.
|
|
*
|
|
*/
|
|
|
|
apply plugin: 'java'
|
|
apply plugin: 'groovy'
|
|
apply plugin: 'maven'
|
|
apply plugin: 'maven-publish'
|
|
//apply from: 'config.gradle'
|
|
|
|
repositories {
|
|
jcenter()
|
|
mavenCentral()
|
|
}
|
|
|
|
buildscript {
|
|
repositories {
|
|
jcenter()
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
// classpath 'com.android.tools.build:gradle:2.1.0'
|
|
// 将项目发布到JCenter 所需要的jar 添加依赖
|
|
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
|
|
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
|
}
|
|
}
|
|
|
|
group = 'com.qihoo360.replugin' // 组名
|
|
version = '2.1.3' // 版本
|
|
|
|
dependencies {
|
|
compile 'com.android.tools.build:gradle:2.1.3'
|
|
compile 'org.json:json:20160212'
|
|
compile 'org.codehaus.groovy:groovy:2.4.7'
|
|
compile 'com.squareup:javapoet:1.5.1'
|
|
compile 'com.android.tools.build:transform-api:1.5.0'
|
|
compile 'javassist:javassist:3.12.1.GA'
|
|
compile 'commons-io:commons-io:2.5'
|
|
|
|
compile gradleApi()
|
|
compile localGroovy()
|
|
|
|
compile 'com.google.gradle:osdetector-gradle-plugin:1.2.1'
|
|
}
|
|
|
|
if (project.hasProperty("android")) { // Android libraries
|
|
task sourcesJar(type: Jar) {
|
|
classifier = 'sources'
|
|
from android.sourceSets.main.java.srcDirs
|
|
}
|
|
|
|
task javadoc(type: Javadoc) {
|
|
source = android.sourceSets.main.java.srcDirs
|
|
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
|
}
|
|
} else { // Java libraries
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
classifier = 'sources'
|
|
from sourceSets.main.allSource
|
|
}
|
|
}
|
|
|
|
// 强制 Java/JavaDoc 等的编码为 UTF-8
|
|
tasks.withType(JavaCompile) {
|
|
options.encoding = "UTF-8"
|
|
}
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
classifier = 'javadoc'
|
|
from javadoc.destinationDir
|
|
}
|
|
|
|
|
|
|
|
// add javadoc/source jar tasks as artifacts
|
|
artifacts {
|
|
archives sourcesJar, javadocJar
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
if (plugins.hasPlugin('war')) {
|
|
from components.web
|
|
} else {
|
|
from components.java
|
|
}
|
|
|
|
artifact sourcesJar
|
|
artifact javadocJar
|
|
}
|
|
}
|
|
}
|
|
|
|
apply from: 'bintray.gradle' |