├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── demo.keystore ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── io │ │ └── github │ │ └── lizhangqu │ │ └── app │ │ ├── App.java │ │ └── MainActivity.java │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ └── activity_main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── buildSrc ├── .gitignore ├── build.gradle ├── gradle.properties └── src │ └── main │ ├── groovy │ └── io │ │ └── github │ │ └── lizhangqu │ │ └── veridex │ │ ├── VeridexHelper.groovy │ │ ├── VeridexList.groovy │ │ ├── VeridexPlugin.groovy │ │ └── VeridexResult.groovy │ └── resources │ ├── META-INF │ └── gradle-plugins │ │ └── veridex.properties │ └── veridex │ ├── hiddenapi-flags.csv │ ├── org.apache.http.legacy-stubs.zip │ ├── system-stubs.zip │ ├── veridex-linux │ └── veridex-mac ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /.idea 3 | /.gradle 4 | *.iml 5 | local.properties 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### plugin veridex 2 | 3 | ``` 4 | buildscript { 5 | repositories { 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath "io.github.lizhangqu:plugin-veridex:1.0.1" 10 | } 11 | } 12 | 13 | apply plugin: 'veridex' 14 | ``` 15 | 16 | Execute veridex gradle task 17 | 18 | ``` 19 | gradlew veridexDebug 20 | #or gradlew veridexRelease 21 | ``` 22 | 23 | Example output 24 | 25 | ``` 26 | #1: Reflection greylist Landroid/content/res/Resources;->mResourcesImpl use(s): 27 | Landroid/support/v7/app/ResourcesFlusher;->flushNougats(Landroid/content/res/Resources;)Z 28 | 29 | #2: Reflection greylist Landroid/graphics/FontFamily;->abortCreation use(s): 30 | Landroid/support/v4/graphics/TypefaceCompatApi26Impl;->()V 31 | 32 | #3: Reflection greylist Landroid/graphics/FontFamily;->addFontFromAssetManager use(s): 33 | Landroid/support/v4/graphics/TypefaceCompatApi26Impl;->()V 34 | 35 | #4: Reflection greylist Landroid/graphics/FontFamily;->addFontFromBuffer use(s): 36 | Landroid/support/v4/graphics/TypefaceCompatApi26Impl;->()V 37 | 38 | #5: Reflection greylist Landroid/graphics/FontFamily;->freeze use(s): 39 | Landroid/support/v4/graphics/TypefaceCompatApi26Impl;->()V 40 | 41 | #6: Reflection greylist Landroid/graphics/Typeface;->createFromFamiliesWithDefault use(s): 42 | Landroid/support/v4/graphics/TypefaceCompatApi24Impl;->()V 43 | Landroid/support/v4/graphics/TypefaceCompatApi26Impl;->()V 44 | 45 | #7: Reflection greylist Landroid/os/Bundle;->getIBinder use(s): 46 | Landroid/support/v4/app/BundleCompat$BundleCompatBaseImpl;->getBinder(Landroid/os/Bundle;Ljava/lang/String;)Landroid/os/IBinder; 47 | 48 | #8: Reflection greylist Landroid/os/Bundle;->putIBinder use(s): 49 | Landroid/support/v4/app/BundleCompat$BundleCompatBaseImpl;->putBinder(Landroid/os/Bundle;Ljava/lang/String;Landroid/os/IBinder;)V 50 | 51 | #9: Reflection greylist Landroid/view/LayoutInflater;->mFactory2 use(s): 52 | Landroid/support/v4/view/LayoutInflaterCompat;->forceSetFactory2(Landroid/view/LayoutInflater;Landroid/view/LayoutInflater$Factory2;)V 53 | 54 | #10: Reflection greylist Landroid/view/View;->computeFitSystemWindows use(s): 55 | Landroid/support/v7/widget/ViewUtils;->()V 56 | 57 | #11: Reflection greylist Landroid/view/View;->mAccessibilityDelegate use(s): 58 | Landroid/support/v4/view/ViewCompat$ViewCompatBaseImpl;->hasAccessibilityDelegate(Landroid/view/View;)Z 59 | 60 | #12: Reflection greylist-max-p Landroid/view/View;->mMinHeight use(s): 61 | Landroid/support/v4/view/ViewCompat$ViewCompatBaseImpl;->getMinimumHeight(Landroid/view/View;)I 62 | 63 | #13: Reflection greylist-max-p Landroid/view/View;->mMinWidth use(s): 64 | Landroid/support/v4/view/ViewCompat$ViewCompatBaseImpl;->getMinimumWidth(Landroid/view/View;)I 65 | 66 | #14: Reflection greylist Landroid/view/View;->mRecreateDisplayList use(s): 67 | Landroid/support/v4/widget/SlidingPaneLayout$SlidingPanelLayoutImplJB;->()V 68 | 69 | #15: Reflection greylist-max-p Landroid/view/animation/Animation;->mListener use(s): 70 | Landroid/support/v4/app/FragmentManagerImpl;->getAnimationListener(Landroid/view/animation/Animation;)Landroid/view/animation/Animation$AnimationListener; 71 | 72 | #16: Reflection greylist Landroid/widget/AbsListView;->mIsChildViewEnabled use(s): 73 | Landroid/support/v7/widget/DropDownListView;->(Landroid/content/Context;Z)V 74 | 75 | #17: Reflection greylist-max-p Landroid/widget/AutoCompleteTextView;->doAfterTextChanged use(s): 76 | Landroid/support/v7/widget/SearchView$AutoCompleteTextViewReflector;->()V 77 | 78 | #18: Reflection greylist-max-p Landroid/widget/AutoCompleteTextView;->doBeforeTextChanged use(s): 79 | Landroid/support/v7/widget/SearchView$AutoCompleteTextViewReflector;->()V 80 | 81 | #19: Reflection greylist-max-p Landroid/widget/AutoCompleteTextView;->ensureImeVisible use(s): 82 | Landroid/support/v7/widget/SearchView$AutoCompleteTextViewReflector;->()V 83 | 84 | #20: Reflection greylist Landroid/widget/CompoundButton;->mButtonDrawable use(s): 85 | Landroid/support/v4/widget/CompoundButtonCompat$CompoundButtonCompatBaseImpl;->getButtonDrawable(Landroid/widget/CompoundButton;)Landroid/graphics/drawable/Drawable; 86 | 87 | #21: Reflection greylist-max-p Landroid/widget/PopupWindow;->mOverlapAnchor use(s): 88 | Landroid/support/v4/widget/PopupWindowCompat$PopupWindowCompatApi21Impl;->()V 89 | 90 | #22: Reflection greylist-max-p Landroid/widget/TextView;->getHorizontallyScrolling use(s): 91 | Landroid/support/v7/widget/AppCompatTextViewAutoSizeHelper;->autoSizeText()V 92 | 93 | #23: Reflection greylist Landroid/widget/TextView;->getLayoutAlignment use(s): 94 | Landroid/support/v7/widget/AppCompatTextViewAutoSizeHelper;->suggestedSizeFitsInSpace(ILandroid/graphics/RectF;)Z 95 | 96 | #24: Reflection greylist Landroid/widget/TextView;->mMaxMode use(s): 97 | Landroid/support/v4/widget/TextViewCompat$TextViewCompatBaseImpl;->getMaxLines(Landroid/widget/TextView;)I 98 | 99 | #25: Reflection greylist Landroid/widget/TextView;->mMaximum use(s): 100 | Landroid/support/v4/widget/TextViewCompat$TextViewCompatBaseImpl;->getMaxLines(Landroid/widget/TextView;)I 101 | Landroid/support/v4/widget/TextViewCompat$TextViewCompatBaseImpl;->getMaxLines(Landroid/widget/TextView;)I 102 | 103 | #26: Reflection greylist Landroid/widget/TextView;->mMinMode use(s): 104 | Landroid/support/v4/widget/TextViewCompat$TextViewCompatBaseImpl;->getMinLines(Landroid/widget/TextView;)I 105 | 106 | #27: Reflection greylist Landroid/widget/TextView;->mMinimum use(s): 107 | Landroid/support/v4/widget/TextViewCompat$TextViewCompatBaseImpl;->getMinLines(Landroid/widget/TextView;)I 108 | Landroid/support/v4/widget/TextViewCompat$TextViewCompatBaseImpl;->getMinLines(Landroid/widget/TextView;)I 109 | 110 | #28: Reflection greylist Landroid/widget/TextView;->nullLayouts use(s): 111 | Landroid/support/v7/widget/AppCompatTextViewAutoSizeHelper;->setRawTextSize(F)V 112 | 113 | #29: Reflection greylist Llibcore/icu/ICU;->addLikelySubtags use(s): 114 | Landroid/support/v4/text/ICUCompat;->()V 115 | 116 | 29 hidden API(s) used: 0 linked against, 29 through reflection 117 | 21 in greylist 118 | 0 in blacklist 119 | 0 in greylist-max-o 120 | 8 in greylist-max-p 121 | To run an analysis that can give more reflection accesses, 122 | but could include false positives, pass the --imprecise flag. 123 | ``` 124 | 125 | ### Thanks 126 | 127 | - [appcompat](https://android.googlesource.com/platform/prebuilts/runtime/+/master/appcompat) -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'veridex' 3 | 4 | android { 5 | compileSdkVersion 28 6 | buildToolsVersion "28.0.3" 7 | useLibrary 'org.apache.http.legacy' 8 | 9 | defaultConfig { 10 | applicationId "io.github.lizhangqu.app" 11 | minSdkVersion 14 12 | targetSdkVersion 27 13 | versionCode 1 14 | versionName "1.0" 15 | } 16 | 17 | signingConfigs { 18 | release { 19 | keyAlias 'demo' 20 | keyPassword '123456' 21 | storeFile project.file('demo.keystore') 22 | storePassword '123456' 23 | } 24 | } 25 | buildTypes { 26 | debug { 27 | debuggable true 28 | signingConfig signingConfigs.release 29 | minifyEnabled false 30 | } 31 | release { 32 | debuggable false 33 | signingConfig signingConfigs.release 34 | minifyEnabled true 35 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 36 | } 37 | } 38 | 39 | compileOptions { 40 | sourceCompatibility JavaVersion.VERSION_1_8 41 | targetCompatibility JavaVersion.VERSION_1_8 42 | } 43 | } 44 | 45 | dependencies { 46 | compile fileTree(dir: 'libs', include: ['*.jar']) 47 | compile 'com.android.support:appcompat-v7:27.1.1' 48 | compile 'com.android.support.constraint:constraint-layout:1.1.3' 49 | } 50 | -------------------------------------------------------------------------------- /app/demo.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/app/demo.keystore -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lizhangqu/app/App.java: -------------------------------------------------------------------------------- 1 | package io.github.lizhangqu.app; 2 | 3 | import android.app.Application; 4 | import android.content.res.Resources; 5 | 6 | /** 7 | * @author lizhangqu 8 | * @version V1.0 9 | * @since 2018-11-08 17:08 10 | */ 11 | public class App extends Application { 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/lizhangqu/app/MainActivity.java: -------------------------------------------------------------------------------- 1 | package io.github.lizhangqu.app; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | import java.io.IOException; 7 | 8 | /** 9 | * @author lizhangqu 10 | * @version V1.0 11 | * @since 2018-11-08 17:08 12 | */ 13 | public class MainActivity extends AppCompatActivity { 14 | 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.activity_main); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | App 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { 4 | url 'https://maven.aliyun.com/repository/public' 5 | } 6 | maven { 7 | url 'https://maven.aliyun.com/repository/central' 8 | } 9 | maven { 10 | url 'https://maven.aliyun.com/repository/gradle-plugin' 11 | } 12 | maven { 13 | url 'https://maven.aliyun.com/repository/google' 14 | } 15 | maven { 16 | url 'https://maven.aliyun.com/repository/jcenter' 17 | } 18 | maven { 19 | url 'https://dl.google.com/dl/android/maven2/' 20 | } 21 | jcenter() 22 | mavenCentral() 23 | mavenLocal() 24 | } 25 | dependencies { 26 | File localFile = project.rootProject.file('local.properties') 27 | Properties extProperties = new Properties() 28 | if (localFile.exists()) { 29 | extProperties.load(localFile.newDataInputStream()) 30 | } 31 | def androidGradlePluginVersion = "3.2.1" 32 | if (extProperties.containsKey('gradleVersion')) { 33 | androidGradlePluginVersion = extProperties.get("gradleVersion") as String 34 | } 35 | if (project.hasProperty('gradleVersion')) { 36 | androidGradlePluginVersion = project.getProperties().get("gradleVersion") as String 37 | } 38 | project.logger.error "root build.gradle androidGradlePluginVersion ${androidGradlePluginVersion}" 39 | 40 | classpath "com.android.tools.build:gradle:${androidGradlePluginVersion}" 41 | } 42 | } 43 | 44 | allprojects { 45 | repositories { 46 | maven { 47 | url 'https://maven.aliyun.com/repository/public' 48 | } 49 | maven { 50 | url 'https://maven.aliyun.com/repository/central' 51 | } 52 | maven { 53 | url 'https://maven.aliyun.com/repository/gradle-plugin' 54 | } 55 | maven { 56 | url 'https://maven.aliyun.com/repository/google' 57 | } 58 | maven { 59 | url 'https://maven.aliyun.com/repository/jcenter' 60 | } 61 | maven { 62 | url 'https://dl.google.com/dl/android/maven2/' 63 | } 64 | jcenter() 65 | mavenCentral() 66 | mavenLocal() 67 | } 68 | } 69 | 70 | task clean(type: Delete) { 71 | delete rootProject.buildDir 72 | } 73 | -------------------------------------------------------------------------------- /buildSrc/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build -------------------------------------------------------------------------------- /buildSrc/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'groovy' 2 | apply plugin: 'java' 3 | 4 | repositories { 5 | maven { 6 | url 'https://maven.aliyun.com/repository/public' 7 | } 8 | maven { 9 | url 'https://maven.aliyun.com/repository/central' 10 | } 11 | maven { 12 | url 'https://maven.aliyun.com/repository/gradle-plugin' 13 | } 14 | maven { 15 | url 'https://maven.aliyun.com/repository/google' 16 | } 17 | maven { 18 | url 'https://maven.aliyun.com/repository/jcenter' 19 | } 20 | maven { 21 | url 'https://dl.google.com/dl/android/maven2/' 22 | } 23 | jcenter() 24 | mavenCentral() 25 | mavenLocal() 26 | } 27 | 28 | dependencies { 29 | compile localGroovy() 30 | compile gradleApi() 31 | 32 | File localFile = project.rootProject.file('../local.properties') 33 | Properties extProperties = new Properties() 34 | if (!localFile.exists()) { 35 | localFile = project.rootProject.file('local.properties') 36 | } 37 | if (localFile.exists()) { 38 | extProperties.load(localFile.newDataInputStream()) 39 | } 40 | def androidGradlePluginVersion = "3.2.1" 41 | if (extProperties.containsKey('gradleVersion')) { 42 | androidGradlePluginVersion = extProperties.get("gradleVersion") as String 43 | } 44 | if (project.hasProperty('gradleVersion')) { 45 | androidGradlePluginVersion = project.getProperties().get("gradleVersion") as String 46 | } 47 | project.logger.error "buildSrc build.gradle androidGradlePluginVersion ${androidGradlePluginVersion}" 48 | 49 | compile "com.android.tools.build:gradle:${androidGradlePluginVersion}" 50 | 51 | compile 'org.javassist:javassist:3.20.0-GA' 52 | } 53 | 54 | buildscript { 55 | repositories { 56 | maven { 57 | url 'https://maven.aliyun.com/repository/public' 58 | } 59 | maven { 60 | url 'https://maven.aliyun.com/repository/central' 61 | } 62 | maven { 63 | url 'https://maven.aliyun.com/repository/gradle-plugin' 64 | } 65 | maven { 66 | url 'https://maven.aliyun.com/repository/google' 67 | } 68 | maven { 69 | url 'https://maven.aliyun.com/repository/jcenter' 70 | } 71 | maven { 72 | url 'https://dl.google.com/dl/android/maven2/' 73 | } 74 | jcenter() 75 | mavenCentral() 76 | mavenLocal() 77 | } 78 | dependencies { 79 | classpath 'io.github.lizhangqu:core-publish:1.4.0' 80 | } 81 | configurations.all { 82 | it.resolutionStrategy.cacheDynamicVersionsFor(5, 'minutes') 83 | it.resolutionStrategy.cacheChangingModulesFor(0, 'seconds') 84 | } 85 | } 86 | 87 | group = "io.github.lizhangqu" 88 | archivesBaseName = "plugin-veridex" 89 | apply plugin: 'android.publish' 90 | 91 | pom { 92 | exclude "com.android.tools.build:gradle" 93 | } 94 | -------------------------------------------------------------------------------- /buildSrc/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_DESCRIPTION=veridex plugin 2 | POM_LICENSE=Apache-2.0 3 | POM_LICENSE_URL=https://opensource.org/licenses/Apache-2.0 4 | POM_WEBSITE_URL=https://github.com/lizhangqu/plugin-veridex 5 | POM_VCS_URL=https://github.com/lizhangqu/plugin-veridex.git 6 | POM_ISSUE_URL=https://github.com/lizhangqu/plugin-veridex/issues 7 | POM_DEVELOPER_ID=lizhangqu 8 | POM_DEVELOPER_NAME=lizhangqu 9 | POM_DEVELOPER_EMAIL=li330324@gmail.com 10 | release.bintray=true 11 | 12 | version=1.0.2-SNAPSHOT 13 | ###latest release version=1.0.1 14 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/io/github/lizhangqu/veridex/VeridexHelper.groovy: -------------------------------------------------------------------------------- 1 | package io.github.lizhangqu.veridex 2 | 3 | import org.apache.commons.io.FilenameUtils 4 | import org.gradle.api.Action 5 | import org.gradle.api.Project 6 | import org.apache.tools.ant.taskdefs.condition.Os 7 | import org.gradle.process.ExecResult 8 | import org.gradle.process.ExecSpec 9 | import org.gradle.util.GFileUtils 10 | 11 | import java.util.regex.Matcher 12 | import java.util.regex.Pattern 13 | 14 | 15 | /** 16 | * @author lizhangqu 17 | */ 18 | class VeridexHelper { 19 | Project project 20 | 21 | VeridexHelper(Project project) { 22 | this.project = project 23 | } 24 | 25 | public void execute(File filePath) { 26 | if (filePath == null || !filePath.exists()) { 27 | project.logger.error("filePath == null or not exist") 28 | return 29 | } 30 | File veridexFile = getVeridexFile() 31 | File apacheStubsFile = getApacheStubsFile() 32 | File systemStubsFile = getSystemStubsFile() 33 | File hiddenApiFlagFile = getHiddenApiFlagFile() 34 | if (veridexFile == null || apacheStubsFile == null || systemStubsFile == null || hiddenApiFlagFile == null) { 35 | project.logger.error("file == null") 36 | return 37 | } 38 | if (!veridexFile.exists() || !apacheStubsFile.exists() || !systemStubsFile.exists() || !hiddenApiFlagFile.exists()) { 39 | project.logger.error("file not exist") 40 | return 41 | } 42 | 43 | project.logger.error("veridex current file: ${filePath}") 44 | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream() 45 | ExecResult execResult = project.exec(new Action() { 46 | @Override 47 | void execute(ExecSpec execSpec) { 48 | execSpec.executable veridexFile 49 | execSpec.args("--core-stubs=${apacheStubsFile.getAbsolutePath()}:${systemStubsFile.getAbsolutePath()}") 50 | execSpec.args("--api-flags=${hiddenApiFlagFile.getAbsolutePath()}") 51 | execSpec.args("--dex-file=${filePath.getAbsolutePath()}") 52 | execSpec.standardOutput byteArrayOutputStream 53 | } 54 | }) 55 | 56 | VeridexList veridexList = new VeridexList() 57 | 58 | Pattern pattern = Pattern.compile('^#(?\\d+):\\s(?.*)\\s(?.*)\\s(?.*)\\suse\\(s\\):$') 59 | new BufferedReader(new StringReader(byteArrayOutputStream.toString())).withReader { reader -> 60 | String line = reader.readLine()?.trim() 61 | if (line?.startsWith("To run an analysis that can give more reflection accesses,")) { 62 | return 63 | } 64 | if (line?.startsWith("but could include false positives, pass the --imprecise flag.")) { 65 | return 66 | } 67 | while (line?.startsWith("#")) { 68 | Matcher matcher = pattern.matcher(line) 69 | if (matcher.matches()) { 70 | int number = matcher.group("number")?.toInteger() 71 | String reflectionOrLinking = matcher.group("reflectionOrLinking") 72 | boolean reflection = (reflectionOrLinking == "Reflection") 73 | boolean linking = (reflectionOrLinking == "Linking") 74 | String type = matcher.group("type") 75 | String callee = matcher.group("callee") 76 | 77 | VeridexResult result = new VeridexResult() 78 | result.setNumber(number) 79 | result.setReflection(reflection) 80 | result.setLinking(linking) 81 | result.setType(type) 82 | result.setCallee(callee) 83 | String caller = reader.readLine()?.trim() 84 | while (caller != null && caller.length() > 0) { 85 | result.addCaller(caller) 86 | caller = reader.readLine()?.trim() 87 | } 88 | veridexList.add(result) 89 | line = reader.readLine()?.trim() 90 | } 91 | } 92 | } 93 | 94 | project.logger.error("${veridexList.getReport()}") 95 | } 96 | 97 | 98 | public File getVeridexFile() { 99 | String filePath = null 100 | if (Os.isFamily(Os.FAMILY_MAC)) { 101 | filePath = "veridex/veridex-mac" 102 | } else if (Os.isFamily(Os.FAMILY_UNIX)) { 103 | filePath = "veridex/veridex-linux" 104 | } else if (Os.isFamily(Os.FAMILY_WINDOWS)) { 105 | return null 106 | } 107 | return getFileFromResource(filePath) 108 | } 109 | 110 | public File getApacheStubsFile() { 111 | return getFileFromResource("veridex/org.apache.http.legacy-stubs.zip") 112 | } 113 | 114 | public File getSystemStubsFile() { 115 | return getFileFromResource("veridex/system-stubs.zip") 116 | } 117 | 118 | 119 | public File getHiddenApiFlagFile() { 120 | return getFileFromResource("veridex/hiddenapi-flags.csv") 121 | } 122 | 123 | private File getFileFromResource(String resourcePath) { 124 | if (resourcePath == null) { 125 | return null 126 | } 127 | try { 128 | URL url = this.getClass().getClassLoader().getResource(resourcePath) 129 | if (url != null) { 130 | File file = new File(url.getFile()) 131 | if (file.isFile() && file.exists()) { 132 | file.setExecutable(true) 133 | return file 134 | } 135 | //取jar包中的文件 136 | URL jarUrl = this.getClass().getProtectionDomain().getCodeSource().getLocation() 137 | if (jarUrl != null) { 138 | File jarFile = new File(jarUrl.getFile()) 139 | File jarFolder = new File(jarFile.getParentFile(), 140 | FilenameUtils.getBaseName(jarFile.getName())) 141 | GFileUtils.mkdirs(jarFolder) 142 | file = new File(jarFolder, resourcePath) 143 | GFileUtils.mkdirs(file.getParentFile()) 144 | if (file.isFile() && file.exists()) { 145 | file.setExecutable(true) 146 | return file 147 | } 148 | //否则解压 149 | new FileOutputStream(file).withStream { 150 | def inputStream = this.getClass().getClassLoader().getResourceAsStream(resourcePath) 151 | it.write(inputStream.getBytes()) 152 | } 153 | file.setExecutable(true) 154 | return file 155 | } 156 | } 157 | } catch (Exception e) { 158 | e.printStackTrace() 159 | } 160 | return null 161 | } 162 | 163 | 164 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/io/github/lizhangqu/veridex/VeridexList.groovy: -------------------------------------------------------------------------------- 1 | package io.github.lizhangqu.veridex 2 | 3 | 4 | /** 5 | * @author lizhangqu 6 | */ 7 | class VeridexList extends ArrayList { 8 | public String getReport() { 9 | StringBuilder stringBuilder = new StringBuilder() 10 | int number = 0 11 | int linked = 0 12 | int reflection = 0 13 | Map count = new TreeMap<>() 14 | this.each { 15 | number++ 16 | if (it.reflection) { 17 | reflection++ 18 | } 19 | if (it.linking) { 20 | linked++ 21 | } 22 | stringBuilder.append("#${it.number}: ${it.reflection ? "Reflection" : (it.linking ? "Linking" : "Unknown")} ${it.type} ${it.callee} use(s):\n") 23 | it.caller?.each { 24 | stringBuilder.append(" ${it}\n") 25 | } 26 | if (it.caller?.size() > 0) { 27 | stringBuilder.append("\n") 28 | } 29 | if (!count.containsKey(it.type)) { 30 | count.put(it.type, 1) 31 | } else { 32 | count.put(it.type, count.get(it.type) + 1) 33 | } 34 | } 35 | stringBuilder.append("${number} hidden API(s) used: ${linked} linked against, ${reflection} through reflection\n") 36 | if (!count.containsKey("blacklist")) { 37 | count.put("blacklist", 0) 38 | } 39 | if (!count.containsKey("blacklist,core-platform-api")) { 40 | count.put("blacklist,core-platform-api", 0) 41 | } 42 | if (!count.containsKey("greylist")) { 43 | count.put("greylist", 0) 44 | } 45 | if (!count.containsKey("greylist-max-o")) { 46 | count.put("greylist-max-o", 0) 47 | } 48 | if (!count.containsKey("greylist-max-p")) { 49 | count.put("greylist-max-p", 0) 50 | } 51 | if (!count.containsKey("greylist,core-platform-api")) { 52 | count.put("greylist,core-platform-api", 0) 53 | } 54 | count?.each { 55 | stringBuilder.append(" ${it.value} in ${it.key}\n") 56 | } 57 | return stringBuilder.toString() 58 | } 59 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/io/github/lizhangqu/veridex/VeridexPlugin.groovy: -------------------------------------------------------------------------------- 1 | package io.github.lizhangqu.veridex 2 | 3 | import com.android.build.gradle.api.BaseVariant 4 | import com.android.build.gradle.internal.pipeline.TransformTask 5 | import groovy.io.FileType 6 | import org.gradle.api.Plugin 7 | import org.gradle.api.Project 8 | import org.gradle.api.Task 9 | import org.gradle.api.tasks.TaskCollection 10 | 11 | /** 12 | * @author lizhangqu 13 | */ 14 | class VeridexPlugin implements Plugin { 15 | 16 | @SuppressWarnings("UnnecessaryQualifiedReference") 17 | @Override 18 | void apply(Project project) { 19 | if (!project.plugins.hasPlugin('com.android.application')) { 20 | return 21 | } 22 | 23 | def variants = null; 24 | if (project.plugins.hasPlugin('com.android.application')) { 25 | variants = project.android.getApplicationVariants() 26 | } else if (project.plugins.hasPlugin('com.android.library')) { 27 | variants = project.android.getLibraryVariants() 28 | } 29 | 30 | VeridexHelper veridexHelper = new VeridexHelper(project) 31 | variants?.all { BaseVariant variant -> 32 | def variantName = variant.getName() 33 | project.tasks.create("veridex${variantName.capitalize()}") { 34 | setGroup("veridex") 35 | dependsOn project.tasks.findByName("assemble${variantName.capitalize()}") 36 | doLast { 37 | def mergeNativeLibsTask = VeridexPlugin.findMergeNativeLibsTask(project, variantName) 38 | Map bundles = new HashMap<>() 39 | mergeNativeLibsTask?.getOutputs()?.files?.each { 40 | if (it.isFile()) { 41 | VeridexPlugin.collectBundle(project, it, bundles) 42 | } else if (it.isDirectory()) { 43 | it.eachFileRecurse(FileType.FILES) { 44 | VeridexPlugin.collectBundle(project, it, bundles) 45 | } 46 | } 47 | } 48 | bundles.each { String md5, File bundleFile -> 49 | veridexHelper.execute(bundleFile) 50 | } 51 | 52 | File apkFile = VeridexPlugin.getApkFile(project, variant) 53 | veridexHelper.execute(apkFile) 54 | } 55 | } 56 | 57 | } 58 | } 59 | 60 | static File getApkFile(Project project, BaseVariant variant) { 61 | def variantData = variant.getMetaClass().getProperty(variant, 'variantData') 62 | def variantScope = variantData.getScope() 63 | try { 64 | //>=3.3.0 65 | String taskName = variantScope.getTaskContainer().getPackageAndroidTask().getName() 66 | def packageApplication = project.getTasks().findByName(taskName) 67 | return new File(packageApplication.getOutputDirectory(), packageApplication.getMetaClass().getProperty(packageApplication, "outputScope").getMainSplit().getOutputFileName() - '-unaligned') 68 | } catch (Exception e) { 69 | 70 | } 71 | 72 | try { 73 | //>=3.0.0 74 | def packageApplication = variant.getPackageApplication() 75 | return new File(packageApplication.getOutputDirectory(), packageApplication.getMetaClass().getProperty(packageApplication, "outputScope").getMainSplit().getOutputFileName() - '-unaligned') 76 | } catch (Exception e) { 77 | 78 | } 79 | 80 | try { 81 | //>=2.3.3 82 | File apkFile = variantData.getOutputs().get(0).getScope().getFinalPackage() 83 | return new File(apkFile.getAbsolutePath() - "-unaligned") 84 | } catch (Exception e1) { 85 | 86 | } 87 | try { 88 | //>=2.2.3 89 | File apkFile = variantData.getOutputs().get(0).getScope().getFinalApk() 90 | return new File(apkFile.getAbsolutePath() - "-unaligned") 91 | } catch (Exception e2) { 92 | 93 | } 94 | try { 95 | //<2.2.3 96 | File apkFile = variantData.getOutputs().get(0).getScope().getPackageApk() 97 | return new File(apkFile.getAbsolutePath() - "-unaligned") 98 | } catch (Exception e3) { 99 | } 100 | 101 | return null 102 | } 103 | 104 | static boolean collectBundle(Project project, File file, Map bundles) { 105 | if (file.getParentFile().getName() != 'zip-cache' && isBundle(file)) { 106 | String bundleMd5 = file.withInputStream { 107 | //noinspection UnnecessaryQualifiedReference 108 | new java.security.DigestInputStream(it, java.security.MessageDigest.getInstance('MD5')).withStream { 109 | it.eachByte {} 110 | it.messageDigest.digest().encodeHex() as String 111 | } 112 | } 113 | bundles.put(bundleMd5, file) 114 | return true 115 | } 116 | return false 117 | } 118 | 119 | static Task findMergeNativeLibsTask(Project project, String variantName) { 120 | def mergeNativeLibsTask = findTransformTaskByTransformName(project, variantName, "mergeJniLibs") 121 | if (mergeNativeLibsTask == null) { 122 | mergeNativeLibsTask = project.getTasks().findByName(("merge${variantName.capitalize()}NativeLibs")) 123 | } 124 | return mergeNativeLibsTask 125 | } 126 | 127 | static Task findTransformTaskByTransformName(Project project, String variantName, String name) { 128 | TaskCollection transformTasks = project.getTasks().withType(TransformTask.class) 129 | Task transformTask = null 130 | transformTasks.each { 131 | if (it.getVariantName() == variantName && it.getTransform().getName() == name) { 132 | transformTask = it 133 | } 134 | } 135 | return transformTask 136 | } 137 | 138 | static boolean isBundle(File file) { 139 | if (file == null) { 140 | return false 141 | } 142 | if (file.length() < 4) { 143 | return false 144 | } 145 | FileInputStream fileInputStream = null 146 | try { 147 | fileInputStream = new FileInputStream(file) 148 | byte[] buffer = new byte[4]; 149 | int read = fileInputStream.read(buffer, 0, 4) 150 | //0x504b0304 151 | if (read == 4 152 | && buffer[0] == (byte) 0x50 153 | && buffer[1] == (byte) 0x4b 154 | && buffer[2] == (byte) 0x03 155 | && buffer[3] == (byte) 0x04) { 156 | return true 157 | } 158 | } catch (IOException e) { 159 | e.printStackTrace() 160 | } finally { 161 | fileInputStream?.close() 162 | } 163 | return false 164 | } 165 | 166 | } -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/io/github/lizhangqu/veridex/VeridexResult.groovy: -------------------------------------------------------------------------------- 1 | package io.github.lizhangqu.veridex 2 | 3 | 4 | /** 5 | * @author lizhangqu 6 | */ 7 | class VeridexResult { 8 | int number 9 | boolean linking 10 | boolean reflection 11 | String type 12 | String callee 13 | Set caller 14 | 15 | VeridexResult() { 16 | this.caller = new HashSet<>() 17 | } 18 | 19 | int getNumber() { 20 | return number 21 | } 22 | 23 | void setNumber(int number) { 24 | this.number = number 25 | } 26 | 27 | String getType() { 28 | return type 29 | } 30 | 31 | void setType(String type) { 32 | this.type = type 33 | } 34 | 35 | String getCallee() { 36 | return callee 37 | } 38 | 39 | void setCallee(String callee) { 40 | this.callee = callee 41 | } 42 | 43 | Set getCaller() { 44 | return caller 45 | } 46 | 47 | void addCaller(String caller) { 48 | this.caller.add(caller) 49 | } 50 | 51 | boolean isLinking() { 52 | return linking 53 | } 54 | 55 | void setLinking(boolean linking) { 56 | this.linking = linking 57 | } 58 | 59 | boolean isReflection() { 60 | return reflection 61 | } 62 | 63 | void setReflection(boolean reflection) { 64 | this.reflection = reflection 65 | } 66 | 67 | 68 | @Override 69 | public String toString() { 70 | return "VeridexResult{" + 71 | "number=" + number + 72 | ", linking=" + linking + 73 | ", reflection=" + reflection + 74 | ", type='" + type + '\'' + 75 | ", callee='" + callee + '\'' + 76 | ", caller=" + caller + 77 | '}'; 78 | } 79 | } -------------------------------------------------------------------------------- /buildSrc/src/main/resources/META-INF/gradle-plugins/veridex.properties: -------------------------------------------------------------------------------- 1 | implementation-class=io.github.lizhangqu.veridex.VeridexPlugin -------------------------------------------------------------------------------- /buildSrc/src/main/resources/veridex/org.apache.http.legacy-stubs.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/buildSrc/src/main/resources/veridex/org.apache.http.legacy-stubs.zip -------------------------------------------------------------------------------- /buildSrc/src/main/resources/veridex/system-stubs.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/buildSrc/src/main/resources/veridex/system-stubs.zip -------------------------------------------------------------------------------- /buildSrc/src/main/resources/veridex/veridex-linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/buildSrc/src/main/resources/veridex/veridex-linux -------------------------------------------------------------------------------- /buildSrc/src/main/resources/veridex/veridex-mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/buildSrc/src/main/resources/veridex/veridex-mac -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | android.enableBuildScriptClasspathCheck=false 2 | 3 | release.bintray=true 4 | #flutter.sdk=/Users/lizhangqu/Library/Flutter/v1.0.0/flutter -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizhangqu/plugin-veridex/b031dd973a71b54424e22c3edba67899ee0d64eb/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 13 13:54:35 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn ( ) { 37 | echo "$*" 38 | } 39 | 40 | die ( ) { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save ( ) { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':buildSrc' 2 | include ':app' 3 | --------------------------------------------------------------------------------