Skip to content

Commit

Permalink
🎨 配置插件的jcenter发布配置
Browse files Browse the repository at this point in the history
🎨 插件依赖注解方法优化,不需要显示引入注解
  • Loading branch information
taoszu committed Sep 2, 2018
1 parent 7a5274b commit 5ea946e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 28 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
if (Boolean.valueOf(applyConfigurerPlugin)) {
apply plugin: 'com.taoszu.configurer'
}
Expand All @@ -13,8 +16,6 @@ android {
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }

}
buildTypes {
release {
Expand All @@ -39,6 +40,5 @@ dependencies {
}

dependencies {
implementation project(":processor")
annotationProcessor project(":processor")
// annotationProcessor project(":processor")
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/taoszu/configurer/BTeacher.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

import com.taoszu.configurer.annotation.Worker;

@Worker(key = "B", module = "teacher")
@Worker(key = "B", module = "a")
public class BTeacher {
}
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ buildscript {
repositories {
google()
jcenter()
maven { url 'https://www.jitpack.io' }
maven {
url uri("./repo")
}
Expand All @@ -16,6 +17,7 @@ buildscript {
classpath 'com.novoda:bintray-release:0.4.0'

if (Boolean.valueOf(applyConfigurerPlugin)) {
// classpath "com.github.taoszu.Configurer:gradle-plugin:1.0.0"
classpath 'com.taoszu.configurer:plugin:1.0.4'
}

Expand Down
20 changes: 14 additions & 6 deletions gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'com.novoda.bintray-release'

dependencies {
compile gradleApi()
compile localGroovy()
implementation gradleApi()
implementation localGroovy()

compile 'com.android.tools.build:gradle:3.1.4'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.tools.build:gradle:3.1.4'
}

repositories {
mavenCentral()
jcenter()
maven {url 'https://dl.bintray.com/taoszu/maven'}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

publish {
userOrg = 'taoszu'
groupId = 'com.taoszu.configurer'
artifactId = 'plugin'
publishVersion = '1.0.1'
desc = 'Configurer plugin'
website = 'https://github.com/taoszu/Configurer'
autoPublish = true
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class ConfigurerPlugin implements Plugin<Project> {
throw new GradleException("require android plugin")
}


def isKotlinProject = project.plugins.hasPlugin('kotlin-android')
if (isKotlinProject) {
if (!project.plugins.hasPlugin('kotlin-kapt')) {
Expand All @@ -33,22 +32,22 @@ class ConfigurerPlugin implements Plugin<Project> {
}

String compileConf = 'compile'

String aptConf = 'annotationProcessor'
if (isKotlinProject) {
aptConf = 'kapt'
}

String kaptConf = 'kapt'
Project processorProject = project.rootProject.findProject("processor")
if (processorProject) {
project.dependencies.add(compileConf, processorProject)
project.dependencies.add(aptConf, processorProject)
} else {
ExtraPropertiesExtension ext = project.rootProject.ext
if (ext.has("processorVersion")) {
DEFAULT_PROCESSOR_VERSION = ext.get("processorVersion")
if (isKotlinProject) {
project.dependencies.add(kaptConf, processorProject)
}

} else {
project.dependencies.add(compileConf, "com.taoszu.configurer:processor:${DEFAULT_PROCESSOR_VERSION}")
project.dependencies.add(aptConf, "com.taoszu.configurer:processor:${DEFAULT_PROCESSOR_VERSION}")
if (isKotlinProject) {
project.dependencies.add(kaptConf, "com.taoszu.configurer:processor:${DEFAULT_PROCESSOR_VERSION}")
}
}

def android = project.extensions.findByName("android")
Expand Down
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
# https://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
# org.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# https://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

applyConfigurerPlugin=false
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx512m
applyConfigurerPlugin=true
org.gradle.daemon=true
android.enableAapt2=false
7 changes: 4 additions & 3 deletions processor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ publish {
userOrg = 'taoszu'
groupId = 'com.taoszu.configurer'
artifactId = 'processor'
publishVersion = '1.0.0'
desc = 'Configurer'//描述,不重要
website = 'https://github.com/taoszu/Configurer'//网站,不重要;尽量模拟github上的地址,例如我这样的;当然你有地址最好了
publishVersion = '1.0.1'
desc = 'Configurer'
website = 'https://github.com/taoszu/Configurer'
autoPublish = true
}

sourceCompatibility = "1.8"
Expand Down

0 comments on commit 5ea946e

Please sign in to comment.