Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
LinXueyuanStdio committed Sep 10, 2021
0 parents commit 28130ca
Show file tree
Hide file tree
Showing 93 changed files with 3,280 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties
token.properties
keystore.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
*.iml
.idea/
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/dictionaries
.idea/libraries

# Keystore files
*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# Google Services (e.g. APIs or Firebase)
google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json
apktool/
app/sampledata/
psFiles/
projectFilesBackup/
*.hprof
checksum.txt
RouterDocument/
104 changes: 104 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Library Analysis Gradle Plugin

## 概述

分析各依赖库文件的大小

1. 支持大文件提醒
2. 支持忽略部分依赖库大小(大小显示为灰色)
3. 支持依赖节点大小统计
4. 输出aar的PackageName以及冲突提示
5. 输出依赖库被直接依赖次数(Used)、包含的依赖库数量(Contains)
6. 标识可移除的依赖库(实验性功能)

>可移除的依赖库<br>
例如有这样的依赖关系:A->B->C, A->C,那么A~~->C~~
## 配置

```gradle
buildscript {
repositories {
// ...
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.timecat.plugin:report:#LAST_VERSION'
}
}
apply plugin: 'com.timecat.plugin.report'
libReport {
output = [
"txt", "html" // default
]
ignore = [
"com.android.support:support-v4"
]
log = true
}
```

## 使用

```
gradle libReportReleaseCompileClasspath ...
```

### output

**/build/reports/timecat/analysis/library/compile/Tree.html**

![screenshot](./image/module-list.png)

![screenshot](./image/tree-x.png)

**/build/reports/timecat/analysis/library/compile/Tree.txt**

```
6.050 MB 0 B \--- project :analysis-sample
20.275 KB 20.275 KB +--- com.android.support:multidex:1.0.1
0 B 0 B +--- project :module-library
174 KB 104 KB +--- com.squareup.moshi:moshi:1.2.0
70.328 KB 70.328 KB | \--- com.squareup.okio:okio:1.8.0
199 KB 199 KB +--- com.alibaba:fastjson:1.1.54.android
1.432 MB 1.143 MB +--- com.fasterxml.jackson.core:jackson-databind:2.7.0
49.701 KB 49.701 KB | +--- com.fasterxml.jackson.core:jackson-annotations:2.7.0
246 KB 246 KB | \--- com.fasterxml.jackson.core:jackson-core:2.7.0
314 KB 259 KB +--- com.github.Raizlabs.DBFlow:dbflow:3.1.1
33.072 KB 33.072 KB | +--- com.github.Raizlabs.DBFlow:dbflow-core:3.1.1
21.275 KB 21.275 KB | \--- com.android.support:support-annotations:23.1.1 -> 24.1.0
325 KB 119 KB +--- com.squareup.retrofit:retrofit:1.9.0
206 KB 206 KB | \--- com.google.code.gson:gson:2.3.1
492 KB 86.272 KB +--- com.squareup.retrofit2:retrofit:2.1.0
406 KB 335 KB | \--- com.squareup.okhttp3:okhttp:3.3.0
70.328 KB 70.328 KB | \--- com.squareup.okio:okio:1.8.0
464 KB 464 KB +--- com.github.bumptech.glide:glide:3.7.0
118 KB 118 KB +--- com.squareup.picasso:picasso:2.5.2
1.456 MB 11.842 KB +--- com.facebook.fresco:fresco:0.13.0
200 KB 106 KB | +--- com.facebook.fresco:drawee:0.13.0
0 B 1.167 MB | | +--- com.android.support:support-v4:23.2.1
0 B 21.275 KB | | | \--- com.android.support:support-annotations:23.2.1 -> 24.1.0
93.288 KB 93.288 KB | | \--- com.facebook.fresco:fbcore:0.13.0
93.288 KB 93.288 KB | +--- com.facebook.fresco:fbcore:0.13.0
1.341 MB 1.114 MB | \--- com.facebook.fresco:imagepipeline:0.13.0
0 B 1.167 MB | +--- com.android.support:support-v4:23.2.1
232 KB 102 KB | +--- com.facebook.fresco:imagepipeline-base:0.13.0
0 B 1.167 MB | | +--- com.android.support:support-v4:23.2.1
37.199 KB 37.199 KB | | +--- com.parse.bolts:bolts-tasks:1.4.0
93.288 KB 93.288 KB | | \--- com.facebook.fresco:fbcore:0.13.0
37.199 KB 37.199 KB | +--- com.parse.bolts:bolts-tasks:1.4.0
93.288 KB 93.288 KB | \--- com.facebook.fresco:fbcore:0.13.0
18.699 KB 18.699 KB +--- com.jakewharton.timber:timber:4.3.0
1.111 MB 9.466 KB +--- io.reactivex:rxandroid:1.2.1
1.102 MB 1.102 MB | \--- io.reactivex:rxjava:1.1.6 -> 1.3.0
1.102 MB 1.102 MB +--- io.reactivex:rxjava:1.3.0
54.464 KB 16.989 KB +--- com.jakewharton:butterknife:8.4.0
37.475 KB 16.199 KB | +--- com.jakewharton:butterknife-annotations:8.4.0
21.275 KB 21.275 KB | | \--- com.android.support:support-annotations:24.1.0
21.275 KB 21.275 KB | \--- com.android.support:support-annotations:24.1.0
9.570 KB 9.570 KB +--- com.jakewharton.scalpel:scalpel:1.1.2
3.603 KB 3.603 KB \--- com.jakewharton:process-phoenix:1.0.2
...
```
1 change: 1 addition & 0 deletions analysis-sample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
79 changes: 79 additions & 0 deletions analysis-sample/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apply plugin: 'com.android.application'
//apply plugin: 'com.timecat.plugin.report'
//apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-android-extensions'

android {
compileSdk 30

defaultConfig {
applicationId "com.timecat.android.analysis.sample"
minSdkVersion 9
targetSdkVersion 29
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:multidex:1.0.1'
implementation project(":module-library")

implementation 'com.squareup.moshi:moshi:1.2.0'
implementation 'com.alibaba:fastjson:1.1.54.android'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.7.0'

implementation "com.github.Raizlabs.DBFlow:dbflow:3.1.1"

implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'

implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.facebook.fresco:fresco:0.13.0'

implementation 'com.jakewharton.timber:timber:4.3.0'

implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.3.0'
// implementation 'io.reactivex.rxjava2:rxjava:2.0.0-RC2'

implementation 'com.jakewharton:butterknife:8.4.0'
implementation 'com.jakewharton.scalpel:scalpel:1.1.2'
implementation 'com.jakewharton:process-phoenix:1.0.2'

androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})

testImplementation 'junit:junit:4.12'
}

//libReport {
//// log = true
//// fullTree = true
//// output = [
//// "txt", "html"
//// ]
// ignore = [
// "com.android.support:support-v4"
// ]
//}
17 changes: 17 additions & 0 deletions analysis-sample/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\sdk\Android/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.timecat.android.analysis.sample;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.timecat.android.analysis.sample", appContext.getPackageName());
}
}
20 changes: 20 additions & 0 deletions analysis-sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timecat.android.analysis.sample">

<application
android:name="com.timecat.android.analysis.sample.DemoApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true">
<activity android:name="com.timecat.android.analysis.sample.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

</manifest>
Loading

0 comments on commit 28130ca

Please sign in to comment.