Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
986bbddd
Commit
986bbddd
authored
Aug 16, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(tools): check and test qml if it's necessary!
parent
03010465
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
44 deletions
+44
-44
check_qml_syntax
tools/check_qml_syntax
+13
-17
test_qml
tools/test_qml
+24
-20
update_resources
tools/update_resources
+7
-7
No files found.
tools/check_qml_syntax
View file @
986bbddd
...
@@ -18,34 +18,30 @@ cd $SCRIPT_DIR/..
...
@@ -18,34 +18,30 @@ cd $SCRIPT_DIR/..
# ==============================================================================
# ==============================================================================
if
!
[
-x
"
$(
command
-v
"
$LINTER
"
)
"
]
;
then
if
!
[
-x
"
$(
command
-v
"
$LINTER
"
)
"
]
;
then
printf
"
${
RED
}
Unable to found
`
$LINTER
`
.
No tests can be executed.
${
NC
}
\n
"
printf
"
${
RED
}
Unable to found
`
$LINTER
`
.
${
NC
}
\n
"
exit
0
exit
1
fi
fi
"
${
LINTER
}
"
-v
"
${
LINTER
}
"
-v
2> /dev/null 1>&2
if
[[
$?
!=
0
]]
;
then
if
[[
$?
!=
0
]]
;
then
printf
"
${
RED
}
Unable to check qml syntax.
${
NC
}
\n
"
printf
"
${
RED
}
Unable to check qml syntax.
${
NC
}
\n
"
exit
0
exit
1
fi
fi
printf
"
${
BLUE
}
Checking qml files...
${
NC
}
\n
"
printf
"
${
BLUE
}
Checking qml files...
${
NC
}
\n
"
so_far_so_good
=
0
so_far_so_good
=
0
while
read
line
while
read
file
;
do
do
$LINTER
"
$file
"
result
=
$(
if
[[
$?
!=
0
]]
;
then
printf
"
$line
"
|
so_far_so_good
=
1
sed
-n
's/^\s*<\s*file\s*>\s*\(.*\.\(qml\|js\)\)\s*<\s*\/\s*file\s*>\s*$/\1/p'
fi
)
done
< <
(
git diff
--name-only
--cached
|
grep
-E
'\.qml|js|js\.spec$'
)
if
[[
!
-z
$result
]]
&&
!
$LINTER
"
$result
"
;
then
so_far_so_good
=
1
fi
done
<
$RESOURCES_FILE
if
[[
$so_far_so_good
==
0
]]
;
then
if
[[
$so_far_so_good
==
0
]]
;
then
printf
"
${
GREEN
}
Done. No qml error found.
\n
"
printf
"
${
GREEN
}
Done. No qml error found.
\n
"
else
else
printf
"
${
RED
}
One or more errors were found. Please to fix them.
\n
"
printf
"
${
RED
}
One or more errors were found. Please to fix them.
\n
"
fi
fi
printf
"
${
NC
}
"
printf
"
${
NC
}
"
...
...
tools/test_qml
View file @
986bbddd
...
@@ -28,38 +28,42 @@ if ! [ -x "$( command -v "$TEST_RUNNER" )" ]; then
...
@@ -28,38 +28,42 @@ if ! [ -x "$( command -v "$TEST_RUNNER" )" ]; then
exit
0
exit
0
fi
fi
so_far_so_good
=
0
git diff
--name-only
--cached
|
grep
-Eq
'\.qml|js|js\.spec$'
if
[[
$?
!=
0
]]
;
then
exit
0
fi
# Check all `*.spec.qml` files.
# Check all `*.spec.qml` files.
so_far_so_good
=
0
while
read
line
while
read
line
do
do
source_file
=
$(
source_file
=
$(
printf
"
$line
"
|
printf
"
$line
"
|
sed
-n
's/^\s*<\s*file\s*>\s*\(.*\.\(qml\|js\)\)\s*<\s*\/\s*file\s*>\s*$/\1/p'
sed
-n
's/^\s*<\s*file\s*>\s*\(.*\.\(qml\|js\)\)\s*<\s*\/\s*file\s*>\s*$/\1/p'
)
)
if
[[
!
-z
$source_file
]]
;
then
if
[[
!
-z
$source_file
]]
;
then
spec_file
=
"
${
source_file
%.*
}
.
${
TEST_FILE_EXTENSION
}
"
spec_file
=
"
${
source_file
%.*
}
.
${
TEST_FILE_EXTENSION
}
"
if
[
-f
$spec_file
]
;
then
if
[
-f
$spec_file
]
;
then
printf
"
${
BLUE
}
Running unit qml tests of '
${
source_file
}
'...
${
NC
}
\n
"
printf
"
${
BLUE
}
Running unit qml tests of '
${
source_file
}
'...
${
NC
}
\n
"
$TEST_RUNNER
-import
$DEV_MODULES_PATH
-import
$MODULES_PATH
-import
$SCRIPTS_PATH
-input
"
$spec_file
"
$TEST_RUNNER
-import
$DEV_MODULES_PATH
-import
$MODULES_PATH
-import
$SCRIPTS_PATH
-input
"
$spec_file
"
if
[[
$?
==
0
]]
;
then
if
[[
$?
==
0
]]
;
then
printf
"
${
GREEN
}
All unit tests have succeeded for '
${
spec_file
}
'.
\n
"
printf
"
${
GREEN
}
All unit tests have succeeded for '
${
spec_file
}
'.
\n
"
else
else
printf
"
${
RED
}
Unit tests have failed for '
${
spec_file
}
'.
\n
"
printf
"
${
RED
}
Unit tests have failed for '
${
spec_file
}
'.
\n
"
so_far_so_good
=
1
so_far_so_good
=
1
fi
fi
printf
"
${
NC
}
\n
"
printf
"
${
NC
}
\n
"
fi
fi
fi
fi
done
<
$RESOURCES_FILE
done
<
$RESOURCES_FILE
if
[[
$so_far_so_good
==
0
]]
;
then
if
[[
$so_far_so_good
==
0
]]
;
then
printf
"
${
GREEN
}
Done. All tests have succeeded.
\n
"
printf
"
${
GREEN
}
Done. All tests have succeeded.
\n
"
else
else
printf
"
${
RED
}
Fail. One or many tests have failed.
\n
"
printf
"
${
RED
}
Fail. One or many tests have failed.
\n
"
so_far_so_good
=
1
so_far_so_good
=
1
fi
fi
printf
"
${
NC
}
\n
"
printf
"
${
NC
}
\n
"
...
...
tools/update_resources
View file @
986bbddd
...
@@ -20,14 +20,14 @@ echo '<!DOCTYPE RCC><RCC version="1.0">
...
@@ -20,14 +20,14 @@ echo '<!DOCTYPE RCC><RCC version="1.0">
for
filename
in
$(
find ui/modules/ ui/scripts/ ui/views/ assets/
-type
f |
sort
)
for
filename
in
$(
find ui/modules/ ui/scripts/ ui/views/ assets/
-type
f |
sort
)
do
do
basename
=
"
${
filename
##*/
}
"
basename
=
"
${
filename
##*/
}
"
extension
=
"
${
filename
##*.
}
"
extension
=
"
${
filename
##*.
}
"
if
[[
$extension
==
@
(
svg|png|jpg|js|ttf
)
||
if
[[
$extension
==
@
(
svg|png|jpg|js|ttf
)
||
$basename
==
qmldir
||
$basename
==
qmldir
||
(
$extension
==
qml
&&
$basename
!=
*
\.
spec
\.
qml
)
]]
;
then
(
$extension
==
qml
&&
$basename
!=
*
\.
spec
\.
qml
)
]]
;
then
echo
" <file>
$filename
</file>"
>>
$RESOURCES_FILE
echo
" <file>
$filename
</file>"
>>
$RESOURCES_FILE
fi
fi
done
done
echo
' </qresource>
echo
' </qresource>
...
...
Write
Preview
Markdown
is supported
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