Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tech
pi_build
Commits
36742e54
Commit
36742e54
authored
8 years ago
by
tangm
Browse files
Options
Download
Email Patches
Plain Diff
修复了初始化判断错误的bug
parent
c1c92f12
master
apk_patch
app_build
babel
babel7
canvas
dev
direct
flex_layout3.0
multi_gui_new
multi_gui_new5.0
multi_version
new1
new_layout
npm2.0
npm2.2
npm2.3.70++
npm3.0
npm_test
patch-1
preprocess
psd_new_merge
recon_v0.5
refactor
refactor_new_layout
render3d
revert-3edcea72
rs
rs1
rs_client
rs_server
srs_android
sync
tax
temp
test_gui
tm
xlsx_2.1.23
xssj
ydzm
ydzm_2022_05_05
ydzm_new1
yszz
1.0
v6.0.1
v6.0.0
v5.0.4
v5.0.3
v5.0.2
v5.0.1
v5.0.0
v4.2.53
v4.2.52
v4.2.51
v4.2.50
v4.2.49
v4.2.48
v4.2.47
v4.2.46
v4.2.45
v4.2.44
v4.2.43
v4.2.42
v4.2.41
v4.2.40
v4.2.39
v4.2.38
v4.2.37
v4.2.36
v4.2.35
v4.2.34
v4.2.33
v4.2.32
v4.2.31
v4.2.30
v4.2.29
v4.2.28
v4.2.27
v4.2.26
v4.2.25
v4.2.24
v4.2.23
v4.2.22
v4.2.21
v4.2.20
v4.2.19
v4.2.18
v4.2.17
v4.2.16
v4.2.15
v4.2.14
v4.2.13
v4.2.12
v4.2.11
v4.2.10
v4.2.9
v4.2.8
v4.2.7
v4.2.6
v4.2.5
v4.2.4
v4.2.3
v4.2.2
v4.2.1
v4.2.0
v4.1.0
v4.0.22
v4.0.21
v4.0.20
v4.0.19
v4.0.18
v4.0.17
v4.0.16
v4.0.15
v4.0.14
v4.0.13
v4.0.12
v4.0.11
v4.0.10
v4.0.9
v4.0.8
v4.0.7
v4.0.6
v4.0.5
v4.0.4
v4.0.3
v4.0.2
v4.0.1
v4.0.0
v3.0.29
v3.0.28
v3.0.27
v3.0.26
v3.0.25
v3.0.24
v3.0.23
v3.0.22
v3.0.21
v3.0.20
v3.0.19
v3.0.18
v3.0.17
v3.0.16
v3.0.15
v3.0.14
v3.0.13
v3.0.12
v3.0.11
v3.0.10
v3.0.9
v3.0.8
v3.0.7
v3.0.6
v3.0.5
v3.0.4
v3.0.3
v3.0.2
v3.0.1
v3.0.0
v2.3.79
v2.3.78
v2.3.75
v2.3.74
v2.3.73
v2.3.72
v2.3.71
v2.3.70
v2.3.69
v2.3.68
v2.3.67
v2.3.66
v2.3.65
v2.3.64
v2.3.63
v2.3.62
v2.3.61
v2.3.60
v2.3.59
v2.3.58
v2.3.57
v2.3.56
v2.3.55
v2.3.54
v2.3.53
v2.3.52
v2.3.51
v2.3.50
v2.3.49
v2.3.48
v2.3.47
v2.3.46
v2.3.45
v2.3.44
v2.3.43
v2.3.42
v2.3.41
v2.3.40
v2.3.39
v2.3.38
v2.3.37
v2.3.36
v2.3.35
v2.3.34
v2.3.33
v2.3.32
v2.3.31
v2.3.30
v2.3.29
v2.3.28
v2.3.27
v2.3.26
v2.3.25
v2.3.24
v2.3.23
v2.3.22
v2.3.21
v2.3.20
v2.3.19
v2.3.18
v2.3.17
v2.3.16
v2.3.15
v2.3.14
v2.3.13
v2.3.12
v2.3.11
v2.3.10
v2.3.9
v2.3.8
v2.3.7
v2.3.6
v2.3.5
v2.3.4
v2.3.3
v2.3.2
v2.3.1
v2.3.0
v2.2.2
v2.2.1
v2.2.0
v2.1.23
v2.1.22
v2.1.21
v2.1.20
v2.1.19
v2.1.18
v2.1.17
v2.1.16
v2.1.15
v2.1.14
v2.1.13
v2.1.12
v2.1.11
v2.1.10
v2.1.9
v2.1.8
v2.1.7
v2.1.6
v2.1.5
v2.1.4
v2.1.3
v2.1.2
v2.1.1
v2.1.0
v2.0.26
v2.0.25
v2.0.24
v2.0.23
v2.0.22
v2.0.21
v2.0.20
v2.0.19
v2.0.18
v2.0.17
v2.0.16
v2.0.15
v2.0.14
v2.0.13
v2.0.12
v2.0.11
v2.0.10
v2.0.9
v2.0.8
v2.0.7
v2.0.6
v2.0.5
v2.0.4
v2.0.3
v2.0.2
v2.0.1
v2.0.0
v1.2.71
v1.2.70
v1.2.69
v1.2.68
v1.2.67
v1.2.66
v1.2.65
v1.2.64
v1.2.63
v1.2.62
v1.2.61
v1.2.60
v1.2.59
v1.2.58
v1.2.57
v1.2.56
v1.2.55
v1.2.54
v1.2.53
v1.2.52
v1.2.51
v1.2.50
v1.2.49
v1.2.48
v1.2.47
v1.2.46
v1.2.45
v1.2.44
v1.2.43
v1.2.42
v1.2.41
v1.2.40
v1.2.39
v1.2.38
v1.2.37
v1.2.36
v1.2.35
v1.2.34
v1.2.33
v1.2.32
v1.2.31
v1.2.30
v1.2.29
v1.2.28
v1.2.27
v1.2.26
v1.2.25
v1.2.24
v1.2.23
v1.2.22
v1.2.21
v1.2.20
v1.2.19
v1.2.18
v1.2.17
v1.2.16
v1.2.15
v1.2.14
v1.2.13
v1.2.12
v1.2.11
v1.2.10
v1.2.9
v1.2.8
v1.2.7
v1.2.6
v1.2.5
v1.2.4
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.1.13
v1.1.12
v1.1.11
v1.1.10
platform-android
Wallet_1.0
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/dst_proc.js
+3
-1
src/dst_proc.js
src/info.js
+1
-1
src/info.js
src/memory_db.js
+9
-0
src/memory_db.js
src/src_proc.js
+15
-5
src/src_proc.js
src/util.js
+8
-0
src/util.js
with
36 additions
and
7 deletions
+36
-7
src/dst_proc.js
+
3
-
1
View file @
36742e54
...
...
@@ -90,7 +90,8 @@ export class DstProc{
if
(
fileEvent
===
FILE_EVENT
.
ADD
){
insertInfo
(
self
.
dependDb
,
_fileInfo
);
}
else
{
else
{
debug
(
"
1 file path is :
"
+
_fileInfo
.
path
);
modByAttr
(
self
.
dependDb
,
_fileInfo
);
}
}
...
...
@@ -117,6 +118,7 @@ export class DstProc{
}
_sign
&&
(
_fileInfo
.
sign
=
_sign
);
oldFileInfo
.
depend
&&
(
_fileInfo
.
depend
=
oldFileInfo
.
depend
);
debug
(
"
2 file path is :
"
+
_fileInfo
.
path
);
modByAttr
(
self
.
dependDb
,
_fileInfo
);
})
}
...
...
This diff is collapsed.
Click to expand it.
src/info.js
+
1
-
1
View file @
36742e54
...
...
@@ -7,7 +7,7 @@ const LogLevel = {
"
none
"
:
4
}
const
logLevel
=
LogLevel
.
debug
;
const
logLevel
=
LogLevel
.
info
;
const
debug
=
(
msg
,
...
args
)
=>
{
if
(
logLevel
>=
LogLevel
.
debug
)
...
...
This diff is collapsed.
Click to expand it.
src/memory_db.js
+
9
-
0
View file @
36742e54
...
...
@@ -90,18 +90,27 @@ export const insertInfo = (db, file) => {
* @return {[type]} [description]
*/
export
const
modByAttr
=
(
db
,
file
,
attr
=
"
path
"
)
=>
{
debug
(
"
modByAttr file is :
"
+
file
.
path
);
let
_fileAttrValue
=
file
[
attr
];
debug
(
"
1
"
);
if
(
!
_fileAttrValue
)
{
info
(
"
the attr :
"
+
attr
+
"
is not exist
"
,
"
MemoryDB
"
,
"
modByAttr
"
);
return
false
;
}
let
_strSql
=
"
/*[/
"
+
attr
+
"
=='
"
+
_fileAttrValue
.
replace
(
/
\\
/g
,
"
/
"
)
+
"
']
"
;
debug
(
"
2
"
);
let
_oldFile
=
db
.
select
(
_strSql
);
debug
(
"
_oldFile is :
"
+
_oldFile
);
debug
(
"
3
"
);
if
(
!
_oldFile
)
{
info
(
"
fail to modify file in db
"
,
"
MemoryDB
"
,
"
modByAttr
"
);
return
false
;
}
debug
(
"
_oldFile is :
"
+
_oldFile
);
debug
(
"
_oldFile is :
"
+
_oldFile
.
value
());
debug
(
"
_oldFile is :
"
+
JSON
.
stringify
(
_oldFile
.
value
()));
debug
(
"
4
"
);
_oldFile
.
replace
(
file
);
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
src/src_proc.js
+
15
-
5
View file @
36742e54
...
...
@@ -18,7 +18,7 @@
let
spahql
=
require
(
"
spahql
"
);
import
{
debug
,
info
,
warn
,
err
}
from
"
./info
"
;
import
{
getStat
,
getFileType
,
fileNormalize
,
isExist
,
readFile
,
writeFile
,
getAp
,
FILE_EVENT
}
from
"
./file_operator
"
;
import
{
parseJson
,
calSign
,
renameTs2Js
}
from
"
./util
"
;
import
{
parseJson
,
calSign
,
renameTs2Js
,
renameJs2Ts
}
from
"
./util
"
;
import
{
DstProc
}
from
"
./dst_proc
"
;
import
{
copyDb
,
modByAttr
,
insertInfo
,
initSrcDb
,
getAllInfo
,
getInfoByRp
,
delByRp
}
from
"
./memory_db
"
;
import
{
Watcher
}
from
"
./watcher
"
;
...
...
@@ -90,15 +90,17 @@ export class SrcProc{
}
/**
* [analysisDelWhenStart 只有开始的时候需要分析删除事件]
* [analysisDelWhenStart 只有开始的时候需要分析删除事件
* 存在db里面的js文件可能是js文件也可能是ts文件,判断的时候两种情况都要判断
* 发送change事件的时候都当做ts文件发送]
* @return {[Array]} [相对路径,对应的事件,该事件是否值得相信]
*/
analysisDelFromDB
(){
let
_arrDelFiles
=
[];
let
_arrFilesInfo
=
getAllInfo
(
this
.
dependDb
);
_arrFilesInfo
.
forEach
((
file
)
=>
{
if
(
!
isExist
(
getAp
(
this
.
rootAp
,
file
.
path
))){
_arrDelFiles
.
push
([
fileNormalize
(
file
.
path
),
FILE_EVENT
.
DEL
,
true
])
if
(
(
!
isExist
(
getAp
(
this
.
rootAp
,
file
.
path
)))
&&
(
!
isExist
(
getAp
(
this
.
rootAp
,
renameJs2Ts
(
file
.
path
)))))
{
_arrDelFiles
.
push
([
fileNormalize
(
renameJs2Ts
(
file
.
path
)
)
,
FILE_EVENT
.
DEL
,
true
])
}
})
return
_arrDelFiles
;
...
...
@@ -145,7 +147,9 @@ export class SrcProc{
* @return {[null|obj]} [如果有返回则则表明不是add,需要继续判断]
*/
const
_addCheck
=
(
fileDesc
)
=>
{
let
_fileInfo
=
getInfoByRp
(
this
.
dependDb
,
renameTs2Js
(
fileDesc
[
0
]));
debug
(
"
src db is :
"
+
JSON
.
stringify
(
getAllInfo
(
this
.
dependDb
))
+
"
, file name is :
"
+
renameTs2Js
(
fileDesc
[
0
])
+
"
, fileInfo is :
"
+
_fileInfo
);
if
(
!
_fileInfo
){
this
.
changeList
.
push
([
fileDesc
[
0
],
FILE_EVENT
.
ADD
,
true
]);
}
...
...
@@ -164,9 +168,11 @@ export class SrcProc{
err
(
"
can not find the modify file :
"
+
fileDesc
[
0
]
+
"
from native storage
"
);
}
else
if
(
_stat
[
1
]
!==
fileInfo
.
size
){
debug
(
"
new size is :
"
+
_stat
[
1
]
+
"
, old size is :
"
+
fileInfo
.
size
);
this
.
changeList
.
push
([
fileDesc
[
0
],
FILE_EVENT
.
MOD
,
true
])
}
else
if
(
calSign
(
readFile
(
getAp
(
this
.
rootAp
,
fileDesc
[
0
])))
!==
fileInfo
.
sign
){
else
if
(
calSign
(
readFile
(
getAp
(
this
.
rootAp
,
fileDesc
[
0
])))
!==
(
fileInfo
.
sign
==
undefined
?
null
:
fileInfo
.
sign
)){
//fileInfo.sign可能没有这个属性,结果为undefined
debug
(
"
new md5 is :
"
+
calSign
(
readFile
(
getAp
(
this
.
rootAp
,
fileDesc
[
0
])))
+
"
, old md5 is :
"
+
fileInfo
.
sign
);
this
.
changeList
.
push
([
fileDesc
[
0
],
FILE_EVENT
.
MOD
,
true
])
}
//其他情况下文件文件应该都没有发生任何变化
...
...
@@ -218,6 +224,7 @@ export class SrcProc{
insertInfo
(
this
.
dependDb
,
_fileInfo
);
}
else
{
debug
(
"
3 file path is :
"
+
_fileInfo
.
path
);
modByAttr
(
this
.
dependDb
,
_fileInfo
);
}
}
...
...
@@ -241,6 +248,8 @@ export class SrcProc{
info
(
"
no file change
"
);
return
;
}
debug
(
"
sendList is :
"
+
JSON
.
stringify
(
this
.
sendList
));
debug
(
"
src db is :
"
+
JSON
.
stringify
(
getAllInfo
(
this
.
dependDb
)));
_writeDb
(
this
.
sendList
);
writeFile
(
getAp
(
this
.
rootAp
,
DEPEND_PATH
),
JSON
.
stringify
(
getAllInfo
(
this
.
dependDb
)));
this
.
arrDstProc
.
forEach
((
dstProc
)
=>
{
...
...
@@ -250,6 +259,7 @@ export class SrcProc{
}
dstProc
.
handleChange
(
this
.
sendList
);
});
this
.
sendList
.
length
=
0
;
if
(
this
.
changeList
.
length
){
this
.
sendChange
();
...
...
This diff is collapsed.
Click to expand it.
src/util.js
+
8
-
0
View file @
36742e54
...
...
@@ -77,4 +77,12 @@ export const renameTs2Js = (fileName) => {
}
/**
* [.js转换为.ts]
* @param {[type]} fileName [description]
* @return {[type]} [description]
*/
export
const
renameJs2Ts
=
(
fileName
)
=>
{
return
fileName
.
replace
(
/
(\.
js
)
$/
,
"
.ts
"
);
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help