diff --git a/example/build.gradle b/example/build.gradle index cb01d02..7b55298 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -12,6 +12,7 @@ buildscript { } ext { plugin_version = upload_version + enableMinify = true } dependencies { classpath "com.bytedance.android.byteX:base-plugin:${plugin_version}" @@ -35,6 +36,15 @@ android { compileSdkVersion 28 buildToolsVersion "29.0.0" + signingConfigs { + release { + keyAlias 'bytex' + keyPassword 'bytex-example' + storeFile project.file("bytex.keystore") + storePassword 'bytex-example' + } + } + flavorDimensions "app", "mode" productFlavors { douyin { @@ -62,15 +72,17 @@ android { buildTypes { release { - minifyEnabled true + minifyEnabled enableMinify multiDexEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.release } debug { - minifyEnabled true + minifyEnabled enableMinify multiDexEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.release } } @@ -85,3 +97,29 @@ dependencies { implementation "com.bytedance.android.byteX:coverage-lib:${plugin_version}" } apply from: project.file('plugin-bytex.gradle') + +Set assembles = new HashSet<>() +assembles.add("assembleDouyinCnDebug") +assembles.add("assembleDouyinCnRelease") +assembles.add("assembleDouyinI18nDebug") +assembles.add("assembleDouyinI18nRelease") +assembles.add("assembleBytexCnDebug") +assembles.add("assembleBytexCnRelease") +assembles.add("assembleBytexI18nDebug") +assembles.add("assembleBytexI18nRelease") +project.gradle + .startParameter + .taskRequests + .stream() + .flatMap() { it.args.stream() } + .filter { it.contains("assemble") } + .map { it.toLowerCase() } + .forEach { + if (!( + (it.contains("douyin") || it.contains("bytex")) && + (it.contains("cn") || it.contains("i18n")) && + (it.contains("release") || it.contains("debug")) + )) { + throw new IllegalArgumentException(assembles.join(",") + " supportted only") + } + } diff --git a/example/bytex.keystore b/example/bytex.keystore new file mode 100644 index 0000000..e67cd2d Binary files /dev/null and b/example/bytex.keystore differ diff --git a/example/plugin-bytex.gradle b/example/plugin-bytex.gradle index e64119f..8cac437 100644 --- a/example/plugin-bytex.gradle +++ b/example/plugin-bytex.gradle @@ -118,11 +118,13 @@ shrinkR { } } -apply plugin: 'bytex.getter_setter_inline' -getter_setter_inline { - enable pluginEnable - enableInDebug pluginEnableInDebug - logLevel pluginLogLevel +if (enableMinify) { + apply plugin: 'bytex.getter_setter_inline' + getter_setter_inline { + enable pluginEnable + enableInDebug pluginEnableInDebug + logLevel pluginLogLevel + } } apply plugin: 'bytex.closeable_checker' @@ -252,7 +254,7 @@ field_assign_opt { apply plugin: 'bytex.sourcefile' SourceFile { enable pluginEnable - enableInDebug pluginEnableInDebug +// enableInDebug pluginEnableInDebug logLevel pluginLogLevel deleteSourceFile true deleteLineNumber true diff --git a/example/src/main/res/layout/activity_main.xml b/example/src/main/res/layout/activity_main.xml index 84f1951..075fc00 100644 --- a/example/src/main/res/layout/activity_main.xml +++ b/example/src/main/res/layout/activity_main.xml @@ -9,7 +9,7 @@