File tree Expand file tree Collapse file tree
src/main/groovy/cn/hx/plugin/junkcode/task Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ apply plugin: 'com.getkeepsafe.dexcount'
77apply plugin : ' kotlin-kapt'
88
99android {
10- compileSdkVersion 31
10+ compileSdkVersion 33
1111
1212 defaultConfig {
1313 applicationId " cn.hx.plugin.junkcode.demo"
1414 minSdkVersion 16
15- targetSdkVersion 31
15+ targetSdkVersion 33
1616 versionCode 1
1717 versionName " 1.0"
1818 multiDexEnabled true
@@ -25,6 +25,7 @@ android {
2525 buildTypes {
2626 release {
2727 minifyEnabled true
28+ shrinkResources true
2829 proguardFiles getDefaultProguardFile(' proguard-android-optimize.txt' ), ' proguard-rules.pro'
2930 }
3031 }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ buildscript {
1111 classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
1212 classpath " com.getkeepsafe.dexcount:dexcount-gradle-plugin:3.0.1"
1313 if (PLUGIN_ENABLE . toBoolean()) {
14- classpath " com.github.qq549631030:android-junk-code:1.2.0 "
14+ classpath " com.github.qq549631030:android-junk-code:1.2.1 "
1515 }
1616 // NOTE: Do not place your application dependencies here; they belong
1717 // in the individual module build.gradle files
Original file line number Diff line number Diff line change 11# project
22GROUP =com.github.qq549631030
3- VERSION_NAME =1.2.0
3+ VERSION_NAME =1.2.1
44
55POM_ARTIFACT_ID =android-junk-code
66POM_NAME =AndroidJunkCode
Original file line number Diff line number Diff line change @@ -181,6 +181,7 @@ class AndroidJunkCodeTask extends DefaultTask {
181181 stringList. add(" ${ config.resPrefix.toLowerCase()}${ generateName(i)} " )
182182 }
183183 generateStringsFile()
184+ generateKeep()
184185 }
185186
186187 /**
@@ -235,6 +236,14 @@ class AndroidJunkCodeTask extends DefaultTask {
235236 writeStringToFile(stringFile, sb. toString())
236237 }
237238
239+ void generateKeep () {
240+ def keepFile = new File (outDir, " res/raw/keep.xml" )
241+ StringBuilder sb = new StringBuilder ()
242+ sb. append(" <resources xmlns:tools=\" http://schemas.android.com/tools\"\n " +
243+ " tools:keep=\" @layout/${ config.resPrefix} *, @drawable/${ config.resPrefix} *\" />\n " )
244+ writeStringToFile(keepFile, sb. toString())
245+ }
246+
238247 private void writeJavaFile (JavaFile javaFile ) {
239248 def outputDirectory = new File (outDir, " java" ). toPath()
240249 if (! javaFile. packageName. isEmpty()) {
You can’t perform that action at this time.
0 commit comments