Skip to content

Commit 1a5ec0f

Browse files
author
yangzhiqian
committed
fix sample
1 parent f9a0b80 commit 1a5ec0f

File tree

4 files changed

+49
-9
lines changed

4 files changed

+49
-9
lines changed

example/build.gradle

+40-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ buildscript {
1212
}
1313
ext {
1414
plugin_version = upload_version
15+
enableMinify = true
1516
}
1617
dependencies {
1718
classpath "com.bytedance.android.byteX:base-plugin:${plugin_version}"
@@ -35,6 +36,15 @@ android {
3536
compileSdkVersion 28
3637
buildToolsVersion "29.0.0"
3738

39+
signingConfigs {
40+
release {
41+
keyAlias 'bytex'
42+
keyPassword 'bytex-example'
43+
storeFile project.file("bytex.keystore")
44+
storePassword 'bytex-example'
45+
}
46+
}
47+
3848
flavorDimensions "app", "mode"
3949
productFlavors {
4050
douyin {
@@ -62,15 +72,17 @@ android {
6272

6373
buildTypes {
6474
release {
65-
minifyEnabled true
75+
minifyEnabled enableMinify
6676
multiDexEnabled true
6777
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
78+
signingConfig signingConfigs.release
6879
}
6980

7081
debug {
71-
minifyEnabled true
82+
minifyEnabled enableMinify
7283
multiDexEnabled true
7384
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
85+
signingConfig signingConfigs.release
7486

7587
}
7688
}
@@ -85,3 +97,29 @@ dependencies {
8597
implementation "com.bytedance.android.byteX:coverage-lib:${plugin_version}"
8698
}
8799
apply from: project.file('plugin-bytex.gradle')
100+
101+
Set<String> assembles = new HashSet<>()
102+
assembles.add("assembleDouyinCnDebug")
103+
assembles.add("assembleDouyinCnRelease")
104+
assembles.add("assembleDouyinI18nDebug")
105+
assembles.add("assembleDouyinI18nRelease")
106+
assembles.add("assembleBytexCnDebug")
107+
assembles.add("assembleBytexCnRelease")
108+
assembles.add("assembleBytexI18nDebug")
109+
assembles.add("assembleBytexI18nRelease")
110+
project.gradle
111+
.startParameter
112+
.taskRequests
113+
.stream()
114+
.flatMap() { it.args.stream() }
115+
.filter { it.contains("assemble") }
116+
.map { it.toLowerCase() }
117+
.forEach {
118+
if (!(
119+
(it.contains("douyin") || it.contains("bytex")) &&
120+
(it.contains("cn") || it.contains("i18n")) &&
121+
(it.contains("release") || it.contains("debug"))
122+
)) {
123+
throw new IllegalArgumentException(assembles.join(",") + " supportted only")
124+
}
125+
}

example/bytex.keystore

2.01 KB
Binary file not shown.

example/plugin-bytex.gradle

+8-6
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,13 @@ shrinkR {
118118
}
119119
}
120120

121-
apply plugin: 'bytex.getter_setter_inline'
122-
getter_setter_inline {
123-
enable pluginEnable
124-
enableInDebug pluginEnableInDebug
125-
logLevel pluginLogLevel
121+
if (enableMinify) {
122+
apply plugin: 'bytex.getter_setter_inline'
123+
getter_setter_inline {
124+
enable pluginEnable
125+
enableInDebug pluginEnableInDebug
126+
logLevel pluginLogLevel
127+
}
126128
}
127129

128130
apply plugin: 'bytex.closeable_checker'
@@ -252,7 +254,7 @@ field_assign_opt {
252254
apply plugin: 'bytex.sourcefile'
253255
SourceFile {
254256
enable pluginEnable
255-
enableInDebug pluginEnableInDebug
257+
// enableInDebug pluginEnableInDebug
256258
logLevel pluginLogLevel
257259
deleteSourceFile true
258260
deleteLineNumber true

example/src/main/res/layout/activity_main.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<TextView
1010
android:layout_width="wrap_content"
1111
android:layout_height="wrap_content"
12-
android:text="Hello World!"
12+
android:text="ByteX Sample!"
1313
app:layout_constraintBottom_toBottomOf="parent"
1414
app:layout_constraintLeft_toLeftOf="parent"
1515
app:layout_constraintRight_toRightOf="parent"

0 commit comments

Comments
 (0)