core add include exclde,add clean library

This commit is contained in:
yummylau
2019-08-30 20:56:48 +08:00
parent 2da7522566
commit 9545e34636
9 changed files with 131 additions and 1 deletions

View File

@@ -21,6 +21,8 @@ class ComponentExtension {
CompileOption compileOptions //编译选项
Action<? super RepositoryHandler> configure //仓库配置
OnModuleExtensionListener listener //发布监听器
String includes = ""
String excludes = ""
public DebugOption debugOption
public PublicationOption publicationOption
@@ -34,6 +36,29 @@ class ComponentExtension {
debugOption = new DebugOption()
}
/**
* 过滤或者包含功能说明
* 如果只存在include则插件只作用incilude
* 如果只存在exclude则插件默认作用的模块为all modules - exclude
* 如果两者都存在,则取 include
* 如果两则都不存在,则取 exclude 即所有
*/
/**
* 过滤哪些模块,格式为 ':library' 或者 'library' ,多个使用 "," 隔开 比如 "library,:libraryKotlin"
* @param modules
*/
void include(String modules) {
this.includes = modules
}
/**
* 包含哪些模块,格式为 ':library' 或者 'library' ,多个使用 "," 隔开 比如 "library,:libraryKotlin"
* @param modules
*/
void exclude(String modules){
this.excludes = modules
}
/**
* 编译sdk

1
librarywithoutplugin/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,34 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

21
librarywithoutplugin/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,27 @@
package com.plugin.librarywithoutplugin;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.plugin.librarywithoutplugin.test", appContext.getPackageName());
}
}

View File

@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.plugin.librarywithoutplugin" />

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">libraryWithoutPlugin</string>
</resources>

View File

@@ -0,0 +1,17 @@
package com.plugin.librarywithoutplugin;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@@ -1,4 +1,4 @@
include ':app', ':library', ':librarykotlin'
include ':app', ':library', ':librarykotlin', ':librarywithoutplugin'
//调试插件使用