forked from scwang90/SmartRefreshLayout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
method-count-layout.bat
73 lines (55 loc) · 1.74 KB
/
method-count-layout.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Method Count Starter
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal enabledelayedexpansion
set SDK=
set TOOL=
for /F "delims== tokens=2" %%i IN ('findstr /i "sdk.dir" local.properties') DO SET SDK=%%i
for /F "delims=' tokens=2" %%i IN ('findstr /i "buildToolsVersion" %~dp0app\build.gradle') DO SET TOOL=%%i
echo TOOL=%TOOL%
echo SDK=%SDK%
if "%SDK%" == "" (
echo 没找到 Android Sdk 路径,脚本中止!
goto end
)
if "%TOOL%" == "" (
echo 没找到 Android Build Tool 版本,脚本中止!
goto end
)
set SDK=%SDK:\\=\%
set SDK=%SDK:\:=:%
set MODULE=refresh-layout
set OUTPUT=methods-apk.txt
set PATH_TOOL=%SDK%\build-tools\%TOOL%\dx.bat
set PATH_JAR=%MODULE%/build/intermediates/intermediate-jars/debug/classes.jar
set PATH_JAR=%MODULE%/build/intermediates/compile_library_classes/release/classes.jar
set PATH_DEX=%PATH_JAR%.dex
echo 正在构建。。。
call ./gradlew assemble
if "%ERRORLEVEL%" == "0" (
echo.
echo 构建成功!,开始生成DEX文件。。。
) else (
echo.
echo 构建失败,脚本中止!
goto end
)
:dex
echo 正在生成DEX。。。
call %PATH_TOOL% --dex --verbose --no-strict --output=%PATH_DEX% %PATH_JAR% >NUL
if "%ERRORLEVEL%" == "0" (
echo.
echo 生成DEX文件成功!,开始统计。。。
) else (
echo.
echo 生成DEX失败,脚本中止!
goto end
)
call java -jar ./art/dex-method-counts.jar --filter=all --include-classes --include-detail --output-style=tree %PATH_DEX% > %OUTPUT%
call ./method-count-words.bat %OUTPUT% %OUTPUT:.txt=-count.txt%
:end
if "%OS%"=="Windows_NT" endlocal