├── .gitignore
├── BlockIndigo.iml
├── LICENSE
├── README.md
├── block_demo
├── .gitignore
├── block_demo.iml
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── dodola
│ │ └── block
│ │ └── demo
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── dodola
│ │ │ └── block
│ │ │ └── demo
│ │ │ ├── FragmentPagerActivity.java
│ │ │ ├── MainActivity.java
│ │ │ └── WatcherApplication.java
│ └── res
│ │ ├── layout
│ │ ├── activity_anr_test.xml
│ │ ├── activity_main.xml
│ │ └── activity_scroll.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
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── dodola
│ └── block
│ └── demo
│ └── ExampleUnitTest.java
├── blockindigo
├── .gitignore
├── blockindigo.iml
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── dodola
│ └── blockindigo
│ ├── ANRAnalysis.java
│ ├── BlockIndigo.java
│ └── ChoreographerAnalysis.java
├── blockindigo_.iml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 |
19 | # Local configuration file (sdk path, etc)
20 | local.properties
21 |
22 | # Proguard folder generated by Eclipse
23 | proguard/
24 |
25 | # Log Files
26 | *.log
27 |
28 | # Android Studio Navigation editor temp files
29 | .navigation/
30 |
31 | # Android Studio captures folder
32 | captures/
33 |
34 | .idea
35 | .idea/
36 |
--------------------------------------------------------------------------------
/BlockIndigo.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 dodola
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # blockindigo
2 |
3 | ##简介
4 |
5 | 之前在Blockcanary的issue里讨论过,使用Blockcanary监测细粒度的卡顿会产生很多日志。
6 | 另一方面Blockcanary和我们项目里所使用的日志系统有冲突。
7 |
8 | 所以直接把Blockcanary的日志采样机制和UI拿过来写了这个,是的你没有看错。
9 |
10 | 在此之前一直使用Debug的MethodTrace进行分析,好像会有效率问题,放弃使用了。
11 |
12 | 框架的原理使用的是黄油项...(Project Butter) 中的`Choreographer`来监测类似界面绘制时候的丢帧(Skipped Frame)情况。
13 |
14 | 原理具体可以参照:http://bugly.qq.com/blog/?p=166
15 |
16 | ##使用
17 | ```groovy
18 |
19 | repositories {
20 | maven {
21 | url "http://dl.bintray.com/dodola/maven"
22 | }
23 | }
24 |
25 | compile 'com.dodola:blockindigo:1.0'
26 | ```
27 |
28 | ```java
29 | public class WatcherApplication extends Application {
30 | @Override
31 | public void onCreate() {
32 | super.onCreate();
33 | BlockIndigo.install(this, new BlockCanaryContext());
34 | }
35 | }
36 | public class FragmentPagerActivity extends AppCompatActivity {
37 |
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | setContentView(R.layout.activity_scroll);
42 |
43 | BlockIndigo.get().start(this);
44 | }
45 |
46 | @Override
47 | protected void onDestroy() {
48 | super.onDestroy();
49 | BlockIndigo.get().stop();
50 | }
51 |
52 | }
53 |
54 | ```
55 |
56 |
57 | ##相关项目
58 | [blockcanary](https://github.com/moduth/blockcanary)
59 | [leakcanary](https://github.com/square/leakcanary)
60 |
61 |
--------------------------------------------------------------------------------
/block_demo/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/block_demo/block_demo.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | generateDebugSources
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/block_demo/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Baidu, Inc. All Rights Reserved.
3 | */
4 | apply plugin: 'com.android.application'
5 | repositories {
6 | maven {
7 | url "http://dl.bintray.com/dodola/maven"
8 | }
9 | }
10 | android {
11 | compileSdkVersion 'Google Inc.:Google APIs:23'
12 | buildToolsVersion "23.0.2"
13 |
14 | defaultConfig {
15 | applicationId "dodola.block.demo"
16 | minSdkVersion 18
17 | targetSdkVersion 23
18 | versionCode 1
19 | versionName "1.0"
20 | }
21 | buildTypes {
22 | release {
23 | minifyEnabled false
24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25 | }
26 | }
27 | }
28 |
29 | dependencies {
30 | compile fileTree(include: ['*.jar'], dir: 'libs')
31 | testCompile 'junit:junit:4.12'
32 | compile 'com.android.support:appcompat-v7:23.+'
33 | // compile 'com.dodola:blockindigo:1.0'
34 | compile project(':blockindigo')
35 | }
36 |
--------------------------------------------------------------------------------
/block_demo/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 /Users/baidu/Library/Android/sdk/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 |
--------------------------------------------------------------------------------
/block_demo/src/androidTest/java/dodola/block/demo/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Baidu, Inc. All Rights Reserved.
3 | */
4 | package dodola.block.demo;
5 |
6 | import android.app.Application;
7 | import android.test.ApplicationTestCase;
8 |
9 | /**
10 | * Testing Fundamentals
11 | */
12 | public class ApplicationTest extends ApplicationTestCase {
13 | public ApplicationTest() {
14 | super(Application.class);
15 | }
16 | }
--------------------------------------------------------------------------------
/block_demo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
6 |
7 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/block_demo/src/main/java/dodola/block/demo/FragmentPagerActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Baidu, Inc. All Rights Reserved.
3 | */
4 | package dodola.block.demo;
5 |
6 | import java.util.Random;
7 |
8 | import android.graphics.Color;
9 | import android.os.Bundle;
10 | import android.support.v4.app.Fragment;
11 | import android.support.v4.app.FragmentActivity;
12 | import android.support.v4.app.FragmentManager;
13 | import android.support.v4.app.FragmentPagerAdapter;
14 | import android.support.v4.view.ViewPager;
15 | import android.support.v7.app.AppCompatActivity;
16 | import android.view.LayoutInflater;
17 | import android.view.View;
18 | import android.view.ViewGroup;
19 | import android.widget.LinearLayout;
20 |
21 | import dodola.blockindigo.BlockIndigo;
22 |
23 | public class FragmentPagerActivity extends AppCompatActivity {
24 | static final int NUM_ITEMS = 10;
25 | MyAdapter mAdapter;
26 | ViewPager mPager;
27 |
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.activity_scroll);
32 | BlockIndigo.get().start(this);
33 |
34 | mAdapter = new MyAdapter(getSupportFragmentManager());
35 |
36 | mPager = (ViewPager) findViewById(R.id.viewpager);
37 | mPager.setAdapter(mAdapter);
38 | }
39 |
40 | @Override
41 | protected void onDestroy() {
42 | super.onDestroy();
43 | BlockIndigo.get().stop();
44 | }
45 |
46 | public static class MyAdapter extends FragmentPagerAdapter {
47 | public MyAdapter(FragmentManager fm) {
48 | super(fm);
49 | }
50 |
51 | @Override
52 | public int getCount() {
53 | return NUM_ITEMS;
54 | }
55 |
56 | @Override
57 | public Fragment getItem(int position) {
58 | return ArrayListFragment.newInstance();
59 | }
60 | }
61 |
62 | public static class ArrayListFragment extends Fragment {
63 |
64 | static ArrayListFragment newInstance() {
65 | return new ArrayListFragment();
66 | }
67 |
68 | @Override
69 | public void onCreate(Bundle savedInstanceState) {
70 | super.onCreate(savedInstanceState);
71 | }
72 |
73 | @Override
74 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
75 | try {
76 | Thread.sleep(500);
77 | } catch (InterruptedException e) {
78 | e.printStackTrace();
79 | }
80 | LinearLayout rootView = new LinearLayout(getActivity());
81 | Random rand = new Random(System.currentTimeMillis());
82 | int r = rand.nextInt(255);
83 | int g = rand.nextInt(255);
84 | int b = rand.nextInt(255);
85 | int randomColor = Color.rgb(r, g, b);
86 | rootView.setBackgroundColor(randomColor);
87 | return rootView;
88 | }
89 |
90 | @Override
91 | public void onActivityCreated(Bundle savedInstanceState) {
92 | super.onActivityCreated(savedInstanceState);
93 | }
94 | }
95 |
96 | }
--------------------------------------------------------------------------------
/block_demo/src/main/java/dodola/block/demo/MainActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Baidu, Inc. All Rights Reserved.
3 | */
4 | package dodola.block.demo;
5 |
6 | import android.content.Intent;
7 | import android.os.Bundle;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.view.View;
10 | import android.widget.Button;
11 |
12 | public class MainActivity extends AppCompatActivity implements View.OnClickListener {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_main);
18 | Button btn = (Button) this.findViewById(R.id.anr_test);
19 | btn.setOnClickListener(this);
20 |
21 | }
22 |
23 | @Override
24 | public void onClick(View v) {
25 | switch (v.getId()) {
26 | case R.id.anr_test:
27 | startActivity(new Intent(this, FragmentPagerActivity.class));
28 | break;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/block_demo/src/main/java/dodola/block/demo/WatcherApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Baidu, Inc. All Rights Reserved.
3 | */
4 | package dodola.block.demo;
5 |
6 | import android.app.Application;
7 |
8 | import com.github.moduth.blockcanary.BlockCanaryContext;
9 |
10 | import dodola.blockindigo.BlockIndigo;
11 |
12 | /**
13 | * Created by sunpengfei on 16/1/17.
14 | */
15 | public class WatcherApplication extends Application {
16 | @Override
17 | public void onCreate() {
18 | super.onCreate();
19 | BlockIndigo.install(this, new BlockCanaryContext());
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/block_demo/src/main/res/layout/activity_anr_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/block_demo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
4 |
12 |
13 |
20 |
21 |
--------------------------------------------------------------------------------
/block_demo/src/main/res/layout/activity_scroll.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/block_demo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dodola/blockindigo/b32c4bf19c6d20b207a2187812f20c5cec990c1d/block_demo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/block_demo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dodola/blockindigo/b32c4bf19c6d20b207a2187812f20c5cec990c1d/block_demo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/block_demo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dodola/blockindigo/b32c4bf19c6d20b207a2187812f20c5cec990c1d/block_demo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/block_demo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dodola/blockindigo/b32c4bf19c6d20b207a2187812f20c5cec990c1d/block_demo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/block_demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dodola/blockindigo/b32c4bf19c6d20b207a2187812f20c5cec990c1d/block_demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/block_demo/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/block_demo/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/block_demo/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/block_demo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | WatcherDemo
3 |
4 |
--------------------------------------------------------------------------------
/block_demo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/block_demo/src/test/java/dodola/block/demo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Baidu, Inc. All Rights Reserved.
3 | */
4 | package dodola.block.demo;
5 |
6 | import org.junit.Test;
7 |
8 | import static org.junit.Assert.*;
9 |
10 | /**
11 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
12 | */
13 | public class ExampleUnitTest {
14 | @Test
15 | public void addition_isCorrect() throws Exception {
16 | assertEquals(4, 2 + 2);
17 | }
18 | }
--------------------------------------------------------------------------------
/blockindigo/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/blockindigo/blockindigo.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | generateDebugSources
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/blockindigo/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.jfrog.bintray" version "1.4"
3 | }
4 | apply plugin: 'com.android.library'
5 |
6 | android {
7 | compileSdkVersion 22
8 | buildToolsVersion "23.0.2"
9 | defaultConfig {
10 | minSdkVersion 16
11 | targetSdkVersion 22
12 | versionCode 1
13 | versionName "1.0"
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | productFlavors {
22 | }
23 | }
24 |
25 | dependencies {
26 | compile fileTree(include: ['*.jar'], dir: 'libs')
27 | compile 'com.github.moduth:blockcanary-android:1.1.0'
28 | compile 'com.github.moduth:blockcanary-ui:1.1.0'
29 | }
30 |
31 |
32 |
33 |
34 |
35 | apply plugin: 'com.github.dcendents.android-maven'
36 | apply plugin: 'com.jfrog.bintray'
37 | group = 'com.dodola'
38 | version = '1.0'
39 | def siteUrl = 'https://github.com/dodola/blockindigo'
40 | def gitUrl = 'https://github.com/dodola/blockindigo.git'
41 |
42 | install {
43 | repositories.mavenInstaller {
44 | pom {
45 | project {
46 | packaging 'aar'
47 | name ''
48 | url siteUrl
49 | licenses {
50 | license {
51 | name 'The MIT License (MIT)'
52 | url 'https://github.com/dodola/blockindigo/blob/master/LICENSE'
53 | }
54 | }
55 | developers {
56 | developer {
57 | id 'dodola'
58 | name 'Dodola'
59 | email 'dinophp@gmail.com'
60 | }
61 | }
62 | scm {
63 | connection 'https://github.com/dodola/blockindigo.git'
64 | developerConnection 'https://github.com/dodola/blockindigo.git'
65 | url siteUrl
66 |
67 | }
68 | }
69 | }
70 | }
71 | }
72 |
73 |
74 |
75 | bintray {
76 | user = 'dodola'
77 | key = ''
78 | publish = true
79 | configurations = ['archives'] //When uploading configuration files
80 | pkg {
81 | repo = 'maven'
82 | name = "blockindigo"
83 | desc = 'another ui-block detection library for Android base on Blockcanary'
84 | websiteUrl = siteUrl
85 | issueTrackerUrl = 'https://github.com/dodola/blockindigo/issues'
86 | vcsUrl = gitUrl
87 | licenses = ['MIT']
88 | labels = ['aar', 'android', 'ui']
89 | publicDownloadNumbers = true
90 | version {
91 | name = '1.0'
92 | vcsTag = '1.1.0'
93 | // attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
94 | }
95 | }
96 | }
97 |
98 |
99 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/blockindigo/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 /Users/baidu/Library/Android/sdk/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 |
--------------------------------------------------------------------------------
/blockindigo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/blockindigo/src/main/java/dodola/blockindigo/ANRAnalysis.java:
--------------------------------------------------------------------------------
1 | ///*
2 | // * Copyright (C) 2016 Baidu, Inc. All Rights Reserved.
3 | // */
4 | //package dodola.blockindigo;
5 | //
6 | //import android.os.Handler;
7 | //import android.os.Looper;
8 | //
9 | ///**
10 | // * Created by sunpengfei on 16/1/17.
11 | // */
12 | //public class ANRAnalysis extends Thread {
13 | // private volatile int prevTimeTick;
14 | // private volatile int nextTimeTick;
15 | // /**
16 | // * 主线程Handler,
17 | // */
18 | // private Handler mainUIHandler;
19 | // /**
20 | // *
21 | // */
22 | // private Runnable prevTimeTickRunnable = new Runnable() {
23 | // @Override
24 | // public void run() {
25 | // prevTimeTick = (prevTimeTick + 1) % 100;
26 | // }
27 | // };
28 | // /**
29 | // *
30 | // */
31 | // private Runnable nextTimeTickRunnable = new Runnable() {
32 | // @Override
33 | // public void run() {
34 | // nextTimeTick = (nextTimeTick + 1) % 100;// %100为了防止整数溢出
35 | // }
36 | // };
37 | //
38 | // /**
39 | // * 判定anr开始的时限,在主线程卡住5000毫秒的时候,开始记录method_trace
40 | // */
41 | // private final int DEFAULT_ANR_TIME = 3000;
42 | //
43 | // public ANRAnalysis() {
44 | // setName("DODO_ANR_WATCHER");
45 | // mainUIHandler = new Handler(Looper.getMainLooper());
46 | // }
47 | //
48 | // public void run() {
49 | // boolean mayAnr = false;
50 | // while (true) {
51 | // int lastPrevTick = this.prevTimeTick;
52 | // int lastNextTick = this.nextTimeTick;
53 | // this.mainUIHandler.post(this.prevTimeTickRunnable);
54 | // this.mainUIHandler.post(this.nextTimeTickRunnable);
55 | // try {
56 | // Thread.sleep(50);
57 | // if (this.prevTimeTick == lastPrevTick) {
58 | // mayAnr = true;
59 | // }
60 | // if (mayAnr) {
61 | // mayAnr = false;
62 | // try {
63 | // Thread.sleep(DEFAULT_ANR_TIME);
64 | // if (this.nextTimeTick == lastNextTick) {
65 | // return;
66 | // }
67 | // } catch (InterruptedException e2) {
68 | // return;
69 | // }
70 | // }
71 | // } catch (InterruptedException e3) {
72 | // return;
73 | // }
74 | // }
75 | // }
76 | //}
77 |
--------------------------------------------------------------------------------
/blockindigo/src/main/java/dodola/blockindigo/BlockIndigo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Baidu, Inc. All Rights Reserved.
3 | */
4 | package dodola.blockindigo;
5 |
6 | import android.app.Activity;
7 | import android.content.Context;
8 | import android.preference.PreferenceManager;
9 |
10 | import com.github.moduth.blockcanary.BlockCanaryContext;
11 | import com.github.moduth.blockcanary.BlockCanaryCore;
12 | import com.github.moduth.blockcanary.OnBlockEventInterceptor;
13 | import com.github.moduth.blockcanary.UploadMonitorLog;
14 |
15 | import java.lang.reflect.Constructor;
16 |
17 | public class BlockIndigo {
18 |
19 | private static BlockIndigo sInstance;
20 | private ChoreographerAnalysis choregrapherAnalysis;
21 |
22 | private BlockIndigo() {
23 | BlockCanaryCore.setIBlockCanaryContext(BlockCanaryContext.get());
24 |
25 | ChoreographerAnalysis.setIBlockCanaryContext(BlockCanaryContext.get());
26 |
27 | choregrapherAnalysis = ChoreographerAnalysis.get();
28 | initNotification();
29 | }
30 |
31 | /**
32 | * Install {@link BlockIndigo}
33 | *
34 | * @param context application context
35 | * @param blockCanaryContext implementation for {@link BlockCanaryContext}
36 | * @return {@link BlockIndigo}
37 | */
38 | public static BlockIndigo install(Context context, BlockCanaryContext blockCanaryContext) {
39 | BlockCanaryContext.init(context, blockCanaryContext);
40 | return get();
41 | }
42 |
43 | /**
44 | * Get {@link BlockIndigo} singleton.
45 | *
46 | * @return {@link BlockIndigo} instance
47 | */
48 | public static BlockIndigo get() {
49 | if (sInstance == null) {
50 | synchronized (BlockIndigo.class) {
51 | if (sInstance == null) {
52 | sInstance = new BlockIndigo();
53 | }
54 | }
55 | }
56 | return sInstance;
57 | }
58 |
59 | /**
60 | * Start main-thread monitoring.
61 | */
62 | public void start() {
63 | }
64 |
65 | /**
66 | * Stop monitoring.
67 | */
68 | public void stop() {
69 | choregrapherAnalysis.stop();
70 | }
71 |
72 | public void start(Activity activity) {
73 | choregrapherAnalysis.start(activity);
74 | }
75 |
76 | /**
77 | * Zip and upload log files.
78 | */
79 | public void upload() {
80 | UploadMonitorLog.forceZipLogAndUpload();
81 | }
82 |
83 | /**
84 | * 记录开启监控的时间到preference,可以在release包收到push通知后调用。
85 | */
86 | public void recordStartTime() {
87 | PreferenceManager.getDefaultSharedPreferences(BlockCanaryContext.get().getContext()).edit()
88 | .putLong("BlockCanary_StartTime", System.currentTimeMillis()).commit();
89 | }
90 |
91 | /**
92 | * 是否监控时间结束,根据上次开启的时间(recordStartTime)和getConfigDuration计算出来。
93 | *
94 | * @return true则结束
95 | */
96 | public boolean isMonitorDurationEnd() {
97 | long startTime =
98 | PreferenceManager.getDefaultSharedPreferences(BlockCanaryContext.get().getContext()).getLong(
99 | "BlockCanary_StartTime", 0);
100 | return startTime != 0
101 | && System.currentTimeMillis() - startTime > BlockCanaryContext.get().getConfigDuration() * 3600 * 1000;
102 | }
103 |
104 | private void initNotification() {
105 | if (!BlockCanaryContext.get().isNeedDisplay()) {
106 | return;
107 | }
108 |
109 | try {
110 | Class notifier = Class.forName("com.github.moduth.blockcanary.ui.Notifier");
111 | if (notifier == null) {
112 | return;
113 | }
114 | Constructor extends OnBlockEventInterceptor> constructor = notifier.getConstructor();
115 | choregrapherAnalysis.setOnBlockEventInterceptor(constructor.newInstance());
116 | } catch (Exception e) {
117 | e.printStackTrace();
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/blockindigo/src/main/java/dodola/blockindigo/ChoreographerAnalysis.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Baidu, Inc. All Rights Reserved.
3 | */
4 | package dodola.blockindigo;
5 |
6 | import android.annotation.SuppressLint;
7 | import android.annotation.TargetApi;
8 | import android.app.Activity;
9 | import android.os.Build;
10 | import android.os.Looper;
11 | import android.os.SystemClock;
12 | import android.view.Choreographer;
13 | import android.view.Choreographer.FrameCallback;
14 |
15 | import com.github.moduth.blockcanary.CpuSampler;
16 | import com.github.moduth.blockcanary.IBlockCanaryContext;
17 | import com.github.moduth.blockcanary.LogWriter;
18 | import com.github.moduth.blockcanary.OnBlockEventInterceptor;
19 | import com.github.moduth.blockcanary.ThreadStackSampler;
20 | import com.github.moduth.blockcanary.log.Block;
21 |
22 | import java.util.ArrayList;
23 | import java.util.concurrent.TimeUnit;
24 |
25 | public class ChoreographerAnalysis {
26 | private static boolean isStop = false;
27 | private long mFrameIntervalNanos;
28 | private Activity mActivity;
29 | private FrameMonitor monitor = null;
30 | public ThreadStackSampler threadStackSampler;
31 | public CpuSampler cpuSampler;
32 | private static IBlockCanaryContext sBlockCanaryContext;
33 | private OnBlockEventInterceptor mOnBlockEventInterceptor;
34 |
35 | @SuppressLint({ "NewApi" })
36 | private class FrameMonitor implements FrameCallback {
37 | private long doFrameCostTime;
38 | private boolean isTraceViewStarted;
39 | private long startTime;
40 | private long realTimeStart;
41 | private long realTimeEnd;
42 | private long threadTimeStart;
43 | private long threadTimeEnd;
44 |
45 | private FrameMonitor() {
46 | this.startTime = 0;
47 | this.doFrameCostTime = 0;
48 | this.isTraceViewStarted = false;
49 | realTimeStart = System.currentTimeMillis();
50 | }
51 |
52 | public void doFrame(long frameTimeNanos) {
53 | long doFrameStart = System.nanoTime();
54 | long costTime = TimeUnit.NANOSECONDS.toMillis(frameTimeNanos - this.startTime) - this.doFrameCostTime;
55 | this.startTime = frameTimeNanos;
56 | openTraceview(costTime);
57 | this.doFrameCostTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - doFrameStart);
58 | if (!ChoreographerAnalysis.isStop && ChoreographerAnalysis.this.mActivity != null) {
59 | ChoreographerAnalysis.this.mActivity.runOnUiThread(new Runnable() {
60 | public void run() {
61 | Choreographer.getInstance().postFrameCallback(ChoreographerAnalysis.this.monitor);
62 | }
63 | });
64 | }
65 | }
66 |
67 | private void openTraceview(long costTime) {
68 |
69 | if (costTime > 160 && !this.isTraceViewStarted) {// 300ms
70 | this.isTraceViewStarted = true;
71 | realTimeEnd = System.currentTimeMillis();
72 |
73 | ArrayList threadStackEntries =
74 | threadStackSampler.getThreadStackEntries(realTimeStart, realTimeEnd);
75 | if (threadStackEntries.size() > 0) {
76 | threadTimeStart = realTimeStart;
77 | threadTimeEnd = SystemClock.currentThreadTimeMillis();
78 | Block block =
79 | Block.newInstance()
80 | .setMainThreadTimeCost(realTimeStart, realTimeEnd, threadTimeStart, threadTimeEnd)
81 | .setCpuBusyFlag(cpuSampler.isCpuBusy(realTimeStart, realTimeEnd))
82 | .setRecentCpuRate(cpuSampler.getCpuRateInfo())
83 | .setThreadStackEntries(threadStackEntries).flushString();
84 | LogWriter.saveLooperLog(block.toString());
85 |
86 | if (getContext().isNeedDisplay() && mOnBlockEventInterceptor != null) {
87 | mOnBlockEventInterceptor.onBlockEvent(getContext().getContext(), block.timeStart);
88 | }
89 | }
90 | } else if (costTime <= mFrameIntervalNanos && this.isTraceViewStarted) {
91 | this.isTraceViewStarted = false;
92 | }
93 | if (costTime <= mFrameIntervalNanos) {
94 | realTimeStart = System.currentTimeMillis();
95 | }
96 | }
97 | }
98 |
99 | private static final int MIN_INTERVAL_MILLIS = 300;
100 |
101 | private long sampleInterval(int blockThresholdMillis) {
102 | long sampleIntervalMillis = blockThresholdMillis / 2;
103 | if (sampleIntervalMillis < MIN_INTERVAL_MILLIS) {
104 | sampleIntervalMillis = MIN_INTERVAL_MILLIS;
105 | }
106 | return sampleIntervalMillis;
107 | }
108 |
109 | private ChoreographerAnalysis() {
110 | int blockThresholdMillis = getContext().getConfigBlockThreshold();
111 | long sampleIntervalMillis = sampleInterval(blockThresholdMillis);
112 | threadStackSampler = new ThreadStackSampler(Looper.getMainLooper().getThread(), sampleIntervalMillis);
113 | cpuSampler = new CpuSampler();
114 | }
115 |
116 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
117 | public void start(Activity activity) {
118 | this.mActivity = activity;
119 | threadStackSampler.start();
120 | cpuSampler.start();
121 | float refreshRate = mActivity.getWindowManager().getDefaultDisplay().getRefreshRate();
122 | mFrameIntervalNanos = (long) (1000000000 / refreshRate);
123 | if (this.monitor == null) {
124 | this.monitor = new FrameMonitor();
125 | }
126 | isStop = false;
127 | if (this.mActivity != null) {
128 | this.mActivity.runOnUiThread(new Runnable() {
129 | public void run() {
130 | Choreographer.getInstance().postFrameCallback(ChoreographerAnalysis.this.monitor);
131 | }
132 | });
133 | }
134 | }
135 |
136 | public void stop() {
137 | isStop = true;
138 | threadStackSampler.stop();
139 | cpuSampler.stop();
140 | this.monitor = null;
141 | }
142 |
143 | public static void setIBlockCanaryContext(IBlockCanaryContext blockCanaryContext) {
144 | sBlockCanaryContext = blockCanaryContext;
145 | }
146 |
147 | public void setOnBlockEventInterceptor(OnBlockEventInterceptor onBlockEventInterceptor) {
148 | mOnBlockEventInterceptor = onBlockEventInterceptor;
149 | }
150 |
151 | public static IBlockCanaryContext getContext() {
152 | return sBlockCanaryContext;
153 | }
154 |
155 | private static ChoreographerAnalysis sInstance;
156 |
157 | public static ChoreographerAnalysis get() {
158 | if (sInstance == null) {
159 | synchronized (ChoreographerAnalysis.class) {
160 | if (sInstance == null) {
161 | sInstance = new ChoreographerAnalysis();
162 | }
163 | }
164 | }
165 | return sInstance;
166 | }
167 |
168 | }
--------------------------------------------------------------------------------
/blockindigo_.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.0.0-alpha7'
9 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
10 |
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dodola/blockindigo/b32c4bf19c6d20b207a2187812f20c5cec990c1d/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
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-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
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 Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':blockindigo', ':block_demo'
2 |
--------------------------------------------------------------------------------