├── analysis-sample ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── styles.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── dimens.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── zen │ │ │ │ └── android │ │ │ │ └── analysis │ │ │ │ └── sample │ │ │ │ ├── DemoApplication.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── InitManager.java │ │ │ │ └── BaseActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── zen │ │ │ └── android │ │ │ └── analysis │ │ │ └── sample │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── zen │ │ └── android │ │ └── analysis │ │ └── sample │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── kotlin-sample ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── styles.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── dimens.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── layout │ │ │ │ └── activity_main.xml │ │ │ └── values-w820dp │ │ │ │ └── dimens.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── zen │ │ │ │ └── android │ │ │ │ └── kotlin │ │ │ │ └── sample │ │ │ │ └── MainActivity.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── zen │ │ │ └── android │ │ │ └── analysis │ │ │ └── sample │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── zen │ │ └── android │ │ └── analysis │ │ └── sample │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── module-library ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── zen │ │ │ └── android │ │ │ └── lib │ │ │ └── report │ │ │ └── module │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── zen │ │ └── android │ │ └── lib │ │ └── report │ │ └── module │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── image ├── tree.png ├── tree-x.png └── module-list.png ├── .gitignore ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── gradle-mvn-push.gradle ├── plugin ├── src │ ├── main │ │ ├── resources │ │ │ ├── META-INF │ │ │ │ └── gradle-plugins │ │ │ │ │ └── com.zen.lib.analysis.properties │ │ │ └── com │ │ │ │ └── zen │ │ │ │ └── plugin │ │ │ │ └── lib │ │ │ │ └── analysis │ │ │ │ ├── css │ │ │ │ ├── z │ │ │ │ │ ├── img │ │ │ │ │ │ ├── aar.png │ │ │ │ │ │ ├── jar.png │ │ │ │ │ │ ├── line_conn.gif │ │ │ │ │ │ ├── loading.gif │ │ │ │ │ │ ├── zTreeStandard.gif │ │ │ │ │ │ └── zTreeStandard.png │ │ │ │ │ └── ztree.css │ │ │ │ └── demo.css │ │ │ │ ├── support.html │ │ │ │ ├── Tree.html │ │ │ │ └── js │ │ │ │ ├── cytoscape-dagre.js │ │ │ │ └── jquery.ztree.core.min.js │ │ └── groovy │ │ │ └── com │ │ │ └── zen │ │ │ └── plugin │ │ │ └── lib │ │ │ └── analysis │ │ │ ├── util │ │ │ ├── Logger.groovy │ │ │ ├── Timer.groovy │ │ │ ├── FileUtils.groovy │ │ │ ├── ResourceUtils.groovy │ │ │ └── PackageChecker.groovy │ │ │ ├── model │ │ │ ├── FileInfo.groovy │ │ │ ├── Node.groovy │ │ │ ├── FileDictionary.groovy │ │ │ └── Library.groovy │ │ │ ├── ext │ │ │ ├── LimitSizeConfig.groovy │ │ │ └── LibraryAnalysisExtension.groovy │ │ │ ├── render │ │ │ ├── HtmlRenderer.groovy │ │ │ ├── OutputModuleList.groovy │ │ │ └── TextRenderer.groovy │ │ │ ├── LibraryAnalysisPlugin.groovy │ │ │ ├── convert │ │ │ └── NodeConvert.groovy │ │ │ └── task │ │ │ └── DependencyTreeReportTask.groovy │ └── test │ │ └── groovy │ │ └── com │ │ └── zen │ │ └── plugin │ │ └── lib │ │ └── analysis │ │ ├── task │ │ └── DependencyTreeReportTaskTest.groovy │ │ ├── mock │ │ ├── BaseGenerator.groovy │ │ └── DependencyGenerator.groovy │ │ ├── render │ │ └── TextRendererTest.groovy │ │ ├── convert │ │ └── NodeConvertTest.groovy │ │ ├── util │ │ └── ResourceUtilsTest.groovy │ │ ├── model │ │ ├── DependencyTestBase.groovy │ │ ├── LibraryTest.groovy │ │ └── FileDictionaryTest.groovy │ │ └── ext │ │ └── LibraryAnalysisExtensionTest.groovy └── build.gradle ├── settings.gradle ├── .travis.yml ├── gradle.properties ├── jacoco.gradle ├── gradlew.bat ├── README.md └── gradlew /analysis-sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /kotlin-sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /module-library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /kotlin-sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /analysis-sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /image/tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/image/tree.png -------------------------------------------------------------------------------- /image/tree-x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/image/tree-x.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea/ 3 | .gradle/ 4 | build/ 5 | *.log 6 | local.properties 7 | *.ipr 8 | *.iws -------------------------------------------------------------------------------- /image/module-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/image/module-list.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /module-library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | module-library 3 | 4 | -------------------------------------------------------------------------------- /plugin/src/main/resources/META-INF/gradle-plugins/com.zen.lib.analysis.properties: -------------------------------------------------------------------------------- 1 | implementation-class=com.zen.plugin.lib.analysis.LibraryAnalysisPlugin -------------------------------------------------------------------------------- /kotlin-sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/kotlin-sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /kotlin-sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/kotlin-sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /module-library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /analysis-sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/analysis-sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /analysis-sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/analysis-sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /analysis-sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/analysis-sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /kotlin-sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/kotlin-sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /kotlin-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/kotlin-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /kotlin-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/kotlin-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /analysis-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/analysis-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /analysis-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/analysis-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/aar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/aar.png -------------------------------------------------------------------------------- /plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/jar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/jar.png -------------------------------------------------------------------------------- /plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/line_conn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/line_conn.gif -------------------------------------------------------------------------------- /plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/loading.gif -------------------------------------------------------------------------------- /kotlin-sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AnalysisSample 3 | Success 4 | Fail! 5 | 6 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/zTreeStandard.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/zTreeStandard.gif -------------------------------------------------------------------------------- /plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/zTreeStandard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znyang/library-analysis/HEAD/plugin/src/main/resources/com/zen/plugin/lib/analysis/css/z/img/zTreeStandard.png -------------------------------------------------------------------------------- /analysis-sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AnalysisSample 3 | Success 4 | Fail! 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=http\://services.gradle.org/distributions/gradle-4.4-all.zip 6 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | if(VERSION_NAME.endsWith("-SNAPSHOT")){ 2 | include ':analysis-sample', ':module-library' 3 | include ':kotlin-sample' 4 | } 5 | // Sets the output JAR filename 6 | rootProject.name = 'library-analysis-gradle-plugin' 7 | include 'plugin' -------------------------------------------------------------------------------- /analysis-sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /analysis-sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /kotlin-sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /kotlin-sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /plugin/src/test/groovy/com/zen/plugin/lib/analysis/task/DependencyTreeReportTaskTest.groovy: -------------------------------------------------------------------------------- 1 | package com.zen.plugin.lib.analysis.task; 2 | 3 | /** 4 | * @author zen 5 | * @version 2016/9/11 6 | */ 7 | 8 | class DependencyTreeReportTaskTest { 9 | 10 | 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | 5 | before_install: 6 | - chmod +x gradlew 7 | - export JAVA8_HOME=/usr/lib/jvm/java-8-oracle 8 | - export JAVA_HOME=$JAVA8_HOME 9 | - export ENV_CI=true 10 | 11 | script: ./gradlew :plugin:clean :plugin:build :plugin:jacocoReport --info --stacktrace 12 | 13 | after_success: 14 | - bash <(curl -s https://codecov.io/bash) -------------------------------------------------------------------------------- /kotlin-sample/src/main/java/com/zen/android/kotlin/sample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.zen.android.kotlin.sample 2 | 3 | import android.app.Activity 4 | import android.os.Bundle 5 | 6 | class MainActivity : Activity() { 7 | 8 | override fun onCreate(savedInstanceState: Bundle?) { 9 | super.onCreate(savedInstanceState) 10 | setContentView(R.layout.activity_main) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /kotlin-sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /kotlin-sample/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /analysis-sample/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /analysis-sample/src/main/java/com/zen/android/analysis/sample/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.zen.android.analysis.sample; 2 | 3 | import android.app.Application; 4 | 5 | /** 6 | * @author zen 7 | * @version 2016/9/13 8 | */ 9 | 10 | public class DemoApplication extends Application { 11 | 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | 16 | InitManager.initLazy(this); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/com/zen/plugin/lib/analysis/util/Logger.groovy: -------------------------------------------------------------------------------- 1 | package com.zen.plugin.lib.analysis.util; 2 | 3 | /** 4 | * @author zen 5 | * @version 2016/9/10 6 | */ 7 | 8 | class Logger { 9 | 10 | static Logger D = new Logger() 11 | static Logger W = new Logger() 12 | 13 | private Logger() { 14 | } 15 | 16 | void log(def message) { 17 | print "LibReport " 18 | println message 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/com/zen/plugin/lib/analysis/model/FileInfo.groovy: -------------------------------------------------------------------------------- 1 | package com.zen.plugin.lib.analysis.model 2 | /** 3 | * Node 4 | * 5 | * @author yangz 6 | * @version 2016/7/8 7 | */ 8 | class FileInfo { 9 | String id 10 | long size 11 | String type 12 | File file 13 | 14 | FileInfo(String id, long size, String type, File file) { 15 | this.id = id 16 | this.size = size 17 | this.type = type 18 | this.file = file 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/com/zen/plugin/lib/analysis/util/Timer.groovy: -------------------------------------------------------------------------------- 1 | package com.zen.plugin.lib.analysis.util; 2 | 3 | /** 4 | * @author zen 5 | * @version 2016/9/10 6 | */ 7 | 8 | class Timer { 9 | 10 | long start 11 | 12 | Timer() { 13 | start = System.currentTimeMillis() 14 | } 15 | 16 | void mark(Logger logger, String message) { 17 | long now = System.currentTimeMillis() 18 | logger?.log "${message ?: ""} cost ${now - start}ms" 19 | start = now 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /module-library/src/test/java/com/zen/android/lib/report/module/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.zen.android.lib.report.module; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | 14 | @Test 15 | public void addition_isCorrect() { 16 | assertEquals(4, 2 + 2); 17 | } 18 | } -------------------------------------------------------------------------------- /plugin/src/test/groovy/com/zen/plugin/lib/analysis/mock/BaseGenerator.groovy: -------------------------------------------------------------------------------- 1 | package com.zen.plugin.lib.analysis.mock 2 | 3 | import org.gmock.GMockController 4 | import org.gradle.api.tasks.diagnostics.internal.graph.nodes.RenderableDependency 5 | 6 | import java.util.concurrent.atomic.AtomicInteger 7 | 8 | /** 9 | * @author zen 10 | * @version 2016/9/11 11 | */ 12 | class BaseGenerator { 13 | 14 | protected final GMockController gmc 15 | 16 | BaseGenerator(GMockController gmc) { 17 | this.gmc = gmc 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /plugin/src/test/groovy/com/zen/plugin/lib/analysis/render/TextRendererTest.groovy: -------------------------------------------------------------------------------- 1 | package com.zen.plugin.lib.analysis.render 2 | 3 | import org.junit.Assert 4 | import org.junit.Test 5 | 6 | /** 7 | * 8 | * @author: zen 9 | * date: 2017/4/14 0014. 10 | */ 11 | class TextRendererTest { 12 | 13 | @Test 14 | void testTextAlign() { 15 | def content = "123" 16 | def target = " 123" 17 | def aligned = TextRenderer.textAlign(content, 9) 18 | Assert.assertEquals(aligned, target) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /analysis-sample/src/test/java/com/zen/android/analysis/sample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.zen.android.analysis.sample; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /kotlin-sample/src/test/java/com/zen/android/analysis/sample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.zen.android.analysis.sample; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /kotlin-sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /kotlin-sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\sdk\Android/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /analysis-sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\sdk\Android/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /analysis-sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | GROUP=com.github.znyang 2 | VERSION_NAME=0.2.2 3 | 4 | POM_ARTIFACT_ID=library-analysis 5 | POM_NAME=Library Analysis Gradle Plugin 6 | POM_PACKAGING=jar 7 | 8 | POM_DESCRIPTION=A Gradle plugin for analysis library 9 | POM_INCEPTION_YEAR=2016 10 | 11 | POM_URL=http://github.com/znyang/library-analysis-gradle-plugin/ 12 | POM_SCM_URL=http://github.com/znyang/library-analysis-gradle-plugin/ 13 | POM_SCM_CONNECTION=scm:git:git@github.com:znyang/library-analysis-gradle-plugin.git 14 | POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com:znyang/library-analysis-gradle-plugin.git 15 | 16 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 17 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 18 | POM_LICENCE_DIST=repo 19 | 20 | POM_DEVELOPER_ID=zen 21 | POM_DEVELOPER_NAME=ZenYang Software, Inc. -------------------------------------------------------------------------------- /plugin/src/main/groovy/com/zen/plugin/lib/analysis/ext/LimitSizeConfig.groovy: -------------------------------------------------------------------------------- 1 | package com.zen.plugin.lib.analysis.ext; 2 | 3 | /** 4 | * @author zen 5 | * @version 2016/6/21 6 | */ 7 | class LimitSizeConfig { 8 | 9 | static final long DEFAULT_LIB_SIZE_LIMIT = 1024 * 1024; 10 | static final long DEFAULT_FILE_SIZE_LIMIT = 100 * 1024; 11 | 12 | private long fileSize = DEFAULT_FILE_SIZE_LIMIT; 13 | private long libSize = DEFAULT_LIB_SIZE_LIMIT; 14 | 15 | public long getFileSize() { 16 | return fileSize; 17 | } 18 | 19 | public void setFileSize(long fileSize) { 20 | this.fileSize = fileSize; 21 | } 22 | 23 | public long getLibSize() { 24 | return libSize; 25 | } 26 | 27 | public void setLibSize(long libSize) { 28 | this.libSize = libSize; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /module-library/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 | -------------------------------------------------------------------------------- /module-library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 25 5 | 6 | defaultConfig { 7 | minSdkVersion 9 8 | targetSdkVersion 25 9 | versionCode 1 10 | versionName "1.0" 11 | 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | 14 | } 15 | 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | 28 | testImplementation 'junit:junit:4.12' 29 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 30 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 31 | } 32 | -------------------------------------------------------------------------------- /module-library/src/androidTest/java/com/zen/android/lib/report/module/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.zen.android.lib.report.module; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getTargetContext(); 24 | 25 | assertEquals("com.zen.android.lib.report.module.test", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /plugin/src/test/groovy/com/zen/plugin/lib/analysis/convert/NodeConvertTest.groovy: -------------------------------------------------------------------------------- 1 | package com.zen.plugin.lib.analysis.convert 2 | 3 | import com.zen.plugin.lib.analysis.model.DependencyTestBase 4 | import com.zen.plugin.lib.analysis.model.Library 5 | 6 | /** 7 | * 8 | * @author: zen 9 | * date: 2017/6/26 0026. 10 | */ 11 | class NodeConvertTest extends DependencyTestBase { 12 | 13 | void testConvert() { 14 | play { 15 | prePlay() 16 | 17 | long start = System.currentTimeMillis() 18 | Library output = Library.create(root, fileDic) 19 | def node = NodeConvert.convert(output, NodeConvert.Args.get(fileDic)) 20 | long cost = System.currentTimeMillis() - start 21 | 22 | System.out.println("${cost}ms") 23 | assertTrue(cost < 500) 24 | 25 | printLibrary(output, "") 26 | printNode(node, "") 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /kotlin-sample/src/androidTest/java/com/zen/android/analysis/sample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.zen.android.analysis.sample; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.zen.android.analysis.sample", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /analysis-sample/src/androidTest/java/com/zen/android/analysis/sample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.zen.android.analysis.sample; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.zen.android.analysis.sample", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/zen/plugin/lib/analysis/support.html: -------------------------------------------------------------------------------- 1 |
2 | Star 4 | 5 | Fork 8 | 9 | Issue 12 |
13 |
14 | 15 | 16 | 17 |
-------------------------------------------------------------------------------- /plugin/src/test/groovy/com/zen/plugin/lib/analysis/util/ResourceUtilsTest.groovy: -------------------------------------------------------------------------------- 1 | package com.zen.plugin.lib.analysis.util 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * @author zen 7 | * @version 2016/9/11 8 | */ 9 | class ResourceUtilsTest { 10 | 11 | private static final SEP = File.separator 12 | 13 | @Test 14 | public void testCopyResources() { 15 | def target = ".${SEP}build${SEP}test${SEP}" 16 | def path = new File(target).absolutePath 17 | println path 18 | 19 | ResourceUtils.copyResources(path) 20 | 21 | ResourceUtils.RESOURCE_FILES.each { 22 | def file = new File(target, it) 23 | assert file.exists() 24 | // if (file.isFile()) { 25 | // assert !file.text.equals("null") 26 | // } 27 | } 28 | } 29 | 30 | @Test 31 | public void testGetTemplate() { 32 | //assert !ResourceUtils.getTemplateFileContent("Tree.html").isEmpty() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/com/zen/plugin/lib/analysis/util/FileUtils.groovy: -------------------------------------------------------------------------------- 1 | package com.zen.plugin.lib.analysis.util; 2 | 3 | /** 4 | * @author zen 5 | * @version 2016/6/5 6 | */ 7 | class FileUtils { 8 | 9 | static String convertFileSize(long size) { 10 | long kb = 1024 11 | long mb = kb * 1024 12 | long gb = mb * 1024 13 | 14 | if (size >= gb) { 15 | String.format("%.3f GB", (float) size / gb) 16 | } else if (size >= mb) { 17 | float f = (float) size / mb 18 | String.format(f > 100 ? "%.0f MB" : "%.3f MB", f) 19 | } else if (size >= kb) { 20 | float f = (float) size / kb; 21 | String.format(f > 100 ? "%.0f KB" : "%.3f KB", f) 22 | } else { 23 | String.format("%d B", size) 24 | } 25 | } 26 | 27 | static String getFileType(String fileName) { 28 | int index = fileName.lastIndexOf(".") 29 | if (index >= 0) { 30 | return fileName.substring(index + 1) 31 | } 32 | fileName 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /analysis-sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 19 | 20 |