[skip ci] autoUpdate cronet proguard rules
This commit is contained in:
@@ -53,6 +53,25 @@ function write_github_env_variable() {
|
|||||||
echo "$1=$2" >> $GITHUB_ENV
|
echo "$1=$2" >> $GITHUB_ENV
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sync_proguard_rules() {
|
||||||
|
local raw_github_git="https://raw.githubusercontent.com/chromium/chromium/$lastest_cronet_version"
|
||||||
|
local proguard_paths=(
|
||||||
|
base/android/proguard/chromium_code.flags
|
||||||
|
components/cronet/android/cronet_impl_common_proguard.cfg
|
||||||
|
components/cronet/android/cronet_impl_native_proguard.cfg
|
||||||
|
components/cronet/android/cronet_impl_platform_proguard.cfg
|
||||||
|
components/cronet/android/cronet_shared_proguard.cfg
|
||||||
|
)
|
||||||
|
|
||||||
|
local proguard_rules_path="$GITHUB_WORKSPACE/app/cronet_proguard_rules.pro"
|
||||||
|
rm -f proguard_rules_path
|
||||||
|
echo "fetch cronet proguard rules from upstream $raw_github_git"
|
||||||
|
for path in ${proguard_paths[@]}
|
||||||
|
do
|
||||||
|
echo "fetching $path ..."
|
||||||
|
curl "$raw_github_git/$path" >> proguard_rules_path
|
||||||
|
done
|
||||||
|
}
|
||||||
##########
|
##########
|
||||||
# 获取本地cronet版本
|
# 获取本地cronet版本
|
||||||
path=$GITHUB_WORKSPACE/gradle.properties
|
path=$GITHUB_WORKSPACE/gradle.properties
|
||||||
@@ -66,6 +85,8 @@ if version_compare $current_cronet_version $lastest_cronet_version; then
|
|||||||
# 更新gradle.properties
|
# 更新gradle.properties
|
||||||
sed -i s/CronetVersion=.*/CronetVersion=$lastest_cronet_version/ $path
|
sed -i s/CronetVersion=.*/CronetVersion=$lastest_cronet_version/ $path
|
||||||
sed -i s/CronetMainVersion=.*/CronetMainVersion=$lastest_cronet_main_version/ $path
|
sed -i s/CronetMainVersion=.*/CronetMainVersion=$lastest_cronet_main_version/ $path
|
||||||
|
# 更新cronet_proguard_rules.pro
|
||||||
|
sync_proguard_rules
|
||||||
# 添加更新日志
|
# 添加更新日志
|
||||||
sed "15a* 更新cronet: $lastest_cronet_version" -i $GITHUB_WORKSPACE/app/src/main/assets/updateLog.md
|
sed "15a* 更新cronet: $lastest_cronet_version" -i $GITHUB_WORKSPACE/app/src/main/assets/updateLog.md
|
||||||
# 生成pull request信息
|
# 生成pull request信息
|
||||||
|
|||||||
@@ -50,3 +50,4 @@ jobs:
|
|||||||
*cronet.json
|
*cronet.json
|
||||||
*updateLog.md
|
*updateLog.md
|
||||||
gradle.properties
|
gradle.properties
|
||||||
|
cronet_proguard_rules.pro
|
||||||
|
|||||||
+1
-1
@@ -90,7 +90,7 @@ android {
|
|||||||
applicationIdSuffix '.debug'
|
applicationIdSuffix '.debug'
|
||||||
versionNameSuffix 'debug'
|
versionNameSuffix 'debug'
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'cronet_proguard_rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//noinspection GrDeprecatedAPIUsage
|
//noinspection GrDeprecatedAPIUsage
|
||||||
|
|||||||
Vendored
+3
-157
@@ -191,9 +191,11 @@
|
|||||||
-keep class tyrantgit.explosionfield.**{*;}
|
-keep class tyrantgit.explosionfield.**{*;}
|
||||||
-keep class freemarker.**{*;}
|
-keep class freemarker.**{*;}
|
||||||
-keep class com.gyf.barlibrary.** {*;}
|
-keep class com.gyf.barlibrary.** {*;}
|
||||||
|
|
||||||
## JSOUP
|
## JSOUP
|
||||||
-keep class org.jsoup.**{*;}
|
-keep class org.jsoup.**{*;}
|
||||||
-keep class **.xpath.**{*;}
|
-keep class **.xpath.**{*;}
|
||||||
|
-dontwarn org.jspecify.annotations.NullMarked
|
||||||
|
|
||||||
-keep class org.slf4j.**{*;}
|
-keep class org.slf4j.**{*;}
|
||||||
-dontwarn org.slf4j.**
|
-dontwarn org.slf4j.**
|
||||||
@@ -222,7 +224,7 @@
|
|||||||
-keep class org.mozilla.** { *; }
|
-keep class org.mozilla.** { *; }
|
||||||
-dontwarn org.mozilla.javascript.engine.RhinoScriptEngineFactory
|
-dontwarn org.mozilla.javascript.engine.RhinoScriptEngineFactory
|
||||||
|
|
||||||
###EPUB
|
## EPUB
|
||||||
-dontwarn nl.siegmann.epublib.**
|
-dontwarn nl.siegmann.epublib.**
|
||||||
-dontwarn org.xmlpull.**
|
-dontwarn org.xmlpull.**
|
||||||
-keep class nl.siegmann.epublib.**{*;}
|
-keep class nl.siegmann.epublib.**{*;}
|
||||||
@@ -253,162 +255,6 @@
|
|||||||
# 繁简转换
|
# 繁简转换
|
||||||
-keep class com.github.liuyueyi.quick.transfer.** {*;}
|
-keep class com.github.liuyueyi.quick.transfer.** {*;}
|
||||||
|
|
||||||
|
|
||||||
#-------------------Cronet------------------------------------
|
|
||||||
# Contains flags that can be safely shared with Cronet, and thus would be
|
|
||||||
# appropriate for third-party apps to include.
|
|
||||||
|
|
||||||
# Keep all annotation related attributes that can affect runtime
|
|
||||||
-keepattributes RuntimeVisible*Annotations
|
|
||||||
-keepattributes AnnotationDefault
|
|
||||||
|
|
||||||
# Keep the annotations, because if we don't, the ProGuard rules that use them
|
|
||||||
# will not be respected. These classes then show up in our final dex, which we
|
|
||||||
# do not want - see crbug.com/628226.
|
|
||||||
-keep @interface org.chromium.base.annotations.AccessedByNative
|
|
||||||
-keep @interface org.chromium.base.annotations.CalledByNative
|
|
||||||
-keep @interface org.chromium.base.annotations.CalledByNativeUnchecked
|
|
||||||
-keep @interface org.chromium.base.annotations.DoNotInline
|
|
||||||
-keep @interface org.chromium.base.annotations.UsedByReflection
|
|
||||||
-keep @interface org.chromium.base.annotations.IdentifierNameString
|
|
||||||
|
|
||||||
# Android support library annotations will get converted to androidx ones
|
|
||||||
# which we want to keep.
|
|
||||||
-keep @interface androidx.annotation.Keep
|
|
||||||
-keep @androidx.annotation.Keep class *
|
|
||||||
-keepclasseswithmembers,allowaccessmodification class * {
|
|
||||||
@androidx.annotation.Keep <fields>;
|
|
||||||
}
|
|
||||||
-keepclasseswithmembers,allowaccessmodification class * {
|
|
||||||
@androidx.annotation.Keep <methods>;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Keeps for class level annotations.
|
|
||||||
-keep,allowaccessmodification @org.chromium.base.annotations.UsedByReflection class ** {}
|
|
||||||
|
|
||||||
# Keeps for method level annotations.
|
|
||||||
-keepclasseswithmembers,allowaccessmodification class ** {
|
|
||||||
@org.chromium.base.annotations.AccessedByNative <fields>;
|
|
||||||
}
|
|
||||||
-keepclasseswithmembers,includedescriptorclasses,allowaccessmodification class ** {
|
|
||||||
@org.chromium.base.annotations.CalledByNative <methods>;
|
|
||||||
}
|
|
||||||
-keepclasseswithmembers,includedescriptorclasses,allowaccessmodification class ** {
|
|
||||||
@org.chromium.base.annotations.CalledByNativeUnchecked <methods>;
|
|
||||||
}
|
|
||||||
-keepclasseswithmembers,allowaccessmodification class ** {
|
|
||||||
@org.chromium.base.annotations.UsedByReflection <methods>;
|
|
||||||
}
|
|
||||||
-keepclasseswithmembers,allowaccessmodification class ** {
|
|
||||||
@org.chromium.base.annotations.UsedByReflection <fields>;
|
|
||||||
}
|
|
||||||
# Even unused methods kept due to explicit jni registration:
|
|
||||||
# https://crbug.com/688465.
|
|
||||||
-keepclasseswithmembers,includedescriptorclasses,allowaccessmodification class !org.chromium.base.library_loader.**,** {
|
|
||||||
native <methods>;
|
|
||||||
}
|
|
||||||
-keepclasseswithmembernames,includedescriptorclasses,allowaccessmodification class org.chromium.base.library_loader.** {
|
|
||||||
native <methods>;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Use assumevalues block instead of assumenosideeffects block because Google3 proguard cannot parse
|
|
||||||
# assumenosideeffects blocks which overwrite return value.
|
|
||||||
-assumevalues class org.chromium.base.Log {
|
|
||||||
static boolean isDebug() return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Never inline classes, methods, or fields with this annotation, but allow
|
|
||||||
# shrinking and obfuscation.
|
|
||||||
# Relevant to fields when they are needed to store strong references to objects
|
|
||||||
# that are held as weak references by native code.
|
|
||||||
-if @org.chromium.base.annotations.DoNotInline class * {
|
|
||||||
*** *(...);
|
|
||||||
}
|
|
||||||
-keep,allowobfuscation,allowaccessmodification class <1> {
|
|
||||||
*** <2>(...);
|
|
||||||
}
|
|
||||||
-keepclassmembers,allowobfuscation,allowaccessmodification class * {
|
|
||||||
@org.chromium.base.annotations.DoNotInline <methods>;
|
|
||||||
}
|
|
||||||
-keepclassmembers,allowobfuscation,allowaccessmodification class * {
|
|
||||||
@org.chromium.base.annotations.DoNotInline <fields>;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Never merge classes horizontally or vertically with this annotation.
|
|
||||||
# Relevant to classes being used as a key in maps or sets.
|
|
||||||
-keep,allowaccessmodification,allowobfuscation,allowshrinking @org.chromium.base.annotations.DoNotClassMerge class *
|
|
||||||
|
|
||||||
# Keep all CREATOR fields within Parcelable that are kept.
|
|
||||||
-keepclassmembers class org.chromium.** implements android.os.Parcelable {
|
|
||||||
public static *** CREATOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Don't obfuscate Parcelables as they might be marshalled outside Chrome.
|
|
||||||
# If we annotated all Parcelables that get put into Bundles other than
|
|
||||||
# for saveInstanceState (e.g. PendingIntents), then we could actually keep the
|
|
||||||
# names of just those ones. For now, we'll just keep them all.
|
|
||||||
-keepnames,allowaccessmodification class org.chromium.** implements android.os.Parcelable {}
|
|
||||||
|
|
||||||
# Keep all enum values and valueOf methods. See
|
|
||||||
# http://proguard.sourceforge.net/index.html#manual/examples.html
|
|
||||||
# for the reason for this. Also, see http://crbug.com/248037.
|
|
||||||
-keepclassmembers enum org.chromium.** {
|
|
||||||
public static **[] values();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Mark members annotated with IdentifierNameString as identifier name strings
|
|
||||||
-identifiernamestring class * {
|
|
||||||
@org.chromium.base.annotations.IdentifierNameString *;
|
|
||||||
}
|
|
||||||
|
|
||||||
# -identifiernamestring doesn't keep the module impl around, we have to
|
|
||||||
# explicitly keep it.
|
|
||||||
-if @org.chromium.components.module_installer.builder.ModuleInterface interface *
|
|
||||||
-keep,allowobfuscation,allowaccessmodification class * extends <1> {
|
|
||||||
<init>();
|
|
||||||
}
|
|
||||||
# Proguard config for apps that depend on cronet_impl_native_java.jar.
|
|
||||||
|
|
||||||
# This constructor is called using the reflection from Cronet API (cronet_api.jar).
|
|
||||||
-keep class org.chromium.** { *; }
|
|
||||||
-keep class * extends org.chromium.net.CronetProvider{
|
|
||||||
public <init>(android.content.Context);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Suppress unnecessary warnings.
|
|
||||||
-dontnote org.chromium.net.ProxyChangeListener$ProxyReceiver
|
|
||||||
-dontnote org.chromium.net.AndroidKeyStore
|
|
||||||
# Needs 'void setTextAppearance(int)' (API level 23).
|
|
||||||
-dontwarn org.chromium.base.ApiCompatibilityUtils
|
|
||||||
# Needs 'boolean onSearchRequested(android.view.SearchEvent)' (API level 23).
|
|
||||||
-dontwarn org.chromium.base.WindowCallbackWrapper
|
|
||||||
|
|
||||||
# Generated for chrome apk and not included into cronet.
|
|
||||||
-dontwarn org.chromium.base.multidex.ChromiumMultiDexInstaller
|
|
||||||
-dontwarn org.chromium.base.library_loader.LibraryLoader
|
|
||||||
-dontwarn org.chromium.base.SysUtils
|
|
||||||
-dontwarn org.chromium.build.NativeLibraries
|
|
||||||
|
|
||||||
# Objects of this type are passed around by native code, but the class
|
|
||||||
# is never used directly by native code. Since the class is not loaded, it does
|
|
||||||
# not need to be preserved as an entry point.
|
|
||||||
-dontnote org.chromium.net.UrlRequest$ResponseHeadersMap
|
|
||||||
# https://android.googlesource.com/platform/sdk/+/marshmallow-mr1-release/files/proguard-android.txt#54
|
|
||||||
-dontwarn android.support.**
|
|
||||||
|
|
||||||
# Please add these rules to your existing keep rules in order to suppress warnings.
|
|
||||||
# This is generated automatically by the Android Gradle plugin.
|
|
||||||
-dontwarn android.util.StatsEvent$Builder
|
|
||||||
-dontwarn android.util.StatsEvent
|
|
||||||
-dontwarn org.chromium.base.FeatureList
|
|
||||||
-dontwarn org.chromium.base.FeatureMap
|
|
||||||
|
|
||||||
# Please add these rules to your existing keep rules in order to suppress warnings.
|
|
||||||
# This is generated automatically by the Android Gradle plugin.
|
|
||||||
-dontwarn org.jspecify.annotations.NullMarked
|
|
||||||
|
|
||||||
#-------------------Cronet------------------------------------
|
|
||||||
|
|
||||||
# Class.forName调用
|
# Class.forName调用
|
||||||
-keep class io.legado.app.lib.cronet.CronetInterceptor{*;}
|
-keep class io.legado.app.lib.cronet.CronetInterceptor{*;}
|
||||||
-keep class io.legado.app.lib.cronet.CronetLoader{*;}
|
-keep class io.legado.app.lib.cronet.CronetLoader{*;}
|
||||||
|
|||||||
Reference in New Issue
Block a user