Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
mod: 优化控制台执行
Browse files Browse the repository at this point in the history
  • Loading branch information
CiyLei committed Jul 8, 2021
1 parent 9f66e8c commit 60b7a2f
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion library/src/main/assets/webdebug/index2.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>webdebug-web</title><link href=/css/app.87e29815.css rel=preload as=style><link href=/css/chunk-vendors.967f559c.css rel=preload as=style><link href=/js/app.dbee0c1a.js rel=preload as=script><link href=/js/chunk-vendors.237c2d58.js rel=preload as=script><link href=/css/chunk-vendors.967f559c.css rel=stylesheet><link href=/css/app.87e29815.css rel=stylesheet></head><body style=margin:0px;><noscript><strong>We're sorry but webdebug-web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.237c2d58.js></script><script src=/js/app.dbee0c1a.js></script></body></html>
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>webdebug-web</title><link href=/css/app.87e29815.css rel=preload as=style><link href=/css/chunk-vendors.967f559c.css rel=preload as=style><link href=/js/app.174f46b6.js rel=preload as=script><link href=/js/chunk-vendors.237c2d58.js rel=preload as=script><link href=/css/chunk-vendors.967f559c.css rel=stylesheet><link href=/css/app.87e29815.css rel=stylesheet></head><body style=margin:0px;><noscript><strong>We're sorry but webdebug-web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.237c2d58.js></script><script src=/js/app.174f46b6.js></script></body></html>
2 changes: 2 additions & 0 deletions library/src/main/assets/webdebug/js/app.14695022.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions library/src/main/assets/webdebug/js/app.14695022.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions library/src/main/assets/webdebug/js/app.174f46b6.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions library/src/main/assets/webdebug/js/app.174f46b6.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions library/src/main/assets/webdebug/js/app.5a4b5ea9.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions library/src/main/assets/webdebug/js/app.5a4b5ea9.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions library/src/main/assets/webdebug/js/app.f4378305.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions library/src/main/assets/webdebug/js/app.f4378305.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class DynamicExecute private constructor(
// 生成Java代码
var javaSource = generateJavaSource(mImportCode, mCode)
// 替换System.out为TaskExecutor中的out
javaSource = javaSource.replace("System.out", "out")
javaSource = javaSource.replace("System.out", "$mClassName.this.out")
// 编译Java代码
val classDatas = DynamicCompilerUtil.compile(javaSource, mContext.classLoader)
// class数据写入jar文件
Expand Down Expand Up @@ -106,10 +106,7 @@ class DynamicExecute private constructor(
"\n" +
"public class $mClassName extends TaskExecutor {\n" +
"\n" +
" @Override\n" +
" public void execute() {\n" +
" $code\n" +
" }\n" +
" $code\n" +
"}\n"
}

Expand All @@ -124,6 +121,8 @@ class DynamicExecute private constructor(
Handler(Looper.getMainLooper()).post {
try {
task.run()
// 如果有开启子线程进行打印的话,等待一会儿进行收集
Thread.sleep(100)
} catch (e: Exception) {
// 添加异常信息
e.printStackTrace(task.out)
Expand All @@ -146,6 +145,8 @@ class DynamicExecute private constructor(
} else {
try {
task.run()
// 如果有开启子线程进行打印的话,等待一会儿进行收集
Thread.sleep(100)
} catch (e: Exception) {
// 添加异常信息
e.printStackTrace(task.out)
Expand Down

0 comments on commit 60b7a2f

Please sign in to comment.