mirror of
https://github.com/apache/cordova-android.git
synced 2026-01-30 00:05:28 +08:00
Compare commits
1444 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdcb4ddcd9 | ||
|
|
8e53e2aa56 | ||
|
|
5276f56cc4 | ||
|
|
9df6793f34 | ||
|
|
d90e191837 | ||
|
|
d5d448888d | ||
|
|
8d8600b442 | ||
|
|
0bf6455153 | ||
|
|
80b7a7f6ac | ||
|
|
6b789c57e8 | ||
|
|
b8a344fc17 | ||
|
|
1b6319e9cf | ||
|
|
2cc81253ff | ||
|
|
499c694146 | ||
|
|
bc32cca281 | ||
|
|
dead4b4ab6 | ||
|
|
305cb2cdd5 | ||
|
|
287bfcbaa3 | ||
|
|
2a61b751ab | ||
|
|
a830145f36 | ||
|
|
08dc1dd9b9 | ||
|
|
e86b211cd1 | ||
|
|
6c5febc189 | ||
|
|
4d0d60c294 | ||
|
|
16a88ec631 | ||
|
|
1ce2b6b315 | ||
|
|
43a6805902 | ||
|
|
566262c923 | ||
|
|
e4bff281b2 | ||
|
|
9a675912f8 | ||
|
|
f86044e6ce | ||
|
|
43fdaa91a3 | ||
|
|
80f46aefcd | ||
|
|
71f63d7b33 | ||
|
|
8d47cd73c0 | ||
|
|
6d451bc6f9 | ||
|
|
6402e7b755 | ||
|
|
c93f93f637 | ||
|
|
6e51943d15 | ||
|
|
c81cd871f8 | ||
|
|
8ab1dbc373 | ||
|
|
fb26050fab | ||
|
|
c56cd4d5a8 | ||
|
|
de105e8651 | ||
|
|
8e98de6e7c | ||
|
|
6372ca3fac | ||
|
|
3712619f5c | ||
|
|
dee1e77d0b | ||
|
|
d01ed80a61 | ||
|
|
92268b2e76 | ||
|
|
0924654a47 | ||
|
|
8ef742e79d | ||
|
|
64ef13c6e0 | ||
|
|
66ad2c948e | ||
|
|
60e022fedd | ||
|
|
09256b766f | ||
|
|
a951793431 | ||
|
|
f4b8f44d4a | ||
|
|
08ab7d4b59 | ||
|
|
5889001465 | ||
|
|
91d2716122 | ||
|
|
0e6ad28e56 | ||
|
|
fd57909730 | ||
|
|
e3cc75caff | ||
|
|
e26142f43b | ||
|
|
d0f972e128 | ||
|
|
e42fedc820 | ||
|
|
f0c9814c04 | ||
|
|
529278190c | ||
|
|
fcaab36484 | ||
|
|
5dfa995a4b | ||
|
|
c35a990c09 | ||
|
|
11f40bd2cc | ||
|
|
7e8b47d012 | ||
|
|
902aa32dda | ||
|
|
42c0cba7f7 | ||
|
|
f2b84d8d83 | ||
|
|
1b11206174 | ||
|
|
c93e3e9f6f | ||
|
|
9808a0d4d3 | ||
|
|
bd1697dbd2 | ||
|
|
b3b8690bbd | ||
|
|
ad742ec93c | ||
|
|
1de7c38134 | ||
|
|
997943a194 | ||
|
|
47c6048d53 | ||
|
|
a64d459c8e | ||
|
|
a5ad440f17 | ||
|
|
acad24d62a | ||
|
|
989b4cc913 | ||
|
|
38c6627999 | ||
|
|
4b9e18c6b8 | ||
|
|
906f8cc002 | ||
|
|
01ab11644c | ||
|
|
4cf3dcfaae | ||
|
|
b177f84825 | ||
|
|
485e6e0e4d | ||
|
|
516c3411aa | ||
|
|
908354e7fa | ||
|
|
9531dbbc7b | ||
|
|
d10dd1c0b4 | ||
|
|
6533474070 | ||
|
|
576edb53bb | ||
|
|
20e390af85 | ||
|
|
931251a5a8 | ||
|
|
9697550488 | ||
|
|
3dac984613 | ||
|
|
867da56e2e | ||
|
|
719acd3ab1 | ||
|
|
549cae0a06 | ||
|
|
bb45f4f3ba | ||
|
|
b4de6f55c4 | ||
|
|
e99c145d55 | ||
|
|
9cb9f32fbb | ||
|
|
a6f30b6977 | ||
|
|
73692e60d8 | ||
|
|
4abe3d3a49 | ||
|
|
54df4a116c | ||
|
|
715ce2f9ac | ||
|
|
7a98708eef | ||
|
|
d9c08f12a7 | ||
|
|
e41fbc5708 | ||
|
|
634f92efb6 | ||
|
|
98a7b759e8 | ||
|
|
3976685e4e | ||
|
|
f7688bc64e | ||
|
|
18e28294d6 | ||
|
|
39bd0d6463 | ||
|
|
c1819cc027 | ||
|
|
f228d90ca2 | ||
|
|
5f44af3757 | ||
|
|
8a4ae311ce | ||
|
|
ef2434188e | ||
|
|
a014228f7c | ||
|
|
2163c8ae05 | ||
|
|
47bb5184a0 | ||
|
|
f1f1ac3cbd | ||
|
|
f1396c7aad | ||
|
|
21ae48eada | ||
|
|
53e1c1b65c | ||
|
|
858611f95e | ||
|
|
5c334b6c10 | ||
|
|
cf5a02ea0f | ||
|
|
a67bc75b93 | ||
|
|
895ab0c970 | ||
|
|
21f84732c8 | ||
|
|
7eed65e9b4 | ||
|
|
cf5915ad01 | ||
|
|
a4caa87d29 | ||
|
|
bbb3913a36 | ||
|
|
92f07d0418 | ||
|
|
578a642209 | ||
|
|
9d03e4ec0a | ||
|
|
576ad183e7 | ||
|
|
e31596f60e | ||
|
|
ef493b4c0f | ||
|
|
c15312ee70 | ||
|
|
3caefcae49 | ||
|
|
c2f6631f91 | ||
|
|
fb1dfb27df | ||
|
|
898a6a8d8d | ||
|
|
7da53741cd | ||
|
|
47aabc631d | ||
|
|
fb75ac371d | ||
|
|
98c866704a | ||
|
|
e58453d3e6 | ||
|
|
03c62e1ce2 | ||
|
|
2c10545cd8 | ||
|
|
ff2ec7eed1 | ||
|
|
8dfddef6f9 | ||
|
|
73edf4de7b | ||
|
|
cfa58a5661 | ||
|
|
905bff3d59 | ||
|
|
eadcd33e84 | ||
|
|
76fe89dd1f | ||
|
|
3f487c5c28 | ||
|
|
c35a46ec45 | ||
|
|
e3eb933182 | ||
|
|
dacb0e5c72 | ||
|
|
23b24491c3 | ||
|
|
7ab0cf123d | ||
|
|
8f2a4c7231 | ||
|
|
ce53154555 | ||
|
|
c0188ab95a | ||
|
|
ebbd91f87d | ||
|
|
4b0725dfc2 | ||
|
|
350d35fb24 | ||
|
|
8ee3a73dd1 | ||
|
|
b6e4598e7c | ||
|
|
bd2ad99402 | ||
|
|
d26c1199ab | ||
|
|
1ea7c1366a | ||
|
|
b2263fe35e | ||
|
|
bd07907a4c | ||
|
|
ca8931c8af | ||
|
|
46a036ef26 | ||
|
|
e9750b5cab | ||
|
|
0bf0e48698 | ||
|
|
4f1aa97ea9 | ||
|
|
f90f004dea | ||
|
|
559b0833b4 | ||
|
|
31bad290d5 | ||
|
|
2e88f7ead2 | ||
|
|
1a8154c90e | ||
|
|
8fb49ec7ec | ||
|
|
393dad6349 | ||
|
|
2c3db19310 | ||
|
|
472ab626d6 | ||
|
|
2106e2e081 | ||
|
|
d3c80ea5d5 | ||
|
|
6dad25668c | ||
|
|
d862d42e76 | ||
|
|
828b5f053a | ||
|
|
032d1fa9cb | ||
|
|
83ad646734 | ||
|
|
88c25a6a6a | ||
|
|
a254cfc841 | ||
|
|
0d4b9f4ba6 | ||
|
|
bf29fe0e10 | ||
|
|
3df8f8b120 | ||
|
|
38d0e684f1 | ||
|
|
83e9aefff5 | ||
|
|
02ee925103 | ||
|
|
fc69da7a42 | ||
|
|
5dc179ebef | ||
|
|
59e3b907e9 | ||
|
|
fe7629e8fc | ||
|
|
76180d3ea1 | ||
|
|
5c4f8ca246 | ||
|
|
b8530a6b70 | ||
|
|
83686542b2 | ||
|
|
b1551cad98 | ||
|
|
5af6b016c1 | ||
|
|
6abd6d6b47 | ||
|
|
e456a325f9 | ||
|
|
eddad666ff | ||
|
|
ca9a25e860 | ||
|
|
8d9a1b82dd | ||
|
|
f1b57dd9b4 | ||
|
|
d2a0323ae4 | ||
|
|
3a339ba37f | ||
|
|
e9603b0738 | ||
|
|
3d83fd784b | ||
|
|
38a5f891a4 | ||
|
|
8563c8beef | ||
|
|
f91102ee07 | ||
|
|
cc08e9d84a | ||
|
|
075d38117a | ||
|
|
6cc4896690 | ||
|
|
673a6773b2 | ||
|
|
3a6923988d | ||
|
|
0d1692681f | ||
|
|
fcf705e007 | ||
|
|
5c93c214b9 | ||
|
|
7cbb8401a2 | ||
|
|
b3c262cd47 | ||
|
|
45a7b90c6c | ||
|
|
e1c3b4fd94 | ||
|
|
109112ae75 | ||
|
|
a24ba41eda | ||
|
|
be3f8ef80d | ||
|
|
d50dedb5d0 | ||
|
|
74e9e213d6 | ||
|
|
d8d92cae61 | ||
|
|
99d5b4d982 | ||
|
|
52fd32c837 | ||
|
|
061f08bc03 | ||
|
|
735bc98243 | ||
|
|
e53a65ef07 | ||
|
|
3642ffb57a | ||
|
|
3dcc319cd2 | ||
|
|
8484f7b906 | ||
|
|
59018ab632 | ||
|
|
c6cfeb15f4 | ||
|
|
adc7dab377 | ||
|
|
a9e01f4309 | ||
|
|
0269e532df | ||
|
|
4863320e45 | ||
|
|
3ad1ed7dbc | ||
|
|
ae823e6c4e | ||
|
|
9056e5a2dc | ||
|
|
2b20802dbb | ||
|
|
a972d1ef62 | ||
|
|
30c3713dca | ||
|
|
6f58d4c474 | ||
|
|
9d9bac397b | ||
|
|
d8f10c33dc | ||
|
|
5d57eff612 | ||
|
|
43956c1bc8 | ||
|
|
2930900963 | ||
|
|
6404780186 | ||
|
|
5d99e50c4a | ||
|
|
aaeb630eb1 | ||
|
|
3acba59494 | ||
|
|
3760616639 | ||
|
|
026dce563b | ||
|
|
b77febc7a7 | ||
|
|
83601dca2f | ||
|
|
05aeaf1bd2 | ||
|
|
b138867b78 | ||
|
|
a1195cefd5 | ||
|
|
b83c3b3684 | ||
|
|
5502ddaf0d | ||
|
|
f54336eb61 | ||
|
|
18d6884522 | ||
|
|
8ba0109e55 | ||
|
|
f50ca85a95 | ||
|
|
39e6765e64 | ||
|
|
47e20da631 | ||
|
|
bb7b47b063 | ||
|
|
a2618dcde5 | ||
|
|
9fdb126715 | ||
|
|
b2a81c09ec | ||
|
|
04fa5d3feb | ||
|
|
d73108cc13 | ||
|
|
3ba00f91bb | ||
|
|
cbee8580d0 | ||
|
|
6ccd6b009b | ||
|
|
6cf6e20d2e | ||
|
|
93efe71080 | ||
|
|
697c8f129c | ||
|
|
c12f7fef76 | ||
|
|
cde238de94 | ||
|
|
ec83d481fa | ||
|
|
1f12fdbeea | ||
|
|
8743e88550 | ||
|
|
f3c238db1c | ||
|
|
2534a3c767 | ||
|
|
b1f527e682 | ||
|
|
6fa16b615b | ||
|
|
e5c90badba | ||
|
|
be6c6ba976 | ||
|
|
7f3be98199 | ||
|
|
0e498db735 | ||
|
|
7203b740fd | ||
|
|
97aab900da | ||
|
|
dddb2837dd | ||
|
|
7d282426c4 | ||
|
|
1637937664 | ||
|
|
03144eb160 | ||
|
|
53210710ba | ||
|
|
0d98e09fb1 | ||
|
|
e7a972df77 | ||
|
|
cb2f396e33 | ||
|
|
2940d05209 | ||
|
|
2377aa7ac2 | ||
|
|
f18086f83a | ||
|
|
dce3b7ed6c | ||
|
|
5bda4df7fa | ||
|
|
1a8e36ccd3 | ||
|
|
14816c7c81 | ||
|
|
8fdb16c555 | ||
|
|
940439866e | ||
|
|
e91b19d006 | ||
|
|
46905ebe99 | ||
|
|
d364f46baa | ||
|
|
2b53c98cf5 | ||
|
|
36d07d7a15 | ||
|
|
458e479681 | ||
|
|
5fe95570d2 | ||
|
|
c3ce2f8a07 | ||
|
|
d0dab4bb09 | ||
|
|
893356abcd | ||
|
|
00c879e27d | ||
|
|
b65af106ff | ||
|
|
fdd7eb3446 | ||
|
|
22645d9158 | ||
|
|
76dd8613ca | ||
|
|
99f15c507d | ||
|
|
849b887e20 | ||
|
|
245d9a1e46 | ||
|
|
5917d4ef0b | ||
|
|
90053eb9df | ||
|
|
a7304b9a19 | ||
|
|
540929c6a0 | ||
|
|
e456175a81 | ||
|
|
3ff32092a3 | ||
|
|
55d7cf3865 | ||
|
|
ac4ac935f6 | ||
|
|
d83d49d83b | ||
|
|
e36158a0da | ||
|
|
b20028c42b | ||
|
|
5cc14b8031 | ||
|
|
1cda7a9de0 | ||
|
|
49b76f5c71 | ||
|
|
c0474e811d | ||
|
|
40c9709445 | ||
|
|
b67e9905bc | ||
|
|
c74192d578 | ||
|
|
33feb00e8f | ||
|
|
8f16df4c90 | ||
|
|
fb6cb51e64 | ||
|
|
28ebbb8f02 | ||
|
|
bd4ddcdedd | ||
|
|
e621edfba7 | ||
|
|
304a899114 | ||
|
|
8391af2e8f | ||
|
|
69ab6a0e0d | ||
|
|
a216f0db75 | ||
|
|
69260fb96a | ||
|
|
db87e0ae6a | ||
|
|
8ead919fae | ||
|
|
b73c04f3c8 | ||
|
|
f790aeb8f6 | ||
|
|
7b17abc555 | ||
|
|
ffadf5dd51 | ||
|
|
23d8d99925 | ||
|
|
d88df59c32 | ||
|
|
17906735df | ||
|
|
3a6e898b12 | ||
|
|
0cc3df3747 | ||
|
|
2bc842a2b3 | ||
|
|
1c6f640026 | ||
|
|
6daad829cc | ||
|
|
7d926822ed | ||
|
|
d4dcbb13fc | ||
|
|
f396712f59 | ||
|
|
d97250f968 | ||
|
|
e7e8e95242 | ||
|
|
d518a655a8 | ||
|
|
b6a5844027 | ||
|
|
9d9abea157 | ||
|
|
ee1165ea33 | ||
|
|
2704ee54cf | ||
|
|
ad01d28351 | ||
|
|
a215c1cf30 | ||
|
|
cadea2f6c3 | ||
|
|
e13e15d3e9 | ||
|
|
6ef2f67ae8 | ||
|
|
765c4ee9f6 | ||
|
|
a4103d8dc8 | ||
|
|
8e0f021cad | ||
|
|
002ab85f76 | ||
|
|
4a0f69a3f0 | ||
|
|
8a2e96d995 | ||
|
|
13dbd2f5d4 | ||
|
|
6d084428a8 | ||
|
|
312efc3878 | ||
|
|
301faebfcc | ||
|
|
a8af103ff4 | ||
|
|
0df50c3f33 | ||
|
|
08c80f77a9 | ||
|
|
ea8d65d7fc | ||
|
|
e3198b0f6b | ||
|
|
19220de388 | ||
|
|
52878d6c5b | ||
|
|
abfece70c1 | ||
|
|
33da6e9eb8 | ||
|
|
4919a2d2a8 | ||
|
|
2f2e8a560d | ||
|
|
884818934f | ||
|
|
1d8e6f53a1 | ||
|
|
3554267adf | ||
|
|
f7687a2567 | ||
|
|
ebd4a02d2c | ||
|
|
4a354bba86 | ||
|
|
d40c22441f | ||
|
|
6395eda0c8 | ||
|
|
eb6ada8091 | ||
|
|
a7ef686a27 | ||
|
|
e2af492a63 | ||
|
|
84de9ee0da | ||
|
|
e182e669f0 | ||
|
|
a9a28d3e77 | ||
|
|
6a77acdbf2 | ||
|
|
028725468a | ||
|
|
9dbffa6ee8 | ||
|
|
2d3f3cae13 | ||
|
|
fb9f0f3ee8 | ||
|
|
ab276504fd | ||
|
|
3cc4e5b440 | ||
|
|
b2664bc469 | ||
|
|
7d5afdebe1 | ||
|
|
3bbc7fb328 | ||
|
|
ac6ad2dea1 | ||
|
|
0b116f1b5c | ||
|
|
acdb934ef9 | ||
|
|
5591a1a4e8 | ||
|
|
124574bb3a | ||
|
|
a2cfaab7f4 | ||
|
|
6355425a6f | ||
|
|
2d96995801 | ||
|
|
3fc4daa447 | ||
|
|
c7ff24b983 | ||
|
|
3f674faf30 | ||
|
|
b9ad1b6b26 | ||
|
|
676f0ddc2e | ||
|
|
6c60dc5dc8 | ||
|
|
1af5ade39a | ||
|
|
ad40d33400 | ||
|
|
5017e2302b | ||
|
|
3bfeda4a3b | ||
|
|
348b1b4dda | ||
|
|
0fd7e7f040 | ||
|
|
cfa0fa7243 | ||
|
|
6a63d9df0a | ||
|
|
36646eb527 | ||
|
|
48940bf4c0 | ||
|
|
5346a386f7 | ||
|
|
b3201ad073 | ||
|
|
35b0ba6d07 | ||
|
|
3c087c6716 | ||
|
|
854946e313 | ||
|
|
d6a1d7a913 | ||
|
|
700b425774 | ||
|
|
e31634b0fb | ||
|
|
1f06176149 | ||
|
|
e628026cf0 | ||
|
|
3a512c300e | ||
|
|
7f9e7c73ab | ||
|
|
3e7be6cc0f | ||
|
|
81dfe96355 | ||
|
|
efa23bd39b | ||
|
|
6aa4b1b301 | ||
|
|
304cbef5ed | ||
|
|
263968e019 | ||
|
|
c05521e55a | ||
|
|
2f3c71feaa | ||
|
|
0b710a86a9 | ||
|
|
2e37d2c253 | ||
|
|
d7c1dc5517 | ||
|
|
77b9fd62a7 | ||
|
|
f838db4e18 | ||
|
|
b2d7124424 | ||
|
|
2532c4a39e | ||
|
|
be19585c68 | ||
|
|
ca0cbad1c7 | ||
|
|
fb53452d37 | ||
|
|
b5246f3f09 | ||
|
|
4be413af79 | ||
|
|
5db2de95f5 | ||
|
|
6418add83d | ||
|
|
7d26c51da6 | ||
|
|
dcada79e06 | ||
|
|
37384c583d | ||
|
|
9544783b5e | ||
|
|
eaf9b319ca | ||
|
|
47abde2f8d | ||
|
|
30325e4f32 | ||
|
|
9cf38f8705 | ||
|
|
7de4803e21 | ||
|
|
9586a7ddcd | ||
|
|
a4f6c8bf7b | ||
|
|
f5ab6fc602 | ||
|
|
222fb1c0e7 | ||
|
|
511fe7c51e | ||
|
|
acb3cc80b7 | ||
|
|
23fd0982b0 | ||
|
|
d2a159d2dc | ||
|
|
dc0bfeb0cc | ||
|
|
deea0f7e4f | ||
|
|
3a33f4c0a6 | ||
|
|
312872adaf | ||
|
|
ba5e3a81e0 | ||
|
|
bf5c32d780 | ||
|
|
d3cb38de29 | ||
|
|
047ed52d60 | ||
|
|
bb96bb9a88 | ||
|
|
0ee672d2b0 | ||
|
|
2a8a6b3970 | ||
|
|
5dbc51da59 | ||
|
|
f1a6d938cd | ||
|
|
991a2b1873 | ||
|
|
172c01561b | ||
|
|
b2f061cbaf | ||
|
|
1f1b2977a4 | ||
|
|
4a0a7bc424 | ||
|
|
8fbb6d7c62 | ||
|
|
0299467831 | ||
|
|
2efe240617 | ||
|
|
ed543dc648 | ||
|
|
db6295c917 | ||
|
|
d54a42f0f0 | ||
|
|
74ae6651c8 | ||
|
|
f33f352501 | ||
|
|
39c17e71ef | ||
|
|
081637134f | ||
|
|
39165a8694 | ||
|
|
ad163ce244 | ||
|
|
a7176d39f0 | ||
|
|
f1c185b771 | ||
|
|
103e1e8d24 | ||
|
|
30198c4bdd | ||
|
|
841f02f43f | ||
|
|
a5e9861440 | ||
|
|
d69698c23f | ||
|
|
d763f14ffe | ||
|
|
22918152cc | ||
|
|
1fcee242dc | ||
|
|
3f99c15338 | ||
|
|
f496f015b6 | ||
|
|
5e7e9d5b6c | ||
|
|
8bd4ca49a8 | ||
|
|
d33f7e08a8 | ||
|
|
d46ad592b5 | ||
|
|
eda765453b | ||
|
|
b295fc6687 | ||
|
|
0959608ab9 | ||
|
|
6db94dbb9a | ||
|
|
04a3c9d9ee | ||
|
|
db4d1f5768 | ||
|
|
81d6219663 | ||
|
|
3a1b4ffcb8 | ||
|
|
d6fe1a65eb | ||
|
|
72bbe9fdf0 | ||
|
|
d125ece9e9 | ||
|
|
ecb99c963d | ||
|
|
9738079c42 | ||
|
|
e9e27ca47c | ||
|
|
5d21fb26e6 | ||
|
|
bcf3f8611a | ||
|
|
d351e316bf | ||
|
|
dc6384d063 | ||
|
|
914e2fa35f | ||
|
|
8b96081579 | ||
|
|
f3e0623d1d | ||
|
|
abcaee24f9 | ||
|
|
8951660393 | ||
|
|
e4ecbad3cb | ||
|
|
40a740b45c | ||
|
|
9af7f506f0 | ||
|
|
9b8558dbde | ||
|
|
d28ca67edb | ||
|
|
0deaba0920 | ||
|
|
bcb10ba6da | ||
|
|
ef268e2320 | ||
|
|
d9814c5542 | ||
|
|
dd3b9dd01c | ||
|
|
1b43bc99a1 | ||
|
|
eccde6c0c0 | ||
|
|
69a2a5b551 | ||
|
|
bc9e895e25 | ||
|
|
457c5b8b3b | ||
|
|
9f1aedb56d | ||
|
|
2cefb42559 | ||
|
|
a048aa94ec | ||
|
|
27d359bd43 | ||
|
|
456b4801af | ||
|
|
82582e5a5b | ||
|
|
18e81c4b90 | ||
|
|
bad0034e5d | ||
|
|
99d5ff7347 | ||
|
|
dc579417fe | ||
|
|
fe906dabda | ||
|
|
8ab75e7109 | ||
|
|
aa2b3d3da1 | ||
|
|
0a1b71f125 | ||
|
|
757a3685f2 | ||
|
|
fd2c3c9857 | ||
|
|
84477ff212 | ||
|
|
1d7ccaece6 | ||
|
|
ce2525d4d8 | ||
|
|
7be9e880c2 | ||
|
|
7233931681 | ||
|
|
d7e111fb71 | ||
|
|
2ac191fbb8 | ||
|
|
088140aca4 | ||
|
|
e08d0671ab | ||
|
|
7669378c6e | ||
|
|
1494082a2a | ||
|
|
233c2bd882 | ||
|
|
9c4f09a50a | ||
|
|
89d982a8e4 | ||
|
|
9d3ee3d56e | ||
|
|
44421bbc79 | ||
|
|
320558a782 | ||
|
|
9ef7ddbf20 | ||
|
|
603f994f3f | ||
|
|
ada35e0e00 | ||
|
|
fc778006ef | ||
|
|
11760afddd | ||
|
|
d78ae309f1 | ||
|
|
73fd9e4dfa | ||
|
|
fb9cf60c41 | ||
|
|
b6a329d479 | ||
|
|
70bc7b39b7 | ||
|
|
03777067cd | ||
|
|
f5271431fb | ||
|
|
c30eeee5d8 | ||
|
|
dac02bef8c | ||
|
|
32edaee3a2 | ||
|
|
ff1c58def4 | ||
|
|
f9372f5578 | ||
|
|
6afc16c33b | ||
|
|
74a3d2028f | ||
|
|
dfe468f335 | ||
|
|
4f7721b405 | ||
|
|
3abd12aee3 | ||
|
|
1c90a77325 | ||
|
|
671219ae56 | ||
|
|
78fa7374d9 | ||
|
|
c1b389ad9b | ||
|
|
5a07a51b5d | ||
|
|
824b9803d2 | ||
|
|
ab72e48431 | ||
|
|
78b7ae72c9 | ||
|
|
1151856d38 | ||
|
|
12c282ce5c | ||
|
|
0ac822c577 | ||
|
|
400282282f | ||
|
|
789c505a88 | ||
|
|
0429bb0ab8 | ||
|
|
000eb0916e | ||
|
|
4db1fecba8 | ||
|
|
013ad94af0 | ||
|
|
2ceb8030ee | ||
|
|
47ac514835 | ||
|
|
5e0c9595c3 | ||
|
|
a0747aa960 | ||
|
|
07912fdecd | ||
|
|
9a33943783 | ||
|
|
8981ddb681 | ||
|
|
7d61a79a78 | ||
|
|
afa61aeb09 | ||
|
|
bf57aa1df0 | ||
|
|
055e3bf609 | ||
|
|
b1dadaf15d | ||
|
|
9e400911f5 | ||
|
|
892b875867 | ||
|
|
8f7bc1ffbb | ||
|
|
e5506d40bc | ||
|
|
64f89c5eda | ||
|
|
1ad0665eb5 | ||
|
|
37309c23c2 | ||
|
|
8983ddbdcc | ||
|
|
d99a21eb8d | ||
|
|
f9ce1c607b | ||
|
|
847312fcf9 | ||
|
|
b770076b7f | ||
|
|
dc9413258e | ||
|
|
4b574a2863 | ||
|
|
4b3cc67353 | ||
|
|
32b72756f3 | ||
|
|
2fc86e2833 | ||
|
|
fab472859d | ||
|
|
92caa3a186 | ||
|
|
26c7a96255 | ||
|
|
e170e463fe | ||
|
|
899daa9ea7 | ||
|
|
6d334c05e9 | ||
|
|
5ac0cc51d3 | ||
|
|
f93c2b161d | ||
|
|
6b071c0fb2 | ||
|
|
d3245a43d3 | ||
|
|
90a51c2cc1 | ||
|
|
61df5e0a37 | ||
|
|
c0312f9b50 | ||
|
|
eb70f05168 | ||
|
|
505db38232 | ||
|
|
096e1e3caa | ||
|
|
b5d8b51310 | ||
|
|
c9e7201058 | ||
|
|
4bf705a3d3 | ||
|
|
ce42568721 | ||
|
|
eb956b2449 | ||
|
|
1bf4e93da1 | ||
|
|
aba0a8421b | ||
|
|
b5a58e6ca0 | ||
|
|
44aa7464e1 | ||
|
|
4ea684dd7a | ||
|
|
215b7e08f8 | ||
|
|
754911f346 | ||
|
|
9873106785 | ||
|
|
d005359f89 | ||
|
|
1ce52a2845 | ||
|
|
7e480d1ff9 | ||
|
|
85877d259c | ||
|
|
0b86db8748 | ||
|
|
bca7f62efd | ||
|
|
4953ae84cd | ||
|
|
e96a5a0b3e | ||
|
|
e4678f4709 | ||
|
|
1def13deb3 | ||
|
|
bce4283239 | ||
|
|
9ff786d021 | ||
|
|
ee14a67795 | ||
|
|
b63a2e37be | ||
|
|
84274b4259 | ||
|
|
b6bf5298e6 | ||
|
|
b0d5ffec8f | ||
|
|
09ff81c411 | ||
|
|
a0293578b1 | ||
|
|
4595403a99 | ||
|
|
0f73884c8d | ||
|
|
2e9cbdcb0d | ||
|
|
a652d892ca | ||
|
|
581252febc | ||
|
|
b27d283f21 | ||
|
|
f2d7c49acf | ||
|
|
a397a23a9c | ||
|
|
9f7e179288 | ||
|
|
ad1c3d2438 | ||
|
|
51adf81918 | ||
|
|
97718a0a25 | ||
|
|
1aaba440b5 | ||
|
|
b8f2b8948f | ||
|
|
d96d49329b | ||
|
|
4db421ca36 | ||
|
|
c3991c8164 | ||
|
|
e904bab206 | ||
|
|
500ccd8e80 | ||
|
|
7cf7311a9d | ||
|
|
0669edddae | ||
|
|
38a8d7742e | ||
|
|
32e84d2316 | ||
|
|
151b86cb7b | ||
|
|
e4c9bebe34 | ||
|
|
8d5cb00bec | ||
|
|
15530a4820 | ||
|
|
f6e56b345d | ||
|
|
56d61eb44f | ||
|
|
2103da7b9d | ||
|
|
679069729c | ||
|
|
f764448ccc | ||
|
|
e1828696f7 | ||
|
|
5b87380749 | ||
|
|
917d0dfc49 | ||
|
|
191839f764 | ||
|
|
316cf057f3 | ||
|
|
55be212594 | ||
|
|
489e63f8e7 | ||
|
|
62c081dc85 | ||
|
|
023ad9ddf8 | ||
|
|
eccf486162 | ||
|
|
a6da46a00e | ||
|
|
747d2c97cd | ||
|
|
af2969dec5 | ||
|
|
53dba8678c | ||
|
|
afdac9b413 | ||
|
|
1ad280db98 | ||
|
|
035c3ad319 | ||
|
|
c237a1c0d2 | ||
|
|
f1d093548e | ||
|
|
beab74adf5 | ||
|
|
2a49e8a931 | ||
|
|
395857c37c | ||
|
|
9a34f25edc | ||
|
|
0af02fb9ae | ||
|
|
dcff8794ad | ||
|
|
1b4f5b13f1 | ||
|
|
3950818030 | ||
|
|
d6da2ef096 | ||
|
|
455298d736 | ||
|
|
d99856c52b | ||
|
|
087ec11e6a | ||
|
|
00c0a84e4e | ||
|
|
be229b1ac6 | ||
|
|
8106981bb6 | ||
|
|
de4d7cd10d | ||
|
|
804dcac12f | ||
|
|
fb0987b824 | ||
|
|
88f50a66ff | ||
|
|
7be600d8e9 | ||
|
|
11d6b8029f | ||
|
|
f1d4c01190 | ||
|
|
c12d93e77f | ||
|
|
204130a598 | ||
|
|
dbd45d4173 | ||
|
|
7e0bfbbad2 | ||
|
|
db18e1480e | ||
|
|
9baa27508a | ||
|
|
c3267def97 | ||
|
|
390927772e | ||
|
|
a8bec4ec9c | ||
|
|
167e283450 | ||
|
|
0c3254fd48 | ||
|
|
0faf2f0461 | ||
|
|
dd6e42aacc | ||
|
|
18e5e9dcc5 | ||
|
|
c8f44ab460 | ||
|
|
ac1f9c790a | ||
|
|
7533996fac | ||
|
|
1721571012 | ||
|
|
4358a04730 | ||
|
|
c552d912a0 | ||
|
|
ad7ce085f7 | ||
|
|
828edb3a43 | ||
|
|
4cb64580fd | ||
|
|
5b2fa128a4 | ||
|
|
b7abb64661 | ||
|
|
66424b7ed5 | ||
|
|
81dafb7b3f | ||
|
|
cea81c2dc1 | ||
|
|
4b1e99ef93 | ||
|
|
83120a5bea | ||
|
|
20723896e1 | ||
|
|
aed4859642 | ||
|
|
d0ade1d190 | ||
|
|
fb8e35bb44 | ||
|
|
ce351f5c38 | ||
|
|
26ee1c4547 | ||
|
|
bf327f3916 | ||
|
|
e3dd6d8c88 | ||
|
|
137fe12c43 | ||
|
|
a2fed200fe | ||
|
|
efeeef214b | ||
|
|
37617c67f8 | ||
|
|
56f675f188 | ||
|
|
7e7dc7694c | ||
|
|
8cf8da5776 | ||
|
|
b59705bed4 | ||
|
|
3b909253bb | ||
|
|
98f90340f3 | ||
|
|
a4c9bf7d30 | ||
|
|
f459eaa5ea | ||
|
|
8d8b874c20 | ||
|
|
ccceaeaca2 | ||
|
|
076e93184b | ||
|
|
c352b296da | ||
|
|
9e04eec9dd | ||
|
|
0e19f88a04 | ||
|
|
e788e8fa0f | ||
|
|
a56c406aa3 | ||
|
|
a3457d9408 | ||
|
|
b69fed18e2 | ||
|
|
2964aea447 | ||
|
|
587488a1b1 | ||
|
|
623b394c83 | ||
|
|
e671ffdab1 | ||
|
|
92d1080b2f | ||
|
|
893c0e9b67 | ||
|
|
af60f71ea3 | ||
|
|
9a952f1004 | ||
|
|
3ec7dfff8b | ||
|
|
d30a5e0388 | ||
|
|
fcece7e189 | ||
|
|
3949d9633c | ||
|
|
62c1c5f38b | ||
|
|
56204c5748 | ||
|
|
34c163be88 | ||
|
|
11002d4a56 | ||
|
|
240f27ce97 | ||
|
|
5295be1c25 | ||
|
|
238a67af3a | ||
|
|
4382234676 | ||
|
|
8e5c93a31f | ||
|
|
0e5d72dc5d | ||
|
|
4b8069f5ec | ||
|
|
a816a48416 | ||
|
|
5415440829 | ||
|
|
9668272b80 | ||
|
|
15e19489e3 | ||
|
|
2083f683ad | ||
|
|
c3610aa43c | ||
|
|
df4fbc272a | ||
|
|
9698a995fb | ||
|
|
c1ac3aa483 | ||
|
|
311bdbd360 | ||
|
|
291f111913 | ||
|
|
95e10bdb9e | ||
|
|
c2a6dcb6bd | ||
|
|
61c4bb9888 | ||
|
|
3439746645 | ||
|
|
b10fe465ab | ||
|
|
c6b171ba95 | ||
|
|
5a17d6cd5f | ||
|
|
480af2644c | ||
|
|
ecd2e06883 | ||
|
|
4f3ae23170 | ||
|
|
7cfb33d0ef | ||
|
|
9224ab1592 | ||
|
|
a696ff37f1 | ||
|
|
931a996dab | ||
|
|
68c03090a3 | ||
|
|
98fe46757f | ||
|
|
cefd137634 | ||
|
|
6b6e887c2f | ||
|
|
20cd4f806a | ||
|
|
b92303b1c9 | ||
|
|
59d23e05b1 | ||
|
|
731a36d3a0 | ||
|
|
162fc0720e | ||
|
|
342bbaa3ae | ||
|
|
f086ef5cad | ||
|
|
56a3ee5fe6 | ||
|
|
d80d532a2a | ||
|
|
3aca14d530 | ||
|
|
aa2d3962bf | ||
|
|
f7c717e393 | ||
|
|
268fea58ee | ||
|
|
87cdc5ad1c | ||
|
|
ba140a8a84 | ||
|
|
27f1181d53 | ||
|
|
f953e6adb8 | ||
|
|
ffd14fe7d9 | ||
|
|
3206c2100d | ||
|
|
66fa12a091 | ||
|
|
b1bdf23d9c | ||
|
|
12bf07d560 | ||
|
|
132650df28 | ||
|
|
81a77949fc | ||
|
|
e597f98c62 | ||
|
|
7fbb2b195f | ||
|
|
1feaa7fed7 | ||
|
|
9b82ae19b0 | ||
|
|
9d3c13065b | ||
|
|
4859f8f759 | ||
|
|
ac284fd39c | ||
|
|
fdef0db87c | ||
|
|
e78db000c6 | ||
|
|
032ea8a8d3 | ||
|
|
fc63f66e89 | ||
|
|
832e626573 | ||
|
|
cc7d352209 | ||
|
|
ce5d9a2ee8 | ||
|
|
77c51d3ae7 | ||
|
|
53dae45430 | ||
|
|
16343ffe70 | ||
|
|
b37498d5f6 | ||
|
|
7ad16e5b0c | ||
|
|
9f41906895 | ||
|
|
2af8daff1d | ||
|
|
fbeb379f1b | ||
|
|
9577735ff7 | ||
|
|
2dcd50c11b | ||
|
|
862c223e11 | ||
|
|
7f4d5aeb0e | ||
|
|
30681eb772 | ||
|
|
52e575e1e7 | ||
|
|
890e12c306 | ||
|
|
6cbf6b7875 | ||
|
|
c255a84941 | ||
|
|
ce7d6d69d9 | ||
|
|
d5538b7076 | ||
|
|
cdfa13b265 | ||
|
|
e5efc91ef4 | ||
|
|
e31c911c30 | ||
|
|
a658ea1573 | ||
|
|
6d5b88d7b9 | ||
|
|
a986e72338 | ||
|
|
162d9b6c2e | ||
|
|
f7f49d27c5 | ||
|
|
9e3ccf4b3e | ||
|
|
6b71c2f392 | ||
|
|
0d313a3964 | ||
|
|
75a0a6752a | ||
|
|
363fc8deb5 | ||
|
|
ddac192c4a | ||
|
|
69a03c2e16 | ||
|
|
2b128b85f7 | ||
|
|
b09f973231 | ||
|
|
95815a558c | ||
|
|
879da03438 | ||
|
|
d022be547b | ||
|
|
3f83fdbfc1 | ||
|
|
949152532c | ||
|
|
215adab1f9 | ||
|
|
7ce46ed60c | ||
|
|
c32bcca67b | ||
|
|
cb442364ca | ||
|
|
6bdc01290d | ||
|
|
ac34bf1e54 | ||
|
|
6fb164d200 | ||
|
|
a5d300c6ff | ||
|
|
6eb4409a72 | ||
|
|
533677df8b | ||
|
|
8f27b2ab56 | ||
|
|
25be42d385 | ||
|
|
00f6d30e08 | ||
|
|
090822eb41 | ||
|
|
d9900a725d | ||
|
|
a10106c61a | ||
|
|
5cb01f2ae9 | ||
|
|
4c1efe7ad4 | ||
|
|
4be92f285a | ||
|
|
f9b89e98c2 | ||
|
|
be01ce03d0 | ||
|
|
f221441877 | ||
|
|
18fda7ec68 | ||
|
|
f2e8c00f49 | ||
|
|
30e8b818f5 | ||
|
|
525ce0e0ad | ||
|
|
3cd567dc95 | ||
|
|
2f7ffa3636 | ||
|
|
d99386ef1e | ||
|
|
9ae3d2c074 | ||
|
|
dd5a337a49 | ||
|
|
51e634ccb4 | ||
|
|
31b1a821ca | ||
|
|
bf13fd48ce | ||
|
|
3b99760a42 | ||
|
|
0e78dc35d8 | ||
|
|
c8bbdb23de | ||
|
|
7ee8117186 | ||
|
|
8237c41143 | ||
|
|
d52ca93ba6 | ||
|
|
8354651059 | ||
|
|
81cc3c260f | ||
|
|
4dc32e194b | ||
|
|
5a82dd5110 | ||
|
|
f20708a5e7 | ||
|
|
91cf78f183 | ||
|
|
0cde8819cf | ||
|
|
07632b0eeb | ||
|
|
4a7f825cfe | ||
|
|
0b6b068097 | ||
|
|
4bc2051f44 | ||
|
|
623b2306ca | ||
|
|
34dde53506 | ||
|
|
7a09182446 | ||
|
|
233e513860 | ||
|
|
eb8cf56e8e | ||
|
|
12a27643db | ||
|
|
c6ccde0558 | ||
|
|
16e3ebd87b | ||
|
|
94c096dd5b | ||
|
|
2e3e4ec3b2 | ||
|
|
6e222c3938 | ||
|
|
3b3bd9b6c9 | ||
|
|
4e3331ba66 | ||
|
|
7caa96abcd | ||
|
|
b2776269cf | ||
|
|
b6c5a5fc9a | ||
|
|
94943a9a84 | ||
|
|
4c1942e3fe | ||
|
|
71e72f215d | ||
|
|
58cdfd86d0 | ||
|
|
dfa66b9dd4 | ||
|
|
d56ea25816 | ||
|
|
c91b272648 | ||
|
|
ca8bb75b40 | ||
|
|
36eab713a1 | ||
|
|
7133576fe9 | ||
|
|
effffcba1d | ||
|
|
404ce8bc3e | ||
|
|
a91bd095b0 | ||
|
|
fd6a1e5ed0 | ||
|
|
7d6ac87033 | ||
|
|
8aa813b862 | ||
|
|
95aa5c9f1c | ||
|
|
4319447cb5 | ||
|
|
50ea162251 | ||
|
|
9c239804d3 | ||
|
|
a7ccb9243d | ||
|
|
320e31bb10 | ||
|
|
8b55a16986 | ||
|
|
f9b8f9a45f | ||
|
|
41125ea1e2 | ||
|
|
73219bf2d2 | ||
|
|
d6eb723b7f | ||
|
|
993d73762c | ||
|
|
48b51c451a | ||
|
|
3d191d5884 | ||
|
|
955133f173 | ||
|
|
5054b714e2 | ||
|
|
c2cafb4b45 | ||
|
|
05868b541b | ||
|
|
67f474ef42 | ||
|
|
a40424e75c | ||
|
|
cd6c0e1de9 | ||
|
|
a99c8219bd | ||
|
|
a03fdaba39 | ||
|
|
92be0033a8 | ||
|
|
6f301576eb | ||
|
|
e2b3f76a10 | ||
|
|
b934c1be6a | ||
|
|
145b50a320 | ||
|
|
a33cdc9c7b | ||
|
|
62101e85ff | ||
|
|
0a3714e5e0 | ||
|
|
86a2830d75 | ||
|
|
b277202838 | ||
|
|
a4f6d9f6e7 | ||
|
|
9300e97d2b | ||
|
|
1d4aa44d3d | ||
|
|
3792f75281 | ||
|
|
b52fcb8aa9 | ||
|
|
a14c794255 | ||
|
|
aef96e95e8 | ||
|
|
f0da63a8ff | ||
|
|
cc860804f6 | ||
|
|
f38c460588 | ||
|
|
d8a19b5565 | ||
|
|
1c5b5e2ce6 | ||
|
|
9b9c59766f | ||
|
|
fc2a202afa | ||
|
|
4b4b71ff32 | ||
|
|
9358838dab | ||
|
|
2f24e42dc1 | ||
|
|
0c12aa163e | ||
|
|
a4d9f702e4 | ||
|
|
ec47274fbd | ||
|
|
efcedabee0 | ||
|
|
25a7b66296 | ||
|
|
ac194cd34f | ||
|
|
04ccb06e3f | ||
|
|
d31ee20ba5 | ||
|
|
9b25d45b93 | ||
|
|
eca05e6bad | ||
|
|
84bf20152b | ||
|
|
d51abdd73e | ||
|
|
200e9f1a8e | ||
|
|
7dc09b4019 | ||
|
|
dbb196a17e | ||
|
|
05a95c699f | ||
|
|
9ea8b2237a | ||
|
|
9c5e340fb8 | ||
|
|
e86c2e5970 | ||
|
|
67006add53 | ||
|
|
caeb86843d | ||
|
|
1571b26a65 | ||
|
|
0f15608175 | ||
|
|
705991e5b0 | ||
|
|
b636874bd9 | ||
|
|
965e4e9b19 | ||
|
|
af77977fda | ||
|
|
e74baf188f | ||
|
|
663a71255f | ||
|
|
bdf2f22f81 | ||
|
|
79aa3e159d | ||
|
|
95118398dd | ||
|
|
4d18a8e55f | ||
|
|
3bab41f138 | ||
|
|
a8330773ca | ||
|
|
4ca2305693 | ||
|
|
f577af0886 | ||
|
|
aab47bd453 | ||
|
|
445ddd89fb | ||
|
|
6f21a96238 | ||
|
|
c47bcb2f54 | ||
|
|
b0b628ffc2 | ||
|
|
428e1bc14d | ||
|
|
d66bb84924 | ||
|
|
4ce5123a12 | ||
|
|
4b4a2e9f9e | ||
|
|
58afd0b604 | ||
|
|
4352456129 | ||
|
|
bb141a70e8 | ||
|
|
ff260c03ca | ||
|
|
96a1192474 | ||
|
|
297f862ccc | ||
|
|
c052f40ef8 | ||
|
|
98246c0e35 | ||
|
|
8ac067da89 | ||
|
|
0ffb5d253a | ||
|
|
3a9898a6a6 | ||
|
|
693ec14df5 | ||
|
|
fa189b3234 | ||
|
|
3b27cd093b | ||
|
|
141bbfb051 | ||
|
|
663a919ed1 | ||
|
|
483babe3bc | ||
|
|
6abb9da88a | ||
|
|
b407641049 | ||
|
|
d5e8807756 | ||
|
|
7e9fdb3555 | ||
|
|
32e07c22d0 | ||
|
|
d427c52aac | ||
|
|
eb623a84d5 | ||
|
|
07290277ba | ||
|
|
743541218f | ||
|
|
94de0a7ce2 | ||
|
|
36e9fb292b | ||
|
|
2661e010d9 | ||
|
|
7687becfee | ||
|
|
1641f09dc9 | ||
|
|
b42faea2eb | ||
|
|
1505673393 | ||
|
|
635a6279a9 | ||
|
|
404d3e0959 | ||
|
|
f77b20bbca | ||
|
|
1d0a1664e6 | ||
|
|
410afbf9a1 | ||
|
|
aaddfa6f3a | ||
|
|
2d9a16e857 | ||
|
|
1dcba51092 | ||
|
|
7c63b30de1 | ||
|
|
c0eae1ad52 | ||
|
|
c012b98223 | ||
|
|
559493babd | ||
|
|
990ab2c7ef | ||
|
|
437003de29 | ||
|
|
629e05b7b1 | ||
|
|
22b1959333 | ||
|
|
e98f6ae570 | ||
|
|
0b5bf0c098 | ||
|
|
1deefa48ee | ||
|
|
97008305ff | ||
|
|
1a17083e8c | ||
|
|
b6664cc859 | ||
|
|
50c4aef873 | ||
|
|
cf42d31214 | ||
|
|
00caa1c0a0 | ||
|
|
93c8ba920a | ||
|
|
8702c04d39 | ||
|
|
e595c313a1 | ||
|
|
955da2e360 | ||
|
|
04b3fc0268 | ||
|
|
105ccc81a5 | ||
|
|
c349892c5b | ||
|
|
3d4b8ce99b | ||
|
|
3571307df5 | ||
|
|
64fd87134f | ||
|
|
82bba44538 | ||
|
|
df05f3a3c0 | ||
|
|
8e31ef7be6 | ||
|
|
f4555f7c96 | ||
|
|
8408da55ea | ||
|
|
4a67dd2e28 | ||
|
|
bd806a34d8 | ||
|
|
2f7e833a79 | ||
|
|
c17503ab78 | ||
|
|
19f76d34db | ||
|
|
25c8b2fabb | ||
|
|
bfd8bf9ca4 | ||
|
|
e6adbb0e42 | ||
|
|
11fc6be328 | ||
|
|
7a5405d2ab | ||
|
|
b9a24f00ad | ||
|
|
dbfc292353 | ||
|
|
a09255b2ff | ||
|
|
9d1c72cc07 | ||
|
|
09ac30ef2e | ||
|
|
0ec8f5d283 | ||
|
|
b872df0f31 | ||
|
|
0add4af208 | ||
|
|
298cd9e065 | ||
|
|
b715d20385 | ||
|
|
79e313a0c0 | ||
|
|
9f4c75d1c2 | ||
|
|
b37492644c | ||
|
|
04a792a8c2 | ||
|
|
35ec24c3f0 | ||
|
|
9a00ccdacc | ||
|
|
61b23677d1 | ||
|
|
90037dc6cd | ||
|
|
e8d48e1f43 | ||
|
|
a2f8c9c75b | ||
|
|
5fb83e7f52 | ||
|
|
dd6bf568d1 | ||
|
|
00ee164cef | ||
|
|
448071b02d | ||
|
|
4dad9d0e37 | ||
|
|
3a2117c5d3 | ||
|
|
26a3f6ddc3 | ||
|
|
7741312673 | ||
|
|
954a1723f1 | ||
|
|
87285d94f7 | ||
|
|
d260d0c182 | ||
|
|
137eb40fab | ||
|
|
af440460e1 | ||
|
|
a5c8472a37 | ||
|
|
dfae37421d | ||
|
|
438a8d8b75 | ||
|
|
ac2034561d | ||
|
|
c42cd4233d | ||
|
|
5b2a73e3eb | ||
|
|
6f163a6ba5 | ||
|
|
cc94cc7d01 | ||
|
|
94934ae2cf | ||
|
|
e361f88501 | ||
|
|
708c042b61 | ||
|
|
600599f49e | ||
|
|
1fe7bbbbc4 | ||
|
|
f83d7a7cd1 | ||
|
|
7094047b3d | ||
|
|
11d3607688 | ||
|
|
fcae58d355 | ||
|
|
ef9ace9e65 | ||
|
|
22e4039133 | ||
|
|
4971670e56 | ||
|
|
e16cab6b9c | ||
|
|
a643c3dba6 | ||
|
|
51abf5b0a6 | ||
|
|
1cee6e309b | ||
|
|
0777a660bf | ||
|
|
5e0479e414 | ||
|
|
942c77816d | ||
|
|
8e260d5c40 | ||
|
|
7951eee8a3 | ||
|
|
be2f7d7a8a | ||
|
|
59c8e8b46e | ||
|
|
98c8b28bf3 | ||
|
|
7bb5bc01b7 | ||
|
|
1482c07ae4 | ||
|
|
adba84ae6a | ||
|
|
146e296826 | ||
|
|
28c10dba09 | ||
|
|
e646a0840d | ||
|
|
74ea6bf00a | ||
|
|
d7ad784809 | ||
|
|
642bd10dcc | ||
|
|
7c566c36f4 | ||
|
|
dbbe038939 | ||
|
|
e3430a916c | ||
|
|
ea1f041e11 | ||
|
|
0fe6d9f367 | ||
|
|
46e7359372 | ||
|
|
41cace9a96 | ||
|
|
4638331cb4 | ||
|
|
e339a7583c | ||
|
|
0b7570c9ee | ||
|
|
a85acfcfc5 | ||
|
|
3d4ccbec23 | ||
|
|
2f66ec60db | ||
|
|
f1cfe2b07b | ||
|
|
6160ca6e30 | ||
|
|
b621c3e4c4 | ||
|
|
64d2ae9ad4 | ||
|
|
39fc45b8d8 | ||
|
|
fd954adc81 | ||
|
|
8b379cbf56 | ||
|
|
59c0b04602 | ||
|
|
11b3cf3bfd | ||
|
|
9254f5a8a5 | ||
|
|
e5b68f4a3c | ||
|
|
95babc01e3 | ||
|
|
4dd792a49f | ||
|
|
207c50e500 | ||
|
|
763e34e861 | ||
|
|
b895a0c335 | ||
|
|
c5767eb545 | ||
|
|
94fb79c17f | ||
|
|
6856b02aa7 | ||
|
|
04f812c136 | ||
|
|
8783cf03b2 | ||
|
|
4e1156e083 | ||
|
|
1d6e1d416b | ||
|
|
fd02e5a07e | ||
|
|
937056fcaf | ||
|
|
41ed18684d | ||
|
|
96d4a22215 | ||
|
|
6e4ef508e8 | ||
|
|
4437d7f3c4 | ||
|
|
001570e941 | ||
|
|
28c41294bb | ||
|
|
82898da507 | ||
|
|
eabcdbf129 | ||
|
|
5ab11edad2 | ||
|
|
b57317bdc2 | ||
|
|
1f49f29183 | ||
|
|
638fbfabdc | ||
|
|
16de12a3ba | ||
|
|
1316578ba3 | ||
|
|
1926c50f09 | ||
|
|
b858a4a5d7 | ||
|
|
ec9741443b | ||
|
|
fe7b2a36ec | ||
|
|
2d88a726b7 | ||
|
|
a51edd3579 | ||
|
|
b7ede8f9ba | ||
|
|
15f36cc19d | ||
|
|
95edd970bc | ||
|
|
2c6285d4b3 |
22
.asf.yaml
Normal file
22
.asf.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
notifications:
|
||||
commits: commits@cordova.apache.org
|
||||
issues: issues@cordova.apache.org
|
||||
pullrequests_status: issues@cordova.apache.org
|
||||
pullrequests_comment: issues@cordova.apache.org
|
||||
3
.eslintignore
Normal file
3
.eslintignore
Normal file
@@ -0,0 +1,3 @@
|
||||
bin/templates/project/assets/www/cordova.js
|
||||
test/android/app
|
||||
test/androidx/app
|
||||
27
.eslintrc.yml
Normal file
27
.eslintrc.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
extends: '@cordova/eslint-config/node'
|
||||
|
||||
overrides:
|
||||
- files: [spec/**/*.js]
|
||||
extends: '@cordova/eslint-config/node-tests'
|
||||
rules:
|
||||
prefer-promise-reject-errors: off
|
||||
|
||||
- files: [cordova-js-src/**/*.js]
|
||||
extends: '@cordova/eslint-config/browser'
|
||||
94
.gitattributes
vendored
Normal file
94
.gitattributes
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
* text eol=lf
|
||||
|
||||
# source code
|
||||
*.php text
|
||||
*.css text
|
||||
*.sass text
|
||||
*.scss text
|
||||
*.less text
|
||||
*.styl text
|
||||
*.js text
|
||||
*.coffee text
|
||||
*.json text
|
||||
*.htm text
|
||||
*.html text
|
||||
*.xml text
|
||||
*.svg text
|
||||
*.txt text
|
||||
*.ini text
|
||||
*.inc text
|
||||
*.pl text
|
||||
*.rb text
|
||||
*.py text
|
||||
*.scm text
|
||||
*.sql text
|
||||
*.sh text
|
||||
*.bat text
|
||||
|
||||
# templates
|
||||
*.ejs text
|
||||
*.hbt text
|
||||
*.jade text
|
||||
*.haml text
|
||||
*.hbs text
|
||||
*.dot text
|
||||
*.tmpl text
|
||||
*.phtml text
|
||||
|
||||
# server config
|
||||
.htaccess text
|
||||
|
||||
# git config
|
||||
.gitattributes text
|
||||
.gitignore text
|
||||
.gitconfig text
|
||||
|
||||
# code analysis config
|
||||
.jshintrc text
|
||||
.jscsrc text
|
||||
.jshintignore text
|
||||
.csslintrc text
|
||||
|
||||
# misc config
|
||||
*.yaml text
|
||||
*.yml text
|
||||
.editorconfig text
|
||||
|
||||
# build config
|
||||
*.npmignore text
|
||||
*.bowerrc text
|
||||
|
||||
# Heroku
|
||||
Procfile text
|
||||
.slugignore text
|
||||
|
||||
# Documentation
|
||||
*.md text
|
||||
LICENSE text
|
||||
AUTHORS text
|
||||
|
||||
|
||||
#
|
||||
## These files are binary and should be left untouched
|
||||
#
|
||||
|
||||
# (binary is a macro for -text -diff)
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.jpeg binary
|
||||
*.gif binary
|
||||
*.ico binary
|
||||
*.mov binary
|
||||
*.mp4 binary
|
||||
*.mp3 binary
|
||||
*.flv binary
|
||||
*.fla binary
|
||||
*.swf binary
|
||||
*.gz binary
|
||||
*.zip binary
|
||||
*.7z binary
|
||||
*.ttf binary
|
||||
*.eot binary
|
||||
*.woff binary
|
||||
*.pyc binary
|
||||
*.pdf binary
|
||||
42
.github/ISSUE_TEMPLATE.md
vendored
Normal file
42
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<!--
|
||||
Please have a look at the issue templates you get when you click "New issue" in the GitHub UI.
|
||||
We very much prefer issues created by using one of these templates.
|
||||
-->
|
||||
|
||||
### Issue Type
|
||||
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
|
||||
|
||||
- [ ] Bug Report
|
||||
- [ ] Feature Request
|
||||
- [ ] Support Question
|
||||
|
||||
## Description
|
||||
|
||||
## Information
|
||||
<!-- Include all relevant information that might help understand and reproduce the problem -->
|
||||
|
||||
### Command or Code
|
||||
<!-- What command or code is needed to reproduce the problem? -->
|
||||
|
||||
### Environment, Platform, Device
|
||||
<!-- In what environment, on what platform or on which device are you experiencing the issue? -->
|
||||
|
||||
|
||||
|
||||
### Version information
|
||||
<!--
|
||||
What are relevant versions you are using?
|
||||
For example:
|
||||
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
|
||||
Other Frameworks: Ionic Framework and CLI version
|
||||
Operating System, Android Studio, Xcode etc.
|
||||
-->
|
||||
|
||||
|
||||
|
||||
## Checklist
|
||||
<!-- Please check the boxes by putting an `x` in the `[ ]` like so: `[x]` -->
|
||||
|
||||
- [ ] I searched for already existing GitHub issues about this
|
||||
- [ ] I updated all Cordova tooling to their most recent version
|
||||
- [ ] I included all the necessary information above
|
||||
50
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
Normal file
50
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
name: 🐛 Bug Report
|
||||
about: If something isn't working as expected.
|
||||
|
||||
---
|
||||
|
||||
# Bug Report
|
||||
|
||||
## Problem
|
||||
|
||||
### What is expected to happen?
|
||||
|
||||
|
||||
|
||||
### What does actually happen?
|
||||
|
||||
|
||||
|
||||
## Information
|
||||
<!-- Include all relevant information that might help understand and reproduce the problem -->
|
||||
|
||||
|
||||
|
||||
### Command or Code
|
||||
<!-- What command or code is needed to reproduce the problem? -->
|
||||
|
||||
|
||||
|
||||
### Environment, Platform, Device
|
||||
<!-- In what environment, on what platform or on which device are you experiencing the issue? -->
|
||||
|
||||
|
||||
|
||||
### Version information
|
||||
<!--
|
||||
What are relevant versions you are using?
|
||||
For example:
|
||||
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
|
||||
Other Frameworks: Ionic Framework and CLI version
|
||||
Operating System, Android Studio, Xcode etc.
|
||||
-->
|
||||
|
||||
|
||||
|
||||
## Checklist
|
||||
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
|
||||
|
||||
- [ ] I searched for existing GitHub issues
|
||||
- [ ] I updated all Cordova tooling to most recent version
|
||||
- [ ] I included all the necessary information above
|
||||
29
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
Normal file
29
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: 🚀 Feature Request
|
||||
about: A suggestion for a new functionality
|
||||
|
||||
---
|
||||
|
||||
# Feature Request
|
||||
|
||||
## Motivation Behind Feature
|
||||
<!-- Why should this feature be implemented? What problem does it solve? -->
|
||||
|
||||
|
||||
|
||||
## Feature Description
|
||||
<!--
|
||||
Describe your feature request in detail
|
||||
Please provide any code examples or screenshots of what this feature would look like
|
||||
Are there any drawbacks? Will this break anything for existing users?
|
||||
-->
|
||||
|
||||
|
||||
|
||||
## Alternatives or Workarounds
|
||||
<!--
|
||||
Describe alternatives or workarounds you are currently using
|
||||
Are there ways to do this with existing functionality?
|
||||
-->
|
||||
|
||||
|
||||
27
.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: 💬 Support Question
|
||||
about: If you have a question, please check out our Slack or StackOverflow!
|
||||
|
||||
---
|
||||
|
||||
<!------------^ Click "Preview" for a nicer view! -->
|
||||
|
||||
Apache Cordova uses GitHub Issues as a feature request and bug tracker _only_.
|
||||
For usage and support questions, please check out the resources below. Thanks!
|
||||
|
||||
---
|
||||
|
||||
You can get answers to your usage and support questions about **Apache Cordova** on:
|
||||
|
||||
* Slack Community Chat: https://cordova.slack.com (you can sign-up at http://slack.cordova.io/)
|
||||
* StackOverflow: https://stackoverflow.com/questions/tagged/cordova using the tag `cordova`
|
||||
|
||||
---
|
||||
|
||||
If you are using a tool that uses Cordova internally, like e.g. Ionic, check their support channels:
|
||||
|
||||
* **Ionic Framework**
|
||||
* [Ionic Community Forum](https://forum.ionicframework.com/)
|
||||
* [Ionic Worldwide Slack](https://ionicworldwide.herokuapp.com/)
|
||||
* **PhoneGap**
|
||||
* [PhoneGap Developer Community](https://forums.adobe.com/community/phonegap)
|
||||
35
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
35
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<!--
|
||||
Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines:
|
||||
|
||||
http://cordova.apache.org/contribute/contribute_guidelines.html
|
||||
|
||||
Thanks!
|
||||
-->
|
||||
|
||||
### Platforms affected
|
||||
|
||||
|
||||
|
||||
### Motivation and Context
|
||||
<!-- Why is this change required? What problem does it solve? -->
|
||||
<!-- If it fixes an open issue, please link to the issue here. -->
|
||||
|
||||
|
||||
|
||||
### Description
|
||||
<!-- Describe your changes in detail -->
|
||||
|
||||
|
||||
|
||||
### Testing
|
||||
<!-- Please describe in detail how you tested your changes. -->
|
||||
|
||||
|
||||
|
||||
### Checklist
|
||||
|
||||
- [ ] I've run the tests to see all new and existing tests pass
|
||||
- [ ] I added automated test coverage as appropriate for this change
|
||||
- [ ] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`)
|
||||
- [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
|
||||
- [ ] I've updated the documentation if necessary
|
||||
61
.github/workflows/ci.yml
vendored
Normal file
61
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
name: Node CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: NodeJS ${{ matrix.node-version }} on ${{ matrix.os }}
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [10.x, 12.x]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
|
||||
- name: Environment Information
|
||||
run: |
|
||||
node --version
|
||||
npm --version
|
||||
gradle --version
|
||||
|
||||
- name: npm install and test
|
||||
run: |
|
||||
npm i
|
||||
npm t
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- uses: codecov/codecov-action@v1
|
||||
with:
|
||||
fail_ci_if_error: true
|
||||
68
.gitignore
vendored
68
.gitignore
vendored
@@ -1,27 +1,6 @@
|
||||
.DS_Store
|
||||
default.properties
|
||||
gen
|
||||
assets/www/cordova.js
|
||||
framework/assets/www/.tmp*
|
||||
local.properties
|
||||
framework/lib
|
||||
proguard.cfg
|
||||
proguard.cfg
|
||||
proguard-project.txt
|
||||
framework/bin
|
||||
framework/test/org/apache/cordova/*.class
|
||||
framework/assets/www/.DS_Store
|
||||
framework/assets/www/cordova-*.js
|
||||
framework/assets/www/phonegap-*.js
|
||||
framework/libs
|
||||
test/libs
|
||||
example
|
||||
./test
|
||||
test/bin
|
||||
test/assets/www/.tmp*
|
||||
tmp/**
|
||||
.gradle
|
||||
.metadata
|
||||
tmp/**/*
|
||||
Thumbs.db
|
||||
Desktop.ini
|
||||
*.tmp
|
||||
@@ -29,6 +8,49 @@ Desktop.ini
|
||||
*.swp
|
||||
*.class
|
||||
*.jar
|
||||
default.properties
|
||||
gen
|
||||
assets/www/cordova.js
|
||||
local.properties
|
||||
proguard.cfg
|
||||
proguard-project.txt
|
||||
example
|
||||
/coverage
|
||||
/framework/lib
|
||||
/framework/build
|
||||
/framework/bin
|
||||
/framework/assets/www/.DS_Store
|
||||
/framework/assets/www/cordova-*.js
|
||||
/framework/assets/www/phonegap-*.js
|
||||
/framework/libs
|
||||
/framework/javadoc-public
|
||||
/framework/javadoc-private
|
||||
/test/.externalNativeBuild
|
||||
|
||||
/test/android/gradle
|
||||
/test/android/gradlew
|
||||
/test/android/gradlew.bat
|
||||
/test/androidx/gradle
|
||||
/test/androidx/gradlew
|
||||
/test/androidx/gradlew.bat
|
||||
|
||||
/test/assets/www/.tmp*
|
||||
/test/assets/www/cordova.js
|
||||
/test/bin
|
||||
/test/build
|
||||
/test/captures
|
||||
/test/libs
|
||||
tmp/**
|
||||
tmp/**/*
|
||||
!/spec/fixtures/org.test.plugins.dummyplugin/src/android/TestLib.jar
|
||||
# IntelliJ IDEA files
|
||||
**/.idea/**/*
|
||||
*.iml
|
||||
.idea
|
||||
npm-debug.log
|
||||
node_modules/
|
||||
coverage/
|
||||
.nyc_output/
|
||||
# Eclipse Buildship files
|
||||
.project
|
||||
.settings
|
||||
.classpath
|
||||
|
||||
5
.npmignore
Normal file
5
.npmignore
Normal file
@@ -0,0 +1,5 @@
|
||||
.*
|
||||
coverage
|
||||
test
|
||||
spec
|
||||
framework/build
|
||||
8
.ratignore
Normal file
8
.ratignore
Normal file
@@ -0,0 +1,8 @@
|
||||
*.properties
|
||||
bin
|
||||
gen
|
||||
proguard-project.txt
|
||||
spec
|
||||
framework/build
|
||||
ic_launcher.png
|
||||
build
|
||||
@@ -4,5 +4,5 @@
|
||||
GUESS_FIELDS = True
|
||||
OPEN_BROWSER = True
|
||||
TARGET_GROUPS = 'cordova'
|
||||
REVIEWBOARD_URL = 'http://reviews.apache.org'
|
||||
REVIEWBOARD_URL = 'https://reviews.apache.org'
|
||||
|
||||
|
||||
37
CONTRIBUTING.md
Normal file
37
CONTRIBUTING.md
Normal file
@@ -0,0 +1,37 @@
|
||||
<!--
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
-->
|
||||
|
||||
# Contributing to Apache Cordova
|
||||
|
||||
Anyone can contribute to Cordova. And we need your contributions.
|
||||
|
||||
There are multiple ways to contribute: report bugs, improve the docs, and
|
||||
contribute code.
|
||||
|
||||
For instructions on this, start with the
|
||||
[contribution overview](http://cordova.apache.org/contribute/).
|
||||
|
||||
The details are explained there, but the important items are:
|
||||
- Check for Github issues that corresponds to your contribution and link or create them if necessary.
|
||||
- Run the tests so your patch doesn't break existing functionality.
|
||||
|
||||
We look forward to your contributions!
|
||||
|
||||
69
LICENSE
69
LICENSE
@@ -187,7 +187,7 @@
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Copyright 2015-2020 Apache Cordova
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -199,4 +199,69 @@
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
limitations under the License.
|
||||
|
||||
ADDITIONAL LICENSES:
|
||||
|
||||
================================================================================
|
||||
bin/node_modules/q
|
||||
================================================================================
|
||||
|
||||
Copyright 2009–2017 Kristopher Michael Kowal. All rights reserved.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
================================================================================
|
||||
bin/node_modules/nopt
|
||||
================================================================================
|
||||
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
================================================================================
|
||||
bin/node_modules/which
|
||||
================================================================================
|
||||
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
16
NOTICE
16
NOTICE
@@ -1,17 +1,5 @@
|
||||
Apache Cordova
|
||||
Copyright 2012 The Apache Software Foundation
|
||||
Copyright 2015-2020 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org)
|
||||
|
||||
=========================================================================
|
||||
== NOTICE file corresponding to the section 4 d of ==
|
||||
== the Apache License, Version 2.0, ==
|
||||
== in this case for the Android-specific code. ==
|
||||
=========================================================================
|
||||
|
||||
Android Code
|
||||
Copyright 2005-2008 The Android Open Source Project
|
||||
|
||||
This product includes software developed as part of
|
||||
The Android Open Source Project (http://source.android.com).
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
74
README.md
Executable file → Normal file
74
README.md
Executable file → Normal file
@@ -7,9 +7,9 @@
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,74 +18,46 @@
|
||||
# under the License.
|
||||
#
|
||||
-->
|
||||
Cordova Android
|
||||
===
|
||||
|
||||
Cordova Android is an Android application library that allows for Cordova-based
|
||||
projects to be built for the Android Platform. Cordova based applications are,
|
||||
at the core, applications written with web technology: HTML, CSS and JavaScript.
|
||||
# Cordova Android
|
||||
|
||||
[Apache Cordova](http://cordova.io) is a project at The Apache Software Foundation (ASF).
|
||||
[](https://nodei.co/npm/cordova-android/)
|
||||
|
||||
[](https://github.com/apache/cordova-android/actions?query=branch%3Amaster)
|
||||
[](https://codecov.io/github/apache/cordova-android?branch=master)
|
||||
|
||||
Requires
|
||||
---
|
||||
Cordova Android is an Android application library that allows for Cordova-based projects to be built for the Android Platform. Cordova based applications are, at the core, applications written with web technology: HTML, CSS and JavaScript.
|
||||
|
||||
- Java JDK 1.5 or greater
|
||||
- Apache ANT 1.8.0 or greater
|
||||
- Android SDK [http://developer.android.com](http://developer.android.com)
|
||||
[Apache Cordova](https://cordova.apache.org) is a project of The Apache Software Foundation (ASF).
|
||||
|
||||
|
||||
Cordova Android Developer Tools
|
||||
---
|
||||
## Requires
|
||||
|
||||
The Cordova developer tooling is split between general tooling and project level tooling.
|
||||
- Java JDK 1.8
|
||||
- Android SDK [http://developer.android.com](https://developer.android.com/)
|
||||
|
||||
General Commands
|
||||
## Cordova Android Developer Tools
|
||||
|
||||
./bin/create [path package activity] ... create the ./example app or a cordova android project
|
||||
We recommend using the [Cordova command-line tool](https://www.npmjs.com/package/cordova) to create projects and be able to easily install plugins.
|
||||
|
||||
However, the following scripts can be used instead:
|
||||
|
||||
./bin/create [path package activity] ... creates the ./example app or a cordova android project
|
||||
./bin/check_reqs ....................... checks that your environment is set up for cordova-android development
|
||||
./bin/update [path] .................... updates an existing cordova-android project to the version of the framework
|
||||
|
||||
Project Commands
|
||||
|
||||
These commands live in a generated Cordova Android project. Any interactions with the emulator require you to have an AVD defined.
|
||||
|
||||
./cordova/clean ........................ cleans the project
|
||||
./cordova/build ........................ calls `clean` then compiles the project
|
||||
./cordova/log ........................ stream device or emulate logs to stdout
|
||||
./cordova/log ........................ streams device or emulator logs to STDOUT
|
||||
./cordova/run ........................ calls `build` then deploys to a connected Android device. If no Android device is detected, will launch an emulator and deploy to it.
|
||||
./cordova/version ...................... returns the cordova-android version of the current project
|
||||
|
||||
Importing a Cordova Android Project into Eclipse
|
||||
----
|
||||
## Using Android Studio
|
||||
|
||||
1. File > New > Project...
|
||||
2. Android > Android Project
|
||||
3. Create project from existing source (point to the generated app found in tmp/android)
|
||||
4. Right click on libs/cordova.jar and add to build path
|
||||
5. Right click on the project root: Run as > Run Configurations
|
||||
6. Click on the Target tab and select Manual (this way you can choose the emulator or device to build to)
|
||||
1. Create a project
|
||||
2. Import it via "Non-Android Studio Project"
|
||||
|
||||
Building without the Tooling
|
||||
---
|
||||
Note: The Developer Tools handle this. This is only to be done if the tooling fails, or if
|
||||
you are developing directly against the framework.
|
||||
## Running the Native Tests
|
||||
|
||||
|
||||
To create your `cordova.jar` file, run in the framework directory:
|
||||
|
||||
android update project -p . -t android-17
|
||||
ant jar
|
||||
|
||||
|
||||
Running Tests
|
||||
----
|
||||
Please see details under test/README.md.
|
||||
|
||||
Further Reading
|
||||
---
|
||||
|
||||
- [http://developer.android.com](http://developer.android.com)
|
||||
- [http://cordova.apache.org/](http://cordova.apache.org)
|
||||
- [http://wiki.apache.org/cordova/](http://wiki.apache.org/cordova/)
|
||||
The `test/` directory in this project contains an Android test project that can be used to run different kinds of native tests. Check out the [README contained therein](test/README.md) for more details!
|
||||
|
||||
844
RELEASENOTES.md
Normal file
844
RELEASENOTES.md
Normal file
@@ -0,0 +1,844 @@
|
||||
<!--
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
-->
|
||||
## Release Notes for Cordova (Android)
|
||||
|
||||
### 9.0.0 (Jun 23, 2020)
|
||||
|
||||
* [GH-1005](https://github.com/apache/cordova-android/pull/1005) chore: set AndroidX off by default
|
||||
* [GH-971](https://github.com/apache/cordova-android/pull/971) fix: Accept multiple mime types on file input
|
||||
* [GH-1001](https://github.com/apache/cordova-android/pull/1001) fix: support both adaptive and standard icons at the same time
|
||||
* [GH-985](https://github.com/apache/cordova-android/pull/985) fix: Plugin install fails when preview sdk is installed
|
||||
* [GH-994](https://github.com/apache/cordova-android/pull/994) chore: cleanup yaml files
|
||||
* [GH-999](https://github.com/apache/cordova-android/pull/999) chore: remove trailing spaces from Java sources
|
||||
* [GH-992](https://github.com/apache/cordova-android/pull/992) chore: update some dependencies
|
||||
* [GH-998](https://github.com/apache/cordova-android/pull/998) chore: remove trailing spaces from framework build files
|
||||
* [GH-997](https://github.com/apache/cordova-android/pull/997) chore: remove trailing spaces from project template
|
||||
* [GH-996](https://github.com/apache/cordova-android/pull/996) chore: remove trailing spaces from bat files
|
||||
* [GH-995](https://github.com/apache/cordova-android/pull/995) remove trailing spaces from markdown files
|
||||
* [GH-993](https://github.com/apache/cordova-android/pull/993) chore: update `devDependencies`
|
||||
* [GH-987](https://github.com/apache/cordova-android/pull/987) breaking: reduce combined response cutoff to 16 MB
|
||||
* [GH-988](https://github.com/apache/cordova-android/pull/988) major: Gradle 6.5 & **Android** Gradle plugin 4.0.0 updates
|
||||
* [GH-990](https://github.com/apache/cordova-android/pull/990) chore: remove trailing spaces from `app/build.gradle`
|
||||
* [GH-989](https://github.com/apache/cordova-android/pull/989) breaking: remove `legacy/build.gradle` from template
|
||||
* [GH-978](https://github.com/apache/cordova-android/pull/978) fix: `wait_for_boot` waiting forever
|
||||
* [GH-965](https://github.com/apache/cordova-android/pull/965) fix: Increased `detectArchitecture()` timeout
|
||||
* [GH-962](https://github.com/apache/cordova-android/pull/962) breaking: Bump **Android** gradle plugin to 3.6.0
|
||||
* [GH-948](https://github.com/apache/cordova-android/pull/948) feature: JVM Args flag
|
||||
* [GH-951](https://github.com/apache/cordova-android/pull/951) fix: `ANDROID_SDK_ROOT` variable
|
||||
* [GH-959](https://github.com/apache/cordova-android/pull/959) test: synced AndroidX gradle versions to the same version as the **Android** test
|
||||
* [GH-960](https://github.com/apache/cordova-android/pull/960) feat: `com.android.tools.build:gradle:3.5.3`
|
||||
* [GH-956](https://github.com/apache/cordova-android/pull/956) chore(npm): add `package-lock.json`
|
||||
* [GH-958](https://github.com/apache/cordova-android/pull/958) chore(npm): add ignore list
|
||||
* [GH-957](https://github.com/apache/cordova-android/pull/957) chore: various cleanup
|
||||
* [GH-955](https://github.com/apache/cordova-android/pull/955) chore(eslint): bump package & apply eslint fix
|
||||
* [GH-954](https://github.com/apache/cordova-android/pull/954) breaking(npm): bump packages
|
||||
* [GH-953](https://github.com/apache/cordova-android/pull/953) chore(npm): use short notation in `package.json`
|
||||
* [GH-823](https://github.com/apache/cordova-android/pull/823) fix: prevent exit fullscreen mode from closing application
|
||||
* [GH-950](https://github.com/apache/cordova-android/pull/950) fix: removed redundent logcat print
|
||||
* [GH-915](https://github.com/apache/cordova-android/pull/915) breaking: bump minSdkVersion to 22 and drop pre-Lollipop specific code
|
||||
* [GH-941](https://github.com/apache/cordova-android/pull/941) fix: GH-873 App bundle builds to obey command-line arguments
|
||||
* [GH-940](https://github.com/apache/cordova-android/pull/940) ci: drop travis & move codecov to gh-actions
|
||||
* [GH-929](https://github.com/apache/cordova-android/pull/929) chore: updated `README` to reflect what **Android** requires more accurately, which is Java 8, not anything less, not anything greater. Java 1.8.x is required.
|
||||
* [GH-937](https://github.com/apache/cordova-android/pull/937) fix: GH-935 replaced `compare-func` with native sort method
|
||||
* [GH-939](https://github.com/apache/cordova-android/pull/939) fix: test failure with shebang interpreter in `rewired` files
|
||||
* [GH-911](https://github.com/apache/cordova-android/pull/911) refactor: use es6 class
|
||||
* [GH-910](https://github.com/apache/cordova-android/pull/910) refactor (eslint): use `cordova-eslint`
|
||||
* [GH-909](https://github.com/apache/cordova-android/pull/909) chore: remove appveyor residual
|
||||
* [GH-895](https://github.com/apache/cordova-android/pull/895) feat: add github actions
|
||||
* [GH-842](https://github.com/apache/cordova-android/pull/842) refactor: remove `shelljs` dependency
|
||||
* [GH-896](https://github.com/apache/cordova-android/pull/896) feat: add Kotlin support
|
||||
* [GH-901](https://github.com/apache/cordova-android/pull/901) feat: add AndroidX support
|
||||
* [GH-849](https://github.com/apache/cordova-android/pull/849) fix: cordova requirements consider the `android-targetSdkVersion`
|
||||
* [GH-904](https://github.com/apache/cordova-android/pull/904) fix (adb): shell to return expected stdout
|
||||
* [GH-792](https://github.com/apache/cordova-android/pull/792) feat: upgrade `gradle` to 6.1 & gradle build tools to 3.5.3
|
||||
* [GH-902](https://github.com/apache/cordova-android/pull/902) chore: remove `.project` file & add `.settings` to `gitignore`
|
||||
* [GH-900](https://github.com/apache/cordova-android/pull/900) refactor: simplify `doFindLatestInstalledBuildTools`
|
||||
* [GH-751](https://github.com/apache/cordova-android/pull/751) feat: use Java package name for loading `BuildConfig`
|
||||
* [GH-898](https://github.com/apache/cordova-android/pull/898) chore: rename gradle plugin google services `preference` options
|
||||
* [GH-893](https://github.com/apache/cordova-android/pull/893) feat: add Google Services support
|
||||
* [GH-709](https://github.com/apache/cordova-android/pull/709) feat: add `version-compare` library to compare `build-tools` versions properly.
|
||||
* [GH-831](https://github.com/apache/cordova-android/pull/831) chore: ignore auto-generated eclipse buildship files
|
||||
* [GH-848](https://github.com/apache/cordova-android/pull/848) breaking: increased default target sdk to 29
|
||||
* [GH-859](https://github.com/apache/cordova-android/pull/859) breaking: removed unnecessary project name restriction
|
||||
* [GH-833](https://github.com/apache/cordova-android/pull/833) chore: drop `q` module
|
||||
* [GH-862](https://github.com/apache/cordova-android/pull/862) chore: replace `superspawn` & `child_process` with `execa`
|
||||
* [GH-860](https://github.com/apache/cordova-android/pull/860) feat: don't filter gradle's stderr anymore
|
||||
* [GH-832](https://github.com/apache/cordova-android/pull/832) chore: drop node 6 and 8 support
|
||||
* [GH-890](https://github.com/apache/cordova-android/pull/890) chore: bump version to 9.0.0-dev
|
||||
* [GH-697](https://github.com/apache/cordova-android/pull/697) chore: optimization code
|
||||
* [GH-863](https://github.com/apache/cordova-android/pull/863) chore: removed comment that serves no purpose
|
||||
* [GH-861](https://github.com/apache/cordova-android/pull/861) chore: update `jasmine` to 3.5.0
|
||||
* [GH-858](https://github.com/apache/cordova-android/pull/858) chore: modernize our one E2E test
|
||||
* [GH-854](https://github.com/apache/cordova-android/pull/854) chore: ensure to lint as many files as possible
|
||||
|
||||
### 8.1.0 (Sep 11, 2019)
|
||||
|
||||
* [GH-827](https://github.com/apache/cordova-android/pull/827) chore: bump dependencies for release 8.1.0
|
||||
* [GH-651](https://github.com/apache/cordova-android/pull/651) feat: added multiple selection for filepicker
|
||||
* [GH-672](https://github.com/apache/cordova-android/pull/672) chore: compress files in /res with tinypng.com
|
||||
* [GH-815](https://github.com/apache/cordova-android/pull/815) fix: `clean` command
|
||||
* [GH-750](https://github.com/apache/cordova-android/pull/750) Don't request focus explicitly if not needed
|
||||
* [GH-800](https://github.com/apache/cordova-android/pull/800) [GH-799](https://github.com/apache/cordova-android/pull/799) (android) Stop webview from restarting when activity resizes
|
||||
* [GH-764](https://github.com/apache/cordova-android/pull/764) feat: Build app bundles (.aab files)
|
||||
* [GH-788](https://github.com/apache/cordova-android/pull/788) Simplify `apkSorter` using `compare-func` package
|
||||
* [GH-787](https://github.com/apache/cordova-android/pull/787) Simplify and fix promise handling in specs
|
||||
* [GH-784](https://github.com/apache/cordova-android/pull/784) Properly handle promise in create script
|
||||
* [GH-783](https://github.com/apache/cordova-android/pull/783) Do not clobber process properties with test mocks
|
||||
* [GH-782](https://github.com/apache/cordova-android/pull/782) Do not clobber `console.log` to spy on it
|
||||
* [GH-724](https://github.com/apache/cordova-android/pull/724) Add Node.js 12 to CI Services
|
||||
* [GH-777](https://github.com/apache/cordova-android/pull/777) ci(travis): set `dist: trusty` in `.travis.yml`
|
||||
* [GH-779](https://github.com/apache/cordova-android/pull/779) Consistent order from `ProjectBuilder.apkSorter`
|
||||
* [GH-778](https://github.com/apache/cordova-android/pull/778) test: use verbose spec reporter
|
||||
* [GH-774](https://github.com/apache/cordova-android/pull/774) `rewire` workaround for NodeJS 12
|
||||
* [GH-772](https://github.com/apache/cordova-android/pull/772) `nyc@14` update in devDependencies
|
||||
* [GH-765](https://github.com/apache/cordova-android/pull/765) ci(travis): Fix **Android** SDK
|
||||
* [GH-713](https://github.com/apache/cordova-android/pull/713) Do not explicitly require modules from project directory
|
||||
* [GH-676](https://github.com/apache/cordova-android/pull/676) Added allprojects repositories for Framework Release Builds
|
||||
* [GH-699](https://github.com/apache/cordova-android/pull/699) Improve Gradle Build Arguments
|
||||
* [GH-710](https://github.com/apache/cordova-android/pull/710) Fix deprecation warning in `SystemCookieManager`
|
||||
* [GH-691](https://github.com/apache/cordova-android/pull/691) [GH-690](https://github.com/apache/cordova-android/pull/690): Run `prepare` with the correct `ConfigParser`
|
||||
* [GH-673](https://github.com/apache/cordova-android/pull/673) Updated `Android_HOME` Test to Follow [GH-656](https://github.com/apache/cordova-android/pull/656) Change
|
||||
|
||||
### 8.0.0 (Feb 13, 2019)
|
||||
* [GH-669](https://github.com/apache/cordova-android/pull/669) Added Missing License Headers
|
||||
* [GH-655](https://github.com/apache/cordova-android/pull/655) Use custom Gradle properties to read minSdkVersion value from `config.xml`
|
||||
* [GH-656](https://github.com/apache/cordova-android/pull/656) Quick fix to support **Android**_SDK_ROOT
|
||||
* [GH-632](https://github.com/apache/cordova-android/pull/632) Ignore more Gradle build artifacts in **Android** project
|
||||
* [GH-642](https://github.com/apache/cordova-android/pull/642) **Android** tools 3.3 & **Gradle** 4.10.3 update
|
||||
* [GH-654](https://github.com/apache/cordova-android/pull/654) Quick updates to top-level `project.properties`
|
||||
* [GH-635](https://github.com/apache/cordova-android/pull/635) Ignore **Android** Studio `.idea` files in project
|
||||
* [GH-624](https://github.com/apache/cordova-android/pull/624) Add missing log to Java version check
|
||||
* [GH-630](https://github.com/apache/cordova-android/pull/630) Update `emulator.js` to fix issue [GH-608](https://github.com/apache/cordova-android/pull/608)
|
||||
* [GH-626](https://github.com/apache/cordova-android/pull/626) Added `package-lock.json` to `.gitignore`
|
||||
* [GH-620](https://github.com/apache/cordova-android/pull/620) Fix requirements error messages for JDK 8
|
||||
* [GH-619](https://github.com/apache/cordova-android/pull/619) javac error message fixes in requirements check
|
||||
* [GH-612](https://github.com/apache/cordova-android/pull/612) Android Platform Release Preparation (Cordova 9)
|
||||
* [GH-607](https://github.com/apache/cordova-android/pull/607) Copy `node_modules` if the directory exists
|
||||
* [GH-582](https://github.com/apache/cordova-android/pull/582) Improve Test `README`
|
||||
* [GH-589](https://github.com/apache/cordova-android/pull/589) Rewrite install dir resolution for legacy plugins
|
||||
* [GH-572](https://github.com/apache/cordova-android/pull/572) Resolve issue with plugin `target-dir="app*"` subdirs
|
||||
* [GH-567](https://github.com/apache/cordova-android/pull/567) Output current package name if package name can't be validated
|
||||
* [GH-507](https://github.com/apache/cordova-android/pull/507) Gradle Updates
|
||||
* [GH-559](https://github.com/apache/cordova-android/pull/559) Eslint ignore version file
|
||||
* [GH-550](https://github.com/apache/cordova-android/pull/550) Fix for old plugins with non-Java sources
|
||||
* [GH-558](https://github.com/apache/cordova-android/pull/558) Update `cordova.js` from `cordova-js@4.2.3`
|
||||
* [GH-553](https://github.com/apache/cordova-android/pull/553) Check for `build-extras.gradle` in the app-parent directory
|
||||
* [GH-551](https://github.com/apache/cordova-android/pull/551) Add missing cast for `cdvMinSdkVersion`
|
||||
* [GH-539](https://github.com/apache/cordova-android/pull/539) Fix destination path fallback
|
||||
* [GH-544](https://github.com/apache/cordova-android/pull/544) Remove obsolete check for JellyBean
|
||||
* [GH-465](https://github.com/apache/cordova-android/pull/465) Removes Gradle property in-line command arguments for `gradle.properties`
|
||||
* [GH-523](https://github.com/apache/cordova-android/pull/523) Always put the Google repo above jcenter
|
||||
* [GH-486](https://github.com/apache/cordova-android/pull/486) Change deprecated "compile" to "implementation"
|
||||
* [GH-495](https://github.com/apache/cordova-android/pull/495) Incorrect default sdk version issue fix
|
||||
* [GH-493](https://github.com/apache/cordova-android/pull/493) Remove bundled dependencies
|
||||
* [GH-490](https://github.com/apache/cordova-android/pull/490) Fixes build & run related bugs from builder refactor
|
||||
* [GH-464](https://github.com/apache/cordova-android/pull/464) Unit tests for **Android**_sdk and **Android**Project
|
||||
* [GH-448](https://github.com/apache/cordova-android/pull/448) [CB-13685](https://issues.apache.org/jira/browse/CB-13685) Adaptive Icon Support
|
||||
* [GH-487](https://github.com/apache/cordova-android/pull/487) Do not attempt an activity intent AND a url load into the webview, return from the internal webview load.
|
||||
* [GH-461](https://github.com/apache/cordova-android/pull/461) Remove old builders code
|
||||
* [GH-463](https://github.com/apache/cordova-android/pull/463) Emulator: Add unit tests and remove Q
|
||||
* [GH-462](https://github.com/apache/cordova-android/pull/462) Device: Add unit tests and remove Q
|
||||
* [GH-457](https://github.com/apache/cordova-android/pull/457) Emulator: handle "device still connecting" error
|
||||
* [GH-445](https://github.com/apache/cordova-android/pull/445) Run and retryPromise improvements and tests
|
||||
* [GH-453](https://github.com/apache/cordova-android/pull/453) Lint JS files w/out extension too
|
||||
* [GH-452](https://github.com/apache/cordova-android/pull/452) Emit log event instead of logging directly
|
||||
* [GH-449](https://github.com/apache/cordova-android/pull/449) Increase old plugin compatibility
|
||||
* [GH-442](https://github.com/apache/cordova-android/pull/442) Fixes and cleanup for Java tests and CI
|
||||
* [GH-446](https://github.com/apache/cordova-android/pull/446) [CB-14101](https://issues.apache.org/jira/browse/CB-14101) Fix Java version check for Java >= 9
|
||||
* [CB-14127](https://issues.apache.org/jira/browse/CB-14127) Move google maven repo ahead of jcenter
|
||||
* [CB-14038](https://issues.apache.org/jira/browse/CB-14038) Fix false positive detecting project type
|
||||
* [CB-14008](https://issues.apache.org/jira/browse/CB-14008) Updating Gradle Libraries to work with **Android** Studio 3.1.0
|
||||
* [CB-13975](https://issues.apache.org/jira/browse/CB-13975) Fix to fire pause event when cdvStartInBackground=true
|
||||
* [CB-13830](https://issues.apache.org/jira/browse/CB-13830) Add handlers for plugins that use non-Java source files, such as Camera
|
||||
* [CB-13923](https://issues.apache.org/jira/browse/CB-13923) Fix -1 length for compressed files
|
||||
|
||||
### 7.1.0 (Feb 20, 2018)
|
||||
* [CB-13879](https://issues.apache.org/jira/browse/CB-13879) updated gradle tools dependency to 3.0.1 for project template
|
||||
* [CB-13831](https://issues.apache.org/jira/browse/CB-13831) Update `android-versions` to 1.3.0 to support SDK 27.
|
||||
* [CB-13800](https://issues.apache.org/jira/browse/CB-13800) Drop pre-KitKat specific code
|
||||
* [CB-13724](https://issues.apache.org/jira/browse/CB-13724) Updated the **Android** Tooling required for the latest version on both the test project, and the template
|
||||
* [CB-13724](https://issues.apache.org/jira/browse/CB-13724) Bump Target SDK to API 27
|
||||
* [CB-13646](https://issues.apache.org/jira/browse/CB-13646) Using the deprecated `NDK` by default breaks the build. Crosswalk users need to specify the Gradle parameters to keep it working.
|
||||
* [CB-12218](https://issues.apache.org/jira/browse/CB-12218) Fix consistency of null result message
|
||||
* [CB-13571](https://issues.apache.org/jira/browse/CB-13571) Prevent crash with unrecognized **Android** version
|
||||
* [CB-13721](https://issues.apache.org/jira/browse/CB-13721) Fix build apps that use `cdvHelpers.getConfigPreference`
|
||||
* [CB-13621](https://issues.apache.org/jira/browse/CB-13621) Wrote similar warning to [CB-12948](https://issues.apache.org/jira/browse/CB-12948) on **iOS**. We no longer support `cordova update` command.
|
||||
|
||||
### 7.0.0 (Nov 30, 2017)
|
||||
* [CB-13612](https://issues.apache.org/jira/browse/CB-13612) Fix the remapper so that XML files copy over and the Camera works again.
|
||||
* [CB-13741](https://issues.apache.org/jira/browse/CB-13741) Bump `package.json` so we can install plugins
|
||||
* [CB-13610](https://issues.apache.org/jira/browse/CB-13610) Compress the default app assets
|
||||
* [CB-12835](https://issues.apache.org/jira/browse/CB-12835) add a Context getter in CordovaInterface
|
||||
* [CB-8976](https://issues.apache.org/jira/browse/CB-8976) Added the `cdvVersionCodeForceAbiDigit` flag to the template build.gradle that appends 0 to the versionCode when `cdvBuildMultipleApks` is not set
|
||||
* [CB-12291](https://issues.apache.org/jira/browse/CB-12291) (android) Add x86_64, arm64 and armeabi architecture flavors
|
||||
* [CB-13602](https://issues.apache.org/jira/browse/CB-13602) We were setting the path wrong, this is hacky but it works
|
||||
* [CB-13601](https://issues.apache.org/jira/browse/CB-13601) Fixing the standalone run scripts to make sure this works without using the CLI
|
||||
* [CB-13580](https://issues.apache.org/jira/browse/CB-13580) fix build for multiple apks (different product flavors)
|
||||
* [CB-13558](https://issues.apache.org/jira/browse/CB-13558) Upgrading the gradle so we can upload the AAR
|
||||
* [CB-13297](https://issues.apache.org/jira/browse/CB-13297) This just works once you bump the project structure. Java 1.8 compatibility baked-in
|
||||
* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) **Android** Studio 3 work, things have changed with how the platform is built
|
||||
* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Found bug where the gradle subproject changes weren't actually getting written to the correct gradle file
|
||||
* [CB-13470](https://issues.apache.org/jira/browse/CB-13470) Fix Clean so that it cleans the **Android** Studio structure
|
||||
* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Adding specs for resource files inside an **Android** Studio Project
|
||||
* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Added remapping for drawables
|
||||
* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Found bug in Api.js where xml/strings.xml is used instead of values/strings.xml
|
||||
* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Setup Api.js to support multiple builders based on project structure
|
||||
* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Changing directory creation, will most likely hide this behind a flag for the next release of `cordova-android`, and then make it default in the next major pending feedback
|
||||
* Adding the Studio Builder to build a project based on **Android** Studio, and deleting Ant, since Google does not support Ant Builds anymore. Sorry guys!
|
||||
|
||||
### 6.4.0 (Nov 06, 2017)
|
||||
* [CB-13289](https://issues.apache.org/jira/browse/CB-13289) Fixing build problems with Studio Three, but keeping **Windows** Gradle fix for now, will be deprecated
|
||||
* [CB-13289](https://issues.apache.org/jira/browse/CB-13289) Fix test to work with new Google **Android** Gradle DSL
|
||||
* :CB-13501 : update appveyor node versions to support node 8
|
||||
* [CB-13499](https://issues.apache.org/jira/browse/CB-13499) Remove duplicate "setting" in error strings
|
||||
* Include missing values for task.name when 'cdvBuildMultipleApks' option is true, 'task.name' can have 'validateSigningArmv7Release' or 'validateSigningX86Release' values too.
|
||||
* [CB-13406](https://issues.apache.org/jira/browse/CB-13406) Fixed AVD API level comparison when choosing sub-par API level match. Added tests for the best_image method.
|
||||
* [CB-13404](https://issues.apache.org/jira/browse/CB-13404) add **Android**-versions to bundledDependencies. Ignore best emulator selection when parsed AVD information does not include API level in the target
|
||||
* [CB-12895](https://issues.apache.org/jira/browse/CB-12895) : eslint ignoring cordova.js
|
||||
* [CB-12895](https://issues.apache.org/jira/browse/CB-12895) Temporarily disabling eslint since cordova-js does not have eslint yet.
|
||||
|
||||
### 6.3.0 (Sep 25, 2017)
|
||||
* [CB-6936](https://issues.apache.org/jira/browse/CB-6936) fix crash when calling methods on a destroyed webview
|
||||
* [CB-12981](https://issues.apache.org/jira/browse/CB-12981) handle SDK 26.0.2 slightly different AVD list output for **Android** 8+ AVDs. Would cause "cannot read property replace of undefined" errors when trying to deploy an **Android** 8 emulator.
|
||||
* Updated maven repo to include most recent lib versions
|
||||
* [CB-13177](https://issues.apache.org/jira/browse/CB-13177) Updating to API Level 26
|
||||
* Revert [CB-12015](https://issues.apache.org/jira/browse/CB-12015) initial-scale values less than 1.0 are ignored on **Android**
|
||||
* [CB-12730](https://issues.apache.org/jira/browse/CB-12730) The Cordova Compatibility Plugin is now integrated into cordova-android
|
||||
* [CB-12453](https://issues.apache.org/jira/browse/CB-12453) Remove unnecessary double quotes from .bat files which are the causes of crash if project path contains spaces
|
||||
* [CB-13031](https://issues.apache.org/jira/browse/CB-13031) Fix bug with case-sensitivity of **Android**-packageName
|
||||
* [CB-10916](https://issues.apache.org/jira/browse/CB-10916) Support display name for **Android**
|
||||
* [CB-12423](https://issues.apache.org/jira/browse/CB-12423) make explicit JDK 1.8 or greater is needed in the `README`, we require 1.8 for compilation, but do not have 1.8 Java features yet
|
||||
* [CB-13006](https://issues.apache.org/jira/browse/CB-13006) removed create and update end-to-end tests, and instead added more unit test coverage. tweaked code coverage invocation so that we get coverage details on the create.js module. slight changes to the create.js module so that it is slightly easier to test.
|
||||
* [CB-12950](https://issues.apache.org/jira/browse/CB-12950) lots of tweaks for end-to-end test runs, especially on CI: - rename npm tasks to reflect what they do (npm run unit-tests, npm run e2e-tests). main `npm test` runs linter, unit tests and e2e tests now. - locked jasmine down to ~2.6.0. - consolidate gitignores. - updated travis to run `npm test`. add **Android** sdk installation to appveyor ci run.align **Android** dpendencies across travis and appveyor. have appveyor install gradle. force gradle to version 3.4.1 in appveyor, as that seems to be the only version choco has. explicitly invoke sdkmanager to move license accepting process along.
|
||||
* [CB-12605](https://issues.apache.org/jira/browse/CB-12605) In **Windows** get **Android** studio path from the registry
|
||||
* [CB-12762](https://issues.apache.org/jira/browse/CB-12762) : pointed `package.json` repo items to github mirrors instead of apache repos site
|
||||
* [CB-12617](https://issues.apache.org/jira/browse/CB-12617) : removed node0.x support for platforms and added engineStrict
|
||||
|
||||
### 6.2.3 (May 2, 2017)
|
||||
* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) better handling of unrecognized Android SDK commands on **Windows**.
|
||||
* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) flipped avd parsing logic so that it always tries to use avdmanager to retrieve avds first, then falls back to android command if avdmanager cannot be found (and errors with ENOENT). updated tests - and added explicit tests to ensure to shell out to singular forms of sub-commands when executing `android`
|
||||
* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) support for android sdk tools 26.0.1.
|
||||
|
||||
### 6.2.2 (Apr 24, 2017)
|
||||
* [CB-12697](https://issues.apache.org/jira/browse/CB-12697) Updated checked-in `node_modules`
|
||||
|
||||
### 6.2.1 (Apr 02, 2017)
|
||||
* [CB-12621](https://issues.apache.org/jira/browse/CB-12621) reverted elementtree dep to 0.1.6
|
||||
|
||||
### 6.2.0 (Mar 28, 2017)
|
||||
* [CB-12614](https://issues.apache.org/jira/browse/CB-12614) Adding headers to tests
|
||||
* [CB-8978](https://issues.apache.org/jira/browse/CB-8978) Prepare copy `resource-files` from `config.xml`
|
||||
* [CB-12605](https://issues.apache.org/jira/browse/CB-12605) Fix a requirements check failure on **Windows**
|
||||
* [CB-12595](https://issues.apache.org/jira/browse/CB-12595) This should find an **Android Studio** installation and use the sweet gradle center found inside
|
||||
* [CB-12546](https://issues.apache.org/jira/browse/CB-12546) leverage `avdmanager` if `android` warns it is no longer useful, which happens in **Android SDK Tools 25.3.1**. Explicitly set the `CWD` of the spawned emulator process to workaround a recent google android sdk bug. Rename `android_sdk_version.js` to `android_sdk.js`, to better reflect its contents. Have `create.js` copy over the `android_sdk_version` batch file.
|
||||
* [CB-12524](https://issues.apache.org/jira/browse/CB-12524) Fix for missing gradle template error. This now fetches the template from inside of the **Android Studio** directory, and falls back to a locally installed Gradle instance
|
||||
* [CB-12465](https://issues.apache.org/jira/browse/CB-12465) Writing new JUnit Test Instrumentation to replace tests and retire problmatic tests
|
||||
|
||||
### 6.1.2 (Jan 26, 2017)
|
||||
* **Security** Change to `https` by default
|
||||
* [CB-12018](https://issues.apache.org/jira/browse/CB-12018): updated tests to work with jasmine (promise matcher tests commented out for now)
|
||||
* created directories and corresponding images for `xxhdpi` and `xxxhdpi`, both drawables and `mipmaps`
|
||||
|
||||
### 6.1.1 (Jan 03, 2017)
|
||||
* [CB-12159](https://issues.apache.org/jira/browse/CB-12159) **Android** Keystore password prompt won't show up
|
||||
* [CB-12169](https://issues.apache.org/jira/browse/CB-12169) Check for build directory before running a clean
|
||||
* Fixed `AndroidStudio` tests to actually run, removed `app/src/main/assets/` as a requirement and added `app/src/main/res` instead, added placeholder for `build/` folder, Removed dupe `gitignore`
|
||||
|
||||
### 6.1.0 (Nov 02, 2016)
|
||||
* [CB-12108](https://issues.apache.org/jira/browse/CB-12108) Updating gradle files to work with the latest version of Android Studio
|
||||
* [CB-12102](https://issues.apache.org/jira/browse/CB-12102) Bump travis to build to API 25
|
||||
* Bumping up the version
|
||||
* [CB-12101](https://issues.apache.org/jira/browse/CB-12101) Fix so that CLI builds don't conflict with Android Studio builds
|
||||
* [CB-12077](https://issues.apache.org/jira/browse/CB-12077) Fix paths for Android icons/splashscreens
|
||||
* added framework/build to .ratignore
|
||||
* Fix for broken testUrl test
|
||||
* Last minute change of test targets
|
||||
* Update JS snapshot to version 6.1.0-dev (via coho)
|
||||
* Set VERSION to 6.1.0-dev (via coho)
|
||||
|
||||
### 6.0.0 (Oct 20, 2016)
|
||||
|
||||
This release adds significant functionality, and also introduces a number
|
||||
of breaking changes. Some of the changes to the code base will be of
|
||||
particular interest to third party webview plugin developers.
|
||||
|
||||
#### Major Changes ####
|
||||
* Primary bridge is the EVAL_BRIDGE, which tells the WebView to execute JS directly. This is more stable than the ONLINE_EVENT bridge
|
||||
* Full Support for Android Nougat (API 24)
|
||||
* Ice Cream Sandwich Support has been deprecated. Minimum Supported Android Version is Jellybean (API 16/ Android 4.1)
|
||||
* Plugin Installation now CLEANS the build directory, this speeds up gradle build times and allows for CLI develoment to be more predictable
|
||||
|
||||
Changes For Third-Party WebView Developers:
|
||||
* executeJavascript method added and is an abstract method that must be implemented
|
||||
* the EVAL_BRIDGE must be added to the WebView
|
||||
|
||||
|
||||
#### Curated Changes from the Git Commit Logs ####
|
||||
* Updating the gradle build for test to use the latest
|
||||
* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Fixing syncronous file check and future-proofing the JS for Travis
|
||||
* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Reading files to check for CordovaLib dependency, if so, we exclude CordovaLib to be safe
|
||||
* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Plugin build script for dependencies without a gradle file
|
||||
* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) The GradleBuidler can tell the difference between a Cordova Plugin Framework and a regular framework based on the name
|
||||
* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Fix to deal with custom frameworks with their own Gradle configuration
|
||||
* [CB-12003](https://issues.apache.org/jira/browse/CB-12003) updated node_modules
|
||||
* [CB-11771](https://issues.apache.org/jira/browse/CB-11771) Deep symlink directories to target project instead of linking the directory itself
|
||||
* [CB-11880](https://issues.apache.org/jira/browse/CB-11880) android: Fail-safe for cordova.exec()
|
||||
* [CB-11999](https://issues.apache.org/jira/browse/CB-11999) add message, catch exception if require fails
|
||||
* fix issue with app_name containing apostrophes
|
||||
* [CB-8722](https://issues.apache.org/jira/browse/CB-8722) - Move icons from drawable to mipmap
|
||||
* [CB-11964](https://issues.apache.org/jira/browse/CB-11964) Call clean after plugin install and mock it in tests
|
||||
* Did a try/catch to deal with the unit tests vs actual project environment, code duplication is needed because of builderEnv
|
||||
* [CB-11964](https://issues.apache.org/jira/browse/CB-11964) Do a clean when installing a plugin to et around the bug
|
||||
* [CB-11921](https://issues.apache.org/jira/browse/CB-11921) - Add github pull request template
|
||||
* [CB-11935](https://issues.apache.org/jira/browse/CB-11935) Does a best-effort attempt to pause any processing that can be paused safely, such as animations and geolocation.
|
||||
* [CB-11640](https://issues.apache.org/jira/browse/CB-11640) Fixing check_reqs.js so it actually works
|
||||
* [CB-11640](https://issues.apache.org/jira/browse/CB-11640) Changing requirements check to ask for Java 8
|
||||
* [CB-11869](https://issues.apache.org/jira/browse/CB-11869) Fix cordova-js android exec tests
|
||||
* [CB-11907](https://issues.apache.org/jira/browse/CB-11907) Bumping Gradle to work with Android Studio 2.2 and the Android Gradle Plugin
|
||||
* Enable background start of Cordova Android apps
|
||||
* fixing jshint issues
|
||||
* replace Integer.parseInt with BigInteger so that you can use longer Android version codes
|
||||
* [CB-11828](https://issues.apache.org/jira/browse/CB-11828) Adding dirty userAgent checking to see if we're running Jellybean or not for bridge modes
|
||||
* [CB-11828](https://issues.apache.org/jira/browse/CB-11828) Switching default bridge back to ONLINE_BRIDGE
|
||||
* Add gradle build flag to enable dex in process for large projects
|
||||
* added ability for cordova activity to be viewed in a real full screen regardless of android version (as was the case in previous cordova versions)
|
||||
* Updating travis
|
||||
* Adding Static Method to CoreAndroid Plugin so we can get the BuildConfig data from other plugins
|
||||
* Bump Target and Min API levels
|
||||
* Make evaluateJavaScript brige default
|
||||
* Creating an evaluateJavascript branch
|
||||
* [CB-11727](https://issues.apache.org/jira/browse/CB-11727) - travis ci setup is still using 0.10.32 node
|
||||
* [CB-11726](https://issues.apache.org/jira/browse/CB-11726) - Update appveyor node versions to 4 and 6, so they will always use the latest versions
|
||||
* Close invalid PRs
|
||||
* [CB-11683](https://issues.apache.org/jira/browse/CB-11683) Fixed linking to directories during plugin installation.
|
||||
* fixed [CB-11078](https://issues.apache.org/jira/browse/CB-11078) Empty string for BackgroundColor preference crashes application This closes #316
|
||||
* Update JS snapshot to version 5.3.0-dev (via coho)
|
||||
* Set VERSION to 5.3.0-dev (via coho)
|
||||
* [CB-11626](https://issues.apache.org/jira/browse/CB-11626) Updated RELEASENOTES and Version for release 5.2.2
|
||||
* updated cordoova-common to 1.4.0
|
||||
* This closes #195
|
||||
* Updaing the gradle for the tests to the latest
|
||||
* [CB-11550](https://issues.apache.org/jira/browse/CB-11550) Updated RELEASENOTES for release 5.2.1
|
||||
* [CB-9489](https://issues.apache.org/jira/browse/CB-9489) Fixed "endless waiting for emulator" issue
|
||||
* Update JS snapshot to version 5.3.0-dev (via coho)
|
||||
* Set VERSION to 5.3.0-dev (via coho)
|
||||
* [CB-11444](https://issues.apache.org/jira/browse/CB-11444) Updated RELEASENOTES and Version for release 5.2.0
|
||||
* [CB-11481](https://issues.apache.org/jira/browse/CB-11481) android-library is deprecated use com.android.library instead
|
||||
|
||||
### 5.2.2 (Jul 26, 2016)
|
||||
* [CB-11615](https://issues.apache.org/jira/browse/CB-11615) updated `cordoova-common` to `1.4.0`
|
||||
|
||||
### 5.2.1 (Jul 11, 2016)
|
||||
* [CB-9489](https://issues.apache.org/jira/browse/CB-9489) Fixed "endless waiting for emulator" issue
|
||||
* [CB-11481](https://issues.apache.org/jira/browse/CB-11481) android-library is deprecated use com.android.library instead
|
||||
|
||||
### 5.2.0 (Jun 29, 2016)
|
||||
* [CB-11383](https://issues.apache.org/jira/browse/CB-11383) Update to gradle for using `jcenter` and correct Application plugin
|
||||
* [CB-11365](https://issues.apache.org/jira/browse/CB-11365) fixed plugin rm issue with emit being `undefined`
|
||||
* [CB-11117](https://issues.apache.org/jira/browse/CB-11117) Use `FileUpdater` to optimize prepare for **android** platform
|
||||
* [CB-10096](https://issues.apache.org/jira/browse/CB-10096) Upgrade test project to `Gradle Plugin 2.1.0`
|
||||
* [CB-11292](https://issues.apache.org/jira/browse/CB-11292) fix broken `MessageChannel` after plugins are recreated
|
||||
* [CB-11259](https://issues.apache.org/jira/browse/CB-11259) Improving build output
|
||||
* [CB-10096](https://issues.apache.org/jira/browse/CB-10096) Upgrading to `Gradle Plugin 2.1.0`
|
||||
* [CB-11198](https://issues.apache.org/jira/browse/CB-11198) Skip **android** target sdk check. This closes #303.
|
||||
* [CB-11138](https://issues.apache.org/jira/browse/CB-11138) Reuse `PluginManager` from `common` to add/rm plugins
|
||||
* [CB-11133](https://issues.apache.org/jira/browse/CB-11133) Handle **android** emulator start failure
|
||||
* [CB-11132](https://issues.apache.org/jira/browse/CB-11132) Fix Error: Cannot read property `match` of undefined in `cordova-android` `emulator.js`
|
||||
* Add simple log for package name being deployed
|
||||
* [CB-11015](https://issues.apache.org/jira/browse/CB-11015) Error adding plugin with gradle extras
|
||||
* [CB-11095](https://issues.apache.org/jira/browse/CB-11095) Fix plugin add/removal when running on `Node v.010`
|
||||
* [CB-11022](https://issues.apache.org/jira/browse/CB-11022) Duplicate www files to both destinations on plugin operations
|
||||
* [CB-10964](https://issues.apache.org/jira/browse/CB-10964) Handle `build.json` file starting with a BOM.
|
||||
* [CB-10963](https://issues.apache.org/jira/browse/CB-10963) Handle overlapping permission requests from plugins
|
||||
* [CB-8582](https://issues.apache.org/jira/browse/CB-8582) Obscure `INSTALL_FAILED_VERSION_DOWNGRADE` error when installing app
|
||||
* [CB-10862](https://issues.apache.org/jira/browse/CB-10862) Cannot set `minsdkversion`
|
||||
* [CB-10896](https://issues.apache.org/jira/browse/CB-10896) We never enabled cookies on the `WebView` proper
|
||||
* [CB-10837](https://issues.apache.org/jira/browse/CB-10837) Support platform-specific orientation on **Android**
|
||||
* [CB-10600](https://issues.apache.org/jira/browse/CB-10600) `cordova run android --release` does not use signed and zip-aligned version of `APK`
|
||||
* [CB-9710](https://issues.apache.org/jira/browse/CB-9710) Fixing issues parsing `android avd list` output for certain AVDs which resulted in them not being included in the selection process even if they are the best match.
|
||||
* [CB-10888](https://issues.apache.org/jira/browse/CB-10888) Enable coverage reports collection via codecov
|
||||
* [CB-10846](https://issues.apache.org/jira/browse/CB-10846) Add Travis and AppVeyor badges to readme
|
||||
* [CB-10846](https://issues.apache.org/jira/browse/CB-10846) Add AppVeyor configuration
|
||||
* [CB-10749](https://issues.apache.org/jira/browse/CB-10749) Use `cordova-common.CordovaLogger` in `cordova-android`
|
||||
* [CB-10673](https://issues.apache.org/jira/browse/CB-10673) fixed conflicting plugin install issue with overlapped `<source-file>` tag. Add `--force` flag.
|
||||
* [CB-8976](https://issues.apache.org/jira/browse/CB-8976) Removing the auto-version for non-Crosswalk applications
|
||||
* [CB-10768](https://issues.apache.org/jira/browse/CB-10768) Use `cordova-common.superspawn` in `GradleBuilder`
|
||||
* [CB-10729](https://issues.apache.org/jira/browse/CB-10729) Move plugin handlers tests for into platform's repo
|
||||
* [CB-10669](https://issues.apache.org/jira/browse/CB-10669) `cordova run --list` cannot find `adb`
|
||||
* [CB-10660](https://issues.apache.org/jira/browse/CB-10660) fixed the exception when removing a non-existing directory.
|
||||
|
||||
### 5.1.1 (Feb 24, 2016)
|
||||
* updated `cordova-common` dependnecy to `1.1.0`
|
||||
* [CB-10628](https://issues.apache.org/jira/browse/CB-10628) Fix `emulate android --target`
|
||||
* [CB-10618](https://issues.apache.org/jira/browse/CB-10618) Handle gradle frameworks on plugin installation/uninstallation
|
||||
* [CB-10510](https://issues.apache.org/jira/browse/CB-10510) Add an optional timeout to `emu` start script
|
||||
* [CB-10498](https://issues.apache.org/jira/browse/CB-10498) Resume event should be sticky if it has a plugin result
|
||||
* fix `HtmlNotFoundTest` so that it passes when file not found is handled correctly
|
||||
* [CB-10472](https://issues.apache.org/jira/browse/CB-10472) `NullPointerException`: `org.apache.cordova.PluginManager.onSaveInstanceState` check if `pluginManager` is `null` before using it
|
||||
* [CB-10138](https://issues.apache.org/jira/browse/CB-10138) Adds missing plugin metadata to `plugin_list` module.
|
||||
* [CB-10443](https://issues.apache.org/jira/browse/CB-10443) Pass original options instead of remaining
|
||||
* [CB-10443](https://issues.apache.org/jira/browse/CB-10443) Fix `this.root` null reference
|
||||
* [CB-10421](https://issues.apache.org/jira/browse/CB-10421) Fixes exception when calling run script with `--help` option
|
||||
* updated `.gitignore`
|
||||
* [CB-10406](https://issues.apache.org/jira/browse/CB-10406) Fixes an exception, thrown when building using Ant.
|
||||
* [CB-10157](https://issues.apache.org/jira/browse/CB-10157) Uninstall app from device/emulator only when signed apk is already installed
|
||||
|
||||
### 5.1.0 (Jan 19, 2016)
|
||||
* [CB-10386](https://issues.apache.org/jira/browse/CB-10386) Add `android.useDeprecatedNdk=true` to support `NDK` in `gradle`
|
||||
* [CB-8864](https://issues.apache.org/jira/browse/CB-8864) Fixing this to mitigate [CB-8685](https://issues.apache.org/jira/browse/CB-8685) and [CB-10104](https://issues.apache.org/jira/browse/CB-10104)
|
||||
* [CB-10105](https://issues.apache.org/jira/browse/CB-10105) Spot fix for tilde errors on paths.
|
||||
* Update theme to `Theme.DeviceDefault.NoActionBar`
|
||||
* [CB-10014](https://issues.apache.org/jira/browse/CB-10014) Set gradle `applicationId` to `package name`.
|
||||
* [CB-9949](https://issues.apache.org/jira/browse/CB-9949) Fixing menu button event not fired in **Android**
|
||||
* [CB-9479](https://issues.apache.org/jira/browse/CB-9479) Fixing the conditionals again, we should
|
||||
* [CB-8917](https://issues.apache.org/jira/browse/CB-8917) New Plugin API for passing results on resume after Activity destruction
|
||||
* [CB-9971](https://issues.apache.org/jira/browse/CB-9971) Suppress `gradlew _JAVA_OPTIONS` output during build
|
||||
* [CB-9836](https://issues.apache.org/jira/browse/CB-9836) Add `.gitattributes` to prevent `CRLF` line endings in repos
|
||||
* added node_modules back into `.gitignore`
|
||||
|
||||
### 5.0.0 (Nov 01, 2015)
|
||||
* Update CordovaWebViewEngine.java
|
||||
* [CB-9909](https://issues.apache.org/jira/browse/CB-9909) Shouldn't escape spaces in paths on Windows.
|
||||
* [CB-9870](https://issues.apache.org/jira/browse/CB-9870) updated hello world template
|
||||
* [CB-9880](https://issues.apache.org/jira/browse/CB-9880) Fixes platform update failure when upgrading from android@<4.1.0
|
||||
* [CB-9844](https://issues.apache.org/jira/browse/CB-9844) Remove old .java after renaming activity
|
||||
* [CB-9800](https://issues.apache.org/jira/browse/CB-9800) Fixing contribute link.
|
||||
* [CB-9782](https://issues.apache.org/jira/browse/CB-9782) Check in `cordova-common` dependency
|
||||
* Adds licence header to Adb to pass rat audit
|
||||
* [CB-9835](https://issues.apache.org/jira/browse/CB-9835) Downgrade `properties-parser` to prevent failures in Node < 4.x
|
||||
* [CB-9782](https://issues.apache.org/jira/browse/CB-9782) Implements PlatformApi contract for Android platform.
|
||||
* [CB-9826](https://issues.apache.org/jira/browse/CB-9826) Fixed `test-build` script on windows.
|
||||
* Refactor of the Cordova Plugin/Permissions API
|
||||
* Manually updating version to 5.0.0-dev for engine tags
|
||||
* Bump up to API level 23
|
||||
* Commiting code to handle permissions, and the special case of the Geolocation Plugin
|
||||
* [CB-9608](https://issues.apache.org/jira/browse/CB-9608) cordova-android no longer builds on Node 0.10 or below
|
||||
* [CB-9080](https://issues.apache.org/jira/browse/CB-9080) Cordova CLI run for Android versions 4.1.1 and lower throws error
|
||||
* [CB-9557](https://issues.apache.org/jira/browse/CB-9557) Fixes apk install failure when switching from debug to release build
|
||||
* [CB-9496](https://issues.apache.org/jira/browse/CB-9496) removed permissions added for crosswalk
|
||||
* [CB-9402](https://issues.apache.org/jira/browse/CB-9402) Allow to set gradle distubutionUrl via env variable CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL
|
||||
* [CB-9428](https://issues.apache.org/jira/browse/CB-9428) update script now bumps up minSdkVersion to 14 if it is less than that.
|
||||
* [CB-9430](https://issues.apache.org/jira/browse/CB-9430) Fixes check_reqs failure when javac returns an extra line
|
||||
* [CB-9172](https://issues.apache.org/jira/browse/CB-9172) Improved emulator deploy stability. This closes #188.
|
||||
* [CB-9404](https://issues.apache.org/jira/browse/CB-9404) Fixed an exception when path contained -debug or -release
|
||||
* [CB-8320](https://issues.apache.org/jira/browse/CB-8320) Setting up gradle so we can use CordovaLib as a standard Android Library
|
||||
* [CB-9185](https://issues.apache.org/jira/browse/CB-9185) Fixed an issue when unsigned apks couldn't be found.
|
||||
* [CB-9397](https://issues.apache.org/jira/browse/CB-9397) Fixes minor issues with `cordova requirements android`
|
||||
* [CB-9389](https://issues.apache.org/jira/browse/CB-9389) Fixes build/check_reqs hang
|
||||
|
||||
### Release 4.1.1 (Aug 2015) ###
|
||||
|
||||
* [CB-9428](https://issues.apache.org/jira/browse/CB-9428) update script now bumps up minSdkVersion to 14 if it is less than that
|
||||
* [CB-9430](https://issues.apache.org/jira/browse/CB-9430) Fixes check_reqs failure when javac returns an extra line
|
||||
|
||||
### Release 4.1.0 (Jul 2015) ###
|
||||
* [CB-9392](https://issues.apache.org/jira/browse/CB-9392) Fixed printing flavored versions. This closes #184.
|
||||
* [CB-9382](https://issues.apache.org/jira/browse/CB-9382) [Android] Fix KeepRunning setting when Plugin activity is showed. This closes #200
|
||||
* [CB-9391](https://issues.apache.org/jira/browse/CB-9391) Fixes cdvBuildMultipleApks option casting
|
||||
* [CB-9343](https://issues.apache.org/jira/browse/CB-9343) Split the Content-Type to obtain a clean mimetype
|
||||
* [CB-9255](https://issues.apache.org/jira/browse/CB-9255) Make getUriType case insensitive.
|
||||
* [CB-9149](https://issues.apache.org/jira/browse/CB-9149) Fixes JSHint issue introduced by 899daa9
|
||||
* [CB-9372](https://issues.apache.org/jira/browse/CB-9372) Remove unused files: 'main.js' & 'master.css'. This closes #198
|
||||
* [CB-9149](https://issues.apache.org/jira/browse/CB-9149) Make gradle alias subprojects in order to handle libs that depend on libs. This closes #182
|
||||
* Update min SDK version to 14
|
||||
* Update licenses. This closes #190
|
||||
* [CB-9185](https://issues.apache.org/jira/browse/CB-9185) Fix signed release build exception. This closes #193.
|
||||
* [CB-9286](https://issues.apache.org/jira/browse/CB-9286) Fixes build failure when ANDROID_HOME is not set.
|
||||
* [CB-9284](https://issues.apache.org/jira/browse/CB-9284) Fix for handling absolute path for keystore in build.json
|
||||
* [CB-9260](https://issues.apache.org/jira/browse/CB-9260) Install Android-22 on Travis-CI
|
||||
* Adding .ratignore file.
|
||||
* [CB-9119](https://issues.apache.org/jira/browse/CB-9119) Adding lib/retry.js for retrying promise-returning functions. Retrying 'adb install' in emulator.js because it sometimes hangs.
|
||||
* [CB-9115](https://issues.apache.org/jira/browse/CB-9115) android: Grant Lollipop permission req
|
||||
* Remove extra console message
|
||||
* [CB-8898](https://issues.apache.org/jira/browse/CB-8898) Report expected gradle location properly
|
||||
* [CB-8898](https://issues.apache.org/jira/browse/CB-8898) Fixes gradle check failure due to missing quotes
|
||||
* [CB-9080](https://issues.apache.org/jira/browse/CB-9080) -d option is not supported on Android 4.1.1 and lower, removing
|
||||
* [CB-8954](https://issues.apache.org/jira/browse/CB-8954) Adds `requirements` command support to check_reqs module
|
||||
* Update JS snapshot to version 4.1.0-dev (via coho)
|
||||
* [CB-8417](https://issues.apache.org/jira/browse/CB-8417) updated platform specific files from cordova.js repo
|
||||
* Adding tests to confirm that preferences aren't changed by Intents
|
||||
* Forgot to remove the method that copied over the intent data
|
||||
* Getting around to removing this old Intent code
|
||||
* Update JS snapshot to version 4.1.0-dev (via coho)
|
||||
* Fix CordovaPluginTest on KitKat (start-up events seem to change)
|
||||
* [CB-3360](https://issues.apache.org/jira/browse/CB-3360) Allow setting a custom User-Agent (close #162)
|
||||
* [CB-8902](https://issues.apache.org/jira/browse/CB-8902) Use immersive mode when available when going fullscreen (close #175)
|
||||
* Make BridgeMode methods public (they were always supposed to be)
|
||||
* Simplify: EncodingUtils.getBytes(str) -> str.getBytes()
|
||||
* Don't show warning when gradlew file is read-only
|
||||
* Don't show warning when prepEnv copies gradlew and it's read-only
|
||||
* Make gradle wrapper prepEnv code work even when android-sdk is read-only
|
||||
* [CB-8897](https://issues.apache.org/jira/browse/CB-8897) Delete drawable/icon.png since it duplicates drawable-mdpi/icon.png
|
||||
* Updating the template to target mininumSdkTarget=14
|
||||
* [CB-8894](https://issues.apache.org/jira/browse/CB-8894) Updating the template to target mininumSdkTarget=14
|
||||
* [CB-8891](https://issues.apache.org/jira/browse/CB-8891) Add a note about when the gradle helpers were added
|
||||
* [CB-8891](https://issues.apache.org/jira/browse/CB-8891) Add a gradle helper for retrieving config.xml preference values
|
||||
* [CB-8884](https://issues.apache.org/jira/browse/CB-8884) Delete Eclipse tweaks from create script
|
||||
* [CB-8834](https://issues.apache.org/jira/browse/CB-8834) Don't fail to install on VERSION_DOWNGRADE
|
||||
* Automated tools fail, and you have to remember all four places where this is set.
|
||||
* Update the package.json
|
||||
* [CB-9042](https://issues.apache.org/jira/browse/CB-9042) coho failed to update version, so here we are
|
||||
* CB9042 - Updating Release Notes
|
||||
* Adding tests to confirm that preferences aren't changed by Intents
|
||||
* updating existing test code
|
||||
* Forgot to remove the method that copied over the intent data
|
||||
* Getting around to removing this old Intent code
|
||||
* [CB-8834](https://issues.apache.org/jira/browse/CB-8834) Don't fail to install on VERSION_DOWNGRADE
|
||||
|
||||
### Release 4.0.2 (May 2015) ###
|
||||
|
||||
* Removed Intent Functionality from Preferences - Preferences can no longer be set by intents
|
||||
|
||||
### Release 4.0.1 (April 2015) ###
|
||||
|
||||
* Bug fixed where platform failed to install on a version downgrade
|
||||
|
||||
### Release 4.0.0 (March 2015) ###
|
||||
|
||||
This release adds significant functionality, and also introduces a number
|
||||
of breaking changes. Some of the changes to the code base will be of
|
||||
particular interest to plugin developers.
|
||||
|
||||
#### Major Changes ####
|
||||
* Support for pluggable WebViews
|
||||
* The system WebView can be replaced in your app, via a plugin
|
||||
* Core WebView functionality is encapsulated, with extension points exposed
|
||||
via interfaces
|
||||
* Support for Crosswalk to bring the modern Chromium WebView to older devices
|
||||
* Uses the pluggable WebView framework
|
||||
* You will need to add the new [cordova-crosswalk-engine](https://github.com/MobileChromeApps/cordova-crosswalk-engine) plugin
|
||||
* Splash screen functionality is now provided via plugin
|
||||
* You will need to add the new [cordova-plugin-splashscreen](https://github.com/apache/cordova-plugin-splashscreen) plugin to continue using a splash screen
|
||||
* Whitelist functionality is now provided via plugin (CB-7747)
|
||||
* The whitelist has been enhanced to be more secure and configurable
|
||||
* Setting of Content-Security-Policy is now supported by the framework (see details in plugin readme)
|
||||
* You will need to add the new [cordova-plugin-whitelist](https://github.com/apache/cordova-plugin-whitelist) plugin
|
||||
* Legacy whitelist behaviour is still available via plugin (although not recommended).
|
||||
|
||||
Changes For Plugin Developers:
|
||||
|
||||
* Develop in Android Studio
|
||||
* Android Studio is now fully supported, and recommended over Eclipse
|
||||
* Build using Gradle
|
||||
* All builds [use Gradle by default](Android%20Shell%20Tool%20Guide_building_with_gradle), instead of Ant
|
||||
* Plugins can add their own gradle build steps!
|
||||
* Plugins can depend on Maven libraries using `<framework>` tags
|
||||
* New APIs: `onStart`, `onStop`, `onConfigurationChanged`
|
||||
* `"onScrollChanged"` message removed. Use `view.getViewTreeObserver().addOnScrollChangedListener(...)` instead
|
||||
* [CB-8702](https://issues.apache.org/jira/browse/CB-8702) New API for plugins to override `shouldInterceptRequest` with a stream
|
||||
|
||||
#### Other Changes ####
|
||||
* [CB-8378](https://issues.apache.org/jira/browse/CB-8378) Removed `hidekeyboard` and `showkeyboard` events (apps should use a plugin instead)
|
||||
* [CB-8735](https://issues.apache.org/jira/browse/CB-8735) `bin/create` regex relaxed / better support for numbers
|
||||
* [CB-8699](https://issues.apache.org/jira/browse/CB-8699) Fix CordovaResourceApi `copyResource` creating zero-length files when src=uncompressed asset
|
||||
* [CB-8693](https://issues.apache.org/jira/browse/CB-8693) CordovaLib should not contain icons / splashscreens
|
||||
* [CB-8592](https://issues.apache.org/jira/browse/CB-8592) Fix NPE if lifecycle events reach CordovaWebView before `init()` has been called
|
||||
* [CB-8588](https://issues.apache.org/jira/browse/CB-8588) Add CATEGORY_BROWSABLE to intents from showWebPage openExternal=true
|
||||
* [CB-8587](https://issues.apache.org/jira/browse/CB-8587) Don't allow WebView navigations within showWebPage that are not whitelisted
|
||||
* [CB-7827](https://issues.apache.org/jira/browse/CB-7827) Add `--activity-name` for `bin/create`
|
||||
* [CB-8548](https://issues.apache.org/jira/browse/CB-8548) Use debug-signing.properties and release-signing.properties when they exist
|
||||
* [CB-8545](https://issues.apache.org/jira/browse/CB-8545) Don't add a layout as a parent of the WebView
|
||||
* [CB-7159](https://issues.apache.org/jira/browse/CB-7159) BackgroundColor not used when `<html style="opacity:0">`, nor during screen rotation
|
||||
* [CB-6630](https://issues.apache.org/jira/browse/CB-6630) Removed OkHttp from core library. It's now available as a plugin: [cordova-plugin-okhttp](https://www.npmjs.com/package/cordova-plugin-okhttp)
|
||||
|
||||
### Release 3.7.1 (January 2015) ###
|
||||
* [CB-8411](https://issues.apache.org/jira/browse/CB-8411) Initialize plugins only after `createViews()` is called (regression in 3.7.0)
|
||||
|
||||
### Release 3.7.0 (January 2015) ###
|
||||
|
||||
* [CB-8328](https://issues.apache.org/jira/browse/CB-8328) Allow plugins to handle certificate challenges (close #150)
|
||||
* [CB-8201](https://issues.apache.org/jira/browse/CB-8201) Add support for auth dialogs into Cordova Android
|
||||
* [CB-8017](https://issues.apache.org/jira/browse/CB-8017) Add support for `<input type=file>` for Lollipop
|
||||
* [CB-8143](https://issues.apache.org/jira/browse/CB-8143) Loads of gradle improvements (try it with cordova/build --gradle)
|
||||
* [CB-8329](https://issues.apache.org/jira/browse/CB-8329) Cancel outstanding ActivityResult requests when a new startActivityForResult occurs
|
||||
* [CB-8026](https://issues.apache.org/jira/browse/CB-8026) Bumping up Android Version and setting it up to allow third-party cookies. This might change later.
|
||||
* [CB-8210](https://issues.apache.org/jira/browse/CB-8210) Use PluginResult for various events from native so that content-security-policy <meta> can be used
|
||||
* [CB-8168](https://issues.apache.org/jira/browse/CB-8168) Add support for `cordova/run --list` (closes #139)
|
||||
* [CB-8176](https://issues.apache.org/jira/browse/CB-8176) Vastly better auto-detection of SDK & JDK locations
|
||||
* [CB-8079](https://issues.apache.org/jira/browse/CB-8079) Use activity class package name, but fallback to application package name when looking for splash screen drawable
|
||||
* [CB-8147](https://issues.apache.org/jira/browse/CB-8147) Have corodva/build warn about unrecognized flags rather than fail
|
||||
* [CB-7881](https://issues.apache.org/jira/browse/CB-7881) Android tooling shouldn't lock application directory
|
||||
* [CB-8112](https://issues.apache.org/jira/browse/CB-8112) Turn off mediaPlaybackRequiresUserGesture
|
||||
* [CB-6153](https://issues.apache.org/jira/browse/CB-6153) Add a preference for controlling hardware button audio stream (DefaultVolumeStream)
|
||||
* [CB-8031](https://issues.apache.org/jira/browse/CB-8031) Fix race condition that shows as ConcurrentModificationException
|
||||
* [CB-7974](https://issues.apache.org/jira/browse/CB-7974) Cancel timeout timer if view is destroyed
|
||||
* [CB-7940](https://issues.apache.org/jira/browse/CB-7940) Disable exec bridge if bridgeSecret is wrong
|
||||
* [CB-7758](https://issues.apache.org/jira/browse/CB-7758) Allow content-url-hosted pages to access the bridge
|
||||
* [CB-6511](https://issues.apache.org/jira/browse/CB-6511) Fixes build for android when app name contains unicode characters.
|
||||
* [CB-7707](https://issues.apache.org/jira/browse/CB-7707) Added multipart PluginResult
|
||||
* [CB-6837](https://issues.apache.org/jira/browse/CB-6837) Fix leaked window when hitting back button while alert being rendered
|
||||
* [CB-7674](https://issues.apache.org/jira/browse/CB-7674) Move preference activation back into onCreate()
|
||||
* [CB-7499](https://issues.apache.org/jira/browse/CB-7499) Support RTL text direction
|
||||
* [CB-7330](https://issues.apache.org/jira/browse/CB-7330) Don't run check_reqs for bin/create.
|
||||
|
||||
### 3.6.4 (Sept 30, 2014) ###
|
||||
|
||||
* Set VERSION to 3.6.4 (via coho)
|
||||
* Update JS snapshot to version 3.6.4 (via coho)
|
||||
* [CB-7634](https://issues.apache.org/jira/browse/CB-7634) Detect JAVA_HOME properly on Ubuntu
|
||||
* [CB-7579](https://issues.apache.org/jira/browse/CB-7579) Fix run script's ability to use non-arch-specific APKs
|
||||
* [CB-6511](https://issues.apache.org/jira/browse/CB-6511) Fixes build for android when app name contains unicode characters.
|
||||
* [CB-7463](https://issues.apache.org/jira/browse/CB-7463) Adding licences. I don't know what the gradle syntax is for comments, that still needs to be done.
|
||||
* [CB-7463](https://issues.apache.org/jira/browse/CB-7463) Looked at the Apache BigTop git, gradle uses C-style comments
|
||||
* [CB-7460](https://issues.apache.org/jira/browse/CB-7460) Fixing bug with KitKat where the background colour would override the CSS colours on the application
|
||||
|
||||
### 3.6.0 (Sept 2014) ###
|
||||
|
||||
* Set VERSION to 3.6.0 (via coho)
|
||||
* [CB-7410](https://issues.apache.org/jira/browse/CB-7410) fix the menu test
|
||||
* [CB-7410](https://issues.apache.org/jira/browse/CB-7410) Fix the errorUrl test
|
||||
* [CB-7410](https://issues.apache.org/jira/browse/CB-7410) Fix Basic Authentication test
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Allow build and run scripts to select APK by architecture
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add environment variable 'BUILD_MULTIPLE_APKS' for splitting APKs based on architecture
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Ensure that JAR files in libs directory are included
|
||||
* [CB-7267](https://issues.apache.org/jira/browse/CB-7267) update RELEASENOTES for 3.5.1
|
||||
* [CB-7410](https://issues.apache.org/jira/browse/CB-7410) clarify the title
|
||||
* [CB-7385](https://issues.apache.org/jira/browse/CB-7385) update cordova.js for testing prior to branch/tag
|
||||
* [CB-7410](https://issues.apache.org/jira/browse/CB-7410) add whitelist entries to get iframe/GoogleMaps working
|
||||
* [CB-7291](https://issues.apache.org/jira/browse/CB-7291) propogate change in method signature to the native tests
|
||||
* [CB-7291](https://issues.apache.org/jira/browse/CB-7291) Restrict meaning of "\*" in internal whitelist to just http and https
|
||||
* [CB-7291](https://issues.apache.org/jira/browse/CB-7291) Only add file, content and data URLs to internal whitelist
|
||||
* [CB-7291](https://issues.apache.org/jira/browse/CB-7291) Add defaults to external whitelist
|
||||
* [CB-7291](https://issues.apache.org/jira/browse/CB-7291) Add external-launch-whitelist and use it for filtering intent launches
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Read project.properties to configure gradle libraries
|
||||
* [CB-7325](https://issues.apache.org/jira/browse/CB-7325) Fix error message in android_sdk_version.js when missing SDK on windows
|
||||
* [CB-7335](https://issues.apache.org/jira/browse/CB-7335) Add a .gitignore to android project template
|
||||
* [CB-7330](https://issues.apache.org/jira/browse/CB-7330) Fix dangling function call in last commit (broke gradle builds)
|
||||
* [CB-7330](https://issues.apache.org/jira/browse/CB-7330) Don't run "android update" during creation
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add gradle support clean command (plus some code cleanup)
|
||||
* [CB-7044](https://issues.apache.org/jira/browse/CB-7044) Fix typo in prev commit causing check_reqs to always fail.
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Copy gradle wrapper in build instead of create
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add .gradle template files for "update" as well as "create"
|
||||
* [CB-7044](https://issues.apache.org/jira/browse/CB-7044) Add JAVA_HOME when not set. Be stricter about ANDROID_HOME
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Speed up gradle building (incremental builds go from 10s -> 1.5s for me)
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) android: Copy Gradle wrapper from Android SDK rather than bundling a JAR
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add which to checked-in node_modules
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add option to build and install with gradle
|
||||
* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add an initial set of Gradle build scripts
|
||||
* [CB-7321](https://issues.apache.org/jira/browse/CB-7321) Don't require ant for create script
|
||||
* CB-7044, [CB-7299](https://issues.apache.org/jira/browse/CB-7299) Fix up PATH problems when possible.
|
||||
* Change in test's AndroidManifest.xml needed for the test to run properly. Forgot the manifest.
|
||||
* Change in test's AndroidManifest.xml needed for the test to run properly
|
||||
* Adding tests related to 3.5.1
|
||||
* [CB-7261](https://issues.apache.org/jira/browse/CB-7261) Fix setNativeToJsBridgeMode sometimes crashing when switching to ONLINE_EVENT
|
||||
* [CB-7265](https://issues.apache.org/jira/browse/CB-7265) Fix crash when navigating to custom protocol (introduced in 3.5.1)
|
||||
* Filter out non-launchable intents
|
||||
* Handle unsupported protocol errors in webview better
|
||||
* [CB-7238](https://issues.apache.org/jira/browse/CB-7238) I should have collapsed this, but Config.init() must go before the creation of CordovaWebView
|
||||
* [CB-7238](https://issues.apache.org/jira/browse/CB-7238) Minor band-aid to get tests running again, this has to go away before 3.6.0 is released, since this is an API change.
|
||||
* Extend whitelist to handle URLs without // chars
|
||||
* [CB-7172](https://issues.apache.org/jira/browse/CB-7172) Force window to have focus after resume
|
||||
* [CB-7159](https://issues.apache.org/jira/browse/CB-7159) Set background color of webView as well as its parent
|
||||
* [CB-7018](https://issues.apache.org/jira/browse/CB-7018) Fix setButtonPlumbedToJs never un-listening
|
||||
* Undeprecate some just-deprecated symbols in PluginManager.
|
||||
* @Deprecate methods of PluginManager that were never meant to be public
|
||||
* Move plugin instantiation and instance storing logic PluginEntry->PluginManager
|
||||
* Fix broken unit test due to missing Config.init() call
|
||||
* Update to check for Google Glass APIs
|
||||
* Fix for `android` not being in PATH check on Windows
|
||||
* Displaying error when regex does not match.
|
||||
* Fix broken compile due to previous commit :(
|
||||
* Tweak CordovaPlugin.initialize method to be less deprecated.
|
||||
* Un-deprecate CordovaActivity.init() - it's needed to tweak prefs in onCreate
|
||||
* Tweak log messages in CordovaBridge with bridgeSecret is wrong
|
||||
* Backport CordovaBridge from 4.0.x -> master
|
||||
* Update unit tests to not use most deprecated things (e.g. DroidGap)
|
||||
* Add non-String overloades for CordovaPreferences.set()
|
||||
* Make CordovaWebview resilient to init() not being called (for backwards-compatibility)
|
||||
* Add node_module licenses to LICENSE
|
||||
* Update cordova.js snapshot to work with bridge changes
|
||||
* Provide CordovaPlugin with CordovaPreferences. Add new Plugin.initialize()
|
||||
* Convert usages of Config.\* to use the non-static versions
|
||||
* Change getProperty -> prefs.get\* within CordovaActivity
|
||||
* Make CordovaUriHelper class package-private
|
||||
* Fix PluginManager.setPluginEntries not removing old entries
|
||||
* Move registration of App plugin from config.xml -> code
|
||||
* Make setWebViewClient an override instead of an overload. Delete Location-change JS->Native bridge mode (missed some of it).
|
||||
* [CB-4404](https://issues.apache.org/jira/browse/CB-4404) Revert setting android:windowSoftInputMode to "adjustPan"
|
||||
* Refactor: Use ConfigXmlParser in activity. Adds CordovaWebView.init()
|
||||
* Deprecate some convenience methods on CordovaActivity
|
||||
* Fix CordovaPreferences not correctly parsing hex values (valueOf->decode)
|
||||
* Refactor: Move url-filter information into PluginEntry.
|
||||
* Don't re-parse config.xml in onResume.
|
||||
* Move handling of Fullscreen preference to CordovaActivity
|
||||
* Delete dead code from CordovaActivity
|
||||
* Update .classpath to make Eclipse happy (just re-orders one line)
|
||||
* Delete "CB-3064: The errorUrl is..." Log message left over from debugging presumably
|
||||
* Refactor Config into ConfigXmlParser, CordovaPreferences
|
||||
* Delete Location-change JS->Native bridge mode
|
||||
* [CB-5988](https://issues.apache.org/jira/browse/CB-5988) Allow exec() only from file: or start-up URL's domain
|
||||
* [CB-6761](https://issues.apache.org/jira/browse/CB-6761) Fix native->JS bridge ceasing to fire when page changes and online is set to false and the JS loads quickly
|
||||
* Update the errorurl to no longer use intents
|
||||
* This breaks running the JUnit tests, we'll bring it back soon
|
||||
* Refactoring the URI handling on Cordova, removing dead code
|
||||
* [CB-7018](https://issues.apache.org/jira/browse/CB-7018) Clean up and deprecation of some button-related functions
|
||||
* [CB-7017](https://issues.apache.org/jira/browse/CB-7017) Fix onload=true being set on all subsequent plugins
|
||||
* [CB-5971](https://issues.apache.org/jira/browse/CB-5971) Fix package / project validation
|
||||
* [CB-5971](https://issues.apache.org/jira/browse/CB-5971) Add unit tests to cordova-android
|
||||
* [CB-5971](https://issues.apache.org/jira/browse/CB-5971) Factor out package/project name validation logic
|
||||
* Delete explicit activity.finish() in back button handling. No change in behaviour.
|
||||
* [CB-5971](https://issues.apache.org/jira/browse/CB-5971) This would have been a good first bug, too bad
|
||||
* [CB-4404](https://issues.apache.org/jira/browse/CB-4404) Changing where android:windowSoftInputMode is in the manifest so it works
|
||||
* Add documentation referencing other implementation.
|
||||
* [CB-6851](https://issues.apache.org/jira/browse/CB-6851) Deprecate WebView.sendJavascript()
|
||||
* [CB-6876](https://issues.apache.org/jira/browse/CB-6876) Show the correct executable name
|
||||
* [CB-6876](https://issues.apache.org/jira/browse/CB-6876) Fix the "print usage"
|
||||
* Trivial spelling fix in comments when reading CordovaResourceApi
|
||||
* [CB-6818](https://issues.apache.org/jira/browse/CB-6818) I want to remove this code, because Square didn't do their headers properly
|
||||
* [CB-6860](https://issues.apache.org/jira/browse/CB-6860) Add activity_name and launcher_name to AndroidManifest.xml & strings.xml
|
||||
* Add a comment to custom_rules.xml saying why we move AndroidManifest.xml
|
||||
* Remove +x from README.md
|
||||
* [CB-6784](https://issues.apache.org/jira/browse/CB-6784) Add missing licenses
|
||||
* [CB-6784](https://issues.apache.org/jira/browse/CB-6784) Add license to CONTRIBUTING.md
|
||||
* Revert "defaults.xml: Add AndroidLaunchMode preference"
|
||||
* updated RELEASENOTES
|
||||
* [CB-6315](https://issues.apache.org/jira/browse/CB-6315) Wrapping this so it runs on the UI thread
|
||||
* [CB-6723](https://issues.apache.org/jira/browse/CB-6723) Update package name for Robotium
|
||||
* [CB-6707](https://issues.apache.org/jira/browse/CB-6707) Update minSdkVersion to 10 consistently
|
||||
* [CB-5652](https://issues.apache.org/jira/browse/CB-5652) make visible cordova version
|
||||
* Update JS snapshot to version 3.6.0-dev (via coho)
|
||||
* Update JS snapshot to version 3.6.0-dev (via coho)
|
||||
* Set VERSION to 3.6.0-dev (via coho)
|
||||
|
||||
### 3.5.1 (August 2014) ###
|
||||
|
||||
This was a security update to address CVE-2014-3500, CVE-2014-3501,
|
||||
and CVE-2014-3502. For more information, see
|
||||
http://cordova.apache.org/announcements/2014/08/04/android-351.html
|
||||
|
||||
* Filter out non-launchable intents
|
||||
* Handle unsupported protocol errors in webview better
|
||||
* Update the errorurl to no longer use intents
|
||||
* Refactoring the URI handling on Cordova, removing dead code
|
||||
|
||||
### 3.5.0 (May 2014) ###
|
||||
|
||||
* OkHttp has broken headers. Updating for ASF compliance.
|
||||
* Revert accidentally removed lines from NOTICE
|
||||
* [CB-6552](https://issues.apache.org/jira/browse/CB-6552) added top level package.json
|
||||
* [CB-6491](https://issues.apache.org/jira/browse/CB-6491) add CONTRIBUTING.md
|
||||
* [CB-6543](https://issues.apache.org/jira/browse/CB-6543) Fix cordova/run failure when no custom_rules.xml available
|
||||
* defaults.xml: Add AndroidLaunchMode preference
|
||||
* Add JavaDoc for CordovaResourceApi
|
||||
* [CB-6388](https://issues.apache.org/jira/browse/CB-6388) Handle binary data correctly in LOAD_URL bridge
|
||||
* Fix [CB-6048](https://issues.apache.org/jira/browse/CB-6048) Set launchMode=singleTop so tapping app icon does not always restart app
|
||||
* Remove incorrect usage of AlertDialog.Builder.create
|
||||
* Catch uncaught exceptions in from plugins and turn them into error responses.
|
||||
* Add NOTICE file
|
||||
* [CB-6047](https://issues.apache.org/jira/browse/CB-6047) Fix online sometimes getting in a bad state on page transitions.
|
||||
* Add another convenience overload for CordovaResourceApi.copyResource
|
||||
* Update framework's .classpath to what Eclipse wants it to be.
|
||||
* README.md: `android update` to `android-19`.
|
||||
* Fix NPE when POLLING bridge mode is used.
|
||||
* Updating NOTICE to include Square for OkHttp
|
||||
* [CB-5398](https://issues.apache.org/jira/browse/CB-5398) Apply KitKat content URI fix to all content URIs
|
||||
* [CB-5398](https://issues.apache.org/jira/browse/CB-5398) Work-around for KitKat content: URLs not rendering in <img> tags
|
||||
* [CB-5908](https://issues.apache.org/jira/browse/CB-5908) add splascreen images to template
|
||||
* [CB-5395](https://issues.apache.org/jira/browse/CB-5395) Make scheme and host (but not path) case-insensitive in whitelist
|
||||
* Ignore multiple onPageFinished() callbacks & onReceivedError due to stopLoading()
|
||||
* Removing addJavascriptInterface support from all Android versions lower than 4.2 due to security vu
|
||||
* [CB-4984](https://issues.apache.org/jira/browse/CB-4984) Don't create on CordovaActivity name
|
||||
* [CB-5917](https://issues.apache.org/jira/browse/CB-5917) Add a loadUrlIntoView overload that doesn't recreate plugins.
|
||||
* Use thread pool for load timeout.
|
||||
* [CB-5715](https://issues.apache.org/jira/browse/CB-5715) For CLI, hide assets/www and res/xml/config.xml by default
|
||||
* [CB-5793](https://issues.apache.org/jira/browse/CB-5793) ant builds: Rename AndroidManifest during -post-build to avoid Eclipse detecting ant-build/
|
||||
* [CB-5889](https://issues.apache.org/jira/browse/CB-5889) Make update script find project name instead of using "null" for CordovaLib
|
||||
* [CB-5889](https://issues.apache.org/jira/browse/CB-5889) Add a message in the update script about needing to import CordovaLib when using an IDE.
|
||||
|
||||
### 3.4.0 (Feb 2014) ###
|
||||
|
||||
43 commits from 10 authors. Highlights include:
|
||||
|
||||
* Removing addJavascriptInterface support from all Android versions lower than 4.2 due to security vulnerability
|
||||
* [CB-5917](https://issues.apache.org/jira/browse/CB-5917) Add a loadUrlIntoView overload that doesn't recreate plugins.
|
||||
* [CB-5889](https://issues.apache.org/jira/browse/CB-5889) Make update script find project name instead of using "null" for CordovaLib
|
||||
* [CB-5889](https://issues.apache.org/jira/browse/CB-5889) Add a message in the update script about needing to import CordovaLib when using an IDE.
|
||||
* [CB-5793](https://issues.apache.org/jira/browse/CB-5793) Don't clean before build and change output directory to ant-build to avoid conflicts with Eclipse.
|
||||
* [CB-5803](https://issues.apache.org/jira/browse/CB-5803) Fix cordova/emulate on windows.
|
||||
* [CB-5801](https://issues.apache.org/jira/browse/CB-5801) exec->spawn in build to make sure compile errors are shown.
|
||||
* [CB-5799](https://issues.apache.org/jira/browse/CB-5799) Update version of OkHTTP to 1.3
|
||||
* [CB-4910](https://issues.apache.org/jira/browse/CB-4910) Update CLI project template to point to config.xml at the root now that it's not in www/ by default.
|
||||
* [CB-5504](https://issues.apache.org/jira/browse/CB-5504) Adding onDestroy to app plugin to deregister telephonyReceiver
|
||||
* [CB-5715](https://issues.apache.org/jira/browse/CB-5715) Add Eclipse .project file to create template. For CLI projects, it adds refs for root www/ & config.xml and hides platform versions
|
||||
* [CB-5447](https://issues.apache.org/jira/browse/CB-5447) Removed android:debuggable=“true” from project template.
|
||||
* [CB-5714](https://issues.apache.org/jira/browse/CB-5714) Fix of android build when too big output stops build with error due to buffer overflow.
|
||||
* [CB-5592](https://issues.apache.org/jira/browse/CB-5592) Set MIME type for openExternal when scheme is file:
|
||||
|
||||
### 3.3.0 (Dec 2013) ###
|
||||
|
||||
41 commits from 11 authors. Highlights include:
|
||||
|
||||
* [CB-5481](https://issues.apache.org/jira/browse/CB-5481) Fix for Cordova trying to get config.xml from the wrong namespace
|
||||
* [CB-5487](https://issues.apache.org/jira/browse/CB-5487) Enable Remote Debugging when your Android app is debuggable.
|
||||
* [CB-5445](https://issues.apache.org/jira/browse/CB-5445) Adding onScrollChanged and the ScrollEvent object
|
||||
* [CB-5422](https://issues.apache.org/jira/browse/CB-5422) Don't require JAVA_HOME to be defined
|
||||
* [CB-5490](https://issues.apache.org/jira/browse/CB-5490) Add javadoc target to ant script
|
||||
* [CB-5471](https://issues.apache.org/jira/browse/CB-5471) Deprecated DroidGap class
|
||||
* [CB-5255](https://issues.apache.org/jira/browse/CB-5255) Prefer Google API targets over android-## targets when building.
|
||||
* [CB-5232](https://issues.apache.org/jira/browse/CB-5232) Change create script to use Cordova as a Library Project instead of a .jar
|
||||
* [CB-5302](https://issues.apache.org/jira/browse/CB-5302) Massive movement to get tests working again
|
||||
* [CB-4996](https://issues.apache.org/jira/browse/CB-4996) Fix paths with spaces while launching on emulator and device
|
||||
* [CB-5209](https://issues.apache.org/jira/browse/CB-5209) Cannot build Android app if project path contains spaces
|
||||
|
||||
|
||||
### 3.2.0 (Nov 2013) ###
|
||||
|
||||
27 commits from 7 authors. Highlights include:
|
||||
|
||||
* [CB-5193](https://issues.apache.org/jira/browse/CB-5193) Fix Android WebSQL sometime throwing SECURITY_ERR.
|
||||
* [CB-5191](https://issues.apache.org/jira/browse/CB-5191) Deprecate <url-filter>
|
||||
* Updating shelljs to 0.2.6. Copy now preserves mode bits.
|
||||
* [CB-4872](https://issues.apache.org/jira/browse/CB-4872) Added android version scripts (android_sdk_version, etc)
|
||||
* [CB-5117](https://issues.apache.org/jira/browse/CB-5117) Output confirmation message if check_reqs passes.
|
||||
* [CB-5080](https://issues.apache.org/jira/browse/CB-5080) Find resources in a way that works with aapt's --rename-manifest-package
|
||||
* [CB-4527](https://issues.apache.org/jira/browse/CB-4527) Don't delete .bat files even when on non-windows platform
|
||||
* [CB-4892](https://issues.apache.org/jira/browse/CB-4892) Fix create script only escaping the first space instead of all spaces.
|
||||
|
||||
### 3.1.0 (Sept 2013) ###
|
||||
|
||||
55 commits from 9 authors. Highlights include:
|
||||
|
||||
* [CB-4817](https://issues.apache.org/jira/browse/CB-4817) Remove unused assets in project template.
|
||||
* Fail fast in create script if package name is not com.foo.bar.
|
||||
* [CB-4782](https://issues.apache.org/jira/browse/CB-4782) Convert ApplicationInfo.java -> appinfo.js
|
||||
* [CB-4766](https://issues.apache.org/jira/browse/CB-4766) Deprecated JSONUtils.java (moved into plugins)
|
||||
* [CB-4765](https://issues.apache.org/jira/browse/CB-4765) Deprecated ExifHelper.java (moved into plugins)
|
||||
* [CB-4764](https://issues.apache.org/jira/browse/CB-4764) Deprecated DirectoryManager.java (moved into plugins)
|
||||
* [CB-4763](https://issues.apache.org/jira/browse/CB-4763) Deprecated FileHelper.java (moved into plugins), Move getMimeType() into CordovaResourceApi.
|
||||
* [CB-4725](https://issues.apache.org/jira/browse/CB-4725) Add CordovaWebView.CORDOVA_VERSION constant
|
||||
* Incrementing version check for Android 4.3 API Level 18
|
||||
* [CB-3542](https://issues.apache.org/jira/browse/CB-3542) rewrote cli tooling scripts in node
|
||||
* Allow CordovaChromeClient subclasses access to CordovaInterface and CordovaWebView members
|
||||
* Refactor CordovaActivity.init so that subclasses can easily override factory methods for webview objects
|
||||
* [CB-4652](https://issues.apache.org/jira/browse/CB-4652) Allow default project template to be overridden on create
|
||||
* Tweak the online bridge to not send excess online events.
|
||||
* [CB-4495](https://issues.apache.org/jira/browse/CB-4495) Modify start-emulator script to exit immediately on a fatal emulator error.
|
||||
* Log WebView IOExceptions only when they are not 404s
|
||||
* Use a higher threshold for slow exec() warnings when debugger is attached.
|
||||
* Fix data URI decoding in CordovaResourceApi
|
||||
* [CB-3819](https://issues.apache.org/jira/browse/CB-3819) Made it easier to set SplashScreen delay.
|
||||
* [CB-4013](https://issues.apache.org/jira/browse/CB-4013) Fixed loadUrlTimeoutValue preference.
|
||||
* Upgrading project to Android 4.3
|
||||
* [CB-4198](https://issues.apache.org/jira/browse/CB-4198) bin/create script should be better at handling non-word characters in activity name. Patched windows script as well.
|
||||
* [CB-4198](https://issues.apache.org/jira/browse/CB-4198) bin/create should handle spaces in activity better.
|
||||
* [CB-4096](https://issues.apache.org/jira/browse/CB-4096) Implemented new unified whitelist for android
|
||||
* [CB-3384](https://issues.apache.org/jira/browse/CB-3384) Fix thread assertion when plugins remap URIs
|
||||
|
||||
27
bin/android_sdk_version
Executable file
27
bin/android_sdk_version
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var android_sdk = require('./templates/cordova/lib/android_sdk');
|
||||
|
||||
android_sdk.print_newest_available_sdk_target().catch(err => {
|
||||
console.error(err);
|
||||
process.exit(2);
|
||||
});
|
||||
26
bin/android_sdk_version.bat
Normal file
26
bin/android_sdk_version.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
:: Licensed to the Apache Software Foundation (ASF) under one
|
||||
:: or more contributor license agreements. See the NOTICE file
|
||||
:: distributed with this work for additional information
|
||||
:: regarding copyright ownership. The ASF licenses this file
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
:: KIND, either express or implied. See the License for the
|
||||
:: specific language governing permissions and limitations
|
||||
:: under the License.
|
||||
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0android_sdk_version"
|
||||
IF EXIST %script_path% (
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'android_sdk_version' script in 'bin' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
@@ -19,9 +19,14 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var check_reqs = require('./lib/check_reqs');
|
||||
|
||||
if(!check_reqs.run()) {
|
||||
process.exit(2);
|
||||
}
|
||||
var check_reqs = require('./templates/cordova/lib/check_reqs');
|
||||
|
||||
check_reqs.run().then(
|
||||
function success () {
|
||||
console.log('Looks like your environment fully supports cordova-android development!');
|
||||
},
|
||||
function fail (err) {
|
||||
console.log(err);
|
||||
process.exit(2);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0check_reqs"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'check_reqs' script in 'bin' folder, aborting...>&2
|
||||
|
||||
@@ -17,10 +17,12 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
// We moved everything to CordovaActivity
|
||||
|
||||
package org.apache.cordova;
|
||||
|
||||
public class DroidGap extends CordovaActivity {
|
||||
const fs = require('fs');
|
||||
|
||||
if (fs.existsSync('./test/gradlew')) {
|
||||
fs.unlinkSync('./test/gradlew');
|
||||
}
|
||||
|
||||
if (fs.existsSync('./test/gradlew.bat')) {
|
||||
fs.unlinkSync('./test/gradlew.bat');
|
||||
}
|
||||
41
bin/create
41
bin/create
@@ -19,18 +19,43 @@
|
||||
under the License.
|
||||
*/
|
||||
var path = require('path');
|
||||
var create = require('./lib/create');
|
||||
var args = process.argv;
|
||||
var ConfigParser = require('cordova-common').ConfigParser;
|
||||
var Api = require('./templates/cordova/Api');
|
||||
|
||||
// Support basic help commands
|
||||
if(args.length < 3 || (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
|
||||
args[2] == 'help' || args[2] == '-help' || args[2] == '/help')) {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' <path_to_new_project> <package_name> <project_name>');
|
||||
var argv = require('nopt')({
|
||||
help: Boolean,
|
||||
cli: Boolean,
|
||||
shared: Boolean,
|
||||
link: Boolean,
|
||||
'activity-name': [String, undefined]
|
||||
}, { d: '--verbose' });
|
||||
|
||||
if (argv.help || argv.argv.remain.length === 0) {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' <path_to_new_project> <package_name> <project_name> [<template_path>] [--activity-name <activity_name>] [--link]');
|
||||
console.log(' <path_to_new_project>: Path to your new Cordova Android project');
|
||||
console.log(' <package_name>: Package name, following reverse-domain style convention');
|
||||
console.log(' <project_name>: Project name');
|
||||
console.log(' <template_path>: Path to a custom application template to use');
|
||||
console.log(' --activity-name <activity_name>: Activity name');
|
||||
console.log(' --link will use the CordovaLib project directly instead of making a copy.');
|
||||
process.exit(1);
|
||||
} else {
|
||||
create.createProject(args[2], args[3], args[4], args[5]);
|
||||
}
|
||||
|
||||
var config = new ConfigParser(path.resolve(__dirname, 'templates/project/res/xml/config.xml'));
|
||||
|
||||
if (argv.argv.remain[1]) config.setPackageName(argv.argv.remain[1]);
|
||||
if (argv.argv.remain[2]) config.setName(argv.argv.remain[2]);
|
||||
if (argv['activity-name']) config.setName(argv['activity-name']);
|
||||
|
||||
var options = {
|
||||
link: argv.link || argv.shared,
|
||||
customTemplate: argv.argv.remain[3],
|
||||
activityName: argv['activity-name']
|
||||
};
|
||||
|
||||
require('./templates/cordova/loggingHelper').adjustLoggerLevel(argv);
|
||||
|
||||
Api.createPlatform(argv.argv.remain[0], config, options).catch(err => {
|
||||
console.error(err);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -23,4 +23,4 @@ IF EXIST %script_path% (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'create' script in 'bin' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var shell = require('shelljs'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
// Get valid target from framework/project.properties
|
||||
module.exports.get_target = function() {
|
||||
if(fs.existsSync(path.join(ROOT, 'framework', 'project.properties'))) {
|
||||
var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'framework', 'project.properties'));
|
||||
return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', '');
|
||||
} else if (fs.existsSync(path.join(ROOT, 'project.properties'))) {
|
||||
// if no target found, we're probably in a project and project.properties is in ROOT.
|
||||
var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'project.properties'));
|
||||
return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', '');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.check_ant = function() {
|
||||
var test = shell.exec('ant -version', {silent:true, async:false});
|
||||
if(test.code > 0) {
|
||||
console.error('ERROR : executing command \'ant\', make sure you have ant installed and added to your path.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports.check_java = function() {
|
||||
if(process.env.JAVA_HOME) {
|
||||
var test = shell.exec('java', {silent:true, async:false});
|
||||
if(test.code > 0) {
|
||||
console.error('ERROR : executing command \'java\', make sure you java environment is set up. Including your JDK and JRE.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
console.error('ERROR : Make sure JAVA_HOME is set, as well as paths to your JDK and JRE for java.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.check_android = function() {
|
||||
var valid_target = this.get_target();
|
||||
var targets = shell.exec('android list targets', {silent:true, async:false});
|
||||
|
||||
if(targets.code > 0 && targets.output.match(/command\snot\sfound/)) {
|
||||
console.error('The command \"android\" failed. Make sure you have the latest Android SDK installed, and the \"android\" command (inside the tools/ folder) is added to your path.');
|
||||
return false;
|
||||
} else if(!targets.output.match(valid_target)) {
|
||||
console.error('Please install Android target ' + valid_target.split('-')[1] + ' (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run \"android\" from your command-line to install/update any missing SDKs or tools.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports.run = function() {
|
||||
return this.check_ant() && this.check_java && this.check_android();
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
@@ -18,186 +16,308 @@
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
var shell = require('shelljs'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
check_reqs = require('./check_reqs'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
function exec(command) {
|
||||
var result;
|
||||
try {
|
||||
result = shell.exec(command, {silent:false, async:false});
|
||||
} catch(e) {
|
||||
console.error('Command error on execuation : ' + command);
|
||||
console.error(e);
|
||||
process.exit(2);
|
||||
var path = require('path');
|
||||
var fs = require('fs-extra');
|
||||
var utils = require('../../bin/lib/utils');
|
||||
var check_reqs = require('./../templates/cordova/lib/check_reqs');
|
||||
var ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
var AndroidManifest = require('../templates/cordova/lib/AndroidManifest');
|
||||
|
||||
// Export all helper functions, and make sure internally within this module, we
|
||||
// reference these methods via the `exports` object - this helps with testing
|
||||
// (since we can then mock and control behaviour of all of these functions)
|
||||
exports.validatePackageName = validatePackageName;
|
||||
exports.validateProjectName = validateProjectName;
|
||||
exports.copyJsAndLibrary = copyJsAndLibrary;
|
||||
exports.copyScripts = copyScripts;
|
||||
exports.copyBuildRules = copyBuildRules;
|
||||
exports.writeProjectProperties = writeProjectProperties;
|
||||
exports.prepBuildFiles = prepBuildFiles;
|
||||
|
||||
function getFrameworkDir (projectPath, shared) {
|
||||
return shared ? path.join(ROOT, 'framework') : path.join(projectPath, 'CordovaLib');
|
||||
}
|
||||
|
||||
function copyJsAndLibrary (projectPath, shared, projectName, isLegacy) {
|
||||
var nestedCordovaLibPath = getFrameworkDir(projectPath, false);
|
||||
var srcCordovaJsPath = path.join(ROOT, 'bin', 'templates', 'project', 'assets', 'www', 'cordova.js');
|
||||
var app_path = path.join(projectPath, 'app', 'src', 'main');
|
||||
const platform_www = path.join(projectPath, 'platform_www');
|
||||
|
||||
if (isLegacy) {
|
||||
app_path = projectPath;
|
||||
}
|
||||
if(result && result.code > 0) {
|
||||
console.error('Command failed to execute : ' + command);
|
||||
console.error(result.output);
|
||||
process.exit(2);
|
||||
|
||||
fs.copySync(srcCordovaJsPath, path.join(app_path, 'assets', 'www', 'cordova.js'));
|
||||
|
||||
// Copy the cordova.js file to platforms/<platform>/platform_www/
|
||||
// The www dir is nuked on each prepare so we keep cordova.js in platform_www
|
||||
fs.ensureDirSync(platform_www);
|
||||
fs.copySync(srcCordovaJsPath, path.join(platform_www, 'cordova.js'));
|
||||
|
||||
// Copy cordova-js-src directory into platform_www directory.
|
||||
// We need these files to build cordova.js if using browserify method.
|
||||
fs.copySync(path.join(ROOT, 'cordova-js-src'), path.join(platform_www, 'cordova-js-src'));
|
||||
|
||||
if (shared) {
|
||||
var relativeFrameworkPath = path.relative(projectPath, getFrameworkDir(projectPath, true));
|
||||
fs.symlinkSync(relativeFrameworkPath, nestedCordovaLibPath, 'dir');
|
||||
} else {
|
||||
return result;
|
||||
fs.ensureDirSync(nestedCordovaLibPath);
|
||||
fs.copySync(path.join(ROOT, 'framework', 'AndroidManifest.xml'), path.join(nestedCordovaLibPath, 'AndroidManifest.xml'));
|
||||
fs.copySync(path.join(ROOT, 'framework', 'project.properties'), path.join(nestedCordovaLibPath, 'project.properties'));
|
||||
fs.copySync(path.join(ROOT, 'framework', 'build.gradle'), path.join(nestedCordovaLibPath, 'build.gradle'));
|
||||
fs.copySync(path.join(ROOT, 'framework', 'cordova.gradle'), path.join(nestedCordovaLibPath, 'cordova.gradle'));
|
||||
fs.copySync(path.join(ROOT, 'framework', 'src'), path.join(nestedCordovaLibPath, 'src'));
|
||||
}
|
||||
}
|
||||
|
||||
function setShellFatal(value, func) {
|
||||
var oldVal = shell.config.fatal;
|
||||
shell.config.fatal = value;
|
||||
func();
|
||||
shell.config.fatal = oldVal;
|
||||
}
|
||||
|
||||
function ensureJarIsBuilt(version, target_api) {
|
||||
var isDevVersion = /-dev$/.test(version);
|
||||
if (isDevVersion || !fs.existsSync(path.join(ROOT, 'framework', 'cordova-' + version + '.jar')) && fs.existsSync(path.join(ROOT, 'framework'))) {
|
||||
var valid_target = check_reqs.get_target();
|
||||
console.log('Building cordova-' + version + '.jar');
|
||||
// update the cordova-android framework for the desired target
|
||||
exec('android --silent update lib-project --target "' + target_api + '" --path "' + path.join(ROOT, 'framework') + '"');
|
||||
// compile cordova.js and cordova.jar
|
||||
var cwd = process.cwd();
|
||||
process.chdir(path.join(ROOT, 'framework'));
|
||||
exec('ant jar');
|
||||
process.chdir(cwd);
|
||||
function extractSubProjectPaths (data) {
|
||||
var ret = {};
|
||||
var r = /^\s*android\.library\.reference\.\d+=(.*)(?:\s|$)/mg;
|
||||
var m;
|
||||
while ((m = r.exec(data))) {
|
||||
ret[m[1]] = 1;
|
||||
}
|
||||
return Object.keys(ret);
|
||||
}
|
||||
|
||||
function copyJsAndJar(projectPath, version) {
|
||||
shell.cp(path.join(ROOT, 'framework', 'assets', 'www', 'cordova.js'), path.join(projectPath, 'assets', 'www', 'cordova.js'));
|
||||
// Don't fail if there are no old jars.
|
||||
setShellFatal(false, function() {
|
||||
shell.ls(path.join(projectPath, 'libs', 'cordova-*.jar')).forEach(function(oldJar) {
|
||||
shell.rm('-f', path.join(projectPath, 'libs', oldJar));
|
||||
});
|
||||
function writeProjectProperties (projectPath, target_api) {
|
||||
var dstPath = path.join(projectPath, 'project.properties');
|
||||
var templatePath = path.join(ROOT, 'bin', 'templates', 'project', 'project.properties');
|
||||
var srcPath = fs.existsSync(dstPath) ? dstPath : templatePath;
|
||||
|
||||
var data = fs.readFileSync(srcPath, 'utf8');
|
||||
data = data.replace(/^target=.*/m, 'target=' + target_api);
|
||||
var subProjects = extractSubProjectPaths(data);
|
||||
subProjects = subProjects.filter(function (p) {
|
||||
return !(/^CordovaLib$/m.exec(p) ||
|
||||
/[\\/]cordova-android[\\/]framework$/m.exec(p) ||
|
||||
/^(\.\.[\\/])+framework$/m.exec(p));
|
||||
});
|
||||
shell.cp(path.join(ROOT, 'framework', 'cordova-' + version + '.jar'), path.join(projectPath, 'libs', 'cordova-' + version + '.jar'));
|
||||
subProjects.unshift('CordovaLib');
|
||||
data = data.replace(/^\s*android\.library\.reference\.\d+=.*\n/mg, '');
|
||||
if (!/\n$/.exec(data)) {
|
||||
data += '\n';
|
||||
}
|
||||
for (var i = 0; i < subProjects.length; ++i) {
|
||||
data += 'android.library.reference.' + (i + 1) + '=' + subProjects[i] + '\n';
|
||||
}
|
||||
fs.writeFileSync(dstPath, data);
|
||||
}
|
||||
|
||||
function copyScripts(projectPath) {
|
||||
var srcScriptsDir = path.join(ROOT, 'bin', 'templates', 'cordova');
|
||||
// This makes no sense, what if you're building with a different build system?
|
||||
function prepBuildFiles (projectPath) {
|
||||
var buildModule = require('../templates/cordova/lib/builders/builders');
|
||||
buildModule.getBuilder(projectPath).prepBuildFiles();
|
||||
}
|
||||
|
||||
function copyBuildRules (projectPath, isLegacy) {
|
||||
var srcDir = path.join(ROOT, 'bin', 'templates', 'project');
|
||||
|
||||
if (isLegacy) {
|
||||
// The project's build.gradle is identical to the earlier build.gradle, so it should still work
|
||||
fs.copySync(path.join(srcDir, 'legacy', 'build.gradle'), path.join(projectPath, 'legacy', 'build.gradle'));
|
||||
fs.copySync(path.join(srcDir, 'wrapper.gradle'), path.join(projectPath, 'wrapper.gradle'));
|
||||
} else {
|
||||
fs.copySync(path.join(srcDir, 'build.gradle'), path.join(projectPath, 'build.gradle'));
|
||||
fs.copySync(path.join(srcDir, 'app', 'build.gradle'), path.join(projectPath, 'app', 'build.gradle'));
|
||||
fs.copySync(path.join(srcDir, 'wrapper.gradle'), path.join(projectPath, 'wrapper.gradle'));
|
||||
}
|
||||
}
|
||||
|
||||
function copyScripts (projectPath) {
|
||||
var bin = path.join(ROOT, 'bin');
|
||||
var srcScriptsDir = path.join(bin, 'templates', 'cordova');
|
||||
var destScriptsDir = path.join(projectPath, 'cordova');
|
||||
// Delete old scripts directory if this is an update.
|
||||
shell.rm('-rf', destScriptsDir);
|
||||
fs.removeSync(destScriptsDir);
|
||||
// Copy in the new ones.
|
||||
shell.cp('-r', srcScriptsDir, projectPath);
|
||||
shell.cp('-r', path.join(ROOT, 'bin', 'node_modules'), destScriptsDir);
|
||||
shell.cp(path.join(ROOT, 'bin', 'check_reqs'), path.join(destScriptsDir, 'check_reqs'));
|
||||
shell.cp(path.join(ROOT, 'bin', 'lib', 'check_reqs.js'), path.join(projectPath, 'cordova', 'lib', 'check_reqs.js'));
|
||||
fs.copySync(srcScriptsDir, destScriptsDir);
|
||||
|
||||
if (!/^win/.test(process.platform)) {
|
||||
// Ensure they are all executable and delete .bat files.
|
||||
shell.find(destScriptsDir).forEach(function(p) {
|
||||
if (/\.bat$/.test(p)) {
|
||||
shell.rm(p);
|
||||
} else {
|
||||
shell.chmod(755, p);
|
||||
}
|
||||
});
|
||||
}
|
||||
const nodeModulesDir = path.join(ROOT, 'node_modules');
|
||||
if (fs.existsSync(nodeModulesDir)) fs.copySync(nodeModulesDir, path.join(destScriptsDir, 'node_modules'));
|
||||
|
||||
fs.copySync(path.join(bin, 'check_reqs'), path.join(destScriptsDir, 'check_reqs'));
|
||||
fs.copySync(path.join(bin, 'check_reqs.bat'), path.join(destScriptsDir, 'check_reqs.bat'));
|
||||
fs.copySync(path.join(bin, 'android_sdk_version'), path.join(destScriptsDir, 'android_sdk_version'));
|
||||
fs.copySync(path.join(bin, 'android_sdk_version.bat'), path.join(destScriptsDir, 'android_sdk_version.bat'));
|
||||
|
||||
var check_reqs = path.join(destScriptsDir, 'check_reqs');
|
||||
var android_sdk_version = path.join(destScriptsDir, 'android_sdk_version');
|
||||
|
||||
// TODO: the two files being edited on-the-fly here are shared between
|
||||
// platform and project-level commands. the below is updating the
|
||||
// `require` path for the two libraries. if there's a better way to share
|
||||
// modules across both the repo and generated projects, we should make sure
|
||||
// to remove/update this.
|
||||
const templatesCordovaRegex = /templates\/cordova\//;
|
||||
utils.replaceFileContents(android_sdk_version, templatesCordovaRegex, '');
|
||||
utils.replaceFileContents(check_reqs, templatesCordovaRegex, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* $ create [options]
|
||||
*
|
||||
* Creates an android application with the given options.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `project_path` {String} Path to the new Cordova android project.
|
||||
* - `package_name`{String} Package name, following reverse-domain style convention.
|
||||
* - `project_name` {String} Project name.
|
||||
* - 'project_template_dir' {String} Path to project template (override).
|
||||
* Test whether a package name is acceptable for use as an android project.
|
||||
* Returns a promise, fulfilled if the package name is acceptable; rejected
|
||||
* otherwise.
|
||||
*/
|
||||
function validatePackageName (package_name) {
|
||||
// Make the package conform to Java package types
|
||||
// http://developer.android.com/guide/topics/manifest/manifest-element.html#package
|
||||
// Enforce underscore limitation
|
||||
var msg = 'Error validating package name. ';
|
||||
|
||||
exports.createProject = function(project_path, package_name, project_name, project_template_dir) {
|
||||
var VERSION = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
|
||||
|
||||
// Set default values for path, package and name
|
||||
project_path = typeof project_path !== 'undefined' ? project_path : "CordovaExample";
|
||||
project_path = path.relative(process.cwd(), project_path);
|
||||
package_name = typeof package_name !== 'undefined' ? package_name : 'my.cordova.project';
|
||||
project_name = typeof project_name !== 'undefined' ? project_name : 'CordovaExample';
|
||||
project_template_dir = typeof project_template_dir !== 'undefined' ?
|
||||
project_template_dir :
|
||||
path.join(ROOT, 'bin', 'templates', 'project');
|
||||
|
||||
var safe_activity_name = project_name.replace(/\W/, '');
|
||||
var package_as_path = package_name.replace(/\./g, path.sep);
|
||||
var activity_dir = path.join(project_path, 'src', package_as_path);
|
||||
var activity_path = path.join(activity_dir, safe_activity_name + '.java');
|
||||
var target_api = check_reqs.get_target();
|
||||
var manifest_path = path.join(project_path, 'AndroidManifest.xml');
|
||||
|
||||
// Check if project already exists
|
||||
if(fs.existsSync(project_path)) {
|
||||
console.error('Project already exists! Delete and recreate');
|
||||
process.exit(2);
|
||||
if (!/^[a-zA-Z][a-zA-Z0-9_]+(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(package_name)) {
|
||||
return Promise.reject(new CordovaError(msg + 'Must look like: `com.company.Name`. Currently is: `' + package_name + '`'));
|
||||
}
|
||||
|
||||
if (!/[a-zA-Z0-9_]+\.[a-zA-Z0-9_](.[a-zA-Z0-9_])*/.test(package_name)) {
|
||||
console.error('Package name must look like: com.company.Name');
|
||||
process.exit(2);
|
||||
// Class is a reserved word
|
||||
if (/\b[Cc]lass\b/.test(package_name)) {
|
||||
return Promise.reject(new CordovaError(msg + '"class" is a reserved word'));
|
||||
}
|
||||
|
||||
// Check that requirements are met and proper targets are installed
|
||||
if(!check_reqs.run()) {
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
// Log the given values for the project
|
||||
console.log('Creating Cordova project for the Android platform:');
|
||||
console.log('\tPath: ' + project_path);
|
||||
console.log('\tPackage: ' + package_name);
|
||||
console.log('\tName: ' + project_name);
|
||||
console.log('\tAndroid target: ' + target_api);
|
||||
|
||||
// build from source. distro should have these files
|
||||
ensureJarIsBuilt(VERSION, target_api);
|
||||
|
||||
console.log('Copying template files...');
|
||||
|
||||
setShellFatal(true, function() {
|
||||
// copy project template
|
||||
shell.cp('-r', path.join(project_template_dir, 'assets'), project_path);
|
||||
shell.cp('-r', path.join(project_template_dir, 'res'), project_path);
|
||||
// Manually create directories that would be empty within the template (since git doesn't track directories).
|
||||
shell.mkdir(path.join(project_path, 'libs'));
|
||||
|
||||
// copy cordova.js, cordova.jar and res/xml
|
||||
shell.cp('-r', path.join(ROOT, 'framework', 'res', 'xml'), path.join(project_path, 'res'));
|
||||
copyJsAndJar(project_path, VERSION);
|
||||
|
||||
// interpolate the activity name and package
|
||||
shell.mkdir('-p', activity_dir);
|
||||
shell.cp('-f', path.join(project_template_dir, 'Activity.java'), activity_path);
|
||||
shell.sed('-i', /__ACTIVITY__/, safe_activity_name, activity_path);
|
||||
shell.sed('-i', /__NAME__/, project_name, path.join(project_path, 'res', 'values', 'strings.xml'));
|
||||
shell.sed('-i', /__ID__/, package_name, activity_path);
|
||||
|
||||
shell.cp('-f', path.join(project_template_dir, 'AndroidManifest.xml'), manifest_path);
|
||||
shell.sed('-i', /__ACTIVITY__/, safe_activity_name, manifest_path);
|
||||
shell.sed('-i', /__PACKAGE__/, package_name, manifest_path);
|
||||
shell.sed('-i', /__APILEVEL__/, target_api.split('-')[1], manifest_path);
|
||||
copyScripts(project_path);
|
||||
});
|
||||
// Link it to local android install.
|
||||
console.log('Running "android update project"');
|
||||
exec('android --silent update project --target "'+target_api+'" --path "'+ project_path+'"');
|
||||
console.log('Project successfully created.');
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
exports.updateProject = function(projectPath) {
|
||||
// Check that requirements are met and proper targets are installed
|
||||
if (!check_reqs.run()) {
|
||||
process.exit(2);
|
||||
/**
|
||||
* Test whether given string is acceptable for use as a project name
|
||||
* Returns a promise, fulfilled if the project name is acceptable; rejected
|
||||
* otherwise.
|
||||
*/
|
||||
function validateProjectName (project_name) {
|
||||
var msg = 'Error validating project name. ';
|
||||
// Make sure there's something there
|
||||
if (project_name === '') {
|
||||
return Promise.reject(new CordovaError(msg + 'Project name cannot be empty'));
|
||||
}
|
||||
var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an android application with the given options.
|
||||
*
|
||||
* @param {String} project_path Path to the new Cordova android project.
|
||||
* @param {ConfigParser} config Instance of ConfigParser to retrieve basic
|
||||
* project properties.
|
||||
* @param {Object} [options={}] Various options
|
||||
* @param {String} [options.activityName='MainActivity'] Name for the
|
||||
* activity
|
||||
* @param {Boolean} [options.link=false] Specifies whether javascript files
|
||||
* and CordovaLib framework will be symlinked to created application.
|
||||
* @param {String} [options.customTemplate] Path to project template
|
||||
* (override)
|
||||
* @param {EventEmitter} [events] An EventEmitter instance for logging
|
||||
* events
|
||||
*
|
||||
* @return {Promise<String>} Directory where application has been created
|
||||
*/
|
||||
exports.create = function (project_path, config, options, events) {
|
||||
options = options || {};
|
||||
|
||||
// Set default values for path, package and name
|
||||
project_path = path.relative(process.cwd(), (project_path || 'CordovaExample'));
|
||||
// Check if project already exists
|
||||
if (fs.existsSync(project_path)) {
|
||||
return Promise.reject(new CordovaError('Project already exists! Delete and recreate'));
|
||||
}
|
||||
|
||||
var package_name = config.android_packageName() || config.packageName() || 'my.cordova.project';
|
||||
var project_name = config.name()
|
||||
? config.name().replace(/[^\w.]/g, '_') : 'CordovaExample';
|
||||
|
||||
var safe_activity_name = config.android_activityName() || options.activityName || 'MainActivity';
|
||||
var target_api = check_reqs.get_target();
|
||||
ensureJarIsBuilt(version, target_api);
|
||||
copyJsAndJar(projectPath, version);
|
||||
copyScripts(projectPath);
|
||||
console.log('Android project is now at version ' + version);
|
||||
|
||||
// Make the package conform to Java package types
|
||||
return exports.validatePackageName(package_name)
|
||||
.then(function () {
|
||||
return exports.validateProjectName(project_name);
|
||||
}).then(function () {
|
||||
// Log the given values for the project
|
||||
events.emit('log', 'Creating Cordova project for the Android platform:');
|
||||
events.emit('log', '\tPath: ' + project_path);
|
||||
events.emit('log', '\tPackage: ' + package_name);
|
||||
events.emit('log', '\tName: ' + project_name);
|
||||
events.emit('log', '\tActivity: ' + safe_activity_name);
|
||||
events.emit('log', '\tAndroid target: ' + target_api);
|
||||
|
||||
events.emit('verbose', 'Copying android template project to ' + project_path);
|
||||
|
||||
var project_template_dir = options.customTemplate || path.join(ROOT, 'bin', 'templates', 'project');
|
||||
var app_path = path.join(project_path, 'app', 'src', 'main');
|
||||
|
||||
// copy project template
|
||||
fs.ensureDirSync(app_path);
|
||||
fs.copySync(path.join(project_template_dir, 'assets'), path.join(app_path, 'assets'));
|
||||
fs.copySync(path.join(project_template_dir, 'res'), path.join(app_path, 'res'));
|
||||
fs.copySync(path.join(project_template_dir, 'gitignore'), path.join(project_path, '.gitignore'));
|
||||
|
||||
// Manually create directories that would be empty within the template (since git doesn't track directories).
|
||||
fs.ensureDirSync(path.join(app_path, 'libs'));
|
||||
|
||||
// copy cordova.js, cordova.jar
|
||||
exports.copyJsAndLibrary(project_path, options.link, safe_activity_name);
|
||||
|
||||
// Set up ther Android Studio paths
|
||||
var java_path = path.join(app_path, 'java');
|
||||
var assets_path = path.join(app_path, 'assets');
|
||||
var resource_path = path.join(app_path, 'res');
|
||||
fs.ensureDirSync(java_path);
|
||||
fs.ensureDirSync(assets_path);
|
||||
fs.ensureDirSync(resource_path);
|
||||
|
||||
// interpolate the activity name and package
|
||||
var packagePath = package_name.replace(/\./g, path.sep);
|
||||
var activity_dir = path.join(java_path, packagePath);
|
||||
var activity_path = path.join(activity_dir, safe_activity_name + '.java');
|
||||
|
||||
fs.ensureDirSync(activity_dir);
|
||||
fs.copySync(path.join(project_template_dir, 'Activity.java'), activity_path);
|
||||
utils.replaceFileContents(activity_path, /__ACTIVITY__/, safe_activity_name);
|
||||
utils.replaceFileContents(path.join(app_path, 'res', 'values', 'strings.xml'), /__NAME__/, project_name);
|
||||
utils.replaceFileContents(activity_path, /__ID__/, package_name);
|
||||
|
||||
var manifest = new AndroidManifest(path.join(project_template_dir, 'AndroidManifest.xml'));
|
||||
manifest.setPackageId(package_name)
|
||||
.getActivity().setName(safe_activity_name);
|
||||
|
||||
var manifest_path = path.join(app_path, 'AndroidManifest.xml');
|
||||
manifest.write(manifest_path);
|
||||
|
||||
exports.copyScripts(project_path);
|
||||
exports.copyBuildRules(project_path);
|
||||
|
||||
// Link it to local android install.
|
||||
exports.writeProjectProperties(project_path, target_api);
|
||||
exports.prepBuildFiles(project_path);
|
||||
events.emit('log', generateDoneMessage('create', options.link));
|
||||
}).then(() => project_path);
|
||||
};
|
||||
|
||||
function generateDoneMessage (type, link) {
|
||||
var pkg = require('../../package');
|
||||
var msg = 'Android project ' + (type === 'update' ? 'updated ' : 'created ') + 'with ' + pkg.name + '@' + pkg.version;
|
||||
if (link) {
|
||||
msg += ' and has a linked CordovaLib';
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
// Returns a promise.
|
||||
exports.update = function (projectPath, options, events) {
|
||||
var errorString =
|
||||
'An in-place platform update is not supported. \n' +
|
||||
'The `platforms` folder is always treated as a build artifact in the CLI workflow.\n' +
|
||||
'To update your platform, you have to remove, then add your android platform again.\n' +
|
||||
'Make sure you save your plugins beforehand using `cordova plugin save`, and save \n' + 'a copy of the platform first if you had manual changes in it.\n' +
|
||||
'\tcordova plugin save\n' +
|
||||
'\tcordova platform rm android\n' +
|
||||
'\tcordova platform add android\n'
|
||||
;
|
||||
|
||||
return Promise.reject(errorString);
|
||||
};
|
||||
|
||||
47
bin/lib/utils.js
Normal file
47
bin/lib/utils.js
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Provides a set of utility methods, which can also be spied on during unit tests.
|
||||
*/
|
||||
|
||||
// TODO: Perhaps this should live in cordova-common?
|
||||
|
||||
const fs = require('fs-extra');
|
||||
|
||||
/**
|
||||
* Reads, searches, and replaces the found occurences with replacementString and then writes the file back out.
|
||||
* A backup is not made.
|
||||
*
|
||||
* @param {string} file A file path to a readable & writable file
|
||||
* @param {RegExp} searchRegex The search regex
|
||||
* @param {string} replacementString The string to replace the found occurences
|
||||
* @returns {void}
|
||||
*/
|
||||
exports.replaceFileContents = function (file, searchRegex, replacementString) {
|
||||
// let contents;
|
||||
try {
|
||||
var contents = fs.readFileSync(file).toString();
|
||||
} catch (ex) {
|
||||
console.log('TRYING TO READ: ', file);
|
||||
throw ex;
|
||||
}
|
||||
contents = contents.replace(searchRegex, replacementString);
|
||||
fs.writeFileSync(file, contents);
|
||||
};
|
||||
1
bin/node_modules/.bin/shjs
generated
vendored
1
bin/node_modules/.bin/shjs
generated
vendored
@@ -1 +0,0 @@
|
||||
../shelljs/bin/shjs
|
||||
6
bin/node_modules/shelljs/.documentup.json
generated
vendored
6
bin/node_modules/shelljs/.documentup.json
generated
vendored
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "ShellJS",
|
||||
"twitter": [
|
||||
"r2r"
|
||||
]
|
||||
}
|
||||
1
bin/node_modules/shelljs/.npmignore
generated
vendored
1
bin/node_modules/shelljs/.npmignore
generated
vendored
@@ -1 +0,0 @@
|
||||
node_modules/
|
||||
5
bin/node_modules/shelljs/.travis.yml
generated
vendored
5
bin/node_modules/shelljs/.travis.yml
generated
vendored
@@ -1,5 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- 0.8
|
||||
|
||||
26
bin/node_modules/shelljs/LICENSE
generated
vendored
26
bin/node_modules/shelljs/LICENSE
generated
vendored
@@ -1,26 +0,0 @@
|
||||
Copyright (c) 2012, Artur Adib <aadib@mozilla.com>
|
||||
All rights reserved.
|
||||
|
||||
You may use this project under the terms of the New BSD license as follows:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Artur Adib nor the
|
||||
names of the contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
513
bin/node_modules/shelljs/README.md
generated
vendored
513
bin/node_modules/shelljs/README.md
generated
vendored
@@ -1,513 +0,0 @@
|
||||
# ShellJS - Unix shell commands for Node.js [](http://travis-ci.org/arturadib/shelljs)
|
||||
|
||||
ShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts!
|
||||
|
||||
The project is [unit-tested](http://travis-ci.org/arturadib/shelljs) and battled-tested in projects like:
|
||||
|
||||
+ [PDF.js](http://github.com/mozilla/pdf.js) - Firefox's next-gen PDF reader
|
||||
+ [Firebug](http://getfirebug.com/) - Firefox's infamous debugger
|
||||
+ [JSHint](http://jshint.com) - Most popular JavaScript linter
|
||||
+ [Zepto](http://zeptojs.com) - jQuery-compatible JavaScript library for modern browsers
|
||||
+ [Yeoman](http://yeoman.io/) - Web application stack and development tool
|
||||
+ [Deployd.com](http://deployd.com) - Open source PaaS for quick API backend generation
|
||||
|
||||
and [many more](https://npmjs.org/browse/depended/shelljs).
|
||||
|
||||
## Installing
|
||||
|
||||
Via npm:
|
||||
|
||||
```bash
|
||||
$ npm install [-g] shelljs
|
||||
```
|
||||
|
||||
If the global option `-g` is specified, the binary `shjs` will be installed. This makes it possible to
|
||||
run ShellJS scripts much like any shell script from the command line, i.e. without requiring a `node_modules` folder:
|
||||
|
||||
```bash
|
||||
$ shjs my_script
|
||||
```
|
||||
|
||||
You can also just copy `shell.js` into your project's directory, and `require()` accordingly.
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### JavaScript
|
||||
|
||||
```javascript
|
||||
require('shelljs/global');
|
||||
|
||||
if (!which('git')) {
|
||||
echo('Sorry, this script requires git');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Copy files to release dir
|
||||
mkdir('-p', 'out/Release');
|
||||
cp('-R', 'stuff/*', 'out/Release');
|
||||
|
||||
// Replace macros in each .js file
|
||||
cd('lib');
|
||||
ls('*.js').forEach(function(file) {
|
||||
sed('-i', 'BUILD_VERSION', 'v0.1.2', file);
|
||||
sed('-i', /.*REMOVE_THIS_LINE.*\n/, '', file);
|
||||
sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat('macro.js'), file);
|
||||
});
|
||||
cd('..');
|
||||
|
||||
// Run external tool synchronously
|
||||
if (exec('git commit -am "Auto-commit"').code !== 0) {
|
||||
echo('Error: Git commit failed');
|
||||
exit(1);
|
||||
}
|
||||
```
|
||||
|
||||
### CoffeeScript
|
||||
|
||||
```coffeescript
|
||||
require 'shelljs/global'
|
||||
|
||||
if not which 'git'
|
||||
echo 'Sorry, this script requires git'
|
||||
exit 1
|
||||
|
||||
# Copy files to release dir
|
||||
mkdir '-p', 'out/Release'
|
||||
cp '-R', 'stuff/*', 'out/Release'
|
||||
|
||||
# Replace macros in each .js file
|
||||
cd 'lib'
|
||||
for file in ls '*.js'
|
||||
sed '-i', 'BUILD_VERSION', 'v0.1.2', file
|
||||
sed '-i', /.*REMOVE_THIS_LINE.*\n/, '', file
|
||||
sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat 'macro.js', file
|
||||
cd '..'
|
||||
|
||||
# Run external tool synchronously
|
||||
if (exec 'git commit -am "Auto-commit"').code != 0
|
||||
echo 'Error: Git commit failed'
|
||||
exit 1
|
||||
```
|
||||
|
||||
## Global vs. Local
|
||||
|
||||
The example above uses the convenience script `shelljs/global` to reduce verbosity. If polluting your global namespace is not desirable, simply require `shelljs`.
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
var shell = require('shelljs');
|
||||
shell.echo('hello world');
|
||||
```
|
||||
|
||||
## Make tool
|
||||
|
||||
A convenience script `shelljs/make` is also provided to mimic the behavior of a Unix Makefile. In this case all shell objects are global, and command line arguments will cause the script to execute only the corresponding function in the global `target` object. To avoid redundant calls, target functions are executed only once per script.
|
||||
|
||||
Example (CoffeeScript):
|
||||
|
||||
```coffeescript
|
||||
require 'shelljs/make'
|
||||
|
||||
target.all = ->
|
||||
target.bundle()
|
||||
target.docs()
|
||||
|
||||
target.bundle = ->
|
||||
cd __dirname
|
||||
mkdir 'build'
|
||||
cd 'lib'
|
||||
(cat '*.js').to '../build/output.js'
|
||||
|
||||
target.docs = ->
|
||||
cd __dirname
|
||||
mkdir 'docs'
|
||||
cd 'lib'
|
||||
for file in ls '*.js'
|
||||
text = grep '//@', file # extract special comments
|
||||
text.replace '//@', '' # remove comment tags
|
||||
text.to 'docs/my_docs.md'
|
||||
```
|
||||
|
||||
To run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`, and so on.
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
DO NOT MODIFY BEYOND THIS POINT - IT'S AUTOMATICALLY GENERATED
|
||||
|
||||
-->
|
||||
|
||||
|
||||
## Command reference
|
||||
|
||||
|
||||
All commands run synchronously, unless otherwise stated.
|
||||
|
||||
|
||||
### cd('dir')
|
||||
Changes to directory `dir` for the duration of the script
|
||||
|
||||
### pwd()
|
||||
Returns the current directory.
|
||||
|
||||
### ls([options ,] path [,path ...])
|
||||
### ls([options ,] path_array)
|
||||
Available options:
|
||||
|
||||
+ `-R`: recursive
|
||||
+ `-A`: all files (include files beginning with `.`, except for `.` and `..`)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
ls('projs/*.js');
|
||||
ls('-R', '/users/me', '/tmp');
|
||||
ls('-R', ['/users/me', '/tmp']); // same as above
|
||||
```
|
||||
|
||||
Returns array of files in the given path, or in current directory if no path provided.
|
||||
|
||||
### find(path [,path ...])
|
||||
### find(path_array)
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
find('src', 'lib');
|
||||
find(['src', 'lib']); // same as above
|
||||
find('.').filter(function(file) { return file.match(/\.js$/); });
|
||||
```
|
||||
|
||||
Returns array of all files (however deep) in the given paths.
|
||||
|
||||
The main difference from `ls('-R', path)` is that the resulting file names
|
||||
include the base directories, e.g. `lib/resources/file1` instead of just `file1`.
|
||||
|
||||
### cp([options ,] source [,source ...], dest)
|
||||
### cp([options ,] source_array, dest)
|
||||
Available options:
|
||||
|
||||
+ `-f`: force
|
||||
+ `-r, -R`: recursive
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
cp('file1', 'dir1');
|
||||
cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
|
||||
cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
|
||||
```
|
||||
|
||||
Copies files. The wildcard `*` is accepted.
|
||||
|
||||
### rm([options ,] file [, file ...])
|
||||
### rm([options ,] file_array)
|
||||
Available options:
|
||||
|
||||
+ `-f`: force
|
||||
+ `-r, -R`: recursive
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
rm('-rf', '/tmp/*');
|
||||
rm('some_file.txt', 'another_file.txt');
|
||||
rm(['some_file.txt', 'another_file.txt']); // same as above
|
||||
```
|
||||
|
||||
Removes files. The wildcard `*` is accepted.
|
||||
|
||||
### mv(source [, source ...], dest')
|
||||
### mv(source_array, dest')
|
||||
Available options:
|
||||
|
||||
+ `f`: force
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
mv('-f', 'file', 'dir/');
|
||||
mv('file1', 'file2', 'dir/');
|
||||
mv(['file1', 'file2'], 'dir/'); // same as above
|
||||
```
|
||||
|
||||
Moves files. The wildcard `*` is accepted.
|
||||
|
||||
### mkdir([options ,] dir [, dir ...])
|
||||
### mkdir([options ,] dir_array)
|
||||
Available options:
|
||||
|
||||
+ `p`: full path (will create intermediate dirs if necessary)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');
|
||||
mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above
|
||||
```
|
||||
|
||||
Creates directories.
|
||||
|
||||
### test(expression)
|
||||
Available expression primaries:
|
||||
|
||||
+ `'-b', 'path'`: true if path is a block device
|
||||
+ `'-c', 'path'`: true if path is a character device
|
||||
+ `'-d', 'path'`: true if path is a directory
|
||||
+ `'-e', 'path'`: true if path exists
|
||||
+ `'-f', 'path'`: true if path is a regular file
|
||||
+ `'-L', 'path'`: true if path is a symboilc link
|
||||
+ `'-p', 'path'`: true if path is a pipe (FIFO)
|
||||
+ `'-S', 'path'`: true if path is a socket
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
if (test('-d', path)) { /* do something with dir */ };
|
||||
if (!test('-f', path)) continue; // skip if it's a regular file
|
||||
```
|
||||
|
||||
Evaluates expression using the available primaries and returns corresponding value.
|
||||
|
||||
### cat(file [, file ...])
|
||||
### cat(file_array)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
var str = cat('file*.txt');
|
||||
var str = cat('file1', 'file2');
|
||||
var str = cat(['file1', 'file2']); // same as above
|
||||
```
|
||||
|
||||
Returns a string containing the given file, or a concatenated string
|
||||
containing the files if more than one file is given (a new line character is
|
||||
introduced between each file). Wildcard `*` accepted.
|
||||
|
||||
### 'string'.to(file)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
cat('input.txt').to('output.txt');
|
||||
```
|
||||
|
||||
Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as
|
||||
those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_
|
||||
|
||||
### sed([options ,] search_regex, replace_str, file)
|
||||
Available options:
|
||||
|
||||
+ `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
|
||||
sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
|
||||
```
|
||||
|
||||
Reads an input string from `file` and performs a JavaScript `replace()` on the input
|
||||
using the given search regex and replacement string. Returns the new string after replacement.
|
||||
|
||||
### grep([options ,] regex_filter, file [, file ...])
|
||||
### grep([options ,] regex_filter, file_array)
|
||||
Available options:
|
||||
|
||||
+ `-v`: Inverse the sense of the regex and print the lines not matching the criteria.
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
grep('-v', 'GLOBAL_VARIABLE', '*.js');
|
||||
grep('GLOBAL_VARIABLE', '*.js');
|
||||
```
|
||||
|
||||
Reads input string from given files and returns a string containing all lines of the
|
||||
file that match the given `regex_filter`. Wildcard `*` accepted.
|
||||
|
||||
### which(command)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
var nodeExec = which('node');
|
||||
```
|
||||
|
||||
Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.
|
||||
Returns string containing the absolute path to the command.
|
||||
|
||||
### echo(string [,string ...])
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
echo('hello world');
|
||||
var str = echo('hello world');
|
||||
```
|
||||
|
||||
Prints string to stdout, and returns string with additional utility methods
|
||||
like `.to()`.
|
||||
|
||||
### dirs([options | '+N' | '-N'])
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-c`: Clears the directory stack by deleting all of the elements.
|
||||
|
||||
Arguments:
|
||||
|
||||
+ `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
|
||||
+ `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
|
||||
|
||||
Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
|
||||
|
||||
See also: pushd, popd
|
||||
|
||||
### pushd([options,] [dir | '-N' | '+N'])
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
|
||||
|
||||
Arguments:
|
||||
|
||||
+ `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.
|
||||
+ `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
|
||||
+ `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
// process.cwd() === '/usr'
|
||||
pushd('/etc'); // Returns /etc /usr
|
||||
pushd('+1'); // Returns /usr /etc
|
||||
```
|
||||
|
||||
Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
|
||||
|
||||
### popd([options,] ['-N' | '+N'])
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
|
||||
|
||||
Arguments:
|
||||
|
||||
+ `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
|
||||
+ `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
echo(process.cwd()); // '/usr'
|
||||
pushd('/etc'); // '/etc /usr'
|
||||
echo(process.cwd()); // '/etc'
|
||||
popd(); // '/usr'
|
||||
echo(process.cwd()); // '/usr'
|
||||
```
|
||||
|
||||
When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
|
||||
|
||||
### exit(code)
|
||||
Exits the current process with the given exit code.
|
||||
|
||||
### env['VAR_NAME']
|
||||
Object containing environment variables (both getter and setter). Shortcut to process.env.
|
||||
|
||||
### exec(command [, options] [, callback])
|
||||
Available options (all `false` by default):
|
||||
|
||||
+ `async`: Asynchronous execution. Defaults to true if a callback is provided.
|
||||
+ `silent`: Do not echo program output to console.
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
var version = exec('node --version', {silent:true}).output;
|
||||
|
||||
var child = exec('some_long_running_process', {async:true});
|
||||
child.stdout.on('data', function(data) {
|
||||
/* ... do something with data ... */
|
||||
});
|
||||
|
||||
exec('some_long_running_process', function(code, output) {
|
||||
console.log('Exit code:', code);
|
||||
console.log('Program output:', output);
|
||||
});
|
||||
```
|
||||
|
||||
Executes the given `command` _synchronously_, unless otherwise specified.
|
||||
When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's
|
||||
`output` (stdout + stderr) and its exit `code`. Otherwise returns the child process object, and
|
||||
the `callback` gets the arguments `(code, output)`.
|
||||
|
||||
**Note:** For long-lived processes, it's best to run `exec()` asynchronously as
|
||||
the current synchronous implementation uses a lot of CPU. This should be getting
|
||||
fixed soon.
|
||||
|
||||
### chmod(octal_mode || octal_string, file)
|
||||
### chmod(symbolic_mode, file)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-v`: output a diagnostic for every file processed
|
||||
+ `-c`: like verbose but report only when a change is made
|
||||
+ `-R`: change files and directories recursively
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
chmod(755, '/Users/brandon');
|
||||
chmod('755', '/Users/brandon'); // same as above
|
||||
chmod('u+x', '/Users/brandon');
|
||||
```
|
||||
|
||||
Alters the permissions of a file or directory by either specifying the
|
||||
absolute permissions in octal form or expressing the changes in symbols.
|
||||
This command tries to mimic the POSIX behavior as much as possible.
|
||||
Notable exceptions:
|
||||
|
||||
+ In symbolic modes, 'a-r' and '-r' are identical. No consideration is
|
||||
given to the umask.
|
||||
+ There is no "quiet" option since default behavior is to run silent.
|
||||
|
||||
## Configuration
|
||||
|
||||
|
||||
### config.silent
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
var silentState = config.silent; // save old silent state
|
||||
config.silent = true;
|
||||
/* ... */
|
||||
config.silent = silentState; // restore old silent state
|
||||
```
|
||||
|
||||
Suppresses all command output if `true`, except for `echo()` calls.
|
||||
Default is `false`.
|
||||
|
||||
### config.fatal
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
config.fatal = true;
|
||||
cp('this_file_does_not_exist', '/dev/null'); // dies here
|
||||
/* more commands... */
|
||||
```
|
||||
|
||||
If `true` the script will die on errors. Default is `false`.
|
||||
|
||||
## Non-Unix commands
|
||||
|
||||
|
||||
### tempdir()
|
||||
Searches and returns string containing a writeable, platform-dependent temporary directory.
|
||||
Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
|
||||
|
||||
### error()
|
||||
Tests if error occurred in the last command. Returns `null` if no error occurred,
|
||||
otherwise returns string explaining the error
|
||||
51
bin/node_modules/shelljs/bin/shjs
generated
vendored
51
bin/node_modules/shelljs/bin/shjs
generated
vendored
@@ -1,51 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
require('../global');
|
||||
|
||||
if (process.argv.length < 3) {
|
||||
console.log('ShellJS: missing argument (script name)');
|
||||
console.log();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var args,
|
||||
scriptName = process.argv[2];
|
||||
env['NODE_PATH'] = __dirname + '/../..';
|
||||
|
||||
if (!scriptName.match(/\.js/) && !scriptName.match(/\.coffee/)) {
|
||||
if (test('-f', scriptName + '.js'))
|
||||
scriptName += '.js';
|
||||
if (test('-f', scriptName + '.coffee'))
|
||||
scriptName += '.coffee';
|
||||
}
|
||||
|
||||
if (!test('-f', scriptName)) {
|
||||
console.log('ShellJS: script not found ('+scriptName+')');
|
||||
console.log();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
args = process.argv.slice(3);
|
||||
|
||||
for (var i = 0, l = args.length; i < l; i++) {
|
||||
if (args[i][0] !== "-"){
|
||||
args[i] = '"' + args[i] + '"'; // fixes arguments with multiple words
|
||||
}
|
||||
}
|
||||
|
||||
if (scriptName.match(/\.coffee$/)) {
|
||||
//
|
||||
// CoffeeScript
|
||||
//
|
||||
if (which('coffee')) {
|
||||
exec('coffee ' + scriptName + ' ' + args.join(' '), { async: true });
|
||||
} else {
|
||||
console.log('ShellJS: CoffeeScript interpreter not found');
|
||||
console.log();
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// JavaScript
|
||||
//
|
||||
exec('node ' + scriptName + ' ' + args.join(' '), { async: true });
|
||||
}
|
||||
3
bin/node_modules/shelljs/global.js
generated
vendored
3
bin/node_modules/shelljs/global.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
var shell = require('./shell.js');
|
||||
for (var cmd in shell)
|
||||
global[cmd] = shell[cmd];
|
||||
4
bin/node_modules/shelljs/jshint.json
generated
vendored
4
bin/node_modules/shelljs/jshint.json
generated
vendored
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"loopfunc": true,
|
||||
"sub": true
|
||||
}
|
||||
48
bin/node_modules/shelljs/make.js
generated
vendored
48
bin/node_modules/shelljs/make.js
generated
vendored
@@ -1,48 +0,0 @@
|
||||
require('./global');
|
||||
config.fatal = true;
|
||||
|
||||
global.target = {};
|
||||
|
||||
// This ensures we only execute the script targets after the entire script has
|
||||
// been evaluated
|
||||
var args = process.argv.slice(2);
|
||||
setTimeout(function() {
|
||||
var t;
|
||||
|
||||
if (args.length === 1 && args[0] === '--help') {
|
||||
console.log('Available targets:');
|
||||
for (t in target)
|
||||
console.log(' ' + t);
|
||||
return;
|
||||
}
|
||||
|
||||
// Wrap targets to prevent duplicate execution
|
||||
for (t in target) {
|
||||
(function(t, oldTarget){
|
||||
|
||||
// Wrap it
|
||||
target[t] = function(force) {
|
||||
if (oldTarget.done && !force)
|
||||
return;
|
||||
oldTarget.done = true;
|
||||
return oldTarget.apply(oldTarget, arguments);
|
||||
};
|
||||
|
||||
})(t, target[t]);
|
||||
}
|
||||
|
||||
// Execute desired targets
|
||||
if (args.length > 0) {
|
||||
args.forEach(function(arg) {
|
||||
if (arg in target)
|
||||
target[arg]();
|
||||
else {
|
||||
console.log('no such target: ' + arg);
|
||||
exit(1);
|
||||
}
|
||||
});
|
||||
} else if ('all' in target) {
|
||||
target.all();
|
||||
}
|
||||
|
||||
}, 0);
|
||||
48
bin/node_modules/shelljs/package.json
generated
vendored
48
bin/node_modules/shelljs/package.json
generated
vendored
File diff suppressed because one or more lines are too long
15
bin/node_modules/shelljs/scripts/docs.js
generated
vendored
15
bin/node_modules/shelljs/scripts/docs.js
generated
vendored
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
require('../global');
|
||||
|
||||
echo('Appending docs to README.md');
|
||||
|
||||
cd(__dirname + '/..');
|
||||
|
||||
// Extract docs from shell.js
|
||||
var docs = grep('//@', 'shell.js');
|
||||
// Remove '//@'
|
||||
docs = docs.replace(/\/\/\@ ?/g, '');
|
||||
// Append docs to README
|
||||
sed('-i', /## Command reference(.|\n)*/, '## Command reference\n\n' + docs, 'README.md');
|
||||
|
||||
echo('All done.');
|
||||
50
bin/node_modules/shelljs/scripts/run-tests.js
generated
vendored
50
bin/node_modules/shelljs/scripts/run-tests.js
generated
vendored
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
require('../global');
|
||||
|
||||
var path = require('path');
|
||||
|
||||
var failed = false;
|
||||
|
||||
//
|
||||
// Lint
|
||||
//
|
||||
JSHINT_BIN = './node_modules/jshint/bin/jshint';
|
||||
cd(__dirname + '/..');
|
||||
|
||||
if (!test('-f', JSHINT_BIN)) {
|
||||
echo('JSHint not found. Run `npm install` in the root dir first.');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (exec(JSHINT_BIN + ' --config jshint.json *.js test/*.js').code !== 0) {
|
||||
failed = true;
|
||||
echo('*** JSHINT FAILED! (return code != 0)');
|
||||
echo();
|
||||
} else {
|
||||
echo('All JSHint tests passed');
|
||||
echo();
|
||||
}
|
||||
|
||||
//
|
||||
// Unit tests
|
||||
//
|
||||
cd(__dirname + '/../test');
|
||||
ls('*.js').forEach(function(file) {
|
||||
echo('Running test:', file);
|
||||
if (exec('node ' + file).code !== 123) { // 123 avoids false positives (e.g. premature exit)
|
||||
failed = true;
|
||||
echo('*** TEST FAILED! (missing exit code "123")');
|
||||
echo();
|
||||
}
|
||||
});
|
||||
|
||||
if (failed) {
|
||||
echo();
|
||||
echo('*******************************************************');
|
||||
echo('WARNING: Some tests did not pass!');
|
||||
echo('*******************************************************');
|
||||
exit(1);
|
||||
} else {
|
||||
echo();
|
||||
echo('All tests passed.');
|
||||
}
|
||||
1901
bin/node_modules/shelljs/shell.js
generated
vendored
1901
bin/node_modules/shelljs/shell.js
generated
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "cordova-android",
|
||||
"description": "Cordova tooling for the android platform.",
|
||||
"version": "0.0.0",
|
||||
"homepage": "http://github.com/apache/cordova-android",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git-wip-us.apache.org/repos/asf/cordova-andorid.git"
|
||||
},
|
||||
"keywords": [
|
||||
"cli",
|
||||
"cordova",
|
||||
"tooling"
|
||||
],
|
||||
"engineStrict": "true",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"shelljs" : "0.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
},
|
||||
"optionalDependencies": {
|
||||
},
|
||||
"author": {
|
||||
"name": "Benn Mapes",
|
||||
"email": "bennmapes@gmail.com"
|
||||
},
|
||||
"contributors": [
|
||||
]
|
||||
}
|
||||
384
bin/templates/cordova/Api.js
vendored
Normal file
384
bin/templates/cordova/Api.js
vendored
Normal file
@@ -0,0 +1,384 @@
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @todo update coho to update this line.
|
||||
* @todo use `package.json` instead but first
|
||||
* figure out how this fit in with the platform-centered workflow structure.
|
||||
* This workflow would not have the `package.json` file.
|
||||
*/
|
||||
// Coho updates this line
|
||||
const VERSION = '9.0.0';
|
||||
|
||||
var path = require('path');
|
||||
|
||||
var AndroidProject = require('./lib/AndroidProject');
|
||||
var PluginManager = require('cordova-common').PluginManager;
|
||||
|
||||
var CordovaLogger = require('cordova-common').CordovaLogger;
|
||||
var selfEvents = require('cordova-common').events;
|
||||
var ConfigParser = require('cordova-common').ConfigParser;
|
||||
const prepare = require('./lib/prepare').prepare;
|
||||
|
||||
var PLATFORM = 'android';
|
||||
|
||||
function setupEvents (externalEventEmitter) {
|
||||
if (externalEventEmitter) {
|
||||
// This will make the platform internal events visible outside
|
||||
selfEvents.forwardEventsTo(externalEventEmitter);
|
||||
return externalEventEmitter;
|
||||
}
|
||||
|
||||
// There is no logger if external emitter is not present,
|
||||
// so attach a console logger
|
||||
CordovaLogger.get().subscribe(selfEvents);
|
||||
return selfEvents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class, that acts as abstraction over particular platform. Encapsulates the
|
||||
* platform's properties and methods.
|
||||
*
|
||||
* Platform that implements own PlatformApi instance _should implement all
|
||||
* prototype methods_ of this class to be fully compatible with cordova-lib.
|
||||
*
|
||||
* The PlatformApi instance also should define the following field:
|
||||
*
|
||||
* * platform: String that defines a platform name.
|
||||
* @class Api
|
||||
*/
|
||||
class Api {
|
||||
constructor (platform, platformRootDir, events) {
|
||||
this.platform = PLATFORM;
|
||||
this.root = path.resolve(__dirname, '..');
|
||||
|
||||
setupEvents(events);
|
||||
|
||||
const appMain = path.join(this.root, 'app', 'src', 'main');
|
||||
const appRes = path.join(appMain, 'res');
|
||||
|
||||
this.locations = {
|
||||
root: this.root,
|
||||
www: path.join(appMain, 'assets', 'www'),
|
||||
res: appRes,
|
||||
platformWww: path.join(this.root, 'platform_www'),
|
||||
configXml: path.join(appRes, 'xml', 'config.xml'),
|
||||
defaultConfigXml: path.join(this.root, 'cordova', 'defaults.xml'),
|
||||
strings: path.join(appRes, 'values', 'strings.xml'),
|
||||
manifest: path.join(appMain, 'AndroidManifest.xml'),
|
||||
build: path.join(this.root, 'build'),
|
||||
javaSrc: path.join(appMain, 'java')
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a CordovaPlatform object, that represents the platform structure.
|
||||
*
|
||||
* @return {CordovaPlatform} A structure that contains the description of
|
||||
* platform's file structure and other properties of platform.
|
||||
*/
|
||||
getPlatformInfo () {
|
||||
var result = {};
|
||||
result.locations = this.locations;
|
||||
result.root = this.root;
|
||||
result.name = this.platform;
|
||||
result.version = Api.version();
|
||||
result.projectConfig = this._config;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates installed platform with provided www assets and new app
|
||||
* configuration. This method is required for CLI workflow and will be called
|
||||
* each time before build, so the changes, made to app configuration and www
|
||||
* code, will be applied to platform.
|
||||
*
|
||||
* @param {CordovaProject} cordovaProject A CordovaProject instance, that defines a
|
||||
* project structure and configuration, that should be applied to platform
|
||||
* (contains project's www location and ConfigParser instance for project's
|
||||
* config).
|
||||
*
|
||||
* @return {Promise} Return a promise either fulfilled, or rejected with
|
||||
* CordovaError instance.
|
||||
*/
|
||||
prepare (cordovaProject, prepareOptions) {
|
||||
cordovaProject.projectConfig = new ConfigParser(cordovaProject.locations.rootConfigXml || cordovaProject.projectConfig.path);
|
||||
|
||||
return prepare.call(this, cordovaProject, prepareOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs a new plugin into platform. This method only copies non-www files
|
||||
* (sources, libs, etc.) to platform. It also doesn't resolves the
|
||||
* dependencies of plugin. Both of handling of www files, such as assets and
|
||||
* js-files and resolving dependencies are the responsibility of caller.
|
||||
*
|
||||
* @param {PluginInfo} plugin A PluginInfo instance that represents plugin
|
||||
* that will be installed.
|
||||
* @param {Object} installOptions An options object. Possible options below:
|
||||
* @param {Boolean} installOptions.link: Flag that specifies that plugin
|
||||
* sources will be symlinked to app's directory instead of copying (if
|
||||
* possible).
|
||||
* @param {Object} installOptions.variables An object that represents
|
||||
* variables that will be used to install plugin. See more details on plugin
|
||||
* variables in documentation:
|
||||
* https://cordova.apache.org/docs/en/4.0.0/plugin_ref_spec.md.html
|
||||
*
|
||||
* @return {Promise} Return a promise either fulfilled, or rejected with
|
||||
* CordovaError instance.
|
||||
*/
|
||||
addPlugin (plugin, installOptions) {
|
||||
var project = AndroidProject.getProjectFile(this.root);
|
||||
var self = this;
|
||||
|
||||
installOptions = installOptions || {};
|
||||
installOptions.variables = installOptions.variables || {};
|
||||
// Add PACKAGE_NAME variable into vars
|
||||
if (!installOptions.variables.PACKAGE_NAME) {
|
||||
installOptions.variables.PACKAGE_NAME = project.getPackageName();
|
||||
}
|
||||
|
||||
return Promise.resolve().then(function () {
|
||||
return PluginManager.get(self.platform, self.locations, project).addPlugin(plugin, installOptions);
|
||||
}).then(function () {
|
||||
if (plugin.getFrameworks(this.platform).length === 0) return;
|
||||
selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>');
|
||||
// This should pick the correct builder, not just get gradle
|
||||
require('./lib/builders/builders').getBuilder().prepBuildFiles();
|
||||
}.bind(this))
|
||||
// CB-11022 Return truthy value to prevent running prepare after
|
||||
.then(() => true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an installed plugin from platform.
|
||||
*
|
||||
* Since method accepts PluginInfo instance as input parameter instead of plugin
|
||||
* id, caller shoud take care of managing/storing PluginInfo instances for
|
||||
* future uninstalls.
|
||||
*
|
||||
* @param {PluginInfo} plugin A PluginInfo instance that represents plugin
|
||||
* that will be installed.
|
||||
*
|
||||
* @return {Promise} Return a promise either fulfilled, or rejected with
|
||||
* CordovaError instance.
|
||||
*/
|
||||
removePlugin (plugin, uninstallOptions) {
|
||||
var project = AndroidProject.getProjectFile(this.root);
|
||||
|
||||
if (uninstallOptions && uninstallOptions.usePlatformWww === true) {
|
||||
uninstallOptions.usePlatformWww = false;
|
||||
}
|
||||
|
||||
return PluginManager.get(this.platform, this.locations, project)
|
||||
.removePlugin(plugin, uninstallOptions)
|
||||
.then(function () {
|
||||
if (plugin.getFrameworks(this.platform).length === 0) return;
|
||||
|
||||
selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>');
|
||||
require('./lib/builders/builders').getBuilder().prepBuildFiles();
|
||||
}.bind(this))
|
||||
// CB-11022 Return truthy value to prevent running prepare after
|
||||
.then(() => true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an application package for current platform.
|
||||
*
|
||||
* @param {Object} buildOptions A build options. This object's structure is
|
||||
* highly depends on platform's specific. The most common options are:
|
||||
* @param {Boolean} buildOptions.debug Indicates that packages should be
|
||||
* built with debug configuration. This is set to true by default unless the
|
||||
* 'release' option is not specified.
|
||||
* @param {Boolean} buildOptions.release Indicates that packages should be
|
||||
* built with release configuration. If not set to true, debug configuration
|
||||
* will be used.
|
||||
* @param {Boolean} buildOptions.device Specifies that built app is intended
|
||||
* to run on device
|
||||
* @param {Boolean} buildOptions.emulator: Specifies that built app is
|
||||
* intended to run on emulator
|
||||
* @param {String} buildOptions.target Specifies the device id that will be
|
||||
* used to run built application.
|
||||
* @param {Boolean} buildOptions.nobuild Indicates that this should be a
|
||||
* dry-run call, so no build artifacts will be produced.
|
||||
* @param {String[]} buildOptions.archs Specifies chip architectures which
|
||||
* app packages should be built for. List of valid architectures is depends on
|
||||
* platform.
|
||||
* @param {String} buildOptions.buildConfig The path to build configuration
|
||||
* file. The format of this file is depends on platform.
|
||||
* @param {String[]} buildOptions.argv Raw array of command-line arguments,
|
||||
* passed to `build` command. The purpose of this property is to pass a
|
||||
* platform-specific arguments, and eventually let platform define own
|
||||
* arguments processing logic.
|
||||
*
|
||||
* @return {Promise<Object[]>} A promise either fulfilled with an array of build
|
||||
* artifacts (application packages) if package was built successfully,
|
||||
* or rejected with CordovaError. The resultant build artifact objects is not
|
||||
* strictly typed and may conatin arbitrary set of fields as in sample below.
|
||||
*
|
||||
* {
|
||||
* architecture: 'x86',
|
||||
* buildType: 'debug',
|
||||
* path: '/path/to/build',
|
||||
* type: 'app'
|
||||
* }
|
||||
*
|
||||
* The return value in most cases will contain only one item but in some cases
|
||||
* there could be multiple items in output array, e.g. when multiple
|
||||
* arhcitectures is specified.
|
||||
*/
|
||||
build (buildOptions) {
|
||||
var self = this;
|
||||
|
||||
return require('./lib/check_reqs').run().then(function () {
|
||||
return require('./lib/build').run.call(self, buildOptions);
|
||||
}).then(function (buildResults) {
|
||||
// Cast build result to array of build artifacts
|
||||
return buildResults.paths.map(function (apkPath) {
|
||||
return {
|
||||
buildType: buildResults.buildType,
|
||||
buildMethod: buildResults.buildMethod,
|
||||
path: apkPath,
|
||||
type: path.extname(apkPath).replace(/\./g, '')
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an application package for current platform and runs it on
|
||||
* specified/default device. If no 'device'/'emulator'/'target' options are
|
||||
* specified, then tries to run app on default device if connected, otherwise
|
||||
* runs the app on emulator.
|
||||
*
|
||||
* @param {Object} runOptions An options object. The structure is the same
|
||||
* as for build options.
|
||||
*
|
||||
* @return {Promise} A promise either fulfilled if package was built and ran
|
||||
* successfully, or rejected with CordovaError.
|
||||
*/
|
||||
run (runOptions) {
|
||||
var self = this;
|
||||
return require('./lib/check_reqs').run().then(function () {
|
||||
return require('./lib/run').run.call(self, runOptions);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans out the build artifacts from platform's directory, and also
|
||||
* cleans out the platform www directory if called without options specified.
|
||||
*
|
||||
* @return {Promise} Return a promise either fulfilled, or rejected with
|
||||
* CordovaError.
|
||||
*/
|
||||
clean (cleanOptions) {
|
||||
var self = this;
|
||||
// This will lint, checking for null won't
|
||||
if (typeof cleanOptions === 'undefined') {
|
||||
cleanOptions = {};
|
||||
}
|
||||
|
||||
return require('./lib/check_reqs').run().then(function () {
|
||||
return require('./lib/build').runClean.call(self, cleanOptions);
|
||||
}).then(function () {
|
||||
return require('./lib/prepare').clean.call(self, cleanOptions);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a requirements check for current platform. Each platform defines its
|
||||
* own set of requirements, which should be resolved before platform can be
|
||||
* built successfully.
|
||||
*
|
||||
* @return {Promise<Requirement[]>} Promise, resolved with set of Requirement
|
||||
* objects for current platform.
|
||||
*/
|
||||
requirements () {
|
||||
return require('./lib/check_reqs').check_all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs platform to specified directory and creates a platform project.
|
||||
*
|
||||
* @param {String} destination Destination directory, where insatll platform to
|
||||
* @param {ConfigParser} [config] ConfgiParser instance, used to retrieve
|
||||
* project creation options, such as package id and project name.
|
||||
* @param {Object} [options] An options object. The most common options are:
|
||||
* @param {String} [options.customTemplate] A path to custom template, that
|
||||
* should override the default one from platform.
|
||||
* @param {Boolean} [options.link] Flag that indicates that platform's
|
||||
* sources will be linked to installed platform instead of copying.
|
||||
* @param {EventEmitter} [events] An EventEmitter instance that will be used for
|
||||
* logging purposes. If no EventEmitter provided, all events will be logged to
|
||||
* console
|
||||
*
|
||||
* @return {Promise<PlatformApi>} Promise either fulfilled with PlatformApi
|
||||
* instance or rejected with CordovaError.
|
||||
*/
|
||||
static createPlatform (destination, config, options, events) {
|
||||
events = setupEvents(events);
|
||||
var result;
|
||||
try {
|
||||
result = require('../../lib/create').create(destination, config, options, events).then(function (destination) {
|
||||
return new Api(PLATFORM, destination, events);
|
||||
});
|
||||
} catch (e) {
|
||||
events.emit('error', 'createPlatform is not callable from the android project API.');
|
||||
throw (e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates already installed platform.
|
||||
*
|
||||
* @param {String} destination Destination directory, where platform installed
|
||||
* @param {Object} [options] An options object. The most common options are:
|
||||
* @param {String} [options.customTemplate] A path to custom template, that
|
||||
* should override the default one from platform.
|
||||
* @param {Boolean} [options.link] Flag that indicates that platform's
|
||||
* sources will be linked to installed platform instead of copying.
|
||||
* @param {EventEmitter} [events] An EventEmitter instance that will be used for
|
||||
* logging purposes. If no EventEmitter provided, all events will be logged to
|
||||
* console
|
||||
*
|
||||
* @return {Promise<PlatformApi>} Promise either fulfilled with PlatformApi
|
||||
* instance or rejected with CordovaError.
|
||||
*/
|
||||
static updatePlatform (destination, options, events) {
|
||||
events = setupEvents(events);
|
||||
var result;
|
||||
try {
|
||||
result = require('../../lib/create').update(destination, options, events).then(function (destination) {
|
||||
return new Api(PLATFORM, destination, events);
|
||||
});
|
||||
} catch (e) {
|
||||
events.emit('error', 'updatePlatform is not callable from the android project API, you will need to do this manually.');
|
||||
throw (e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static version () {
|
||||
return VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Api;
|
||||
@@ -19,17 +19,33 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var build = require('./lib/build'),
|
||||
reqs = require('./lib/check_reqs'),
|
||||
args = process.argv;
|
||||
var args = process.argv;
|
||||
var Api = require('./Api');
|
||||
var nopt = require('nopt');
|
||||
var path = require('path');
|
||||
|
||||
// Support basic help commands
|
||||
if(args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
|
||||
args[2] == 'help' || args[2] == '-help' || args[2] == '/help') {
|
||||
build.help();
|
||||
} else if(reqs.run()) {
|
||||
build.run(args[2]);
|
||||
process.exit(0);
|
||||
} else {
|
||||
process.exit(2);
|
||||
}
|
||||
if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) >= 0) {
|
||||
require('./lib/build').help();
|
||||
}
|
||||
|
||||
// Do some basic argument parsing
|
||||
var buildOpts = nopt({
|
||||
verbose: Boolean,
|
||||
silent: Boolean,
|
||||
debug: Boolean,
|
||||
release: Boolean,
|
||||
nobuild: Boolean,
|
||||
buildConfig: path
|
||||
}, { d: '--verbose' });
|
||||
|
||||
// Make buildOptions compatible with PlatformApi build method spec
|
||||
buildOpts.argv = buildOpts.argv.original;
|
||||
|
||||
require('./loggingHelper').adjustLoggerLevel(buildOpts);
|
||||
|
||||
new Api().build(buildOpts)
|
||||
.catch(function (err) {
|
||||
console.error(err.stack);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0build"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2
|
||||
|
||||
@@ -19,16 +19,33 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var clean = require('./lib/clean'),
|
||||
reqs = require('./lib/check_reqs'),
|
||||
args = process.argv;
|
||||
var Api = require('./Api');
|
||||
var path = require('path');
|
||||
var nopt = require('nopt');
|
||||
|
||||
// Usage support for when args are given
|
||||
if(args.length > 2) {
|
||||
clean.help();
|
||||
} else if(reqs.run()) {
|
||||
clean.run();
|
||||
// Support basic help commands
|
||||
if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), process.argv[1]));
|
||||
console.log('Cleans the project directory.');
|
||||
process.exit(0);
|
||||
} else {
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
// Do some basic argument parsing
|
||||
var opts = nopt({
|
||||
verbose: Boolean,
|
||||
silent: Boolean
|
||||
}, { d: '--verbose' });
|
||||
|
||||
// Make buildOptions compatible with PlatformApi clean method spec
|
||||
opts.argv = opts.argv.original;
|
||||
|
||||
// Skip cleaning prepared files when not invoking via cordova CLI.
|
||||
opts.noPrepare = true;
|
||||
|
||||
require('./loggingHelper').adjustLoggerLevel(opts);
|
||||
|
||||
new Api().clean(opts)
|
||||
.catch(function (err) {
|
||||
console.error(err.stack);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0clean"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2
|
||||
|
||||
@@ -20,33 +20,7 @@
|
||||
<widget xmlns = "http://www.w3.org/ns/widgets"
|
||||
id = "io.cordova.helloCordova"
|
||||
version = "2.0.0">
|
||||
<name>Hello Cordova</name>
|
||||
|
||||
<description>
|
||||
A sample Apache Cordova application that responds to the deviceready event.
|
||||
</description>
|
||||
|
||||
<author href="http://cordova.io" email="callback-dev@incubator.apache.org">
|
||||
Apache Cordova Team
|
||||
</author>
|
||||
|
||||
<access origin="*.apache.org"/>
|
||||
|
||||
<!-- <content src="http://mysite.com/myapp.html" /> for external pages -->
|
||||
<content src="index.html" />
|
||||
|
||||
<log level="DEBUG"/>
|
||||
|
||||
<!-- Preferences for Android -->
|
||||
<preference name="useBrowserHistory" value="true" />
|
||||
<preference name="exit-on-suspend" value="false" />
|
||||
|
||||
<feature name="Activity">
|
||||
<param name="android-package" value="org.apache.cordova.test.ActivityPlugin" />
|
||||
</feature>
|
||||
<feature name="App">
|
||||
<param name="android-package" value="org.apache.cordova.App"/>
|
||||
</feature>
|
||||
|
||||
<preference name="loglevel" value="DEBUG" />
|
||||
</widget>
|
||||
|
||||
99
bin/templates/cordova/lib/Adb.js
vendored
Normal file
99
bin/templates/cordova/lib/Adb.js
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var os = require('os');
|
||||
var execa = require('execa');
|
||||
var events = require('cordova-common').events;
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
|
||||
var Adb = {};
|
||||
|
||||
function isDevice (line) {
|
||||
return line.match(/\w+\tdevice/) && !line.match(/emulator/);
|
||||
}
|
||||
|
||||
function isEmulator (line) {
|
||||
return line.match(/device/) && line.match(/emulator/);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists available/connected devices and emulators
|
||||
*
|
||||
* @param {Object} opts Various options
|
||||
* @param {Boolean} opts.emulators Specifies whether this method returns
|
||||
* emulators only
|
||||
*
|
||||
* @return {Promise<String[]>} list of available/connected
|
||||
* devices/emulators
|
||||
*/
|
||||
Adb.devices = function (opts) {
|
||||
return execa('adb', ['devices'], { cwd: os.tmpdir() }).then(({ stdout: output }) => {
|
||||
return output.split('\n').filter(function (line) {
|
||||
// Filter out either real devices or emulators, depending on options
|
||||
return (line && opts && opts.emulators) ? isEmulator(line) : isDevice(line);
|
||||
}).map(function (line) {
|
||||
return line.replace(/\tdevice/, '').replace('\r', '');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Adb.install = function (target, packagePath, opts) {
|
||||
events.emit('verbose', 'Installing apk ' + packagePath + ' on target ' + target + '...');
|
||||
var args = ['-s', target, 'install'];
|
||||
if (opts && opts.replace) args.push('-r');
|
||||
return execa('adb', args.concat(packagePath), { cwd: os.tmpdir() }).then(({ stdout: output }) => {
|
||||
// 'adb install' seems to always returns no error, even if installation fails
|
||||
// so we catching output to detect installation failure
|
||||
if (output.match(/Failure/)) {
|
||||
if (output.match(/INSTALL_PARSE_FAILED_NO_CERTIFICATES/)) {
|
||||
output += '\n\n' + 'Sign the build using \'-- --keystore\' or \'--buildConfig\'' +
|
||||
' or sign and deploy the unsigned apk manually using Android tools.';
|
||||
} else if (output.match(/INSTALL_FAILED_VERSION_DOWNGRADE/)) {
|
||||
output += '\n\n' + 'You\'re trying to install apk with a lower versionCode that is already installed.' +
|
||||
'\nEither uninstall an app or increment the versionCode.';
|
||||
}
|
||||
|
||||
return Promise.reject(new CordovaError('Failed to install apk to device: ' + output));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Adb.uninstall = function (target, packageId) {
|
||||
events.emit('verbose', 'Uninstalling package ' + packageId + ' from target ' + target + '...');
|
||||
return execa('adb', ['-s', target, 'uninstall', packageId], { cwd: os.tmpdir() }).then(({ stdout }) => stdout);
|
||||
};
|
||||
|
||||
Adb.shell = function (target, shellCommand) {
|
||||
events.emit('verbose', 'Running adb shell command "' + shellCommand + '" on target ' + target + '...');
|
||||
var args = ['-s', target, 'shell'];
|
||||
shellCommand = shellCommand.split(/\s+/);
|
||||
return execa('adb', args.concat(shellCommand), { cwd: os.tmpdir() })
|
||||
.then(({ stdout }) => stdout)
|
||||
.catch(error => Promise.reject(new CordovaError(`Failed to execute shell command "${shellCommand}" on device: ${error}`)));
|
||||
};
|
||||
|
||||
Adb.start = function (target, activityName) {
|
||||
events.emit('verbose', 'Starting application "' + activityName + '" on target ' + target + '...');
|
||||
return Adb.shell(target, 'am start -W -a android.intent.action.MAIN -n' + activityName).catch((error) => {
|
||||
return Promise.reject(new CordovaError('Failed to start application "' +
|
||||
activityName + '"" on device: ' + error));
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = Adb;
|
||||
128
bin/templates/cordova/lib/AndroidManifest.js
vendored
Normal file
128
bin/templates/cordova/lib/AndroidManifest.js
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var fs = require('fs');
|
||||
var xml = require('cordova-common').xmlHelpers;
|
||||
|
||||
var DEFAULT_ORIENTATION = 'default';
|
||||
|
||||
/** Wraps an AndroidManifest file */
|
||||
class AndroidManifest {
|
||||
constructor (path) {
|
||||
this.path = path;
|
||||
this.doc = xml.parseElementtreeSync(path);
|
||||
if (this.doc.getroot().tag !== 'manifest') {
|
||||
throw new Error('AndroidManifest at ' + path + ' has incorrect root node name (expected "manifest")');
|
||||
}
|
||||
}
|
||||
|
||||
getVersionName () {
|
||||
return this.doc.getroot().attrib['android:versionName'];
|
||||
}
|
||||
|
||||
setVersionName (versionName) {
|
||||
this.doc.getroot().attrib['android:versionName'] = versionName;
|
||||
return this;
|
||||
}
|
||||
|
||||
getVersionCode () {
|
||||
return this.doc.getroot().attrib['android:versionCode'];
|
||||
}
|
||||
|
||||
setVersionCode (versionCode) {
|
||||
this.doc.getroot().attrib['android:versionCode'] = versionCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
getPackageId () {
|
||||
return this.doc.getroot().attrib.package;
|
||||
}
|
||||
|
||||
setPackageId (pkgId) {
|
||||
this.doc.getroot().attrib.package = pkgId;
|
||||
return this;
|
||||
}
|
||||
|
||||
getActivity () {
|
||||
var activity = this.doc.getroot().find('./application/activity');
|
||||
return {
|
||||
getName: function () {
|
||||
return activity.attrib['android:name'];
|
||||
},
|
||||
setName: function (name) {
|
||||
if (!name) {
|
||||
delete activity.attrib['android:name'];
|
||||
} else {
|
||||
activity.attrib['android:name'] = name;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
getOrientation: function () {
|
||||
return activity.attrib['android:screenOrientation'];
|
||||
},
|
||||
setOrientation: function (orientation) {
|
||||
if (!orientation || orientation.toLowerCase() === DEFAULT_ORIENTATION) {
|
||||
delete activity.attrib['android:screenOrientation'];
|
||||
} else {
|
||||
activity.attrib['android:screenOrientation'] = orientation;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
getLaunchMode: function () {
|
||||
return activity.attrib['android:launchMode'];
|
||||
},
|
||||
setLaunchMode: function (launchMode) {
|
||||
if (!launchMode) {
|
||||
delete activity.attrib['android:launchMode'];
|
||||
} else {
|
||||
activity.attrib['android:launchMode'] = launchMode;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
getDebuggable () {
|
||||
return this.doc.getroot().find('./application').attrib['android:debuggable'] === 'true';
|
||||
}
|
||||
|
||||
setDebuggable (value) {
|
||||
var application = this.doc.getroot().find('./application');
|
||||
if (value) {
|
||||
application.attrib['android:debuggable'] = 'true';
|
||||
} else {
|
||||
// The default value is "false", so we can remove attribute at all.
|
||||
delete application.attrib['android:debuggable'];
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes manifest to disk syncronously. If filename is specified, then manifest
|
||||
* will be written to that file
|
||||
*
|
||||
* @param {String} [destPath] File to write manifest to. If omitted,
|
||||
* manifest will be written to file it has been read from.
|
||||
*/
|
||||
write (destPath) {
|
||||
fs.writeFileSync(destPath || this.path, this.doc.write({ indent: 4 }), 'utf-8');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AndroidManifest;
|
||||
202
bin/templates/cordova/lib/AndroidProject.js
vendored
Normal file
202
bin/templates/cordova/lib/AndroidProject.js
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var properties_parser = require('properties-parser');
|
||||
var AndroidManifest = require('./AndroidManifest');
|
||||
var pluginHandlers = require('./pluginHandlers');
|
||||
|
||||
var projectFileCache = {};
|
||||
|
||||
function addToPropertyList (projectProperties, key, value) {
|
||||
var i = 1;
|
||||
while (projectProperties.get(key + '.' + i)) { i++; }
|
||||
|
||||
projectProperties.set(key + '.' + i, value);
|
||||
projectProperties.dirty = true;
|
||||
}
|
||||
|
||||
function removeFromPropertyList (projectProperties, key, value) {
|
||||
var i = 1;
|
||||
var currentValue;
|
||||
while ((currentValue = projectProperties.get(key + '.' + i))) {
|
||||
if (currentValue === value) {
|
||||
while ((currentValue = projectProperties.get(key + '.' + (i + 1)))) {
|
||||
projectProperties.set(key + '.' + i, currentValue);
|
||||
i++;
|
||||
}
|
||||
projectProperties.set(key + '.' + i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
projectProperties.dirty = true;
|
||||
}
|
||||
|
||||
function getRelativeLibraryPath (parentDir, subDir) {
|
||||
var libraryPath = path.relative(parentDir, subDir);
|
||||
return (path.sep === '\\') ? libraryPath.replace(/\\/g, '/') : libraryPath;
|
||||
}
|
||||
|
||||
class AndroidProject {
|
||||
constructor (projectDir) {
|
||||
this._propertiesEditors = {};
|
||||
this._subProjectDirs = {};
|
||||
this._dirty = false;
|
||||
this.projectDir = projectDir;
|
||||
this.platformWww = path.join(this.projectDir, 'platform_www');
|
||||
this.www = path.join(this.projectDir, 'app/src/main/assets/www');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the package name out of the Android Manifest file
|
||||
*
|
||||
* @param {String} projectDir The absolute path to the directory containing the project
|
||||
* @return {String} The name of the package
|
||||
*/
|
||||
getPackageName () {
|
||||
var manifestPath = path.join(this.projectDir, 'app/src/main/AndroidManifest.xml');
|
||||
return new AndroidManifest(manifestPath).getPackageId();
|
||||
}
|
||||
|
||||
getCustomSubprojectRelativeDir (plugin_id, src) {
|
||||
// All custom subprojects are prefixed with the last portion of the package id.
|
||||
// This is to avoid collisions when opening multiple projects in Eclipse that have subprojects with the same name.
|
||||
var packageName = this.getPackageName();
|
||||
var lastDotIndex = packageName.lastIndexOf('.');
|
||||
var prefix = packageName.substring(lastDotIndex + 1);
|
||||
var subRelativeDir = path.join(plugin_id, prefix + '-' + path.basename(src));
|
||||
return subRelativeDir;
|
||||
}
|
||||
|
||||
addSubProject (parentDir, subDir) {
|
||||
var parentProjectFile = path.resolve(parentDir, 'project.properties');
|
||||
var subProjectFile = path.resolve(subDir, 'project.properties');
|
||||
var parentProperties = this._getPropertiesFile(parentProjectFile);
|
||||
// TODO: Setting the target needs to happen only for pre-3.7.0 projects
|
||||
if (fs.existsSync(subProjectFile)) {
|
||||
var subProperties = this._getPropertiesFile(subProjectFile);
|
||||
subProperties.set('target', parentProperties.get('target'));
|
||||
subProperties.dirty = true;
|
||||
this._subProjectDirs[subDir] = true;
|
||||
}
|
||||
addToPropertyList(parentProperties, 'android.library.reference', getRelativeLibraryPath(parentDir, subDir));
|
||||
|
||||
this._dirty = true;
|
||||
}
|
||||
|
||||
removeSubProject (parentDir, subDir) {
|
||||
var parentProjectFile = path.resolve(parentDir, 'project.properties');
|
||||
var parentProperties = this._getPropertiesFile(parentProjectFile);
|
||||
removeFromPropertyList(parentProperties, 'android.library.reference', getRelativeLibraryPath(parentDir, subDir));
|
||||
delete this._subProjectDirs[subDir];
|
||||
this._dirty = true;
|
||||
}
|
||||
|
||||
addGradleReference (parentDir, subDir) {
|
||||
var parentProjectFile = path.resolve(parentDir, 'project.properties');
|
||||
var parentProperties = this._getPropertiesFile(parentProjectFile);
|
||||
addToPropertyList(parentProperties, 'cordova.gradle.include', getRelativeLibraryPath(parentDir, subDir));
|
||||
this._dirty = true;
|
||||
}
|
||||
|
||||
removeGradleReference (parentDir, subDir) {
|
||||
var parentProjectFile = path.resolve(parentDir, 'project.properties');
|
||||
var parentProperties = this._getPropertiesFile(parentProjectFile);
|
||||
removeFromPropertyList(parentProperties, 'cordova.gradle.include', getRelativeLibraryPath(parentDir, subDir));
|
||||
this._dirty = true;
|
||||
}
|
||||
|
||||
addSystemLibrary (parentDir, value) {
|
||||
var parentProjectFile = path.resolve(parentDir, 'project.properties');
|
||||
var parentProperties = this._getPropertiesFile(parentProjectFile);
|
||||
addToPropertyList(parentProperties, 'cordova.system.library', value);
|
||||
this._dirty = true;
|
||||
}
|
||||
|
||||
removeSystemLibrary (parentDir, value) {
|
||||
var parentProjectFile = path.resolve(parentDir, 'project.properties');
|
||||
var parentProperties = this._getPropertiesFile(parentProjectFile);
|
||||
removeFromPropertyList(parentProperties, 'cordova.system.library', value);
|
||||
this._dirty = true;
|
||||
}
|
||||
|
||||
write () {
|
||||
if (!this._dirty) {
|
||||
return;
|
||||
}
|
||||
this._dirty = false;
|
||||
|
||||
for (var filename in this._propertiesEditors) {
|
||||
var editor = this._propertiesEditors[filename];
|
||||
if (editor.dirty) {
|
||||
fs.writeFileSync(filename, editor.toString());
|
||||
editor.dirty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getInstaller (type) {
|
||||
return pluginHandlers.getInstaller(type);
|
||||
}
|
||||
|
||||
getUninstaller (type) {
|
||||
return pluginHandlers.getUninstaller(type);
|
||||
}
|
||||
|
||||
/*
|
||||
* This checks if an Android project is clean or has old build artifacts
|
||||
*/
|
||||
isClean () {
|
||||
var build_path = path.join(this.projectDir, 'build');
|
||||
// If the build directory doesn't exist, it's clean
|
||||
return !(fs.existsSync(build_path));
|
||||
}
|
||||
|
||||
_getPropertiesFile (filename) {
|
||||
if (!this._propertiesEditors[filename]) {
|
||||
if (fs.existsSync(filename)) {
|
||||
this._propertiesEditors[filename] = properties_parser.createEditor(filename);
|
||||
} else {
|
||||
this._propertiesEditors[filename] = properties_parser.createEditor();
|
||||
}
|
||||
}
|
||||
|
||||
return this._propertiesEditors[filename];
|
||||
}
|
||||
|
||||
static getProjectFile (projectDir) {
|
||||
if (!projectFileCache[projectDir]) {
|
||||
projectFileCache[projectDir] = new AndroidProject(projectDir);
|
||||
}
|
||||
|
||||
return projectFileCache[projectDir];
|
||||
}
|
||||
|
||||
static purgeCache (projectDir) {
|
||||
if (projectDir) {
|
||||
delete projectFileCache[projectDir];
|
||||
} else {
|
||||
projectFileCache = {};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AndroidProject;
|
||||
25
bin/templates/cordova/lib/PackageType.js
vendored
Normal file
25
bin/templates/cordova/lib/PackageType.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
const PackageType = {
|
||||
APK: 'apk',
|
||||
BUNDLE: 'bundle'
|
||||
};
|
||||
|
||||
module.exports = PackageType;
|
||||
101
bin/templates/cordova/lib/android_sdk.js
vendored
Executable file
101
bin/templates/cordova/lib/android_sdk.js
vendored
Executable file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
const execa = require('execa');
|
||||
|
||||
var suffix_number_regex = /(\d+)$/;
|
||||
// Used for sorting Android targets, example strings to sort:
|
||||
// android-19
|
||||
// android-L
|
||||
// Google Inc.:Google APIs:20
|
||||
// Google Inc.:Glass Development Kit Preview:20
|
||||
// The idea is to sort based on largest "suffix" number - meaning the bigger
|
||||
// the number at the end, the more recent the target, the closer to the
|
||||
// start of the array.
|
||||
function sort_by_largest_numerical_suffix (a, b) {
|
||||
let suffix_a = a.match(suffix_number_regex);
|
||||
let suffix_b = b.match(suffix_number_regex);
|
||||
// If no number is detected (eg: preview version like android-R),
|
||||
// designate a suffix of 0 so it gets moved to the end
|
||||
suffix_a = suffix_a || ['0', '0'];
|
||||
suffix_b = suffix_b || ['0', '0'];
|
||||
// Return < zero, or > zero, based on which suffix is larger.
|
||||
return (parseInt(suffix_a[1]) > parseInt(suffix_b[1]) ? -1 : 1);
|
||||
}
|
||||
|
||||
module.exports.print_newest_available_sdk_target = function () {
|
||||
return module.exports.list_targets().then(function (targets) {
|
||||
targets.sort(sort_by_largest_numerical_suffix);
|
||||
console.log(targets[0]);
|
||||
});
|
||||
};
|
||||
|
||||
// Versions should not be represented as float, so we disable quote-props here
|
||||
/* eslint-disable quote-props */
|
||||
module.exports.version_string_to_api_level = {
|
||||
'4.0': 14,
|
||||
'4.0.3': 15,
|
||||
'4.1': 16,
|
||||
'4.2': 17,
|
||||
'4.3': 18,
|
||||
'4.4': 19,
|
||||
'4.4W': 20,
|
||||
'5.0': 21,
|
||||
'5.1': 22,
|
||||
'6.0': 23,
|
||||
'7.0': 24,
|
||||
'7.1.1': 25,
|
||||
'8.0': 26
|
||||
};
|
||||
/* eslint-enable quote-props */
|
||||
|
||||
function parse_targets (output) {
|
||||
var target_out = output.split('\n');
|
||||
var targets = [];
|
||||
for (var i = target_out.length - 1; i >= 0; i--) {
|
||||
if (target_out[i].match(/id:/)) { // if "id:" is in the line...
|
||||
targets.push(target_out[i].match(/"(.+)"/)[1]); // .. match whatever is in quotes.
|
||||
}
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
|
||||
module.exports.list_targets_with_android = function () {
|
||||
return execa('android', ['list', 'target']).then(result => parse_targets(result.stdout));
|
||||
};
|
||||
|
||||
module.exports.list_targets_with_avdmanager = function () {
|
||||
return execa('avdmanager', ['list', 'target']).then(result => parse_targets(result.stdout));
|
||||
};
|
||||
|
||||
module.exports.list_targets = function () {
|
||||
return module.exports.list_targets_with_avdmanager().catch(function (err) {
|
||||
// If there's an error, like avdmanager could not be found, we can try
|
||||
// as a last resort, to run `android`, in case this is a super old
|
||||
// SDK installation.
|
||||
if (err && (err.code === 'ENOENT' || (err.stderr && err.stderr.match(/not recognized/)))) {
|
||||
return module.exports.list_targets_with_android();
|
||||
} else throw err;
|
||||
}).then(function (targets) {
|
||||
if (targets.length === 0) {
|
||||
return Promise.reject(new Error('No android targets (SDKs) installed!'));
|
||||
}
|
||||
return targets;
|
||||
});
|
||||
};
|
||||
41
bin/templates/cordova/lib/appinfo.js
vendored
41
bin/templates/cordova/lib/appinfo.js
vendored
@@ -1,41 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var cachedAppInfo = null;
|
||||
|
||||
function readAppInfoFromManifest() {
|
||||
var manifestPath = path.join(__dirname, '..', '..', 'AndroidManifest.xml');
|
||||
var manifestData = fs.readFileSync(manifestPath, {encoding:'utf8'});
|
||||
var packageName = /\bpackage\s*=\s*"(.+?)"/.exec(manifestData);
|
||||
if (!packageName) throw new Error('Could not find package name within ' + manifestPath);
|
||||
var activityTag = /<activity\b[\s\S]*<\/activity>/.exec(manifestData);
|
||||
if (!activityTag) throw new Error('Could not find <activity> within ' + manifestPath);
|
||||
var activityName = /\bandroid:name\s*=\s*"(.+?)"/.exec(activityTag);
|
||||
if (!activityName) throw new Error('Could not find android:name within ' + manifestPath);
|
||||
|
||||
return packageName[1] + '/.' + activityName[1];
|
||||
}
|
||||
|
||||
exports.getActivityName = function() {
|
||||
return cachedAppInfo = cachedAppInfo || readAppInfoFromManifest();
|
||||
};
|
||||
335
bin/templates/cordova/lib/build.js
vendored
335
bin/templates/cordova/lib/build.js
vendored
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
@@ -19,71 +17,290 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var shell = require('shelljs'),
|
||||
clean = require('./clean'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var nopt = require('nopt');
|
||||
|
||||
/*
|
||||
* Builds the project with ant.
|
||||
*/
|
||||
module.exports.run = function(build_type) {
|
||||
//default build type
|
||||
build_type = typeof build_type !== 'undefined' ? build_type : "--debug";
|
||||
var cmd;
|
||||
switch(build_type) {
|
||||
case '--debug' :
|
||||
clean.run();
|
||||
cmd = 'ant debug -f ' + path.join(ROOT, 'build.xml');
|
||||
break;
|
||||
case '--release' :
|
||||
clean.run();
|
||||
cmd = 'ant release -f ' + path.join(ROOT, 'build.xml');
|
||||
break;
|
||||
case '--nobuild' :
|
||||
console.log('Skipping build...');
|
||||
break;
|
||||
default :
|
||||
console.error('Build option \'' + build_type + '\' not recognized.');
|
||||
process.exit(2);
|
||||
break;
|
||||
var Adb = require('./Adb');
|
||||
|
||||
var builders = require('./builders/builders');
|
||||
var events = require('cordova-common').events;
|
||||
const execa = require('execa');
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
var PackageType = require('./PackageType');
|
||||
|
||||
module.exports.parseBuildOptions = parseOpts;
|
||||
function parseOpts (options, resolvedTarget, projectRoot) {
|
||||
options = options || {};
|
||||
options.argv = nopt({
|
||||
prepenv: Boolean,
|
||||
versionCode: String,
|
||||
minSdkVersion: String,
|
||||
maxSdkVersion: String,
|
||||
targetSdkVersion: String,
|
||||
gradleArg: [String, Array],
|
||||
keystore: path,
|
||||
alias: String,
|
||||
storePassword: String,
|
||||
password: String,
|
||||
keystoreType: String,
|
||||
packageType: String
|
||||
}, {}, options.argv, 0);
|
||||
|
||||
// Android Studio Build method is the default
|
||||
var ret = {
|
||||
buildType: options.release ? 'release' : 'debug',
|
||||
prepEnv: options.argv.prepenv,
|
||||
arch: resolvedTarget && resolvedTarget.arch,
|
||||
extraArgs: []
|
||||
};
|
||||
|
||||
if (options.argv.versionCode) { ret.extraArgs.push('-PcdvVersionCode=' + options.argv.versionCode); }
|
||||
if (options.argv.minSdkVersion) { ret.extraArgs.push('-PcdvMinSdkVersion=' + options.argv.minSdkVersion); }
|
||||
if (options.argv.maxSdkVersion) { ret.extraArgs.push('-PcdvMaxSdkVersion=' + options.argv.maxSdkVersion); }
|
||||
if (options.argv.targetSdkVersion) { ret.extraArgs.push('-PcdvTargetSdkVersion=' + options.argv.targetSdkVersion); }
|
||||
if (options.argv.gradleArg) {
|
||||
ret.extraArgs = ret.extraArgs.concat(options.argv.gradleArg);
|
||||
}
|
||||
if(cmd) {
|
||||
var result = shell.exec(cmd, {silent:false, async:false});
|
||||
if(result.code > 0) {
|
||||
console.error('ERROR: Failed to build android project.');
|
||||
console.error(result.output);
|
||||
process.exit(2);
|
||||
|
||||
var packageArgs = {};
|
||||
|
||||
if (options.argv.keystore) { packageArgs.keystore = path.relative(projectRoot, path.resolve(options.argv.keystore)); }
|
||||
|
||||
['alias', 'storePassword', 'password', 'keystoreType', 'packageType'].forEach(function (flagName) {
|
||||
if (options.argv[flagName]) { packageArgs[flagName] = options.argv[flagName]; }
|
||||
});
|
||||
|
||||
var buildConfig = options.buildConfig;
|
||||
|
||||
// If some values are not specified as command line arguments - use build config to supplement them.
|
||||
// Command line arguments have precedence over build config.
|
||||
if (buildConfig) {
|
||||
if (!fs.existsSync(buildConfig)) {
|
||||
throw new Error('Specified build config file does not exist: ' + buildConfig);
|
||||
}
|
||||
events.emit('log', 'Reading build config file: ' + path.resolve(buildConfig));
|
||||
var buildjson = fs.readFileSync(buildConfig, 'utf8');
|
||||
var config = JSON.parse(buildjson.replace(/^\ufeff/, '')); // Remove BOM
|
||||
if (config.android && config.android[ret.buildType]) {
|
||||
var androidInfo = config.android[ret.buildType];
|
||||
if (androidInfo.keystore && !packageArgs.keystore) {
|
||||
if (androidInfo.keystore.substr(0, 1) === '~') {
|
||||
androidInfo.keystore = process.env.HOME + androidInfo.keystore.substr(1);
|
||||
}
|
||||
packageArgs.keystore = path.resolve(path.dirname(buildConfig), androidInfo.keystore);
|
||||
events.emit('log', 'Reading the keystore from: ' + packageArgs.keystore);
|
||||
}
|
||||
|
||||
['alias', 'storePassword', 'password', 'keystoreType', 'packageType'].forEach(function (key) {
|
||||
packageArgs[key] = packageArgs[key] || androidInfo[key];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the path to the apk file, if not such file exists then
|
||||
* the script will error out. (should we error or just return undefined?)
|
||||
*/
|
||||
module.exports.get_apk = function() {
|
||||
if(fs.existsSync(path.join(ROOT, 'bin'))) {
|
||||
var bin_files = fs.readdirSync(path.join(ROOT, 'bin'));
|
||||
for (file in bin_files) {
|
||||
if(path.extname(bin_files[file]) == '.apk') {
|
||||
return path.join(ROOT, 'bin', bin_files[file]);
|
||||
if (packageArgs.keystore && packageArgs.alias) {
|
||||
ret.packageInfo = new PackageInfo(packageArgs.keystore, packageArgs.alias, packageArgs.storePassword,
|
||||
packageArgs.password, packageArgs.keystoreType);
|
||||
}
|
||||
|
||||
if (!ret.packageInfo) {
|
||||
// The following loop is to decide whether to print a warning about generating a signed archive
|
||||
// We only want to produce a warning if they are using a config property that is related to signing, but
|
||||
// missing the required properties for signing. We don't want to produce a warning if they are simply
|
||||
// using a build property that isn't related to signing, such as --packageType
|
||||
let shouldWarn = false;
|
||||
const signingKeys = ['keystore', 'alias', 'storePassword', 'password', 'keystoreType'];
|
||||
|
||||
for (const key in packageArgs) {
|
||||
if (!shouldWarn && signingKeys.indexOf(key) > -1) {
|
||||
// If we enter this condition, we have a key used for signing a build,
|
||||
// but we are missing some required signing properties
|
||||
shouldWarn = true;
|
||||
}
|
||||
}
|
||||
console.error('ERROR : No .apk found in \'bin\' folder');
|
||||
process.exit(2);
|
||||
} else {
|
||||
console.error('ERROR : unable to find project bin folder, could not locate .apk');
|
||||
process.exit(2);
|
||||
|
||||
if (shouldWarn) {
|
||||
events.emit('warn', '\'keystore\' and \'alias\' need to be specified to generate a signed archive.');
|
||||
}
|
||||
}
|
||||
|
||||
if (packageArgs.packageType) {
|
||||
const VALID_PACKAGE_TYPES = [PackageType.APK, PackageType.BUNDLE];
|
||||
if (VALID_PACKAGE_TYPES.indexOf(packageArgs.packageType) === -1) {
|
||||
events.emit('warn', '"' + packageArgs.packageType + '" is an invalid packageType. Valid values are: ' + VALID_PACKAGE_TYPES.join(', ') + '\nDefaulting packageType to ' + PackageType.APK);
|
||||
ret.packageType = PackageType.APK;
|
||||
} else {
|
||||
ret.packageType = packageArgs.packageType;
|
||||
}
|
||||
} else {
|
||||
ret.packageType = PackageType.APK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
module.exports.help = function() {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'corodva', 'build')) + ' [build_type]');
|
||||
console.log('Build Types : ');
|
||||
console.log(' \'--debug\': Default build, will build project in using ant debug');
|
||||
console.log(' \'--release\': will build project using ant release');
|
||||
console.log(' \'--nobuild\': will skip build process (can be used with run command)');
|
||||
/*
|
||||
* Builds the project with the specifed options
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.runClean = function (options) {
|
||||
var opts = parseOpts(options, null, this.root);
|
||||
var builder = builders.getBuilder();
|
||||
|
||||
return builder.prepEnv(opts).then(function () {
|
||||
return builder.clean(opts);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds the project with the specifed options.
|
||||
*
|
||||
* @param {BuildOptions} options A set of options. See PlatformApi.build
|
||||
* method documentation for reference.
|
||||
* @param {Object} optResolvedTarget A deployment target. Used to pass
|
||||
* target architecture from upstream 'run' call. TODO: remove this option in
|
||||
* favor of setting buildOptions.archs field.
|
||||
*
|
||||
* @return {Promise<Object>} Promise, resolved with built packages
|
||||
* information.
|
||||
*/
|
||||
module.exports.run = function (options, optResolvedTarget) {
|
||||
var opts = parseOpts(options, optResolvedTarget, this.root);
|
||||
var builder = builders.getBuilder();
|
||||
|
||||
return builder.prepEnv(opts).then(function () {
|
||||
if (opts.prepEnv) {
|
||||
events.emit('verbose', 'Build file successfully prepared.');
|
||||
return;
|
||||
}
|
||||
return builder.build(opts).then(function () {
|
||||
var paths;
|
||||
if (opts.packageType === PackageType.BUNDLE) {
|
||||
paths = builder.findOutputBundles(opts.buildType);
|
||||
events.emit('log', 'Built the following bundle(s): \n\t' + paths.join('\n\t'));
|
||||
} else {
|
||||
paths = builder.findOutputApks(opts.buildType, opts.arch);
|
||||
events.emit('log', 'Built the following apk(s): \n\t' + paths.join('\n\t'));
|
||||
}
|
||||
|
||||
return {
|
||||
paths: paths,
|
||||
buildType: opts.buildType
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Detects the architecture of a device/emulator
|
||||
* Returns "arm" or "x86".
|
||||
*/
|
||||
module.exports.detectArchitecture = function (target) {
|
||||
function helper () {
|
||||
return Adb.shell(target, 'cat /proc/cpuinfo').then(function (output) {
|
||||
return /intel/i.exec(output) ? 'x86' : 'arm';
|
||||
});
|
||||
}
|
||||
function timeout (ms, err) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => reject(err), ms);
|
||||
});
|
||||
}
|
||||
// It sometimes happens (at least on OS X), that this command will hang forever.
|
||||
// To fix it, either unplug & replug device, or restart adb server.
|
||||
return Promise.race([
|
||||
helper(),
|
||||
timeout(5000, new CordovaError(
|
||||
'Device communication timed out. Try unplugging & replugging the device.'
|
||||
))
|
||||
]).catch(err => {
|
||||
if (/timed out/.exec('' + err)) {
|
||||
// adb kill-server doesn't seem to do the trick.
|
||||
// Could probably find a x-platform version of killall, but I'm not actually
|
||||
// sure that this scenario even happens on non-OSX machines.
|
||||
events.emit('verbose', 'adb timed out while detecting device/emulator architecture. Killing adb and trying again.');
|
||||
return execa('killall', ['adb']).then(function () {
|
||||
return helper().then(null, function () {
|
||||
// The double kill is sadly often necessary, at least on mac.
|
||||
events.emit('warn', 'adb timed out a second time while detecting device/emulator architecture. Killing adb and trying again.');
|
||||
return execa('killall', ['adb']).then(function () {
|
||||
return helper().then(null, function () {
|
||||
return Promise.reject(new CordovaError('adb timed out a third time while detecting device/emulator architecture. Try unplugging & replugging the device.'));
|
||||
});
|
||||
});
|
||||
});
|
||||
}, function () {
|
||||
// For non-killall OS's.
|
||||
return Promise.reject(err);
|
||||
});
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.findBestApkForArchitecture = function (buildResults, arch) {
|
||||
var paths = buildResults.apkPaths.filter(function (p) {
|
||||
var apkName = path.basename(p);
|
||||
if (buildResults.buildType === 'debug') {
|
||||
return /-debug/.exec(apkName);
|
||||
}
|
||||
return !/-debug/.exec(apkName);
|
||||
});
|
||||
var archPattern = new RegExp('-' + arch);
|
||||
var hasArchPattern = /-x86|-arm/;
|
||||
for (var i = 0; i < paths.length; ++i) {
|
||||
var apkName = path.basename(paths[i]);
|
||||
if (hasArchPattern.exec(apkName)) {
|
||||
if (archPattern.exec(apkName)) {
|
||||
return paths[i];
|
||||
}
|
||||
} else {
|
||||
return paths[i];
|
||||
}
|
||||
}
|
||||
throw new Error('Could not find apk architecture: ' + arch + ' build-type: ' + buildResults.buildType);
|
||||
};
|
||||
|
||||
function PackageInfo (keystore, alias, storePassword, password, keystoreType) {
|
||||
const createNameKeyObject = (name, value) => ({ name, value: value.replace(/\\/g, '\\\\') });
|
||||
|
||||
this.data = [
|
||||
createNameKeyObject('key.store', keystore),
|
||||
createNameKeyObject('key.alias', alias)
|
||||
];
|
||||
|
||||
if (storePassword) this.data.push(createNameKeyObject('key.store.password', storePassword));
|
||||
if (password) this.data.push(createNameKeyObject('key.alias.password', password));
|
||||
if (keystoreType) this.data.push(createNameKeyObject('key.store.type', keystoreType));
|
||||
}
|
||||
|
||||
PackageInfo.prototype = {
|
||||
appendToProperties: function (propertiesParser) {
|
||||
for (const { name, value } of this.data) propertiesParser.set(name, value);
|
||||
|
||||
propertiesParser.save();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.help = function () {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join('../build')) + ' [flags] [Signed APK flags]');
|
||||
console.log('Flags:');
|
||||
console.log(' \'--debug\': will build project in debug mode (default)');
|
||||
console.log(' \'--release\': will build project for release');
|
||||
console.log(' \'--nobuild\': will skip build process (useful when using run command)');
|
||||
console.log(' \'--prepenv\': don\'t build, but copy in build scripts where necessary');
|
||||
console.log(' \'--versionCode=#\': Override versionCode for this build. Useful for uploading multiple APKs.');
|
||||
console.log(' \'--minSdkVersion=#\': Override minSdkVersion for this build.');
|
||||
console.log(' \'--maxSdkVersion=#\': Override maxSdkVersion for this build. (Not Recommended)');
|
||||
console.log(' \'--targetSdkVersion=#\': Override targetSdkVersion for this build.');
|
||||
console.log(' \'--gradleArg=<gradle command line arg>\': Extra args to pass to the gradle command. Use one flag per arg. Ex. --gradleArg=-PcdvBuildMultipleApks=true');
|
||||
console.log(' \'--packageType=<apk|bundle>\': Builds an APK or a bundle');
|
||||
console.log('');
|
||||
console.log('Signed APK flags (overwrites debug/release-signing.proprties) :');
|
||||
console.log(' \'--keystore=<path to keystore>\': Key store used to build a signed archive. (Required)');
|
||||
console.log(' \'--alias=\': Alias for the key store. (Required)');
|
||||
console.log(' \'--storePassword=\': Password for the key store. (Optional - prompted)');
|
||||
console.log(' \'--password=\': Password for the key. (Optional - prompted)');
|
||||
console.log(' \'--keystoreType\': Type of the keystore. (Optional)');
|
||||
process.exit(0);
|
||||
}
|
||||
};
|
||||
|
||||
380
bin/templates/cordova/lib/builders/ProjectBuilder.js
vendored
Normal file
380
bin/templates/cordova/lib/builders/ProjectBuilder.js
vendored
Normal file
@@ -0,0 +1,380 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var fs = require('fs-extra');
|
||||
var path = require('path');
|
||||
const execa = require('execa');
|
||||
var events = require('cordova-common').events;
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
var check_reqs = require('../check_reqs');
|
||||
var PackageType = require('../PackageType');
|
||||
const { createEditor } = require('properties-parser');
|
||||
|
||||
const MARKER = 'YOUR CHANGES WILL BE ERASED!';
|
||||
const SIGNING_PROPERTIES = '-signing.properties';
|
||||
const TEMPLATE =
|
||||
'# This file is automatically generated.\n' +
|
||||
'# Do not modify this file -- ' + MARKER + '\n';
|
||||
|
||||
const archSpecificRegex = /-x86|-arm/;
|
||||
const unsignedBuildRegex = /-unsigned/;
|
||||
|
||||
const fileSorter = (filePathA, filePathB) => {
|
||||
const archSpecificA = archSpecificRegex.test(filePathA);
|
||||
const archSpecificB = archSpecificRegex.test(filePathB);
|
||||
|
||||
// If they are not equal, then sort by specific archs after generic ones
|
||||
if (archSpecificA !== archSpecificB) {
|
||||
return archSpecificA < archSpecificB ? -1 : 1;
|
||||
}
|
||||
|
||||
// Otherwise, move onto the next sort item, which is by sorting unsigned bulds after signed ones
|
||||
const unsignedA = unsignedBuildRegex.test(filePathA);
|
||||
const unsignedB = unsignedBuildRegex.test(filePathB);
|
||||
|
||||
if (unsignedA !== unsignedB) {
|
||||
return unsignedA < unsignedB ? -1 : 1;
|
||||
}
|
||||
|
||||
// Then, sort by modification time, latest first
|
||||
const modTimeA = fs.statSync(filePathA).mtime.getTime();
|
||||
const modTimeB = fs.statSync(filePathB).mtime.getTime();
|
||||
|
||||
if (modTimeA !== modTimeB) {
|
||||
return modTimeA < modTimeB ? 1 : -1;
|
||||
}
|
||||
|
||||
// Finally, if all above is the same, sort by file name length, ascending
|
||||
return filePathB.length < filePathA.length ? -1 : 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* If the provided directory does not exist or extension is missing, return an empty array.
|
||||
* If the director exists, loop the directories and collect list of files matching the extension.
|
||||
*
|
||||
* @param {String} dir Directory to scan
|
||||
* @param {String} extension
|
||||
*/
|
||||
function recursivelyFindFiles (dir, extension) {
|
||||
if (!fs.existsSync(dir) || !extension) return [];
|
||||
|
||||
const files = fs.readdirSync(dir, { withFileTypes: true })
|
||||
.map(entry => {
|
||||
const item = path.resolve(dir, entry.name);
|
||||
|
||||
if (entry.isDirectory()) return recursivelyFindFiles(item, extension);
|
||||
if (path.extname(entry.name) === `.${extension}`) return item;
|
||||
return false;
|
||||
});
|
||||
|
||||
return Array.prototype.concat(...files)
|
||||
.filter(file => file !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} dir
|
||||
* @param {String} build_type
|
||||
* @param {String} arch
|
||||
* @param {String} extension
|
||||
*/
|
||||
function findOutputFilesHelper (dir, build_type, arch, extension) {
|
||||
let files = recursivelyFindFiles(path.resolve(dir, build_type), extension);
|
||||
|
||||
if (files.length === 0) return files;
|
||||
|
||||
// Assume arch-specific build if newest apk has -x86 or -arm.
|
||||
const archSpecific = !!/-x86|-arm/.exec(path.basename(files[0]));
|
||||
|
||||
// And show only arch-specific ones (or non-arch-specific)
|
||||
files = files.filter(p => !!/-x86|-arm/.exec(path.basename(p)) === archSpecific);
|
||||
|
||||
if (archSpecific && files.length > 1 && arch) {
|
||||
files = files.filter(p => path.basename(p).indexOf('-' + arch) !== -1);
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
class ProjectBuilder {
|
||||
constructor (rootDirectory) {
|
||||
this.root = rootDirectory || path.resolve(__dirname, '../../..');
|
||||
this.apkDir = path.join(this.root, 'app', 'build', 'outputs', 'apk');
|
||||
this.aabDir = path.join(this.root, 'app', 'build', 'outputs', 'bundle');
|
||||
}
|
||||
|
||||
getArgs (cmd, opts) {
|
||||
let args;
|
||||
let buildCmd = cmd;
|
||||
if (opts.packageType === PackageType.BUNDLE) {
|
||||
if (cmd === 'release') {
|
||||
buildCmd = ':app:bundleRelease';
|
||||
} else if (cmd === 'debug') {
|
||||
buildCmd = ':app:bundleDebug';
|
||||
}
|
||||
|
||||
args = [buildCmd, '-b', path.join(this.root, 'build.gradle')];
|
||||
} else {
|
||||
if (cmd === 'release') {
|
||||
buildCmd = 'cdvBuildRelease';
|
||||
} else if (cmd === 'debug') {
|
||||
buildCmd = 'cdvBuildDebug';
|
||||
}
|
||||
|
||||
args = [buildCmd, '-b', path.join(this.root, 'build.gradle')];
|
||||
|
||||
if (opts.arch) {
|
||||
args.push('-PcdvBuildArch=' + opts.arch);
|
||||
}
|
||||
}
|
||||
|
||||
args.push.apply(args, opts.extraArgs);
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
/*
|
||||
* This returns a promise
|
||||
*/
|
||||
runGradleWrapper (gradle_cmd) {
|
||||
var gradlePath = path.join(this.root, 'gradlew');
|
||||
var wrapperGradle = path.join(this.root, 'wrapper.gradle');
|
||||
if (fs.existsSync(gradlePath)) {
|
||||
// Literally do nothing, for some reason this works, while !fs.existsSync didn't on Windows
|
||||
} else {
|
||||
return execa(gradle_cmd, ['-p', this.root, 'wrapper', '-b', wrapperGradle], { stdio: 'inherit' });
|
||||
}
|
||||
}
|
||||
|
||||
readProjectProperties () {
|
||||
function findAllUniq (data, r) {
|
||||
var s = {};
|
||||
var m;
|
||||
while ((m = r.exec(data))) {
|
||||
s[m[1]] = 1;
|
||||
}
|
||||
return Object.keys(s);
|
||||
}
|
||||
|
||||
var data = fs.readFileSync(path.join(this.root, 'project.properties'), 'utf8');
|
||||
return {
|
||||
libs: findAllUniq(data, /^\s*android\.library\.reference\.\d+=(.*)(?:\s|$)/mg),
|
||||
gradleIncludes: findAllUniq(data, /^\s*cordova\.gradle\.include\.\d+=(.*)(?:\s|$)/mg),
|
||||
systemLibs: findAllUniq(data, /^\s*cordova\.system\.library\.\d+=(.*)(?:\s|$)/mg)
|
||||
};
|
||||
}
|
||||
|
||||
extractRealProjectNameFromManifest () {
|
||||
var manifestPath = path.join(this.root, 'app', 'src', 'main', 'AndroidManifest.xml');
|
||||
var manifestData = fs.readFileSync(manifestPath, 'utf8');
|
||||
var m = /<manifest[\s\S]*?package\s*=\s*"(.*?)"/i.exec(manifestData);
|
||||
if (!m) {
|
||||
throw new CordovaError('Could not find package name in ' + manifestPath);
|
||||
}
|
||||
|
||||
var packageName = m[1];
|
||||
var lastDotIndex = packageName.lastIndexOf('.');
|
||||
return packageName.substring(lastDotIndex + 1);
|
||||
}
|
||||
|
||||
// Makes the project buildable, minus the gradle wrapper.
|
||||
prepBuildFiles () {
|
||||
// Update the version of build.gradle in each dependent library.
|
||||
var pluginBuildGradle = path.join(this.root, 'cordova', 'lib', 'plugin-build.gradle');
|
||||
var propertiesObj = this.readProjectProperties();
|
||||
var subProjects = propertiesObj.libs;
|
||||
|
||||
// Check and copy the gradle file into the subproject
|
||||
// Called by the loop before this function def
|
||||
|
||||
var checkAndCopy = function (subProject, root) {
|
||||
var subProjectGradle = path.join(root, subProject, 'build.gradle');
|
||||
// This is the future-proof way of checking if a file exists
|
||||
// This must be synchronous to satisfy a Travis test
|
||||
try {
|
||||
fs.accessSync(subProjectGradle, fs.F_OK);
|
||||
} catch (e) {
|
||||
fs.copySync(pluginBuildGradle, subProjectGradle);
|
||||
}
|
||||
};
|
||||
|
||||
for (var i = 0; i < subProjects.length; ++i) {
|
||||
if (subProjects[i] !== 'CordovaLib') {
|
||||
checkAndCopy(subProjects[i], this.root);
|
||||
}
|
||||
}
|
||||
var name = this.extractRealProjectNameFromManifest();
|
||||
// Remove the proj.id/name- prefix from projects: https://issues.apache.org/jira/browse/CB-9149
|
||||
var settingsGradlePaths = subProjects.map(function (p) {
|
||||
var realDir = p.replace(/[/\\]/g, ':');
|
||||
var libName = realDir.replace(name + '-', '');
|
||||
var str = 'include ":' + libName + '"\n';
|
||||
if (realDir.indexOf(name + '-') !== -1) {
|
||||
str += 'project(":' + libName + '").projectDir = new File("' + p + '")\n';
|
||||
}
|
||||
return str;
|
||||
});
|
||||
|
||||
fs.writeFileSync(path.join(this.root, 'settings.gradle'),
|
||||
'// GENERATED FILE - DO NOT EDIT\n' +
|
||||
'include ":"\n' + settingsGradlePaths.join(''));
|
||||
|
||||
// Update dependencies within build.gradle.
|
||||
var buildGradle = fs.readFileSync(path.join(this.root, 'app', 'build.gradle'), 'utf8');
|
||||
var depsList = '';
|
||||
var root = this.root;
|
||||
var insertExclude = function (p) {
|
||||
var gradlePath = path.join(root, p, 'build.gradle');
|
||||
var projectGradleFile = fs.readFileSync(gradlePath, 'utf-8');
|
||||
if (projectGradleFile.indexOf('CordovaLib') !== -1) {
|
||||
depsList += '{\n exclude module:("CordovaLib")\n }\n';
|
||||
} else {
|
||||
depsList += '\n';
|
||||
}
|
||||
};
|
||||
subProjects.forEach(function (p) {
|
||||
events.emit('log', 'Subproject Path: ' + p);
|
||||
var libName = p.replace(/[/\\]/g, ':').replace(name + '-', '');
|
||||
if (libName !== 'app') {
|
||||
depsList += ' implementation(project(path: ":' + libName + '"))';
|
||||
insertExclude(p);
|
||||
}
|
||||
});
|
||||
// For why we do this mapping: https://issues.apache.org/jira/browse/CB-8390
|
||||
var SYSTEM_LIBRARY_MAPPINGS = [
|
||||
[/^\/?extras\/android\/support\/(.*)$/, 'com.android.support:support-$1:+'],
|
||||
[/^\/?google\/google_play_services\/libproject\/google-play-services_lib\/?$/, 'com.google.android.gms:play-services:+']
|
||||
];
|
||||
|
||||
propertiesObj.systemLibs.forEach(function (p) {
|
||||
var mavenRef;
|
||||
// It's already in gradle form if it has two ':'s
|
||||
if (/:.*:/.exec(p)) {
|
||||
mavenRef = p;
|
||||
} else {
|
||||
for (var i = 0; i < SYSTEM_LIBRARY_MAPPINGS.length; ++i) {
|
||||
var pair = SYSTEM_LIBRARY_MAPPINGS[i];
|
||||
if (pair[0].exec(p)) {
|
||||
mavenRef = p.replace(pair[0], pair[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!mavenRef) {
|
||||
throw new CordovaError('Unsupported system library (does not work with gradle): ' + p);
|
||||
}
|
||||
}
|
||||
depsList += ' implementation "' + mavenRef + '"\n';
|
||||
});
|
||||
|
||||
buildGradle = buildGradle.replace(/(SUB-PROJECT DEPENDENCIES START)[\s\S]*(\/\/ SUB-PROJECT DEPENDENCIES END)/, '$1\n' + depsList + ' $2');
|
||||
var includeList = '';
|
||||
|
||||
propertiesObj.gradleIncludes.forEach(function (includePath) {
|
||||
includeList += 'apply from: "../' + includePath + '"\n';
|
||||
});
|
||||
buildGradle = buildGradle.replace(/(PLUGIN GRADLE EXTENSIONS START)[\s\S]*(\/\/ PLUGIN GRADLE EXTENSIONS END)/, '$1\n' + includeList + '$2');
|
||||
// This needs to be stored in the app gradle, not the root grade
|
||||
fs.writeFileSync(path.join(this.root, 'app', 'build.gradle'), buildGradle);
|
||||
}
|
||||
|
||||
prepEnv (opts) {
|
||||
var self = this;
|
||||
return check_reqs.check_gradle()
|
||||
.then(function (gradlePath) {
|
||||
return self.runGradleWrapper(gradlePath);
|
||||
}).then(function () {
|
||||
return self.prepBuildFiles();
|
||||
}).then(() => {
|
||||
// update/set the distributionUrl in the gradle-wrapper.properties
|
||||
const gradleWrapperPropertiesPath = path.join(self.root, 'gradle/wrapper/gradle-wrapper.properties');
|
||||
const gradleWrapperProperties = createEditor(gradleWrapperPropertiesPath);
|
||||
const distributionUrl = process.env.CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL || 'https://services.gradle.org/distributions/gradle-6.5-all.zip';
|
||||
gradleWrapperProperties.set('distributionUrl', distributionUrl);
|
||||
gradleWrapperProperties.save();
|
||||
|
||||
events.emit('verbose', `Gradle Distribution URL: ${distributionUrl}`);
|
||||
})
|
||||
.then(() => {
|
||||
const signingPropertiesPath = path.join(self.root, `${opts.buildType}${SIGNING_PROPERTIES}`);
|
||||
|
||||
if (fs.existsSync(signingPropertiesPath)) fs.removeSync(signingPropertiesPath);
|
||||
if (opts.packageInfo) {
|
||||
fs.ensureFileSync(signingPropertiesPath);
|
||||
const signingProperties = createEditor(signingPropertiesPath);
|
||||
signingProperties.addHeadComment(TEMPLATE);
|
||||
opts.packageInfo.appendToProperties(signingProperties);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Builds the project with gradle.
|
||||
* Returns a promise.
|
||||
*/
|
||||
build (opts) {
|
||||
var wrapper = path.join(this.root, 'gradlew');
|
||||
var args = this.getArgs(opts.buildType === 'debug' ? 'debug' : 'release', opts);
|
||||
|
||||
return execa(wrapper, args, { stdio: 'inherit' })
|
||||
.catch(function (error) {
|
||||
if (error.toString().indexOf('failed to find target with hash string') >= 0) {
|
||||
return check_reqs.check_android_target(error).then(function () {
|
||||
// If due to some odd reason - check_android_target succeeds
|
||||
// we should still fail here.
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
clean (opts) {
|
||||
const wrapper = path.join(this.root, 'gradlew');
|
||||
const args = this.getArgs('clean', opts);
|
||||
return execa(wrapper, args, { stdio: 'inherit' })
|
||||
.then(() => {
|
||||
fs.removeSync(path.join(this.root, 'out'));
|
||||
|
||||
['debug', 'release'].map(config => path.join(this.root, `${config}${SIGNING_PROPERTIES}`))
|
||||
.forEach(file => {
|
||||
const hasFile = fs.existsSync(file);
|
||||
const hasMarker = hasFile && fs.readFileSync(file, 'utf8')
|
||||
.includes(MARKER);
|
||||
|
||||
if (hasFile && hasMarker) fs.removeSync(file);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
findOutputApks (build_type, arch) {
|
||||
return findOutputFilesHelper(this.apkDir, build_type, arch, 'apk').sort(fileSorter);
|
||||
}
|
||||
|
||||
findOutputBundles (build_type) {
|
||||
return findOutputFilesHelper(this.aabDir, build_type, false, 'aab').sort(fileSorter);
|
||||
}
|
||||
|
||||
fetchBuildResults (build_type, arch) {
|
||||
return {
|
||||
apkPaths: this.findOutputApks(build_type, arch),
|
||||
buildType: build_type
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ProjectBuilder;
|
||||
34
bin/templates/cordova/lib/builders/builders.js
vendored
Normal file
34
bin/templates/cordova/lib/builders/builders.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
const CordovaError = require('cordova-common').CordovaError;
|
||||
|
||||
/**
|
||||
* Helper method that instantiates and returns a builder for specified build type.
|
||||
*
|
||||
* @return {Builder} A builder instance for specified build type.
|
||||
*/
|
||||
module.exports.getBuilder = function (projectPath) {
|
||||
try {
|
||||
const Builder = require('./ProjectBuilder');
|
||||
return new Builder(projectPath);
|
||||
} catch (err) {
|
||||
throw new CordovaError('Failed to instantiate ProjectBuilder builder: ' + err);
|
||||
}
|
||||
};
|
||||
480
bin/templates/cordova/lib/check_reqs.js
vendored
Normal file
480
bin/templates/cordova/lib/check_reqs.js
vendored
Normal file
@@ -0,0 +1,480 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
const execa = require('execa');
|
||||
var path = require('path');
|
||||
var fs = require('fs-extra');
|
||||
var os = require('os');
|
||||
var which = require('which');
|
||||
var REPO_ROOT = path.join(__dirname, '..', '..', '..', '..');
|
||||
var PROJECT_ROOT = path.join(__dirname, '..', '..');
|
||||
const { CordovaError, ConfigParser, events } = require('cordova-common');
|
||||
var android_sdk = require('./android_sdk');
|
||||
const { createEditor } = require('properties-parser');
|
||||
|
||||
function forgivingWhichSync (cmd) {
|
||||
const whichResult = which.sync(cmd, { nothrow: true });
|
||||
|
||||
// On null, returns empty string to maintain backwards compatibility
|
||||
// realpathSync follows symlinks
|
||||
return whichResult === null ? '' : fs.realpathSync(whichResult);
|
||||
}
|
||||
|
||||
function getJDKDirectory (directory) {
|
||||
const p = path.resolve(directory, 'java');
|
||||
if (fs.existsSync(p)) {
|
||||
const directories = fs.readdirSync(p);
|
||||
for (let i = 0; i < directories.length; i++) {
|
||||
const dir = directories[i];
|
||||
if (/^(jdk)+./.test(dir)) {
|
||||
return path.resolve(directory, 'java', dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports.isWindows = function () {
|
||||
return (os.platform() === 'win32');
|
||||
};
|
||||
|
||||
module.exports.isDarwin = function () {
|
||||
return (os.platform() === 'darwin');
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Get valid target from framework/project.properties if run from this repo
|
||||
* Otherwise get target from project.properties file within a generated cordova-android project
|
||||
* @returns {string} The android target in format "android-${target}"
|
||||
*/
|
||||
module.exports.get_target = function () {
|
||||
const projectPropertiesPaths = [
|
||||
path.join(REPO_ROOT, 'framework', 'project.properties'),
|
||||
path.join(PROJECT_ROOT, 'project.properties')
|
||||
];
|
||||
|
||||
// Get the minimum required target API from the framework.
|
||||
let target = projectPropertiesPaths.filter(filePath => fs.existsSync(filePath))
|
||||
.map(filePath => createEditor(filePath).get('target'))
|
||||
.pop();
|
||||
|
||||
if (!target) {
|
||||
throw new Error(`We could not locate the target from the "project.properties" at either "${projectPropertiesPaths.join('", "')}".`);
|
||||
}
|
||||
|
||||
// If the repo config.xml file exists, find the desired targetSdkVersion.
|
||||
const configFile = path.join(REPO_ROOT, 'config.xml');
|
||||
if (!fs.existsSync(configFile)) return target;
|
||||
|
||||
const configParser = new ConfigParser(configFile);
|
||||
const desiredAPI = parseInt(configParser.getPreference('android-targetSdkVersion', 'android'), 10);
|
||||
|
||||
if (!isNaN(desiredAPI)) {
|
||||
const minimumAPI = parseInt(target.split('-').pop(), 10);
|
||||
|
||||
if (desiredAPI >= minimumAPI) {
|
||||
target = `android-${desiredAPI}`;
|
||||
} else {
|
||||
events.emit('warn', `android-targetSdkVersion should be greater than or equal to ${minimumAPI}.`);
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
|
||||
// Returns a promise. Called only by build and clean commands.
|
||||
module.exports.check_ant = function () {
|
||||
return execa('ant', ['-version']).then(({ stdout: output }) => {
|
||||
// Parse Ant version from command output
|
||||
return /version ((?:\d+\.)+(?:\d+))/i.exec(output)[1];
|
||||
}).catch(function (err) {
|
||||
if (err) {
|
||||
throw new CordovaError('Failed to run `ant -version`. Make sure you have `ant` on your $PATH.');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.get_gradle_wrapper = function () {
|
||||
var androidStudioPath;
|
||||
var i = 0;
|
||||
var foundStudio = false;
|
||||
var program_dir;
|
||||
// OK, This hack only works on Windows, not on Mac OS or Linux. We will be deleting this eventually!
|
||||
if (module.exports.isWindows()) {
|
||||
var result = execa.sync(path.join(__dirname, 'getASPath.bat'));
|
||||
// console.log('result.stdout =' + result.stdout.toString());
|
||||
// console.log('result.stderr =' + result.stderr.toString());
|
||||
|
||||
if (result.stderr.toString().length > 0) {
|
||||
var androidPath = path.join(process.env.ProgramFiles, 'Android') + '/';
|
||||
if (fs.existsSync(androidPath)) {
|
||||
program_dir = fs.readdirSync(androidPath);
|
||||
while (i < program_dir.length && !foundStudio) {
|
||||
if (program_dir[i].startsWith('Android Studio')) {
|
||||
foundStudio = true;
|
||||
androidStudioPath = path.join(process.env.ProgramFiles, 'Android', program_dir[i], 'gradle');
|
||||
} else { ++i; }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// console.log('got android studio path from registry');
|
||||
// remove the (os independent) new line char at the end of stdout
|
||||
// add gradle to match the above.
|
||||
androidStudioPath = path.join(result.stdout.toString().split('\r\n')[0], 'gradle');
|
||||
}
|
||||
}
|
||||
|
||||
if (androidStudioPath !== null && fs.existsSync(androidStudioPath)) {
|
||||
var dirs = fs.readdirSync(androidStudioPath);
|
||||
if (dirs[0].split('-')[0] === 'gradle') {
|
||||
return path.join(androidStudioPath, dirs[0], 'bin', 'gradle');
|
||||
}
|
||||
} else {
|
||||
// OK, let's try to check for Gradle!
|
||||
return forgivingWhichSync('gradle');
|
||||
}
|
||||
};
|
||||
|
||||
// Returns a promise. Called only by build and clean commands.
|
||||
module.exports.check_gradle = function () {
|
||||
var sdkDir = process.env.ANDROID_SDK_ROOT || process.env.ANDROID_HOME;
|
||||
if (!sdkDir) {
|
||||
return Promise.reject(new CordovaError('Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.\n' +
|
||||
'Might need to install Android SDK or set up \'ANDROID_SDK_ROOT\' env variable.'));
|
||||
}
|
||||
|
||||
var gradlePath = module.exports.get_gradle_wrapper();
|
||||
|
||||
if (gradlePath.length !== 0) return Promise.resolve(gradlePath);
|
||||
|
||||
return Promise.reject(new CordovaError('Could not find an installed version of Gradle either in Android Studio,\n' +
|
||||
'or on your system to install the gradle wrapper. Please include gradle \n' +
|
||||
'in your path, or install Android Studio'));
|
||||
};
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.check_java = function () {
|
||||
var javacPath = forgivingWhichSync('javac');
|
||||
var hasJavaHome = !!process.env.JAVA_HOME;
|
||||
return Promise.resolve().then(function () {
|
||||
if (hasJavaHome) {
|
||||
// Windows java installer doesn't add javac to PATH, nor set JAVA_HOME (ugh).
|
||||
if (!javacPath) {
|
||||
process.env.PATH += path.delimiter + path.join(process.env.JAVA_HOME, 'bin');
|
||||
}
|
||||
} else {
|
||||
if (javacPath) {
|
||||
// OS X has a command for finding JAVA_HOME.
|
||||
var find_java = '/usr/libexec/java_home';
|
||||
var default_java_error_msg = 'Failed to find \'JAVA_HOME\' environment variable. Try setting it manually.';
|
||||
if (fs.existsSync(find_java)) {
|
||||
return execa(find_java).then(({ stdout }) => {
|
||||
process.env.JAVA_HOME = stdout;
|
||||
}).catch(function (err) {
|
||||
if (err) {
|
||||
throw new CordovaError(default_java_error_msg);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// See if we can derive it from javac's location.
|
||||
var maybeJavaHome = path.dirname(path.dirname(javacPath));
|
||||
if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) {
|
||||
process.env.JAVA_HOME = maybeJavaHome;
|
||||
} else {
|
||||
throw new CordovaError(default_java_error_msg);
|
||||
}
|
||||
}
|
||||
} else if (module.exports.isWindows()) {
|
||||
const programFilesEnv = path.resolve(process.env.ProgramFiles);
|
||||
const programFiles = 'C:\\Program Files\\';
|
||||
const programFilesx86 = 'C:\\Program Files (x86)\\';
|
||||
|
||||
let firstJdkDir =
|
||||
getJDKDirectory(programFilesEnv) ||
|
||||
getJDKDirectory(programFiles) ||
|
||||
getJDKDirectory(programFilesx86);
|
||||
|
||||
if (firstJdkDir) {
|
||||
firstJdkDir = firstJdkDir.replace(/\//g, path.sep);
|
||||
if (!javacPath) {
|
||||
process.env.PATH += path.delimiter + path.join(firstJdkDir, 'bin');
|
||||
}
|
||||
process.env.JAVA_HOME = firstJdkDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
}).then(function () {
|
||||
return execa('javac', ['-version'], { all: true })
|
||||
.then(({ all: output }) => {
|
||||
// Java <= 8 writes version info to stderr, Java >= 9 to stdout
|
||||
const match = /javac\s+([\d.]+)/i.exec(output);
|
||||
return match && match[1];
|
||||
}, () => {
|
||||
var msg =
|
||||
'Failed to run "javac -version", make sure that you have a JDK version 8 installed.\n' +
|
||||
'You can get it from the following location:\n' +
|
||||
'https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html';
|
||||
if (process.env.JAVA_HOME) {
|
||||
msg += '\n\n';
|
||||
msg += 'Your JAVA_HOME is invalid: ' + process.env.JAVA_HOME;
|
||||
}
|
||||
throw new CordovaError(msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.check_android = function () {
|
||||
return Promise.resolve().then(function () {
|
||||
function maybeSetAndroidHome (value) {
|
||||
if (!hasAndroidHome && fs.existsSync(value)) {
|
||||
hasAndroidHome = true;
|
||||
process.env.ANDROID_SDK_ROOT = value;
|
||||
}
|
||||
}
|
||||
|
||||
var androidCmdPath = forgivingWhichSync('android');
|
||||
var adbInPath = forgivingWhichSync('adb');
|
||||
var avdmanagerInPath = forgivingWhichSync('avdmanager');
|
||||
var hasAndroidHome = false;
|
||||
|
||||
if (process.env.ANDROID_SDK_ROOT) {
|
||||
maybeSetAndroidHome(path.resolve(process.env.ANDROID_SDK_ROOT));
|
||||
}
|
||||
|
||||
// First ensure ANDROID_HOME is set
|
||||
// If we have no hints (nothing in PATH), try a few default locations
|
||||
if (!hasAndroidHome && !androidCmdPath && !adbInPath && !avdmanagerInPath) {
|
||||
if (process.env.ANDROID_HOME) {
|
||||
// Fallback to deprecated `ANDROID_HOME` variable
|
||||
maybeSetAndroidHome(path.join(process.env.ANDROID_HOME));
|
||||
}
|
||||
if (module.exports.isWindows()) {
|
||||
// Android Studio 1.0 installer
|
||||
if (process.env.LOCALAPPDATA) {
|
||||
maybeSetAndroidHome(path.join(process.env.LOCALAPPDATA, 'Android', 'sdk'));
|
||||
}
|
||||
if (process.env.ProgramFiles) {
|
||||
maybeSetAndroidHome(path.join(process.env.ProgramFiles, 'Android', 'sdk'));
|
||||
}
|
||||
|
||||
// Android Studio pre-1.0 installer
|
||||
if (process.env.LOCALAPPDATA) {
|
||||
maybeSetAndroidHome(path.join(process.env.LOCALAPPDATA, 'Android', 'android-studio', 'sdk'));
|
||||
}
|
||||
if (process.env.ProgramFiles) {
|
||||
maybeSetAndroidHome(path.join(process.env.ProgramFiles, 'Android', 'android-studio', 'sdk'));
|
||||
}
|
||||
|
||||
// Stand-alone installer
|
||||
if (process.env.LOCALAPPDATA) {
|
||||
maybeSetAndroidHome(path.join(process.env.LOCALAPPDATA, 'Android', 'android-sdk'));
|
||||
}
|
||||
if (process.env.ProgramFiles) {
|
||||
maybeSetAndroidHome(path.join(process.env.ProgramFiles, 'Android', 'android-sdk'));
|
||||
}
|
||||
} else if (module.exports.isDarwin()) {
|
||||
// Android Studio 1.0 installer
|
||||
if (process.env.HOME) {
|
||||
maybeSetAndroidHome(path.join(process.env.HOME, 'Library', 'Android', 'sdk'));
|
||||
}
|
||||
// Android Studio pre-1.0 installer
|
||||
maybeSetAndroidHome('/Applications/Android Studio.app/sdk');
|
||||
// Stand-alone zip file that user might think to put under /Applications
|
||||
maybeSetAndroidHome('/Applications/android-sdk-macosx');
|
||||
maybeSetAndroidHome('/Applications/android-sdk');
|
||||
}
|
||||
if (process.env.HOME) {
|
||||
// Stand-alone zip file that user might think to put under their home directory
|
||||
maybeSetAndroidHome(path.join(process.env.HOME, 'android-sdk-macosx'));
|
||||
maybeSetAndroidHome(path.join(process.env.HOME, 'android-sdk'));
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasAndroidHome) {
|
||||
// If we dont have ANDROID_SDK_ROOT, but we do have some tools on the PATH, try to infer from the tooling PATH.
|
||||
var parentDir, grandParentDir;
|
||||
if (androidCmdPath) {
|
||||
parentDir = path.dirname(androidCmdPath);
|
||||
grandParentDir = path.dirname(parentDir);
|
||||
if (path.basename(parentDir) === 'tools' || fs.existsSync(path.join(grandParentDir, 'tools', 'android'))) {
|
||||
maybeSetAndroidHome(grandParentDir);
|
||||
} else {
|
||||
throw new CordovaError('Failed to find \'ANDROID_SDK_ROOT\' environment variable. Try setting it manually.\n' +
|
||||
'Detected \'android\' command at ' + parentDir + ' but no \'tools\' directory found near.\n' +
|
||||
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'tools directory.');
|
||||
}
|
||||
}
|
||||
if (adbInPath) {
|
||||
parentDir = path.dirname(adbInPath);
|
||||
grandParentDir = path.dirname(parentDir);
|
||||
if (path.basename(parentDir) === 'platform-tools') {
|
||||
maybeSetAndroidHome(grandParentDir);
|
||||
} else {
|
||||
throw new CordovaError('Failed to find \'ANDROID_SDK_ROOT\' environment variable. Try setting it manually.\n' +
|
||||
'Detected \'adb\' command at ' + parentDir + ' but no \'platform-tools\' directory found near.\n' +
|
||||
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'platform-tools directory.');
|
||||
}
|
||||
}
|
||||
if (avdmanagerInPath) {
|
||||
parentDir = path.dirname(avdmanagerInPath);
|
||||
grandParentDir = path.dirname(parentDir);
|
||||
if (path.basename(parentDir) === 'bin' && path.basename(grandParentDir) === 'tools') {
|
||||
maybeSetAndroidHome(path.dirname(grandParentDir));
|
||||
} else {
|
||||
throw new CordovaError('Failed to find \'ANDROID_SDK_ROOT\' environment variable. Try setting it manually.\n' +
|
||||
'Detected \'avdmanager\' command at ' + parentDir + ' but no \'tools' + path.sep + 'bin\' directory found near.\n' +
|
||||
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'tools' + path.sep + 'bin directory.');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!process.env.ANDROID_SDK_ROOT) {
|
||||
throw new CordovaError('Failed to find \'ANDROID_SDK_ROOT\' environment variable. Try setting it manually.\n' +
|
||||
'Failed to find \'android\' command in your \'PATH\'. Try update your \'PATH\' to include path to valid SDK directory.');
|
||||
}
|
||||
if (!fs.existsSync(process.env.ANDROID_SDK_ROOT)) {
|
||||
throw new CordovaError('\'ANDROID_SDK_ROOT\' environment variable is set to non-existent path: ' + process.env.ANDROID_SDK_ROOT +
|
||||
'\nTry update it manually to point to valid SDK directory.');
|
||||
}
|
||||
// Next let's make sure relevant parts of the SDK tooling is in our PATH
|
||||
if (hasAndroidHome && !androidCmdPath) {
|
||||
process.env.PATH += path.delimiter + path.join(process.env.ANDROID_SDK_ROOT, 'tools');
|
||||
}
|
||||
if (hasAndroidHome && !adbInPath) {
|
||||
process.env.PATH += path.delimiter + path.join(process.env.ANDROID_SDK_ROOT, 'platform-tools');
|
||||
}
|
||||
if (hasAndroidHome && !avdmanagerInPath) {
|
||||
process.env.PATH += path.delimiter + path.join(process.env.ANDROID_SDK_ROOT, 'tools', 'bin');
|
||||
}
|
||||
return hasAndroidHome;
|
||||
});
|
||||
};
|
||||
|
||||
// TODO: is this actually needed?
|
||||
module.exports.getAbsoluteAndroidCmd = function () {
|
||||
var cmd = forgivingWhichSync('android');
|
||||
if (cmd.length === 0) {
|
||||
cmd = forgivingWhichSync('sdkmanager');
|
||||
}
|
||||
if (module.exports.isWindows()) {
|
||||
return '"' + cmd + '"';
|
||||
}
|
||||
return cmd.replace(/(\s)/g, '\\$1');
|
||||
};
|
||||
|
||||
module.exports.check_android_target = function (originalError) {
|
||||
// valid_target can look like:
|
||||
// android-19
|
||||
// android-L
|
||||
// Google Inc.:Google APIs:20
|
||||
// Google Inc.:Glass Development Kit Preview:20
|
||||
var desired_api_level = module.exports.get_target();
|
||||
return android_sdk.list_targets().then(function (targets) {
|
||||
if (targets.indexOf(desired_api_level) >= 0) {
|
||||
return targets;
|
||||
}
|
||||
var androidCmd = module.exports.getAbsoluteAndroidCmd();
|
||||
var msg = 'Please install Android target / API level: "' + desired_api_level + '".\n\n' +
|
||||
'Hint: Open the SDK manager by running: ' + androidCmd + '\n' +
|
||||
'You will require:\n' +
|
||||
'1. "SDK Platform" for API level ' + desired_api_level + '\n' +
|
||||
'2. "Android SDK Platform-tools (latest)\n' +
|
||||
'3. "Android SDK Build-tools" (latest)';
|
||||
if (originalError) {
|
||||
msg = originalError + '\n' + msg;
|
||||
}
|
||||
throw new CordovaError(msg);
|
||||
});
|
||||
};
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.run = function () {
|
||||
console.log('Checking Java JDK and Android SDK versions');
|
||||
console.log('ANDROID_SDK_ROOT=' + process.env.ANDROID_SDK_ROOT + ' (recommended setting)');
|
||||
console.log('ANDROID_HOME=' + process.env.ANDROID_HOME + ' (DEPRECATED)');
|
||||
|
||||
return Promise.all([this.check_java(), this.check_android()]).then(function (values) {
|
||||
console.log('Using Android SDK: ' + process.env.ANDROID_SDK_ROOT);
|
||||
|
||||
if (!String(values[0]).startsWith('1.8.')) {
|
||||
throw new CordovaError(
|
||||
'Requirements check failed for JDK 8 (\'1.8.*\')! Detected version: ' + values[0] + '\n' +
|
||||
'Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.'
|
||||
);
|
||||
}
|
||||
|
||||
if (!values[1]) {
|
||||
throw new CordovaError('Requirements check failed for Android SDK! Android SDK was not detected.');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Object thar represents one of requirements for current platform.
|
||||
* @param {String} id The unique identifier for this requirements.
|
||||
* @param {String} name The name of requirements. Human-readable field.
|
||||
* @param {String} version The version of requirement installed. In some cases could be an array of strings
|
||||
* (for example, check_android_target returns an array of android targets installed)
|
||||
* @param {Boolean} installed Indicates whether the requirement is installed or not
|
||||
*/
|
||||
var Requirement = function (id, name, version, installed) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.installed = installed || false;
|
||||
this.metadata = {
|
||||
version: version
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Methods that runs all checks one by one and returns a result of checks
|
||||
* as an array of Requirement objects. This method intended to be used by cordova-lib check_reqs method
|
||||
*
|
||||
* @return Promise<Requirement[]> Array of requirements. Due to implementation, promise is always fulfilled.
|
||||
*/
|
||||
module.exports.check_all = function () {
|
||||
var requirements = [
|
||||
new Requirement('java', 'Java JDK'),
|
||||
new Requirement('androidSdk', 'Android SDK'),
|
||||
new Requirement('androidTarget', 'Android target'),
|
||||
new Requirement('gradle', 'Gradle')
|
||||
];
|
||||
|
||||
var checkFns = [
|
||||
this.check_java,
|
||||
this.check_android,
|
||||
this.check_android_target,
|
||||
this.check_gradle
|
||||
];
|
||||
|
||||
// Then execute requirement checks one-by-one
|
||||
return checkFns.reduce(function (promise, checkFn, idx) {
|
||||
// Update each requirement with results
|
||||
var requirement = requirements[idx];
|
||||
return promise.then(checkFn).then(function (version) {
|
||||
requirement.installed = true;
|
||||
requirement.metadata.version = version;
|
||||
}, function (err) {
|
||||
requirement.metadata.reason = err instanceof Error ? err.message : err;
|
||||
});
|
||||
}, Promise.resolve()).then(function () {
|
||||
// When chain is completed, return requirements array to upstream API
|
||||
return requirements;
|
||||
});
|
||||
};
|
||||
43
bin/templates/cordova/lib/clean.js
vendored
43
bin/templates/cordova/lib/clean.js
vendored
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var shell = require('shelljs'),
|
||||
path = require('path'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
/*
|
||||
* Cleans the project using ant
|
||||
*/
|
||||
module.exports.run = function() {
|
||||
var cmd = 'ant clean -f ' + path.join(ROOT, 'build.xml');
|
||||
var result = shell.exec(cmd, {silent:false, async:false});
|
||||
if (result.code > 0) {
|
||||
console.error('ERROR: Failed to clean android project.');
|
||||
console.error(result.output);
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.help = function() {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), process.argv[1]));
|
||||
console.log('Cleans the project directory.');
|
||||
process.exit(0);
|
||||
}
|
||||
150
bin/templates/cordova/lib/config/GradlePropertiesParser.js
vendored
Normal file
150
bin/templates/cordova/lib/config/GradlePropertiesParser.js
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const propertiesParser = require('properties-parser');
|
||||
const events = require('cordova-common').events;
|
||||
|
||||
class GradlePropertiesParser {
|
||||
/**
|
||||
* Loads and Edits Gradle Properties File.
|
||||
*
|
||||
* @param {String} platformDir is the path of the Android platform directory
|
||||
*/
|
||||
constructor (platformDir) {
|
||||
this._defaults = {
|
||||
// 10 seconds -> 6 seconds
|
||||
'org.gradle.daemon': 'true',
|
||||
|
||||
// to allow dex in process
|
||||
'org.gradle.jvmargs': '-Xmx2048m',
|
||||
|
||||
// Android X
|
||||
'android.useAndroidX': 'false',
|
||||
'android.enableJetifier': 'false'
|
||||
|
||||
// Shaves another 100ms, but produces a "try at own risk" warning. Not worth it (yet):
|
||||
// 'org.gradle.parallel': 'true'
|
||||
};
|
||||
|
||||
this.gradleFilePath = path.join(platformDir, 'gradle.properties');
|
||||
}
|
||||
|
||||
configure (userConfigs) {
|
||||
events.emit('verbose', '[Gradle Properties] Preparing Configuration');
|
||||
|
||||
this._initializeEditor();
|
||||
|
||||
events.emit('verbose', '[Gradle Properties] Appending default configuration properties');
|
||||
this._configureProperties(this._defaults);
|
||||
|
||||
events.emit('verbose', '[Gradle Properties] Appending custom configuration properties');
|
||||
this._configureProperties(userConfigs);
|
||||
|
||||
this._save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the properties editor for parsing, setting, etc.
|
||||
*/
|
||||
_initializeEditor () {
|
||||
// Touch empty gradle.properties file if missing.
|
||||
if (!fs.existsSync(this.gradleFilePath)) {
|
||||
events.emit('verbose', '[Gradle Properties] File missing, creating file with Cordova defaults.');
|
||||
fs.writeFileSync(this.gradleFilePath, '', 'utf-8');
|
||||
}
|
||||
|
||||
// Create an editor for parsing, getting, and setting configurations.
|
||||
this.gradleFile = propertiesParser.createEditor(this.gradleFilePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that defaults or user configuration properties are set and
|
||||
* set the missing items.
|
||||
*/
|
||||
_configureProperties (properties) {
|
||||
// Iterate though the properties and set only if missing.
|
||||
Object.keys(properties).forEach(key => {
|
||||
const value = this.gradleFile.get(key);
|
||||
|
||||
if (!value) {
|
||||
// Handles the case of adding missing defaults or new properties that are missing.
|
||||
events.emit('verbose', `[Gradle Properties] Appending configuration item: ${key}=${properties[key]}`);
|
||||
this.gradleFile.set(key, properties[key]);
|
||||
} else if (value !== properties[key]) {
|
||||
if (this._defaults[key] && this._defaults[key] !== properties[key]) {
|
||||
let shouldEmit = true;
|
||||
if (key === 'org.gradle.jvmargs') {
|
||||
shouldEmit = this._isJVMMemoryLessThanRecommended(properties[key], this._defaults[key]);
|
||||
}
|
||||
|
||||
if (shouldEmit) {
|
||||
// Since the value does not match default, we will notify the discrepancy with Cordova's recommended value.
|
||||
events.emit('info', `[Gradle Properties] Detected Gradle property "${key}" with the value of "${properties[key]}", Cordova's recommended value is "${this._defaults[key]}"`);
|
||||
}
|
||||
} else {
|
||||
// When the current value exists but does not match the new value or does matches the default key value, the new value it set.
|
||||
events.emit('verbose', `[Gradle Properties] Updating Gradle property "${key}" with the value of "${properties[key]}"`);
|
||||
}
|
||||
|
||||
// We will set the new value in either case.
|
||||
this.gradleFile.set(key, properties[key]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_isJVMMemoryLessThanRecommended (memoryValue, recommendedMemoryValue) {
|
||||
const UNIT = 2;
|
||||
const SIZE = 1;
|
||||
const regex = /-Xmx+([0-9]+)+([mMgGkK])/;
|
||||
|
||||
const recommendedCapture = regex.exec(recommendedMemoryValue);
|
||||
const recommendedBase = this._getBaseJVMSize(recommendedCapture[SIZE], recommendedCapture[UNIT]);
|
||||
const memoryCapture = regex.exec(memoryValue);
|
||||
const memoryBase = this._getBaseJVMSize(memoryCapture[SIZE], memoryCapture[UNIT]);
|
||||
|
||||
return memoryBase < recommendedBase;
|
||||
}
|
||||
|
||||
_getBaseJVMSize (size, unit) {
|
||||
const KILOBYTE = 1024;
|
||||
const MEGABYTE = 1048576;
|
||||
const GIGABYTE = 1073741824;
|
||||
|
||||
switch (unit.toLowerCase()) {
|
||||
case 'k': return size * KILOBYTE;
|
||||
case 'm': return size * MEGABYTE;
|
||||
case 'g': return size * GIGABYTE;
|
||||
}
|
||||
|
||||
events.emit('warn', `[Gradle Properties] Unknown memory size unit (${unit})`);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves any changes that has been made to the properties file.
|
||||
*/
|
||||
_save () {
|
||||
events.emit('verbose', '[Gradle Properties] Updating and Saving File');
|
||||
this.gradleFile.save();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GradlePropertiesParser;
|
||||
146
bin/templates/cordova/lib/device.js
vendored
146
bin/templates/cordova/lib/device.js
vendored
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
@@ -19,77 +17,93 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var shell = require('shelljs'),
|
||||
path = require('path'),
|
||||
build = require('./build'),
|
||||
appinfo = require('./appinfo'),
|
||||
exec = require('child_process').exec,
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
const execa = require('execa');
|
||||
var build = require('./build');
|
||||
var path = require('path');
|
||||
var Adb = require('./Adb');
|
||||
var AndroidManifest = require('./AndroidManifest');
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
var events = require('cordova-common').events;
|
||||
|
||||
/**
|
||||
* Returns a list of the device ID's found
|
||||
* Returns a promise for the list of the device ID's found
|
||||
* @param lookHarder When true, try restarting adb if no devices are found.
|
||||
*/
|
||||
module.exports.list = function() {
|
||||
var cmd = 'adb devices';
|
||||
var result = shell.exec(cmd, {silent:true, async:false});
|
||||
if (result.code > 0) {
|
||||
console.error('Failed to execute android command \'' + cmd + '\'.');
|
||||
process.exit(2);
|
||||
} else {
|
||||
var response = result.output.split('\n');
|
||||
var device_list = [];
|
||||
for (var i = 1; i < response.length; i++) {
|
||||
if (response[i].match(/\w+\tdevice/) && !response[i].match(/emulator/)) {
|
||||
device_list.push(response[i].replace(/\tdevice/, '').replace('\r', ''));
|
||||
}
|
||||
module.exports.list = function (lookHarder) {
|
||||
return Adb.devices().then(function (list) {
|
||||
if (list.length === 0 && lookHarder) {
|
||||
// adb kill-server doesn't seem to do the trick.
|
||||
// Could probably find a x-platform version of killall, but I'm not actually
|
||||
// sure that this scenario even happens on non-OSX machines.
|
||||
return execa('killall', ['adb']).then(function () {
|
||||
events.emit('verbose', 'Restarting adb to see if more devices are detected.');
|
||||
return Adb.devices();
|
||||
}, function () {
|
||||
// For non-killall OS's.
|
||||
return list;
|
||||
});
|
||||
}
|
||||
return device_list;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.resolveTarget = function (target) {
|
||||
return this.list(true).then(function (device_list) {
|
||||
if (!device_list || !device_list.length) {
|
||||
return Promise.reject(new CordovaError('Failed to deploy to device, no devices found.'));
|
||||
}
|
||||
// default device
|
||||
target = target || device_list[0];
|
||||
|
||||
if (device_list.indexOf(target) < 0) {
|
||||
return Promise.reject(new CordovaError('ERROR: Unable to find target \'' + target + '\'.'));
|
||||
}
|
||||
|
||||
return build.detectArchitecture(target).then(function (arch) {
|
||||
return { target: target, arch: arch, isEmulator: false };
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Installs a previously built application on the device
|
||||
* and launches it.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.install = function(target) {
|
||||
var device_list = this.list();
|
||||
if (device_list.length > 0) {
|
||||
// default device
|
||||
target = typeof target !== 'undefined' ? target : device_list[0];
|
||||
if (device_list.indexOf(target) > -1) {
|
||||
var apk_path = build.get_apk();
|
||||
var launchName = appinfo.getActivityName();
|
||||
console.log('Installing app on device...');
|
||||
cmd = 'adb -s ' + target + ' install -r ' + apk_path;
|
||||
var install = shell.exec(cmd, {silent:false, async:false});
|
||||
if (install.error || install.output.match(/Failure/)) {
|
||||
console.error('ERROR : Failed to install apk to device : ');
|
||||
console.error(install.output);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
//unlock screen
|
||||
cmd = 'adb -s ' + target + ' shell input keyevent 82';
|
||||
shell.exec(cmd, {silent:true, async:false});
|
||||
|
||||
// launch the application
|
||||
console.log('Launching application...');
|
||||
cmd = 'adb -s ' + target + ' shell am start -W -a android.intent.action.MAIN -n ' + launchName;
|
||||
var launch = shell.exec(cmd, {silent:true, async:false});
|
||||
if(launch.code > 0) {
|
||||
console.error('ERROR : Failed to launch application on emulator : ' + launch.error);
|
||||
console.error(launch.output);
|
||||
process.exit(2);
|
||||
} else {
|
||||
console.log('LANCH SUCCESS');
|
||||
}
|
||||
} else {
|
||||
console.error('ERROR : Unable to find target \'' + target + '\'.');
|
||||
console.error('Failed to deploy to device.');
|
||||
process.exit(2);
|
||||
module.exports.install = function (target, buildResults) {
|
||||
return Promise.resolve().then(function () {
|
||||
if (target && typeof target === 'object') {
|
||||
return target;
|
||||
}
|
||||
} else {
|
||||
console.error('ERROR : Failed to deploy to device, no devices found.');
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
return module.exports.resolveTarget(target);
|
||||
}).then(function (resolvedTarget) {
|
||||
var apk_path = build.findBestApkForArchitecture(buildResults, resolvedTarget.arch);
|
||||
var manifest = new AndroidManifest(path.join(__dirname, '../../app/src/main/AndroidManifest.xml'));
|
||||
var pkgName = manifest.getPackageId();
|
||||
var launchName = pkgName + '/.' + manifest.getActivity().getName();
|
||||
events.emit('log', 'Using apk: ' + apk_path);
|
||||
events.emit('log', 'Package name: ' + pkgName);
|
||||
|
||||
return Adb.install(resolvedTarget.target, apk_path, { replace: true }).catch(function (error) {
|
||||
// CB-9557 CB-10157 only uninstall and reinstall app if the one that
|
||||
// is already installed on device was signed w/different certificate
|
||||
if (!/INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES/.test(error.toString())) { throw error; }
|
||||
|
||||
events.emit('warn', 'Uninstalling app from device and reinstalling it again because the ' +
|
||||
'installed app already signed with different key');
|
||||
|
||||
// This promise is always resolved, even if 'adb uninstall' fails to uninstall app
|
||||
// or the app doesn't installed at all, so no error catching needed.
|
||||
return Adb.uninstall(resolvedTarget.target, pkgName).then(function () {
|
||||
return Adb.install(resolvedTarget.target, apk_path, { replace: true });
|
||||
});
|
||||
}).then(function () {
|
||||
// unlock screen
|
||||
return Adb.shell(resolvedTarget.target, 'input keyevent 82');
|
||||
}).then(function () {
|
||||
return Adb.start(resolvedTarget.target, launchName);
|
||||
}).then(function () {
|
||||
events.emit('log', 'LAUNCH SUCCESS');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
688
bin/templates/cordova/lib/emulator.js
vendored
688
bin/templates/cordova/lib/emulator.js
vendored
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
@@ -19,52 +17,83 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var shell = require('shelljs'),
|
||||
path = require('path'),
|
||||
appinfo = require('./appinfo'),
|
||||
build = require('./build'),
|
||||
ROOT = path.join(__dirname, '..', '..'),
|
||||
new_emulator = 'cordova_emulator';
|
||||
const execa = require('execa');
|
||||
const fs = require('fs-extra');
|
||||
var android_versions = require('android-versions');
|
||||
var retry = require('./retry');
|
||||
var build = require('./build');
|
||||
var path = require('path');
|
||||
var Adb = require('./Adb');
|
||||
var AndroidManifest = require('./AndroidManifest');
|
||||
var events = require('cordova-common').events;
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
var android_sdk = require('./android_sdk');
|
||||
var check_reqs = require('./check_reqs');
|
||||
var which = require('which');
|
||||
var os = require('os');
|
||||
|
||||
/**
|
||||
* Returns a list of emulator images in the form of objects
|
||||
* {
|
||||
name : <emulator_name>,
|
||||
path : <path_to_emulator_image>,
|
||||
target : <api_target>,
|
||||
abi : <cpu>,
|
||||
skin : <skin>
|
||||
}
|
||||
*/
|
||||
module.exports.list_images = function() {
|
||||
var cmd = 'android list avds';
|
||||
var result = shell.exec(cmd, {silent:true, async:false});
|
||||
if (result.code > 0) {
|
||||
console.error('Failed to execute android command \'' + cmd + '\'.');
|
||||
process.exit(2);
|
||||
} else {
|
||||
var response = result.output.split('\n');
|
||||
// constants
|
||||
const ONE_SECOND = 1000; // in milliseconds
|
||||
const ONE_MINUTE = 60 * ONE_SECOND; // in milliseconds
|
||||
const INSTALL_COMMAND_TIMEOUT = 5 * ONE_MINUTE; // in milliseconds
|
||||
const NUM_INSTALL_RETRIES = 3;
|
||||
const CHECK_BOOTED_INTERVAL = 3 * ONE_SECOND; // in milliseconds
|
||||
const EXEC_KILL_SIGNAL = 'SIGKILL';
|
||||
|
||||
function forgivingWhichSync (cmd) {
|
||||
const whichResult = which.sync(cmd, { nothrow: true });
|
||||
|
||||
// On null, returns empty string to maintain backwards compatibility
|
||||
// realpathSync follows symlinks
|
||||
return whichResult === null ? '' : fs.realpathSync(whichResult);
|
||||
}
|
||||
|
||||
module.exports.list_images_using_avdmanager = function () {
|
||||
return execa('avdmanager', ['list', 'avd']).then(({ stdout: output }) => {
|
||||
var response = output.split('\n');
|
||||
var emulator_list = [];
|
||||
for (var i = 1; i < response.length; i++) {
|
||||
// To return more detailed information use img_obj
|
||||
var img_obj = {};
|
||||
if (response[i].match(/Name:\s/)) {
|
||||
img_obj['name'] = response[i].split('Name: ')[1].replace('\r', '');
|
||||
img_obj.name = response[i].split('Name: ')[1].replace('\r', '');
|
||||
if (response[i + 1].match(/Device:\s/)) {
|
||||
i++;
|
||||
img_obj.device = response[i].split('Device: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/Path:\s/)) {
|
||||
i++;
|
||||
img_obj['path'] = response[i].split('Path: ')[1].replace('\r', '');
|
||||
img_obj.path = response[i].split('Path: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/\(API\slevel\s/)) {
|
||||
if (response[i + 1].match(/Target:\s/)) {
|
||||
i++;
|
||||
img_obj['target'] = response[i].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/ABI:\s/)) {
|
||||
i++;
|
||||
img_obj['abi'] = response[i].split('ABI: ')[1].replace('\r', '');
|
||||
if (response[i + 1].match(/ABI:\s/)) {
|
||||
img_obj.abi = response[i + 1].split('ABI: ')[1].replace('\r', '');
|
||||
}
|
||||
// This next conditional just aims to match the old output of `android list avd`
|
||||
// We do so so that we don't have to change the logic when parsing for the
|
||||
// best emulator target to spawn (see below in `best_image`)
|
||||
// This allows us to transitionally support both `android` and `avdmanager` binaries,
|
||||
// depending on what SDK version the user has
|
||||
if (response[i + 1].match(/Based\son:\s/)) {
|
||||
img_obj.target = response[i + 1].split('Based on:')[1];
|
||||
if (img_obj.target.match(/Tag\/ABI:\s/)) {
|
||||
img_obj.target = img_obj.target.split('Tag/ABI:')[0].replace('\r', '').trim();
|
||||
if (img_obj.target.indexOf('(') > -1) {
|
||||
img_obj.target = img_obj.target.substr(0, img_obj.target.indexOf('(') - 1).trim();
|
||||
}
|
||||
}
|
||||
var version_string = img_obj.target.replace(/Android\s+/, '');
|
||||
|
||||
var api_level = android_sdk.version_string_to_api_level[version_string];
|
||||
if (api_level) {
|
||||
img_obj.target += ' (API level ' + api_level + ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (response[i + 1].match(/Skin:\s/)) {
|
||||
i++;
|
||||
img_obj['skin'] = response[i].split('Skin: ')[1].replace('\r', '');
|
||||
img_obj.skin = response[i].split('Skin: ')[1].replace('\r', '');
|
||||
}
|
||||
|
||||
emulator_list.push(img_obj);
|
||||
@@ -72,266 +101,417 @@ module.exports.list_images = function() {
|
||||
/* To just return a list of names use this
|
||||
if (response[i].match(/Name:\s/)) {
|
||||
emulator_list.push(response[i].split('Name: ')[1].replace('\r', '');
|
||||
}*/
|
||||
|
||||
} */
|
||||
}
|
||||
return emulator_list;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.list_images_using_android = function () {
|
||||
return execa('android', ['list', 'avd']).then(({ stdout: output }) => {
|
||||
var response = output.split('\n');
|
||||
var emulator_list = [];
|
||||
for (var i = 1; i < response.length; i++) {
|
||||
// To return more detailed information use img_obj
|
||||
var img_obj = {};
|
||||
if (response[i].match(/Name:\s/)) {
|
||||
img_obj.name = response[i].split('Name: ')[1].replace('\r', '');
|
||||
if (response[i + 1].match(/Device:\s/)) {
|
||||
i++;
|
||||
img_obj.device = response[i].split('Device: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/Path:\s/)) {
|
||||
i++;
|
||||
img_obj.path = response[i].split('Path: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/\(API\slevel\s/) || (response[i + 2] && response[i + 2].match(/\(API\slevel\s/))) {
|
||||
i++;
|
||||
var secondLine = response[i + 1].match(/\(API\slevel\s/) ? response[i + 1] : '';
|
||||
img_obj.target = (response[i] + secondLine).split('Target: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/ABI:\s/)) {
|
||||
i++;
|
||||
img_obj.abi = response[i].split('ABI: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/Skin:\s/)) {
|
||||
i++;
|
||||
img_obj.skin = response[i].split('Skin: ')[1].replace('\r', '');
|
||||
}
|
||||
|
||||
emulator_list.push(img_obj);
|
||||
}
|
||||
/* To just return a list of names use this
|
||||
if (response[i].match(/Name:\s/)) {
|
||||
emulator_list.push(response[i].split('Name: ')[1].replace('\r', '');
|
||||
} */
|
||||
}
|
||||
return emulator_list;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a Promise for a list of emulator images in the form of objects
|
||||
* {
|
||||
name : <emulator_name>,
|
||||
device : <device>,
|
||||
path : <path_to_emulator_image>,
|
||||
target : <api_target>,
|
||||
abi : <cpu>,
|
||||
skin : <skin>
|
||||
}
|
||||
*/
|
||||
module.exports.list_images = function () {
|
||||
return Promise.resolve().then(function () {
|
||||
if (forgivingWhichSync('avdmanager')) {
|
||||
return module.exports.list_images_using_avdmanager();
|
||||
} else if (forgivingWhichSync('android')) {
|
||||
return module.exports.list_images_using_android();
|
||||
} else {
|
||||
return Promise.reject(new CordovaError('Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?'));
|
||||
}
|
||||
}).then(function (avds) {
|
||||
// In case we're missing the Android OS version string from the target description, add it.
|
||||
return avds.map(function (avd) {
|
||||
if (avd.target && avd.target.indexOf('Android API') > -1 && avd.target.indexOf('API level') < 0) {
|
||||
var api_level = avd.target.match(/\d+/);
|
||||
if (api_level) {
|
||||
var level = android_versions.get(api_level);
|
||||
if (level) {
|
||||
avd.target = 'Android ' + level.semver + ' (API level ' + api_level + ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
return avd;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Will return the closest avd to the projects target
|
||||
* or undefined if no avds exist.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.best_image = function() {
|
||||
var project_target = this.get_target().replace('android-', '');
|
||||
var images = this.list_images();
|
||||
var closest = 9999;
|
||||
var best = images[0];
|
||||
for (i in images) {
|
||||
var target = images[i].target;
|
||||
if(target) {
|
||||
var num = target.split('(API level ')[1].replace(')', '');
|
||||
if (num == project_target) {
|
||||
return images[i];
|
||||
} else if (project_target - num < closest && project_target > num) {
|
||||
var closest = project_target - num;
|
||||
best = images[i];
|
||||
module.exports.best_image = function () {
|
||||
return this.list_images().then(function (images) {
|
||||
// Just return undefined if there is no images
|
||||
if (images.length === 0) return;
|
||||
|
||||
var closest = 9999;
|
||||
var best = images[0];
|
||||
var project_target = parseInt(check_reqs.get_target().replace('android-', ''));
|
||||
for (var i in images) {
|
||||
var target = images[i].target;
|
||||
if (target && target.indexOf('API level') > -1) {
|
||||
var num = parseInt(target.split('(API level ')[1].replace(')', ''));
|
||||
if (num === project_target) {
|
||||
return images[i];
|
||||
} else if (project_target - num < closest && project_target > num) {
|
||||
closest = project_target - num;
|
||||
best = images[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return best;
|
||||
}
|
||||
return best;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.list_started = function() {
|
||||
var cmd = 'adb devices';
|
||||
var result = shell.exec(cmd, {silent:true, async:false});
|
||||
if (result.code > 0) {
|
||||
console.error('Failed to execute android command \'' + cmd + '\'.');
|
||||
process.exit(2);
|
||||
} else {
|
||||
var response = result.output.split('\n');
|
||||
var started_emulator_list = [];
|
||||
for (var i = 1; i < response.length; i++) {
|
||||
if (response[i].match(/device/) && response[i].match(/emulator/)) {
|
||||
started_emulator_list.push(response[i].replace(/\tdevice/, '').replace('\r', ''));
|
||||
// Returns a promise.
|
||||
module.exports.list_started = function () {
|
||||
return Adb.devices({ emulators: true });
|
||||
};
|
||||
|
||||
// Returns a promise.
|
||||
// TODO: we should remove this, there's a more robust method under android_sdk.js
|
||||
module.exports.list_targets = function () {
|
||||
return execa('android', ['list', 'targets'], { cwd: os.tmpdir() }).then(({ stdout: output }) => {
|
||||
var target_out = output.split('\n');
|
||||
var targets = [];
|
||||
for (var i = target_out.length; i >= 0; i--) {
|
||||
if (target_out[i].match(/id:/)) {
|
||||
targets.push(targets[i].split(' ')[1]);
|
||||
}
|
||||
}
|
||||
return started_emulator_list;
|
||||
}
|
||||
}
|
||||
return targets;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.get_target = function() {
|
||||
var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'project.properties'));
|
||||
return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', '');
|
||||
}
|
||||
/*
|
||||
* Gets unused port for android emulator, between 5554 and 5584
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.get_available_port = function () {
|
||||
var self = this;
|
||||
|
||||
module.exports.list_targets = function() {
|
||||
var target_out = shell.exec('android list targets', {silent:true, async:false}).output.split('\n');
|
||||
var targets = [];
|
||||
for (var i = target_out.length; i >= 0; i--) {
|
||||
if(target_out[i].match(/id:/)) {
|
||||
targets.push(targets[i].split(' ')[1]);
|
||||
return self.list_started().then(function (emulators) {
|
||||
for (var p = 5584; p >= 5554; p -= 2) {
|
||||
if (emulators.indexOf('emulator-' + p) === -1) {
|
||||
events.emit('verbose', 'Found available port: ' + p);
|
||||
return p;
|
||||
}
|
||||
}
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
throw new CordovaError('Could not find an available avd port');
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Starts an emulator with the given ID,
|
||||
* and returns the started ID of that emulator.
|
||||
* If no ID is given it will used the first image availible,
|
||||
* if no image is availible it will error out (maybe create one?).
|
||||
* If no ID is given it will use the first image available,
|
||||
* if no image is available it will error out (maybe create one?).
|
||||
* If no boot timeout is given or the value is negative it will wait forever for
|
||||
* the emulator to boot
|
||||
*
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.start = function(emulator_ID) {
|
||||
var started_emulators = this.list_started();
|
||||
var num_started = started_emulators.length;
|
||||
if (typeof emulator_ID === 'undefined') {
|
||||
var emulator_list = this.list_images();
|
||||
if (emulator_list.length > 0) {
|
||||
emulator_ID = this.best_image().name;
|
||||
console.log('WARNING : no emulator specified, defaulting to ' + emulator_ID);
|
||||
} else {
|
||||
console.error('ERROR : No emulator images (avds) found, if you would like to create an');
|
||||
console.error(' avd follow the instructions provided here : ');
|
||||
console.error(' http://developer.android.com/tools/devices/index.html')
|
||||
console.error(' Or run \'android create avd --name <name> --target <targetID>\' ');
|
||||
console.error(' in on the command line.');
|
||||
process.exit(2);
|
||||
/*console.log('WARNING : no emulators availible, creating \'' + new_emulator + '\'.');
|
||||
this.create_image(new_emulator, this.get_target());
|
||||
emulator_ID = new_emulator;*/
|
||||
}
|
||||
}
|
||||
module.exports.start = function (emulator_ID, boot_timeout) {
|
||||
var self = this;
|
||||
|
||||
var pipe_null = (process.platform == 'win32' || process.platform == 'win64'? '> NUL' : '> /dev/null');
|
||||
var cmd = 'emulator -avd ' + emulator_ID + ' ' + pipe_null + ' &';
|
||||
if(process.platform == 'win32' || process.platform == 'win64') {
|
||||
cmd = '%comspec% /c start cmd /c ' + cmd;
|
||||
}
|
||||
var result = shell.exec(cmd, {silent:true, async:false}, function(code, output) {
|
||||
if (code > 0) {
|
||||
console.error('Failed to execute android command \'' + cmd + '\'.');
|
||||
console.error(output);
|
||||
process.exit(2);
|
||||
return Promise.resolve().then(function () {
|
||||
if (emulator_ID) return Promise.resolve(emulator_ID);
|
||||
|
||||
return self.best_image().then(function (best) {
|
||||
if (best && best.name) {
|
||||
events.emit('warn', 'No emulator specified, defaulting to ' + best.name);
|
||||
return best.name;
|
||||
}
|
||||
|
||||
var androidCmd = check_reqs.getAbsoluteAndroidCmd();
|
||||
return Promise.reject(new CordovaError('No emulator images (avds) found.\n' +
|
||||
'1. Download desired System Image by running: ' + androidCmd + ' sdk\n' +
|
||||
'2. Create an AVD by running: ' + androidCmd + ' avd\n' +
|
||||
'HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver\n'));
|
||||
});
|
||||
}).then(function (emulatorId) {
|
||||
return self.get_available_port().then(function (port) {
|
||||
// Figure out the directory the emulator binary runs in, and set the cwd to that directory.
|
||||
// Workaround for https://code.google.com/p/android/issues/detail?id=235461
|
||||
var emulator_dir = path.dirname(which.sync('emulator'));
|
||||
var args = ['-avd', emulatorId, '-port', port];
|
||||
// Don't wait for it to finish, since the emulator will probably keep running for a long time.
|
||||
execa('emulator', args, { stdio: 'inherit', detached: true, cwd: emulator_dir })
|
||||
.unref();
|
||||
|
||||
// wait for emulator to start
|
||||
events.emit('log', 'Waiting for emulator to start...');
|
||||
return self.wait_for_emulator(port);
|
||||
});
|
||||
}).then(function (emulatorId) {
|
||||
if (!emulatorId) { return Promise.reject(new CordovaError('Failed to start emulator')); }
|
||||
|
||||
// wait for emulator to boot up
|
||||
process.stdout.write('Waiting for emulator to boot (this may take a while)...');
|
||||
return self.wait_for_boot(emulatorId, boot_timeout).then(function (success) {
|
||||
if (success) {
|
||||
events.emit('log', 'BOOT COMPLETE');
|
||||
// unlock screen
|
||||
return Adb.shell(emulatorId, 'input keyevent 82').then(function () {
|
||||
// return the new emulator id for the started emulators
|
||||
return emulatorId;
|
||||
});
|
||||
} else {
|
||||
// We timed out waiting for the boot to happen
|
||||
return null;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Waits for an emulator to boot on a given port.
|
||||
* Returns this emulator's ID in a promise.
|
||||
*/
|
||||
module.exports.wait_for_emulator = function (port) {
|
||||
var self = this;
|
||||
return Promise.resolve().then(function () {
|
||||
var emulator_id = 'emulator-' + port;
|
||||
return Adb.shell(emulator_id, 'getprop dev.bootcomplete').then(function (output) {
|
||||
if (output.indexOf('1') >= 0) {
|
||||
return emulator_id;
|
||||
}
|
||||
return self.wait_for_emulator(port);
|
||||
}, function (error) {
|
||||
if ((error && error.message &&
|
||||
(error.message.indexOf('not found') > -1)) ||
|
||||
(error.message.indexOf('device offline') > -1) ||
|
||||
(error.message.indexOf('device still connecting') > -1) ||
|
||||
(error.message.indexOf('device still authorizing') > -1)) {
|
||||
// emulator not yet started, continue waiting
|
||||
return self.wait_for_emulator(port);
|
||||
} else {
|
||||
// something unexpected has happened
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Waits for the core android process of the emulator to start. Returns a
|
||||
* promise that resolves to a boolean indicating success. Not specifying a
|
||||
* time_remaining or passing a negative value will cause it to wait forever
|
||||
*/
|
||||
module.exports.wait_for_boot = function (emulator_id, time_remaining) {
|
||||
var self = this;
|
||||
return Adb.shell(emulator_id, 'getprop sys.boot_completed').then(function (output) {
|
||||
if (output.match(/1/)) {
|
||||
return true;
|
||||
} else if (time_remaining === 0) {
|
||||
return false;
|
||||
} else {
|
||||
process.stdout.write('.');
|
||||
|
||||
return new Promise(resolve => {
|
||||
const delay = time_remaining < CHECK_BOOTED_INTERVAL ? time_remaining : CHECK_BOOTED_INTERVAL;
|
||||
|
||||
setTimeout(() => {
|
||||
const updated_time = time_remaining >= 0 ? Math.max(time_remaining - CHECK_BOOTED_INTERVAL, 0) : time_remaining;
|
||||
resolve(self.wait_for_boot(emulator_id, updated_time));
|
||||
}, delay);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// wait for emulator to start
|
||||
console.log('Waiting for emulator...');
|
||||
var new_started = this.wait_for_emulator(num_started);
|
||||
var emulator_id;
|
||||
if (new_started.length > 1) {
|
||||
for (i in new_started) {
|
||||
console.log(new_started[i]);
|
||||
console.log(started_emulators.indexOf(new_started[i]));
|
||||
if (started_emulators.indexOf(new_started[i]) < 0) {
|
||||
emulator_id = new_started[i];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
emulator_id = new_started[0];
|
||||
}
|
||||
if (!emulator_id) {
|
||||
console.error('ERROR : Failed to start emulator, could not find new emulator');
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
//wait for emulator to boot up
|
||||
process.stdout.write('Booting up emulator (this may take a while)...');
|
||||
this.wait_for_boot(emulator_id);
|
||||
console.log('BOOT COMPLETE');
|
||||
|
||||
//unlock screen
|
||||
cmd = 'adb -s ' + emulator_id + ' shell input keyevent 82';
|
||||
shell.exec(cmd, {silent:false, async:false});
|
||||
|
||||
//return the new emulator id for the started emulators
|
||||
return emulator_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* Waits for the new emulator to apear on the started-emulator list.
|
||||
*/
|
||||
module.exports.wait_for_emulator = function(num_running) {
|
||||
var new_started = this.list_started();
|
||||
if (new_started.length > num_running) {
|
||||
return new_started;
|
||||
} else {
|
||||
this.sleep(1);
|
||||
return this.wait_for_emulator(num_running);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Waits for the boot animation property of the emulator to switch to 'stopped'
|
||||
*/
|
||||
module.exports.wait_for_boot = function(emulator_id) {
|
||||
var cmd;
|
||||
// ShellJS opens a lot of file handles, and the default on OS X is too small.
|
||||
// TODO : This is not working, need to find a better way to increese the ulimit.
|
||||
if(process.platform == 'win32' || process.platform == 'win64') {
|
||||
cmd = 'adb -s ' + emulator_id + ' shell getprop init.svc.bootanim';
|
||||
} else {
|
||||
cmd = 'ulimit -S -n 4096; adb -s ' + emulator_id + ' shell getprop init.svc.bootanim';
|
||||
}
|
||||
var boot_anim = shell.exec(cmd, {silent:true, async:false});
|
||||
if (boot_anim.output.match(/stopped/)) {
|
||||
return;
|
||||
} else {
|
||||
process.stdout.write('.');
|
||||
this.sleep(3);
|
||||
return this.wait_for_boot(emulator_id);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO : find a better way to wait for the emulator (maybe using async methods?)
|
||||
*/
|
||||
module.exports.sleep = function(time_sec) {
|
||||
if (process.platform == 'win32' || process.platform == 'win64') {
|
||||
shell.exec('ping 127.0.0.1 -n ' + time_sec, {silent:true, async:false});
|
||||
} else {
|
||||
shell.exec('sleep ' + time_sec, {silent:true, async:false});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Create avd
|
||||
* TODO : Enter the stdin input required to complete the creation of an avd.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.create_image = function(name, target) {
|
||||
console.log('Creating avd named ' + name);
|
||||
module.exports.create_image = function (name, target) {
|
||||
console.log('Creating new avd named ' + name);
|
||||
if (target) {
|
||||
var cmd = 'android create avd --name ' + name + ' --target ' + target;
|
||||
var create = shell.exec(cmd, {sient:false, async:false});
|
||||
if (create.error) {
|
||||
return execa('android', ['create', 'avd', '--name', name, '--target', target]).then(null, function (error) {
|
||||
console.error('ERROR : Failed to create emulator image : ');
|
||||
console.error(' Do you have the latest android targets including ' + target + '?');
|
||||
console.error(create.output);
|
||||
process.exit(2);
|
||||
}
|
||||
console.error(error.message);
|
||||
});
|
||||
} else {
|
||||
console.log('WARNING : Project target not found, creating avd with a different target but the project may fail to install.');
|
||||
var cmd = 'android create avd --name ' + name + ' --target ' + this.list_targets()[0];
|
||||
var create = shell.exec(cmd, {sient:false, async:false});
|
||||
if (create.error) {
|
||||
// TODO: there's a more robust method for finding targets in android_sdk.js
|
||||
return execa('android', ['create', 'avd', '--name', name, '--target', this.list_targets()[0]]).then(function () {
|
||||
// TODO: This seems like another error case, even though it always happens.
|
||||
console.error('ERROR : Unable to create an avd emulator, no targets found.');
|
||||
console.error('Ensure you have targets available by running the "android" command');
|
||||
return Promise.reject(new CordovaError());
|
||||
}, function (error) {
|
||||
console.error('ERROR : Failed to create emulator image : ');
|
||||
console.error(create.output);
|
||||
process.exit(2);
|
||||
}
|
||||
console.error('ERROR : Unable to create an avd emulator, no targets found.');
|
||||
console.error('Please insure you have targets availible by runing the "android" command').
|
||||
process.exit(2);
|
||||
console.error(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.resolveTarget = function (target) {
|
||||
return this.list_started().then(function (emulator_list) {
|
||||
if (emulator_list.length < 1) {
|
||||
return Promise.reject(new CordovaError('No running Android emulators found, please start an emulator before deploying your project.'));
|
||||
}
|
||||
|
||||
// default emulator
|
||||
target = target || emulator_list[0];
|
||||
if (emulator_list.indexOf(target) < 0) {
|
||||
return Promise.reject(new CordovaError('Unable to find target \'' + target + '\'. Failed to deploy to emulator.'));
|
||||
}
|
||||
|
||||
return build.detectArchitecture(target).then(function (arch) {
|
||||
return { target: target, arch: arch, isEmulator: true };
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Installs a previously built application on the emulator and launches it.
|
||||
* If no target is specified, then it picks one.
|
||||
* If no started emulators are found, error out.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.install = function(target) {
|
||||
var emulator_list = this.list_started();
|
||||
if (emulator_list.length < 1) {
|
||||
console.error('ERROR : No started emulators found, please start an emultor before deploying your project.');
|
||||
process.exit(2);
|
||||
/*console.log('WARNING : No started emulators found, attemting to start an avd...');
|
||||
this.start(this.best_image().name);*/
|
||||
}
|
||||
// default emulator
|
||||
target = typeof target !== 'undefined' ? target : emulator_list[0];
|
||||
if (emulator_list.indexOf(target) > -1) {
|
||||
console.log('Installing app on emulator...');
|
||||
var apk_path = build.get_apk();
|
||||
var cmd = 'adb -s ' + target + ' install -r ' + apk_path;
|
||||
var install = shell.exec(cmd, {sient:false, async:false});
|
||||
if (install.error || install.output.match(/Failure/)) {
|
||||
console.error('ERROR : Failed to install apk to emulator : ');
|
||||
console.error(install.output);
|
||||
process.exit(2);
|
||||
}
|
||||
module.exports.install = function (givenTarget, buildResults) {
|
||||
var target;
|
||||
// We need to find the proper path to the Android Manifest
|
||||
const manifestPath = path.join(__dirname, '..', '..', 'app', 'src', 'main', 'AndroidManifest.xml');
|
||||
const manifest = new AndroidManifest(manifestPath);
|
||||
const pkgName = manifest.getPackageId();
|
||||
|
||||
//unlock screen
|
||||
cmd = 'adb -s ' + target + ' shell input keyevent 82';
|
||||
shell.exec(cmd, {silent:true, async:false});
|
||||
|
||||
// launch the application
|
||||
console.log('Launching application...');
|
||||
var launchName = appinfo.getActivityName();
|
||||
cmd = 'adb -s ' + target + ' shell am start -W -a android.intent.action.MAIN -n ' + launchName;
|
||||
console.log(cmd);
|
||||
var launch = shell.exec(cmd, {silent:false, async:false});
|
||||
if(launch.code > 0) {
|
||||
console.error('ERROR : Failed to launch application on emulator : ' + launch.error);
|
||||
console.error(launch.output);
|
||||
process.exit(2);
|
||||
// resolve the target emulator
|
||||
return Promise.resolve().then(function () {
|
||||
if (givenTarget && typeof givenTarget === 'object') {
|
||||
return givenTarget;
|
||||
} else {
|
||||
console.log('LANCH SUCCESS');
|
||||
return module.exports.resolveTarget(givenTarget);
|
||||
}
|
||||
} else {
|
||||
console.error('ERROR : Unable to find target \'' + target + '\'.');
|
||||
console.error('Failed to deploy to emulator.');
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
// set the resolved target
|
||||
}).then(function (resolvedTarget) {
|
||||
target = resolvedTarget;
|
||||
|
||||
// install the app
|
||||
}).then(function () {
|
||||
// This promise is always resolved, even if 'adb uninstall' fails to uninstall app
|
||||
// or the app doesn't installed at all, so no error catching needed.
|
||||
return Promise.resolve().then(function () {
|
||||
var apk_path = build.findBestApkForArchitecture(buildResults, target.arch);
|
||||
var execOptions = {
|
||||
cwd: os.tmpdir(),
|
||||
timeout: INSTALL_COMMAND_TIMEOUT, // in milliseconds
|
||||
killSignal: EXEC_KILL_SIGNAL
|
||||
};
|
||||
|
||||
events.emit('log', 'Using apk: ' + apk_path);
|
||||
events.emit('log', 'Package name: ' + pkgName);
|
||||
events.emit('verbose', 'Installing app on emulator...');
|
||||
|
||||
// A special function to call adb install in specific environment w/ specific options.
|
||||
// Introduced as a part of fix for http://issues.apache.org/jira/browse/CB-9119
|
||||
// to workaround sporadic emulator hangs
|
||||
function adbInstallWithOptions (target, apk, opts) {
|
||||
events.emit('verbose', 'Installing apk ' + apk + ' on ' + target + '...');
|
||||
|
||||
const args = ['-s', target, 'install', '-r', apk];
|
||||
return execa('adb', args, opts).then(({ stdout }) => {
|
||||
// adb does not return an error code even if installation fails. Instead it puts a specific
|
||||
// message to stdout, so we have to use RegExp matching to detect installation failure.
|
||||
if (/Failure/.test(stdout)) {
|
||||
if (stdout.match(/INSTALL_PARSE_FAILED_NO_CERTIFICATES/)) {
|
||||
stdout += 'Sign the build using \'-- --keystore\' or \'--buildConfig\'' +
|
||||
' or sign and deploy the unsigned apk manually using Android tools.';
|
||||
} else if (stdout.match(/INSTALL_FAILED_VERSION_DOWNGRADE/)) {
|
||||
stdout += 'You\'re trying to install apk with a lower versionCode that is already installed.' +
|
||||
'\nEither uninstall an app or increment the versionCode.';
|
||||
}
|
||||
|
||||
throw new CordovaError('Failed to install apk to emulator: ' + stdout);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function installPromise () {
|
||||
return adbInstallWithOptions(target.target, apk_path, execOptions).catch(function (error) {
|
||||
// CB-9557 CB-10157 only uninstall and reinstall app if the one that
|
||||
// is already installed on device was signed w/different certificate
|
||||
if (!/INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES/.test(error.toString())) { throw error; }
|
||||
|
||||
events.emit('warn', 'Uninstalling app from device and reinstalling it because the ' +
|
||||
'currently installed app was signed with different key');
|
||||
|
||||
// This promise is always resolved, even if 'adb uninstall' fails to uninstall app
|
||||
// or the app doesn't installed at all, so no error catching needed.
|
||||
return Adb.uninstall(target.target, pkgName).then(function () {
|
||||
return adbInstallWithOptions(target.target, apk_path, execOptions);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return retry.retryPromise(NUM_INSTALL_RETRIES, installPromise).then(function (output) {
|
||||
events.emit('log', 'INSTALL SUCCESS');
|
||||
});
|
||||
});
|
||||
// unlock screen
|
||||
}).then(function () {
|
||||
events.emit('verbose', 'Unlocking screen...');
|
||||
return Adb.shell(target.target, 'input keyevent 82');
|
||||
}).then(function () {
|
||||
Adb.start(target.target, pkgName + '/.' + manifest.getActivity().getName());
|
||||
// report success or failure
|
||||
}).then(function (output) {
|
||||
events.emit('log', 'LAUNCH SUCCESS');
|
||||
});
|
||||
};
|
||||
|
||||
3
bin/templates/cordova/lib/getASPath.bat
Normal file
3
bin/templates/cordova/lib/getASPath.bat
Normal file
@@ -0,0 +1,3 @@
|
||||
@ECHO OFF
|
||||
for /f "tokens=2*" %%a in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Android Studio" /v Path') do set "ASPath=%%~b"
|
||||
ECHO %ASPath%
|
||||
@@ -19,20 +19,24 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var device = require('./device'),
|
||||
args = process.argv;
|
||||
var device = require('./device');
|
||||
var args = process.argv;
|
||||
|
||||
if(args.length > 2) {
|
||||
if (args.length > 2) {
|
||||
var install_target;
|
||||
if (args[2].substring(0, 9) == '--target=') {
|
||||
if (args[2].substring(0, 9) === '--target=') {
|
||||
install_target = args[2].substring(9, args[2].length);
|
||||
device.install(install_target);
|
||||
process.exit(0);
|
||||
} else {
|
||||
device.install(install_target).catch(function (err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
} else {
|
||||
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
device.install();
|
||||
process.exit(0);
|
||||
}
|
||||
device.install().catch(function (err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0install-device"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'install-device' script in 'cordova\lib' folder, aborting...>&2
|
||||
|
||||
@@ -19,20 +19,20 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var emulator = require('./emulator'),
|
||||
args = process.argv;
|
||||
var emulator = require('./emulator');
|
||||
var args = process.argv;
|
||||
|
||||
if(args.length > 2) {
|
||||
var install_target;
|
||||
if (args[2].substring(0, 9) == '--target=') {
|
||||
var install_target;
|
||||
if (args.length > 2) {
|
||||
if (args[2].substring(0, 9) === '--target=') {
|
||||
install_target = args[2].substring(9, args[2].length);
|
||||
emulator.install(install_target);
|
||||
process.exit(0);
|
||||
} else {
|
||||
} else {
|
||||
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
|
||||
process.exit(2);
|
||||
}
|
||||
} else {
|
||||
emulator.install();
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
emulator.install(install_target).catch(function (err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0install-emulator"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'install-emulator' script in 'cordova\lib' folder, aborting...>&2
|
||||
|
||||
@@ -22,7 +22,13 @@
|
||||
var devices = require('./device');
|
||||
|
||||
// Usage support for when args are given
|
||||
var device_list = devices.list();
|
||||
for(device in device_list) {
|
||||
console.log(device_list[device]);
|
||||
}
|
||||
require('./check_reqs').check_android().then(function () {
|
||||
devices.list().then(function (device_list) {
|
||||
device_list && device_list.forEach(function (dev) {
|
||||
console.log(dev);
|
||||
});
|
||||
}, function (err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0list-devices"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'list-devices' script in 'cordova\lib' folder, aborting...>&2
|
||||
|
||||
@@ -22,8 +22,13 @@
|
||||
var emulators = require('./emulator');
|
||||
|
||||
// Usage support for when args are given
|
||||
var emulator_list = emulators.list_images();
|
||||
for(emulator in emulator_list) {
|
||||
console.log(emulator_list[emulator].name);
|
||||
process.exit(0);
|
||||
}
|
||||
require('./check_reqs').check_android().then(function () {
|
||||
emulators.list_images().then(function (emulator_list) {
|
||||
emulator_list && emulator_list.forEach(function (emu) {
|
||||
console.log(emu.name);
|
||||
});
|
||||
}, function (err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,9 +18,9 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0list-emulator-images"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'list-emulator-images' script in 'cordova\lib' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
|
||||
@@ -22,8 +22,13 @@
|
||||
var emulators = require('./emulator');
|
||||
|
||||
// Usage support for when args are given
|
||||
var emulator_list = emulators.list_started();
|
||||
for(emulator in emulator_list) {
|
||||
console.log(emulator_list[emulator]);
|
||||
process.exit(0);
|
||||
}
|
||||
require('./check_reqs').check_android().then(function () {
|
||||
emulators.list_started().then(function (emulator_list) {
|
||||
emulator_list && emulator_list.forEach(function (emu) {
|
||||
console.log(emu);
|
||||
});
|
||||
}, function (err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0list-started-emulators"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'list-started-emulators' script in 'cordova\lib' folder, aborting...>&2
|
||||
|
||||
36
bin/templates/cordova/lib/log.js
vendored
36
bin/templates/cordova/lib/log.js
vendored
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
@@ -19,25 +17,29 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var shell = require('shelljs'),
|
||||
path = require('path'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
var path = require('path');
|
||||
var os = require('os');
|
||||
var execa = require('execa');
|
||||
var ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
/*
|
||||
* Starts running logcat in the shell.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.run = function() {
|
||||
var cmd = 'adb logcat | grep -v nativeGetEnabledTags';
|
||||
var result = shell.exec(cmd, {silent:false, async:false});
|
||||
if (result.code > 0) {
|
||||
console.error('ERROR: Failed to run logcat command.');
|
||||
console.error(result.output);
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
module.exports.run = function () {
|
||||
var adb = execa('adb', ['logcat'], { cwd: os.tmpdir(), stderr: 'inherit' });
|
||||
|
||||
module.exports.help = function() {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'corodva', 'log')));
|
||||
adb.stdout.on('data', function (data) {
|
||||
var lines = data ? data.toString().split('\n') : [];
|
||||
var out = lines.filter(function (x) { return x.indexOf('nativeGetEnabledTags') < 0; });
|
||||
console.log(out.join('\n'));
|
||||
});
|
||||
|
||||
return adb;
|
||||
};
|
||||
|
||||
module.exports.help = function () {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'cordova', 'log')));
|
||||
console.log('Gives the logcat output on the command line.');
|
||||
process.exit(0);
|
||||
}
|
||||
};
|
||||
|
||||
69
bin/templates/cordova/lib/plugin-build.gradle
Normal file
69
bin/templates/cordova/lib/plugin-build.gradle
Normal file
@@ -0,0 +1,69 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
// GENERATED FILE! DO NOT EDIT!
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
// Switch the Android Gradle plugin version requirement depending on the
|
||||
// installed version of Gradle. This dependency is documented at
|
||||
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
|
||||
// and https://issues.apache.org/jira/browse/CB-8143
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.0.0+'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: '*.jar')
|
||||
debugCompile project(path: ":CordovaLib", configuration: "debug")
|
||||
releaseCompile project(path: ":CordovaLib", configuration: "release")
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion cdvCompileSdkVersion
|
||||
buildToolsVersion cdvBuildToolsVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_6
|
||||
targetCompatibility JavaVersion.VERSION_1_6
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
resources.srcDirs = ['src']
|
||||
aidl.srcDirs = ['src']
|
||||
renderscript.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
assets.srcDirs = ['assets']
|
||||
jniLibs.srcDirs = ['libs']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file('build-extras.gradle').exists()) {
|
||||
apply from: 'build-extras.gradle'
|
||||
}
|
||||
323
bin/templates/cordova/lib/pluginHandlers.js
vendored
Normal file
323
bin/templates/cordova/lib/pluginHandlers.js
vendored
Normal file
@@ -0,0 +1,323 @@
|
||||
/*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
var fs = require('fs-extra');
|
||||
var path = require('path');
|
||||
var events = require('cordova-common').events;
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
|
||||
var handlers = {
|
||||
'source-file': {
|
||||
install: function (obj, plugin, project, options) {
|
||||
if (!obj.src) throw new CordovaError(generateAttributeError('src', 'source-file', plugin.id));
|
||||
if (!obj.targetDir) throw new CordovaError(generateAttributeError('target-dir', 'source-file', plugin.id));
|
||||
|
||||
var dest = getInstallDestination(obj);
|
||||
|
||||
if (options && options.force) {
|
||||
copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
|
||||
} else {
|
||||
copyNewFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
|
||||
}
|
||||
},
|
||||
uninstall: function (obj, plugin, project, options) {
|
||||
var dest = getInstallDestination(obj);
|
||||
|
||||
// TODO: Add Koltin extension to uninstall, since they are handled like Java files
|
||||
if (obj.src.endsWith('java')) {
|
||||
deleteJava(project.projectDir, dest);
|
||||
} else {
|
||||
// Just remove the file, not the whole parent directory
|
||||
removeFile(path.resolve(project.projectDir, dest));
|
||||
}
|
||||
}
|
||||
},
|
||||
'lib-file': {
|
||||
install: function (obj, plugin, project, options) {
|
||||
var dest = path.join('app/libs', path.basename(obj.src));
|
||||
copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
|
||||
},
|
||||
uninstall: function (obj, plugin, project, options) {
|
||||
var dest = path.join('app/libs', path.basename(obj.src));
|
||||
removeFile(path.resolve(project.projectDir, dest));
|
||||
}
|
||||
},
|
||||
'resource-file': {
|
||||
install: function (obj, plugin, project, options) {
|
||||
var dest = path.join('app', 'src', 'main', obj.target);
|
||||
copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
|
||||
},
|
||||
uninstall: function (obj, plugin, project, options) {
|
||||
var dest = path.join('app', 'src', 'main', obj.target);
|
||||
removeFile(path.resolve(project.projectDir, dest));
|
||||
}
|
||||
},
|
||||
framework: {
|
||||
install: function (obj, plugin, project, options) {
|
||||
var src = obj.src;
|
||||
if (!src) throw new CordovaError(generateAttributeError('src', 'framework', plugin.id));
|
||||
|
||||
events.emit('verbose', 'Installing Android library: ' + src);
|
||||
var parentDir = obj.parent ? path.resolve(project.projectDir, obj.parent) : project.projectDir;
|
||||
var subDir;
|
||||
|
||||
if (obj.custom) {
|
||||
var subRelativeDir = project.getCustomSubprojectRelativeDir(plugin.id, src);
|
||||
copyNewFile(plugin.dir, src, project.projectDir, subRelativeDir, !!(options && options.link));
|
||||
subDir = path.resolve(project.projectDir, subRelativeDir);
|
||||
} else {
|
||||
obj.type = 'sys';
|
||||
subDir = src;
|
||||
}
|
||||
|
||||
if (obj.type === 'gradleReference') {
|
||||
project.addGradleReference(parentDir, subDir);
|
||||
} else if (obj.type === 'sys') {
|
||||
project.addSystemLibrary(parentDir, subDir);
|
||||
} else {
|
||||
project.addSubProject(parentDir, subDir);
|
||||
}
|
||||
},
|
||||
uninstall: function (obj, plugin, project, options) {
|
||||
var src = obj.src;
|
||||
if (!src) throw new CordovaError(generateAttributeError('src', 'framework', plugin.id));
|
||||
|
||||
events.emit('verbose', 'Uninstalling Android library: ' + src);
|
||||
var parentDir = obj.parent ? path.resolve(project.projectDir, obj.parent) : project.projectDir;
|
||||
var subDir;
|
||||
|
||||
if (obj.custom) {
|
||||
var subRelativeDir = project.getCustomSubprojectRelativeDir(plugin.id, src);
|
||||
removeFile(path.resolve(project.projectDir, subRelativeDir));
|
||||
subDir = path.resolve(project.projectDir, subRelativeDir);
|
||||
// If it's the last framework in the plugin, remove the parent directory.
|
||||
var parDir = path.dirname(subDir);
|
||||
if (fs.existsSync(parDir) && fs.readdirSync(parDir).length === 0) {
|
||||
fs.rmdirSync(parDir);
|
||||
}
|
||||
} else {
|
||||
obj.type = 'sys';
|
||||
subDir = src;
|
||||
}
|
||||
|
||||
if (obj.type === 'gradleReference') {
|
||||
project.removeGradleReference(parentDir, subDir);
|
||||
} else if (obj.type === 'sys') {
|
||||
project.removeSystemLibrary(parentDir, subDir);
|
||||
} else {
|
||||
project.removeSubProject(parentDir, subDir);
|
||||
}
|
||||
}
|
||||
},
|
||||
asset: {
|
||||
install: function (obj, plugin, project, options) {
|
||||
if (!obj.src) {
|
||||
throw new CordovaError(generateAttributeError('src', 'asset', plugin.id));
|
||||
}
|
||||
if (!obj.target) {
|
||||
throw new CordovaError(generateAttributeError('target', 'asset', plugin.id));
|
||||
}
|
||||
|
||||
copyFile(plugin.dir, obj.src, project.www, obj.target);
|
||||
if (options && options.usePlatformWww) {
|
||||
// CB-11022 copy file to both directories if usePlatformWww is specified
|
||||
copyFile(plugin.dir, obj.src, project.platformWww, obj.target);
|
||||
}
|
||||
},
|
||||
uninstall: function (obj, plugin, project, options) {
|
||||
var target = obj.target || obj.src;
|
||||
|
||||
if (!target) throw new CordovaError(generateAttributeError('target', 'asset', plugin.id));
|
||||
|
||||
removeFile(path.resolve(project.www, target));
|
||||
removeFile(path.resolve(project.www, 'plugins', plugin.id));
|
||||
if (options && options.usePlatformWww) {
|
||||
// CB-11022 remove file from both directories if usePlatformWww is specified
|
||||
removeFile(path.resolve(project.platformWww, target));
|
||||
removeFile(path.resolve(project.platformWww, 'plugins', plugin.id));
|
||||
}
|
||||
}
|
||||
},
|
||||
'js-module': {
|
||||
install: function (obj, plugin, project, options) {
|
||||
// Copy the plugin's files into the www directory.
|
||||
var moduleSource = path.resolve(plugin.dir, obj.src);
|
||||
var moduleName = plugin.id + '.' + (obj.name || path.basename(obj.src, path.extname(obj.src)));
|
||||
|
||||
// Read in the file, prepend the cordova.define, and write it back out.
|
||||
var scriptContent = fs.readFileSync(moduleSource, 'utf-8').replace(/^\ufeff/, ''); // Window BOM
|
||||
if (moduleSource.match(/.*\.json$/)) {
|
||||
scriptContent = 'module.exports = ' + scriptContent;
|
||||
}
|
||||
scriptContent = 'cordova.define("' + moduleName + '", function(require, exports, module) {\n' + scriptContent + '\n});\n';
|
||||
|
||||
var wwwDest = path.resolve(project.www, 'plugins', plugin.id, obj.src);
|
||||
fs.ensureDirSync(path.dirname(wwwDest));
|
||||
fs.writeFileSync(wwwDest, scriptContent, 'utf-8');
|
||||
|
||||
if (options && options.usePlatformWww) {
|
||||
// CB-11022 copy file to both directories if usePlatformWww is specified
|
||||
var platformWwwDest = path.resolve(project.platformWww, 'plugins', plugin.id, obj.src);
|
||||
fs.ensureDirSync(path.dirname(platformWwwDest));
|
||||
fs.writeFileSync(platformWwwDest, scriptContent, 'utf-8');
|
||||
}
|
||||
},
|
||||
uninstall: function (obj, plugin, project, options) {
|
||||
var pluginRelativePath = path.join('plugins', plugin.id, obj.src);
|
||||
removeFileAndParents(project.www, pluginRelativePath);
|
||||
if (options && options.usePlatformWww) {
|
||||
// CB-11022 remove file from both directories if usePlatformWww is specified
|
||||
removeFileAndParents(project.platformWww, pluginRelativePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.getInstaller = function (type) {
|
||||
if (handlers[type] && handlers[type].install) {
|
||||
return handlers[type].install;
|
||||
}
|
||||
|
||||
events.emit('verbose', '<' + type + '> is not supported for android plugins');
|
||||
};
|
||||
|
||||
module.exports.getUninstaller = function (type) {
|
||||
if (handlers[type] && handlers[type].uninstall) {
|
||||
return handlers[type].uninstall;
|
||||
}
|
||||
|
||||
events.emit('verbose', '<' + type + '> is not supported for android plugins');
|
||||
};
|
||||
|
||||
function copyFile (plugin_dir, src, project_dir, dest, link) {
|
||||
src = path.resolve(plugin_dir, src);
|
||||
if (!fs.existsSync(src)) throw new CordovaError('"' + src + '" not found!');
|
||||
|
||||
// check that src path is inside plugin directory
|
||||
var real_path = fs.realpathSync(src);
|
||||
var real_plugin_path = fs.realpathSync(plugin_dir);
|
||||
if (real_path.indexOf(real_plugin_path) !== 0) { throw new CordovaError('File "' + src + '" is located outside the plugin directory "' + plugin_dir + '"'); }
|
||||
|
||||
dest = path.resolve(project_dir, dest);
|
||||
|
||||
// check that dest path is located in project directory
|
||||
if (dest.indexOf(project_dir) !== 0) { throw new CordovaError('Destination "' + dest + '" for source file "' + src + '" is located outside the project'); }
|
||||
|
||||
fs.ensureDirSync(path.dirname(dest));
|
||||
if (link) {
|
||||
symlinkFileOrDirTree(src, dest);
|
||||
} else {
|
||||
fs.copySync(src, dest);
|
||||
}
|
||||
}
|
||||
|
||||
// Same as copy file but throws error if target exists
|
||||
function copyNewFile (plugin_dir, src, project_dir, dest, link) {
|
||||
var target_path = path.resolve(project_dir, dest);
|
||||
if (fs.existsSync(target_path)) { throw new CordovaError('"' + target_path + '" already exists!'); }
|
||||
|
||||
copyFile(plugin_dir, src, project_dir, dest, !!link);
|
||||
}
|
||||
|
||||
function symlinkFileOrDirTree (src, dest) {
|
||||
if (fs.existsSync(dest)) {
|
||||
fs.removeSync(dest);
|
||||
}
|
||||
|
||||
if (fs.statSync(src).isDirectory()) {
|
||||
fs.ensureDirSync(path.dirname(dest));
|
||||
fs.readdirSync(src).forEach(function (entry) {
|
||||
symlinkFileOrDirTree(path.join(src, entry), path.join(dest, entry));
|
||||
});
|
||||
} else {
|
||||
fs.symlinkSync(path.relative(fs.realpathSync(path.dirname(dest)), src), dest);
|
||||
}
|
||||
}
|
||||
|
||||
function removeFile (file) {
|
||||
fs.removeSync(file);
|
||||
}
|
||||
|
||||
// Sometimes we want to remove some java, and prune any unnecessary empty directories
|
||||
function deleteJava (project_dir, destFile) {
|
||||
removeFileAndParents(project_dir, destFile, 'src');
|
||||
}
|
||||
|
||||
function removeFileAndParents (baseDir, destFile, stopper) {
|
||||
stopper = stopper || '.';
|
||||
var file = path.resolve(baseDir, destFile);
|
||||
if (!fs.existsSync(file)) return;
|
||||
|
||||
removeFile(file);
|
||||
|
||||
// check if directory is empty
|
||||
var curDir = path.dirname(file);
|
||||
|
||||
while (curDir !== path.resolve(baseDir, stopper)) {
|
||||
if (fs.existsSync(curDir) && fs.readdirSync(curDir).length === 0) {
|
||||
fs.rmdirSync(curDir);
|
||||
curDir = path.resolve(curDir, '..');
|
||||
} else {
|
||||
// directory not empty...do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateAttributeError (attribute, element, id) {
|
||||
return 'Required attribute "' + attribute + '" not specified in <' + element + '> element from plugin: ' + id;
|
||||
}
|
||||
|
||||
function getInstallDestination (obj) {
|
||||
var APP_MAIN_PREFIX = 'app/src/main';
|
||||
var PATH_SEPARATOR = '/';
|
||||
|
||||
var PATH_SEP_MATCH = '\\' + PATH_SEPARATOR;
|
||||
var PATH_SEP_OR_EOL_MATCH = '(\\' + PATH_SEPARATOR + '|$)';
|
||||
|
||||
var appReg = new RegExp('^app' + PATH_SEP_OR_EOL_MATCH);
|
||||
var libsReg = new RegExp('^libs' + PATH_SEP_OR_EOL_MATCH);
|
||||
var srcReg = new RegExp('^src' + PATH_SEP_OR_EOL_MATCH);
|
||||
var srcMainReg = new RegExp('^src' + PATH_SEP_MATCH + 'main' + PATH_SEP_OR_EOL_MATCH);
|
||||
|
||||
if (appReg.test(obj.targetDir)) {
|
||||
// If any source file is using the new app directory structure,
|
||||
// don't penalize it
|
||||
return path.join(obj.targetDir, path.basename(obj.src));
|
||||
} else {
|
||||
// Plugin using deprecated target directory structure (GH-580)
|
||||
if (obj.src.endsWith('.java')) {
|
||||
return path.join(APP_MAIN_PREFIX, 'java', obj.targetDir.replace(srcReg, ''),
|
||||
path.basename(obj.src));
|
||||
} else if (obj.src.endsWith('.aidl')) {
|
||||
return path.join(APP_MAIN_PREFIX, 'aidl', obj.targetDir.replace(srcReg, ''),
|
||||
path.basename(obj.src));
|
||||
} else if (libsReg.test(obj.targetDir)) {
|
||||
if (obj.src.endsWith('.so')) {
|
||||
return path.join(APP_MAIN_PREFIX, 'jniLibs', obj.targetDir.replace(libsReg, ''),
|
||||
path.basename(obj.src));
|
||||
} else {
|
||||
return path.join('app', obj.targetDir, path.basename(obj.src));
|
||||
}
|
||||
} else if (srcMainReg.test(obj.targetDir)) {
|
||||
return path.join('app', obj.targetDir, path.basename(obj.src));
|
||||
}
|
||||
|
||||
// For all other source files not using the new app directory structure,
|
||||
// add 'app/src/main' to the targetDir
|
||||
return path.join(APP_MAIN_PREFIX, obj.targetDir, path.basename(obj.src));
|
||||
}
|
||||
}
|
||||
738
bin/templates/cordova/lib/prepare.js
vendored
Normal file
738
bin/templates/cordova/lib/prepare.js
vendored
Normal file
@@ -0,0 +1,738 @@
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var fs = require('fs-extra');
|
||||
var path = require('path');
|
||||
const nopt = require('nopt');
|
||||
var events = require('cordova-common').events;
|
||||
var AndroidManifest = require('./AndroidManifest');
|
||||
var checkReqs = require('./check_reqs');
|
||||
var xmlHelpers = require('cordova-common').xmlHelpers;
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
var ConfigParser = require('cordova-common').ConfigParser;
|
||||
var FileUpdater = require('cordova-common').FileUpdater;
|
||||
var PlatformJson = require('cordova-common').PlatformJson;
|
||||
var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
|
||||
var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
|
||||
const utils = require('./utils');
|
||||
|
||||
const GradlePropertiesParser = require('./config/GradlePropertiesParser');
|
||||
|
||||
function parseArguments (argv) {
|
||||
return nopt({
|
||||
// `jvmargs` is a valid option however, we don't actually want to parse it because we want the entire string as is.
|
||||
// jvmargs: String
|
||||
}, {}, argv || [], 0);
|
||||
}
|
||||
|
||||
module.exports.prepare = function (cordovaProject, options) {
|
||||
var self = this;
|
||||
|
||||
let args = {};
|
||||
if (options && options.options) {
|
||||
args = parseArguments(options.options.argv);
|
||||
}
|
||||
|
||||
var platformJson = PlatformJson.load(this.locations.root, this.platform);
|
||||
var munger = new PlatformMunger(this.platform, this.locations.root, platformJson, new PluginInfoProvider());
|
||||
|
||||
this._config = updateConfigFilesFrom(cordovaProject.projectConfig, munger, this.locations);
|
||||
|
||||
// Get the min SDK version from config.xml
|
||||
const minSdkVersion = this._config.getPreference('android-minSdkVersion', 'android');
|
||||
const maxSdkVersion = this._config.getPreference('android-maxSdkVersion', 'android');
|
||||
const targetSdkVersion = this._config.getPreference('android-targetSdkVersion', 'android');
|
||||
const androidXEnabled = this._config.getPreference('AndroidXEnabled', 'android');
|
||||
const isGradlePluginKotlinEnabled = this._config.getPreference('GradlePluginKotlinEnabled', 'android');
|
||||
const gradlePluginKotlinCodeStyle = this._config.getPreference('GradlePluginKotlinCodeStyle', 'android');
|
||||
|
||||
const gradlePropertiesUserConfig = {};
|
||||
if (minSdkVersion) gradlePropertiesUserConfig.cdvMinSdkVersion = minSdkVersion;
|
||||
if (maxSdkVersion) gradlePropertiesUserConfig.cdvMaxSdkVersion = maxSdkVersion;
|
||||
if (targetSdkVersion) gradlePropertiesUserConfig.cdvTargetSdkVersion = targetSdkVersion;
|
||||
if (args.jvmargs) gradlePropertiesUserConfig['org.gradle.jvmargs'] = args.jvmargs;
|
||||
if (isGradlePluginKotlinEnabled) {
|
||||
gradlePropertiesUserConfig['kotlin.code.style'] = gradlePluginKotlinCodeStyle || 'official';
|
||||
}
|
||||
|
||||
// Both 'useAndroidX' and 'enableJetifier' are linked together.
|
||||
if (androidXEnabled) {
|
||||
gradlePropertiesUserConfig['android.useAndroidX'] = androidXEnabled;
|
||||
gradlePropertiesUserConfig['android.enableJetifier'] = androidXEnabled;
|
||||
}
|
||||
|
||||
const gradlePropertiesParser = new GradlePropertiesParser(this.locations.root);
|
||||
gradlePropertiesParser.configure(gradlePropertiesUserConfig);
|
||||
|
||||
// Update own www dir with project's www assets and plugins' assets and js-files
|
||||
return Promise.resolve(updateWww(cordovaProject, this.locations)).then(function () {
|
||||
// update project according to config.xml changes.
|
||||
return updateProjectAccordingTo(self._config, self.locations);
|
||||
}).then(function () {
|
||||
updateIcons(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
|
||||
updateSplashes(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
|
||||
updateFileResources(cordovaProject, path.relative(cordovaProject.root, self.locations.root));
|
||||
}).then(function () {
|
||||
events.emit('verbose', 'Prepared android project successfully');
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.clean = function (options) {
|
||||
// A cordovaProject isn't passed into the clean() function, because it might have
|
||||
// been called from the platform shell script rather than the CLI. Check for the
|
||||
// noPrepare option passed in by the non-CLI clean script. If that's present, or if
|
||||
// there's no config.xml found at the project root, then don't clean prepared files.
|
||||
var projectRoot = path.resolve(this.root, '../..');
|
||||
if ((options && options.noPrepare) || !fs.existsSync(this.locations.configXml) ||
|
||||
!fs.existsSync(this.locations.configXml)) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
var projectConfig = new ConfigParser(this.locations.configXml);
|
||||
|
||||
var self = this;
|
||||
return Promise.resolve().then(function () {
|
||||
cleanWww(projectRoot, self.locations);
|
||||
cleanIcons(projectRoot, projectConfig, path.relative(projectRoot, self.locations.res));
|
||||
cleanSplashes(projectRoot, projectConfig, path.relative(projectRoot, self.locations.res));
|
||||
cleanFileResources(projectRoot, projectConfig, path.relative(projectRoot, self.locations.root));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates config files in project based on app's config.xml and config munge,
|
||||
* generated by plugins.
|
||||
*
|
||||
* @param {ConfigParser} sourceConfig A project's configuration that will
|
||||
* be merged into platform's config.xml
|
||||
* @param {ConfigChanges} configMunger An initialized ConfigChanges instance
|
||||
* for this platform.
|
||||
* @param {Object} locations A map of locations for this platform
|
||||
*
|
||||
* @return {ConfigParser} An instance of ConfigParser, that
|
||||
* represents current project's configuration. When returned, the
|
||||
* configuration is already dumped to appropriate config.xml file.
|
||||
*/
|
||||
function updateConfigFilesFrom (sourceConfig, configMunger, locations) {
|
||||
events.emit('verbose', 'Generating platform-specific config.xml from defaults for android at ' + locations.configXml);
|
||||
|
||||
// First cleanup current config and merge project's one into own
|
||||
// Overwrite platform config.xml with defaults.xml.
|
||||
fs.copySync(locations.defaultConfigXml, locations.configXml);
|
||||
|
||||
// Then apply config changes from global munge to all config files
|
||||
// in project (including project's config)
|
||||
configMunger.reapply_global_munge().save_all();
|
||||
|
||||
events.emit('verbose', 'Merging project\'s config.xml into platform-specific android config.xml');
|
||||
// Merge changes from app's config.xml into platform's one
|
||||
var config = new ConfigParser(locations.configXml);
|
||||
xmlHelpers.mergeXml(sourceConfig.doc.getroot(),
|
||||
config.doc.getroot(), 'android', /* clobber= */true);
|
||||
|
||||
config.write();
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs all file operations via the verbose event stream, indented.
|
||||
*/
|
||||
function logFileOp (message) {
|
||||
events.emit('verbose', ' ' + message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates platform 'www' directory by replacing it with contents of
|
||||
* 'platform_www' and app www. Also copies project's overrides' folder into
|
||||
* the platform 'www' folder
|
||||
*
|
||||
* @param {Object} cordovaProject An object which describes cordova project.
|
||||
* @param {Object} destinations An object that contains destination
|
||||
* paths for www files.
|
||||
*/
|
||||
function updateWww (cordovaProject, destinations) {
|
||||
var sourceDirs = [
|
||||
path.relative(cordovaProject.root, cordovaProject.locations.www),
|
||||
path.relative(cordovaProject.root, destinations.platformWww)
|
||||
];
|
||||
|
||||
// If project contains 'merges' for our platform, use them as another overrides
|
||||
var merges_path = path.join(cordovaProject.root, 'merges', 'android');
|
||||
if (fs.existsSync(merges_path)) {
|
||||
events.emit('verbose', 'Found "merges/android" folder. Copying its contents into the android project.');
|
||||
sourceDirs.push(path.join('merges', 'android'));
|
||||
}
|
||||
|
||||
var targetDir = path.relative(cordovaProject.root, destinations.www);
|
||||
events.emit(
|
||||
'verbose', 'Merging and updating files from [' + sourceDirs.join(', ') + '] to ' + targetDir);
|
||||
FileUpdater.mergeAndUpdateDir(
|
||||
sourceDirs, targetDir, { rootDir: cordovaProject.root }, logFileOp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans all files from the platform 'www' directory.
|
||||
*/
|
||||
function cleanWww (projectRoot, locations) {
|
||||
var targetDir = path.relative(projectRoot, locations.www);
|
||||
events.emit('verbose', 'Cleaning ' + targetDir);
|
||||
|
||||
// No source paths are specified, so mergeAndUpdateDir() will clear the target directory.
|
||||
FileUpdater.mergeAndUpdateDir(
|
||||
[], targetDir, { rootDir: projectRoot, all: true }, logFileOp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates project structure and AndroidManifest according to project's configuration.
|
||||
*
|
||||
* @param {ConfigParser} platformConfig A project's configuration that will
|
||||
* be used to update project
|
||||
* @param {Object} locations A map of locations for this platform
|
||||
*/
|
||||
function updateProjectAccordingTo (platformConfig, locations) {
|
||||
// Update app name by editing res/values/strings.xml
|
||||
var strings = xmlHelpers.parseElementtreeSync(locations.strings);
|
||||
|
||||
var name = platformConfig.name();
|
||||
strings.find('string[@name="app_name"]').text = name.replace(/'/g, '\\\'');
|
||||
|
||||
var shortName = platformConfig.shortName && platformConfig.shortName();
|
||||
if (shortName && shortName !== name) {
|
||||
strings.find('string[@name="launcher_name"]').text = shortName.replace(/'/g, '\\\'');
|
||||
}
|
||||
|
||||
fs.writeFileSync(locations.strings, strings.write({ indent: 4 }), 'utf-8');
|
||||
events.emit('verbose', 'Wrote out android application name "' + name + '" to ' + locations.strings);
|
||||
|
||||
// Java packages cannot support dashes
|
||||
var androidPkgName = (platformConfig.android_packageName() || platformConfig.packageName()).replace(/-/g, '_');
|
||||
|
||||
var manifest = new AndroidManifest(locations.manifest);
|
||||
var manifestId = manifest.getPackageId();
|
||||
|
||||
manifest.getActivity()
|
||||
.setOrientation(platformConfig.getPreference('orientation'))
|
||||
.setLaunchMode(findAndroidLaunchModePreference(platformConfig));
|
||||
|
||||
manifest.setVersionName(platformConfig.version())
|
||||
.setVersionCode(platformConfig.android_versionCode() || default_versionCode(platformConfig.version()))
|
||||
.setPackageId(androidPkgName)
|
||||
.write();
|
||||
|
||||
// Java file paths shouldn't be hard coded
|
||||
const javaDirectory = path.join(locations.javaSrc, manifestId.replace(/\./g, '/'));
|
||||
const javaPattern = /\.java$/;
|
||||
const java_files = utils.scanDirectory(javaDirectory, javaPattern, true).filter(function (f) {
|
||||
return utils.grep(f, /extends\s+CordovaActivity/g) !== null;
|
||||
});
|
||||
|
||||
if (java_files.length === 0) {
|
||||
throw new CordovaError('No Java files found that extend CordovaActivity.');
|
||||
} else if (java_files.length > 1) {
|
||||
events.emit('log', 'Multiple candidate Java files that extend CordovaActivity found. Guessing at the first one, ' + java_files[0]);
|
||||
}
|
||||
|
||||
const destFile = java_files[0];
|
||||
|
||||
// var destFile = path.join(locations.root, 'app', 'src', 'main', 'java', androidPkgName.replace(/\./g, '/'), path.basename(java_files[0]));
|
||||
// fs.ensureDirSync(path.dirname(destFile));
|
||||
// events.emit('verbose', java_files[0]);
|
||||
// events.emit('verbose', destFile);
|
||||
// console.log(locations);
|
||||
// fs.copySync(java_files[0], destFile);
|
||||
utils.replaceFileContents(destFile, /package [\w.]*;/, 'package ' + androidPkgName + ';');
|
||||
events.emit('verbose', 'Wrote out Android package name "' + androidPkgName + '" to ' + destFile);
|
||||
|
||||
var removeOrigPkg = checkReqs.isWindows() || checkReqs.isDarwin()
|
||||
? manifestId.toUpperCase() !== androidPkgName.toUpperCase()
|
||||
: manifestId !== androidPkgName;
|
||||
|
||||
if (removeOrigPkg) {
|
||||
// If package was name changed we need to remove old java with main activity
|
||||
fs.removeSync(java_files[0]);
|
||||
// remove any empty directories
|
||||
var currentDir = path.dirname(java_files[0]);
|
||||
var sourcesRoot = path.resolve(locations.root, 'src');
|
||||
while (currentDir !== sourcesRoot) {
|
||||
if (fs.existsSync(currentDir) && fs.readdirSync(currentDir).length === 0) {
|
||||
fs.rmdirSync(currentDir);
|
||||
currentDir = path.resolve(currentDir, '..');
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Consturct the default value for versionCode as
|
||||
// PATCH + MINOR * 100 + MAJOR * 10000
|
||||
// see http://developer.android.com/tools/publishing/versioning.html
|
||||
function default_versionCode (version) {
|
||||
var nums = version.split('-')[0].split('.');
|
||||
var versionCode = 0;
|
||||
if (+nums[0]) {
|
||||
versionCode += +nums[0] * 10000;
|
||||
}
|
||||
if (+nums[1]) {
|
||||
versionCode += +nums[1] * 100;
|
||||
}
|
||||
if (+nums[2]) {
|
||||
versionCode += +nums[2];
|
||||
}
|
||||
|
||||
events.emit('verbose', 'android-versionCode not found in config.xml. Generating a code based on version in config.xml (' + version + '): ' + versionCode);
|
||||
return versionCode;
|
||||
}
|
||||
|
||||
function getImageResourcePath (resourcesDir, type, density, name, sourceName) {
|
||||
if (/\.9\.png$/.test(sourceName)) {
|
||||
name = name.replace(/\.png$/, '.9.png');
|
||||
}
|
||||
var resourcePath = path.join(resourcesDir, (density ? type + '-' + density : type), name);
|
||||
return resourcePath;
|
||||
}
|
||||
|
||||
function getAdaptiveImageResourcePath (resourcesDir, type, density, name, sourceName) {
|
||||
if (/\.9\.png$/.test(sourceName)) {
|
||||
name = name.replace(/\.png$/, '.9.png');
|
||||
}
|
||||
var resourcePath = path.join(resourcesDir, (density ? type + '-' + density + '-v26' : type), name);
|
||||
return resourcePath;
|
||||
}
|
||||
|
||||
function updateSplashes (cordovaProject, platformResourcesDir) {
|
||||
var resources = cordovaProject.projectConfig.getSplashScreens('android');
|
||||
|
||||
// if there are "splash" elements in config.xml
|
||||
if (resources.length === 0) {
|
||||
events.emit('verbose', 'This app does not have splash screens defined');
|
||||
return;
|
||||
}
|
||||
|
||||
var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'drawable', 'screen.png');
|
||||
|
||||
var hadMdpi = false;
|
||||
resources.forEach(function (resource) {
|
||||
if (!resource.density) {
|
||||
return;
|
||||
}
|
||||
if (resource.density === 'mdpi') {
|
||||
hadMdpi = true;
|
||||
}
|
||||
var targetPath = getImageResourcePath(
|
||||
platformResourcesDir, 'drawable', resource.density, 'screen.png', path.basename(resource.src));
|
||||
resourceMap[targetPath] = resource.src;
|
||||
});
|
||||
|
||||
// There's no "default" drawable, so assume default == mdpi.
|
||||
if (!hadMdpi && resources.defaultResource) {
|
||||
var targetPath = getImageResourcePath(
|
||||
platformResourcesDir, 'drawable', 'mdpi', 'screen.png', path.basename(resources.defaultResource.src));
|
||||
resourceMap[targetPath] = resources.defaultResource.src;
|
||||
}
|
||||
|
||||
events.emit('verbose', 'Updating splash screens at ' + platformResourcesDir);
|
||||
FileUpdater.updatePaths(
|
||||
resourceMap, { rootDir: cordovaProject.root }, logFileOp);
|
||||
}
|
||||
|
||||
function cleanSplashes (projectRoot, projectConfig, platformResourcesDir) {
|
||||
var resources = projectConfig.getSplashScreens('android');
|
||||
if (resources.length > 0) {
|
||||
var resourceMap = mapImageResources(projectRoot, platformResourcesDir, 'drawable', 'screen.png');
|
||||
events.emit('verbose', 'Cleaning splash screens at ' + platformResourcesDir);
|
||||
|
||||
// No source paths are specified in the map, so updatePaths() will delete the target files.
|
||||
FileUpdater.updatePaths(
|
||||
resourceMap, { rootDir: projectRoot, all: true }, logFileOp);
|
||||
}
|
||||
}
|
||||
|
||||
function updateIcons (cordovaProject, platformResourcesDir) {
|
||||
const icons = cordovaProject.projectConfig.getIcons('android');
|
||||
|
||||
// Skip if there are no app defined icons in config.xml
|
||||
if (icons.length === 0) {
|
||||
events.emit('verbose', 'This app does not have launcher icons defined');
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. loop icons determin if there is an error in the setup.
|
||||
// 2. during initial loop, also setup for legacy support.
|
||||
const errorMissingAttributes = [];
|
||||
const errorLegacyIconNeeded = [];
|
||||
let hasAdaptive = false;
|
||||
icons.forEach((icon, key) => {
|
||||
if (
|
||||
(icon.background && !icon.foreground) ||
|
||||
(!icon.background && icon.foreground) ||
|
||||
(!icon.background && !icon.foreground && !icon.src)
|
||||
) {
|
||||
errorMissingAttributes.push(icon.density ? icon.density : 'size=' + (icon.height || icon.width));
|
||||
}
|
||||
|
||||
if (icon.foreground) {
|
||||
hasAdaptive = true;
|
||||
|
||||
if (
|
||||
!icon.src &&
|
||||
(
|
||||
icon.foreground.startsWith('@color') ||
|
||||
path.extname(path.basename(icon.foreground)) === '.xml'
|
||||
)
|
||||
) {
|
||||
errorLegacyIconNeeded.push(icon.density ? icon.density : 'size=' + (icon.height || icon.width));
|
||||
} else if (!icon.src) {
|
||||
icons[key].src = icon.foreground;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const errorMessage = [];
|
||||
if (errorMissingAttributes.length > 0) {
|
||||
errorMessage.push('One of the following attributes are set but missing the other for the density type: ' + errorMissingAttributes.join(', ') + '. Please ensure that all require attributes are defined.');
|
||||
}
|
||||
|
||||
if (errorLegacyIconNeeded.length > 0) {
|
||||
errorMessage.push('For the following icons with the density of: ' + errorLegacyIconNeeded.join(', ') + ', adaptive foreground with a defined color or vector can not be used as a standard fallback icon for older Android devices. To support older Android environments, please provide a value for the src attribute.');
|
||||
}
|
||||
|
||||
if (errorMessage.length > 0) {
|
||||
throw new CordovaError(errorMessage.join(' '));
|
||||
}
|
||||
|
||||
let resourceMap = Object.assign(
|
||||
{},
|
||||
mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher.png'),
|
||||
mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher_foreground.png'),
|
||||
mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher_background.png'),
|
||||
mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher_foreground.xml'),
|
||||
mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher_background.xml'),
|
||||
mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher.xml')
|
||||
);
|
||||
|
||||
const preparedIcons = prepareIcons(icons);
|
||||
|
||||
if (hasAdaptive) {
|
||||
resourceMap = updateIconResourceForAdaptive(preparedIcons, resourceMap, platformResourcesDir);
|
||||
}
|
||||
|
||||
resourceMap = updateIconResourceForLegacy(preparedIcons, resourceMap, platformResourcesDir);
|
||||
|
||||
events.emit('verbose', 'Updating icons at ' + platformResourcesDir);
|
||||
FileUpdater.updatePaths(resourceMap, { rootDir: cordovaProject.root }, logFileOp);
|
||||
}
|
||||
|
||||
function updateIconResourceForAdaptive (preparedIcons, resourceMap, platformResourcesDir) {
|
||||
const android_icons = preparedIcons.android_icons;
|
||||
const default_icon = preparedIcons.default_icon;
|
||||
|
||||
// The source paths for icons and splashes are relative to
|
||||
// project's config.xml location, so we use it as base path.
|
||||
let background;
|
||||
let foreground;
|
||||
let targetPathBackground;
|
||||
let targetPathForeground;
|
||||
|
||||
for (const density in android_icons) {
|
||||
let backgroundVal = '@mipmap/ic_launcher_background';
|
||||
let foregroundVal = '@mipmap/ic_launcher_foreground';
|
||||
|
||||
background = android_icons[density].background;
|
||||
foreground = android_icons[density].foreground;
|
||||
|
||||
if (!background || !foreground) {
|
||||
// This icon isn't an adaptive icon, so skip it
|
||||
continue;
|
||||
}
|
||||
|
||||
if (background.startsWith('@color')) {
|
||||
// Colors Use Case
|
||||
backgroundVal = background; // Example: @color/background_foobar_1
|
||||
} else if (path.extname(path.basename(background)) === '.xml') {
|
||||
// Vector Use Case
|
||||
targetPathBackground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher_background.xml', path.basename(android_icons[density].background));
|
||||
resourceMap[targetPathBackground] = android_icons[density].background;
|
||||
} else if (path.extname(path.basename(background)) === '.png') {
|
||||
// Images Use Case
|
||||
targetPathBackground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher_background.png', path.basename(android_icons[density].background));
|
||||
resourceMap[targetPathBackground] = android_icons[density].background;
|
||||
}
|
||||
|
||||
if (foreground.startsWith('@color')) {
|
||||
// Colors Use Case
|
||||
foregroundVal = foreground;
|
||||
} else if (path.extname(path.basename(foreground)) === '.xml') {
|
||||
// Vector Use Case
|
||||
targetPathForeground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher_foreground.xml', path.basename(android_icons[density].foreground));
|
||||
resourceMap[targetPathForeground] = android_icons[density].foreground;
|
||||
} else if (path.extname(path.basename(foreground)) === '.png') {
|
||||
// Images Use Case
|
||||
targetPathForeground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher_foreground.png', path.basename(android_icons[density].foreground));
|
||||
resourceMap[targetPathForeground] = android_icons[density].foreground;
|
||||
}
|
||||
|
||||
// create an XML for DPI and set color
|
||||
const icLauncherTemplate = `<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="` + backgroundVal + `" />
|
||||
<foreground android:drawable="` + foregroundVal + `" />
|
||||
</adaptive-icon>`;
|
||||
|
||||
const launcherXmlPath = path.join(platformResourcesDir, 'mipmap-' + density + '-v26', 'ic_launcher.xml');
|
||||
|
||||
// Remove the XML from the resourceMap so the file does not get removed.
|
||||
delete resourceMap[launcherXmlPath];
|
||||
|
||||
fs.writeFileSync(path.resolve(launcherXmlPath), icLauncherTemplate);
|
||||
}
|
||||
|
||||
// There's no "default" drawable, so assume default == mdpi.
|
||||
if (default_icon && !android_icons.mdpi) {
|
||||
let defaultTargetPathBackground;
|
||||
let defaultTargetPathForeground;
|
||||
|
||||
if (background.startsWith('@color')) {
|
||||
// Colors Use Case
|
||||
targetPathBackground = default_icon.background;
|
||||
} else if (path.extname(path.basename(background)) === '.xml') {
|
||||
// Vector Use Case
|
||||
defaultTargetPathBackground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher_background.xml', path.basename(default_icon.background));
|
||||
resourceMap[defaultTargetPathBackground] = default_icon.background;
|
||||
} else if (path.extname(path.basename(background)) === '.png') {
|
||||
// Images Use Case
|
||||
defaultTargetPathBackground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher_background.png', path.basename(default_icon.background));
|
||||
resourceMap[defaultTargetPathBackground] = default_icon.background;
|
||||
}
|
||||
|
||||
if (foreground.startsWith('@color')) {
|
||||
// Colors Use Case
|
||||
targetPathForeground = default_icon.foreground;
|
||||
} else if (path.extname(path.basename(foreground)) === '.xml') {
|
||||
// Vector Use Case
|
||||
defaultTargetPathForeground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher_foreground.xml', path.basename(default_icon.foreground));
|
||||
resourceMap[defaultTargetPathForeground] = default_icon.foreground;
|
||||
} else if (path.extname(path.basename(foreground)) === '.png') {
|
||||
// Images Use Case
|
||||
defaultTargetPathForeground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher_foreground.png', path.basename(default_icon.foreground));
|
||||
resourceMap[defaultTargetPathForeground] = default_icon.foreground;
|
||||
}
|
||||
}
|
||||
|
||||
return resourceMap;
|
||||
}
|
||||
|
||||
function updateIconResourceForLegacy (preparedIcons, resourceMap, platformResourcesDir) {
|
||||
const android_icons = preparedIcons.android_icons;
|
||||
const default_icon = preparedIcons.default_icon;
|
||||
|
||||
// The source paths for icons and splashes are relative to
|
||||
// project's config.xml location, so we use it as base path.
|
||||
for (var density in android_icons) {
|
||||
var targetPath = getImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher.png', path.basename(android_icons[density].src));
|
||||
resourceMap[targetPath] = android_icons[density].src;
|
||||
}
|
||||
|
||||
// There's no "default" drawable, so assume default == mdpi.
|
||||
if (default_icon && !android_icons.mdpi) {
|
||||
var defaultTargetPath = getImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher.png', path.basename(default_icon.src));
|
||||
resourceMap[defaultTargetPath] = default_icon.src;
|
||||
}
|
||||
|
||||
return resourceMap;
|
||||
}
|
||||
|
||||
function prepareIcons (icons) {
|
||||
// http://developer.android.com/design/style/iconography.html
|
||||
const SIZE_TO_DENSITY_MAP = {
|
||||
36: 'ldpi',
|
||||
48: 'mdpi',
|
||||
72: 'hdpi',
|
||||
96: 'xhdpi',
|
||||
144: 'xxhdpi',
|
||||
192: 'xxxhdpi'
|
||||
};
|
||||
|
||||
const android_icons = {};
|
||||
let default_icon;
|
||||
|
||||
// find the best matching icon for a given density or size
|
||||
// @output android_icons
|
||||
var parseIcon = function (icon, icon_size) {
|
||||
// do I have a platform icon for that density already
|
||||
var density = icon.density || SIZE_TO_DENSITY_MAP[icon_size];
|
||||
if (!density) {
|
||||
// invalid icon defition ( or unsupported size)
|
||||
return;
|
||||
}
|
||||
var previous = android_icons[density];
|
||||
if (previous && previous.platform) {
|
||||
return;
|
||||
}
|
||||
android_icons[density] = icon;
|
||||
};
|
||||
|
||||
// iterate over all icon elements to find the default icon and call parseIcon
|
||||
for (var i = 0; i < icons.length; i++) {
|
||||
var icon = icons[i];
|
||||
var size = icon.width;
|
||||
|
||||
if (!size) {
|
||||
size = icon.height;
|
||||
}
|
||||
|
||||
if (!size && !icon.density) {
|
||||
if (default_icon) {
|
||||
const found = {};
|
||||
const favor = {};
|
||||
|
||||
// populating found icon.
|
||||
if (icon.background && icon.foreground) {
|
||||
found.background = icon.background;
|
||||
found.foreground = icon.foreground;
|
||||
}
|
||||
if (icon.src) {
|
||||
found.src = icon.src;
|
||||
}
|
||||
|
||||
if (default_icon.background && default_icon.foreground) {
|
||||
favor.background = default_icon.background;
|
||||
favor.foreground = default_icon.foreground;
|
||||
}
|
||||
if (default_icon.src) {
|
||||
favor.src = default_icon.src;
|
||||
}
|
||||
|
||||
events.emit('verbose', 'Found extra default icon: ' + JSON.stringify(found) + ' and ignoring in favor of ' + JSON.stringify(favor) + '.');
|
||||
} else {
|
||||
default_icon = icon;
|
||||
}
|
||||
} else {
|
||||
parseIcon(icon, size);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
android_icons: android_icons,
|
||||
default_icon: default_icon
|
||||
};
|
||||
}
|
||||
|
||||
function cleanIcons (projectRoot, projectConfig, platformResourcesDir) {
|
||||
var icons = projectConfig.getIcons('android');
|
||||
|
||||
// Skip if there are no app defined icons in config.xml
|
||||
if (icons.length === 0) {
|
||||
events.emit('verbose', 'This app does not have launcher icons defined');
|
||||
return;
|
||||
}
|
||||
|
||||
const resourceMap = Object.assign(
|
||||
{},
|
||||
mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher.png'),
|
||||
mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher_foreground.png'),
|
||||
mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher_background.png'),
|
||||
mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher_foreground.xml'),
|
||||
mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher_background.xml'),
|
||||
mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher.xml')
|
||||
);
|
||||
|
||||
events.emit('verbose', 'Cleaning icons at ' + platformResourcesDir);
|
||||
|
||||
// No source paths are specified in the map, so updatePaths() will delete the target files.
|
||||
FileUpdater.updatePaths(resourceMap, { rootDir: projectRoot, all: true }, logFileOp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a map containing resources of a specified name from all drawable folders in a directory.
|
||||
*/
|
||||
function mapImageResources (rootDir, subDir, type, resourceName) {
|
||||
const pathMap = {};
|
||||
const pattern = new RegExp(type + '+-.+');
|
||||
utils.scanDirectory(path.join(rootDir, subDir), pattern).forEach(function (drawableFolder) {
|
||||
const imagePath = path.join(subDir, path.basename(drawableFolder), resourceName);
|
||||
pathMap[imagePath] = null;
|
||||
});
|
||||
return pathMap;
|
||||
}
|
||||
|
||||
function updateFileResources (cordovaProject, platformDir) {
|
||||
var files = cordovaProject.projectConfig.getFileResources('android');
|
||||
|
||||
// if there are resource-file elements in config.xml
|
||||
if (files.length === 0) {
|
||||
events.emit('verbose', 'This app does not have additional resource files defined');
|
||||
return;
|
||||
}
|
||||
|
||||
var resourceMap = {};
|
||||
files.forEach(function (res) {
|
||||
var targetPath = path.join(platformDir, res.target);
|
||||
resourceMap[targetPath] = res.src;
|
||||
});
|
||||
|
||||
events.emit('verbose', 'Updating resource files at ' + platformDir);
|
||||
FileUpdater.updatePaths(
|
||||
resourceMap, { rootDir: cordovaProject.root }, logFileOp);
|
||||
}
|
||||
|
||||
function cleanFileResources (projectRoot, projectConfig, platformDir) {
|
||||
var files = projectConfig.getFileResources('android', true);
|
||||
if (files.length > 0) {
|
||||
events.emit('verbose', 'Cleaning resource files at ' + platformDir);
|
||||
|
||||
var resourceMap = {};
|
||||
files.forEach(function (res) {
|
||||
var filePath = path.join(platformDir, res.target);
|
||||
resourceMap[filePath] = null;
|
||||
});
|
||||
|
||||
FileUpdater.updatePaths(
|
||||
resourceMap, { rootDir: projectRoot, all: true }, logFileOp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and validates 'AndroidLaunchMode' prepference from config.xml. Returns
|
||||
* preference value and warns if it doesn't seems to be valid
|
||||
*
|
||||
* @param {ConfigParser} platformConfig A configParser instance for
|
||||
* platform.
|
||||
*
|
||||
* @return {String} Preference's value from config.xml or
|
||||
* default value, if there is no such preference. The default value is
|
||||
* 'singleTop'
|
||||
*/
|
||||
function findAndroidLaunchModePreference (platformConfig) {
|
||||
var launchMode = platformConfig.getPreference('AndroidLaunchMode');
|
||||
if (!launchMode) {
|
||||
// Return a default value
|
||||
return 'singleTop';
|
||||
}
|
||||
|
||||
var expectedValues = ['standard', 'singleTop', 'singleTask', 'singleInstance'];
|
||||
var valid = expectedValues.indexOf(launchMode) >= 0;
|
||||
if (!valid) {
|
||||
// Note: warn, but leave the launch mode as developer wanted, in case the list of options changes in the future
|
||||
events.emit('warn', 'Unrecognized value for AndroidLaunchMode preference: ' +
|
||||
launchMode + '. Expected values are: ' + expectedValues.join(', '));
|
||||
}
|
||||
|
||||
return launchMode;
|
||||
}
|
||||
61
bin/templates/cordova/lib/retry.js
vendored
Normal file
61
bin/templates/cordova/lib/retry.js
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var events = require('cordova-common').events;
|
||||
|
||||
/*
|
||||
* Retry a promise-returning function a number of times, propagating its
|
||||
* results on success or throwing its error on a failed final attempt.
|
||||
*
|
||||
* @arg {Number} attemptsLeft - The number of times to retry the passed call.
|
||||
* @arg {Function} promiseFunction - A function that returns a promise.
|
||||
* @arg {...} - Arguments to pass to promiseFunction.
|
||||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
module.exports.retryPromise = function (attemptsLeft, promiseFunction) {
|
||||
// NOTE:
|
||||
// get all trailing arguments, by skipping the first two (attemptsLeft and
|
||||
// promiseFunction) because they shouldn't get passed to promiseFunction
|
||||
var promiseFunctionArguments = Array.prototype.slice.call(arguments, 2);
|
||||
|
||||
return promiseFunction.apply(undefined, promiseFunctionArguments).then(
|
||||
// on success pass results through
|
||||
function onFulfilled (value) {
|
||||
return value;
|
||||
},
|
||||
|
||||
// on rejection either retry, or throw the error
|
||||
function onRejected (error) {
|
||||
attemptsLeft -= 1;
|
||||
|
||||
if (attemptsLeft < 1) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
events.emit('verbose', 'A retried call failed. Retrying ' + attemptsLeft + ' more time(s).');
|
||||
|
||||
// retry call self again with the same arguments, except attemptsLeft is now lower
|
||||
var fullArguments = [attemptsLeft, promiseFunction].concat(promiseFunctionArguments);
|
||||
return module.exports.retryPromise.apply(undefined, fullArguments);
|
||||
}
|
||||
);
|
||||
};
|
||||
194
bin/templates/cordova/lib/run.js
vendored
194
bin/templates/cordova/lib/run.js
vendored
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
@@ -19,98 +17,114 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var path = require('path'),
|
||||
build = require('./build'),
|
||||
emulator = require('./emulator'),
|
||||
device = require('./device');
|
||||
var path = require('path');
|
||||
var emulator = require('./emulator');
|
||||
var device = require('./device');
|
||||
var PackageType = require('./PackageType');
|
||||
const { CordovaError, events } = require('cordova-common');
|
||||
|
||||
/*
|
||||
* Runs the application on a device if availible.
|
||||
* If not device is found, it will use a started emulator.
|
||||
* If no started emulators are found it will attempt to start an avd.
|
||||
* If no avds are found it will error out.
|
||||
*/
|
||||
module.exports.run = function(args) {
|
||||
var build_type;
|
||||
function getInstallTarget (runOptions) {
|
||||
var install_target;
|
||||
if (runOptions.target) {
|
||||
install_target = runOptions.target;
|
||||
} else if (runOptions.device) {
|
||||
install_target = '--device';
|
||||
} else if (runOptions.emulator) {
|
||||
install_target = '--emulator';
|
||||
}
|
||||
|
||||
for (var i=2; i<args.length; i++) {
|
||||
if (args[i] == '--debug') {
|
||||
build_type = '--debug';
|
||||
} else if (args[i] == '--release') {
|
||||
build_type = '--release';
|
||||
} else if (args[i] == '--nobuild') {
|
||||
build_type = '--nobuild';
|
||||
} else if (args[i] == '--device') {
|
||||
install_target = '--device';
|
||||
} else if (args[i] == '--emulator') {
|
||||
install_target = '--emulator';
|
||||
} else if (args[i].substring(0, 9) == '--target=') {
|
||||
install_target = args[i].substring(9, args[i].length);
|
||||
} else {
|
||||
console.error('ERROR : Run option \'' + args[i] + '\' not recognized.');
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
build.run(build_type);
|
||||
if (install_target == '--device') {
|
||||
device.install();
|
||||
} else if (install_target == '--emulator') {
|
||||
if (emulator.list_started() == 0) {
|
||||
emulator.start();
|
||||
}
|
||||
emulator.install();
|
||||
} else if (install_target) {
|
||||
var devices = device.list();
|
||||
var started_emulators = emulator.list_started();
|
||||
var avds = emulator.list_images();
|
||||
if (devices.indexOf(install_target) > -1) {
|
||||
device.install(install_target);
|
||||
} else if (started_emulators.indexOf(install_target) > -1) {
|
||||
emulator.install(install_target);
|
||||
} else {
|
||||
// if target emulator isn't started, then start it.
|
||||
var emulator_ID;
|
||||
for(avd in avds) {
|
||||
if(avds[avd].name == install_target) {
|
||||
emulator_ID = emulator.start(install_target);
|
||||
emulator.install(emulator_ID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!emulator_ID) {
|
||||
console.error('ERROR : Target \'' + install_target + '\' not found, unalbe to run project');
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// no target given, deploy to device if availible, otherwise use the emulator.
|
||||
var device_list = device.list();
|
||||
if (device_list.length > 0) {
|
||||
console.log('WARNING : No target specified, deploying to device \'' + device_list[0] + '\'.');
|
||||
device.install(device_list[0])
|
||||
} else {
|
||||
var emulator_list = emulator.list_started();
|
||||
if (emulator_list.length > 0) {
|
||||
console.log('WARNING : No target specified, deploying to emulator \'' + emulator_list[0] + '\'.');
|
||||
emulator.install(emulator_list[0]);
|
||||
} else {
|
||||
console.log('WARNING : No started emulators found, starting an emulator.');
|
||||
var best_avd = emulator.best_image();
|
||||
if(best_avd) {
|
||||
var emulator_ID = emulator.start(best_avd.name);
|
||||
console.log('WARNING : No target specified, deploying to emulator \'' + emulator_ID + '\'.');
|
||||
emulator.install(emulator_ID);
|
||||
} else {
|
||||
emulator.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return install_target;
|
||||
}
|
||||
|
||||
module.exports.help = function() {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), args[0]) + ' [options]');
|
||||
/**
|
||||
* Runs the application on a device if available. If no device is found, it will
|
||||
* use a started emulator. If no started emulators are found it will attempt
|
||||
* to start an avd. If no avds are found it will error out.
|
||||
*
|
||||
* @param {Object} runOptions various run/build options. See Api.js build/run
|
||||
* methods for reference.
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
module.exports.run = function (runOptions) {
|
||||
runOptions = runOptions || {};
|
||||
|
||||
var self = this;
|
||||
var install_target = getInstallTarget(runOptions);
|
||||
|
||||
return Promise.resolve().then(function () {
|
||||
if (!install_target) {
|
||||
// no target given, deploy to device if available, otherwise use the emulator.
|
||||
return device.list().then(function (device_list) {
|
||||
if (device_list.length > 0) {
|
||||
events.emit('warn', 'No target specified, deploying to device \'' + device_list[0] + '\'.');
|
||||
install_target = device_list[0];
|
||||
} else {
|
||||
events.emit('warn', 'No target specified and no devices found, deploying to emulator');
|
||||
install_target = '--emulator';
|
||||
}
|
||||
});
|
||||
}
|
||||
}).then(function () {
|
||||
if (install_target === '--device') {
|
||||
return device.resolveTarget(null);
|
||||
} else if (install_target === '--emulator') {
|
||||
// Give preference to any already started emulators. Else, start one.
|
||||
return emulator.list_started().then(function (started) {
|
||||
return started && started.length > 0 ? started[0] : emulator.start();
|
||||
}).then(function (emulatorId) {
|
||||
return emulator.resolveTarget(emulatorId);
|
||||
});
|
||||
}
|
||||
// They specified a specific device/emulator ID.
|
||||
return device.list().then(function (devices) {
|
||||
if (devices.indexOf(install_target) > -1) {
|
||||
return device.resolveTarget(install_target);
|
||||
}
|
||||
return emulator.list_started().then(function (started_emulators) {
|
||||
if (started_emulators.indexOf(install_target) > -1) {
|
||||
return emulator.resolveTarget(install_target);
|
||||
}
|
||||
return emulator.list_images().then(function (avds) {
|
||||
// if target emulator isn't started, then start it.
|
||||
for (var avd in avds) {
|
||||
if (avds[avd].name === install_target) {
|
||||
return emulator.start(install_target).then(function (emulatorId) {
|
||||
return emulator.resolveTarget(emulatorId);
|
||||
});
|
||||
}
|
||||
}
|
||||
return Promise.reject(new CordovaError(`Target '${install_target}' not found, unable to run project`));
|
||||
});
|
||||
});
|
||||
});
|
||||
}).then(function (resolvedTarget) {
|
||||
return new Promise((resolve) => {
|
||||
const builder = require('./builders/builders').getBuilder();
|
||||
const buildOptions = require('./build').parseBuildOptions(runOptions, null, self.root);
|
||||
|
||||
// Android app bundles cannot be deployed directly to the device
|
||||
if (buildOptions.packageType === PackageType.BUNDLE) {
|
||||
const packageTypeErrorMessage = 'Package type "bundle" is not supported during cordova run.';
|
||||
events.emit('error', packageTypeErrorMessage);
|
||||
throw packageTypeErrorMessage;
|
||||
}
|
||||
|
||||
resolve(builder.fetchBuildResults(buildOptions.buildType, buildOptions.arch));
|
||||
}).then(function (buildResults) {
|
||||
if (resolvedTarget && resolvedTarget.isEmulator) {
|
||||
return emulator.wait_for_boot(resolvedTarget.target).then(function () {
|
||||
return emulator.install(resolvedTarget, buildResults);
|
||||
});
|
||||
}
|
||||
|
||||
return device.install(resolvedTarget, buildResults);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.help = function () {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), process.argv[1]) + ' [options]');
|
||||
console.log('Build options :');
|
||||
console.log(' --debug : Builds project in debug mode');
|
||||
console.log(' --release : Builds project in release mode');
|
||||
@@ -120,4 +134,4 @@ module.exports.help = function() {
|
||||
console.log(' --emulator : Will deploy the built project to an emulator if one exists');
|
||||
console.log(' --target=<target_id> : Installs to the target with the specified id.');
|
||||
process.exit(0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,20 +19,20 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var emulator = require('./emulator'),
|
||||
args = process.argv;
|
||||
var emulator = require('./emulator');
|
||||
var args = process.argv;
|
||||
|
||||
if(args.length > 2) {
|
||||
var install_target;
|
||||
if (args[2].substring(0, 9) == '--target=') {
|
||||
var install_target;
|
||||
if (args.length > 2) {
|
||||
if (args[2].substring(0, 9) === '--target=') {
|
||||
install_target = args[2].substring(9, args[2].length);
|
||||
emulator.start(install_target);
|
||||
process.exit(0);
|
||||
} else {
|
||||
} else {
|
||||
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
|
||||
process.exit(2);
|
||||
}
|
||||
} else {
|
||||
emulator.start();
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
emulator.start(install_target).catch(function (err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0start-emulator"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'start-emulator' script in 'cordova\lib' folder, aborting...>&2
|
||||
|
||||
97
bin/templates/cordova/lib/utils.js
vendored
Normal file
97
bin/templates/cordova/lib/utils.js
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Provides a set of utility methods, which can also be spied on during unit tests.
|
||||
*/
|
||||
|
||||
// TODO: Perhaps this should live in cordova-common?
|
||||
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
/**
|
||||
* Reads, searches, and replaces the found occurences with replacementString and then writes the file back out.
|
||||
* A backup is not made.
|
||||
*
|
||||
* @param {string} file A file path to a readable & writable file
|
||||
* @param {RegExp} searchRegex The search regex
|
||||
* @param {string} replacementString The string to replace the found occurences
|
||||
* @returns void
|
||||
*/
|
||||
exports.replaceFileContents = function (file, searchRegex, replacementString) {
|
||||
let contents = fs.readFileSync(file).toString();
|
||||
contents = contents.replace(searchRegex, replacementString);
|
||||
fs.writeFileSync(file, contents);
|
||||
};
|
||||
|
||||
/**
|
||||
* Reads a file and scans for regex. Returns the line of the first occurence or null if no occurences are found.
|
||||
*
|
||||
* @param {string} file A file path
|
||||
* @param {RegExp} regex A search regex
|
||||
* @returns string|null
|
||||
*/
|
||||
exports.grep = function (file, regex) {
|
||||
const contents = fs.readFileSync(file).toString().replace(/\\r/g, '').split('\n');
|
||||
for (let i = 0; i < contents.length; i++) {
|
||||
const line = contents[i];
|
||||
if (regex.test(line)) {
|
||||
return line;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scans directories and outputs a list of found paths that matches the regex
|
||||
*
|
||||
* @param {string} directory The starting directory
|
||||
* @param {RegExp} regex The search regex
|
||||
* @param {boolean} recursive Enables recursion
|
||||
* @returns Array<string>
|
||||
*/
|
||||
exports.scanDirectory = function (directory, regex, recursive) {
|
||||
let output = [];
|
||||
|
||||
if (fs.existsSync(directory)) {
|
||||
const items = fs.readdirSync(directory);
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const item = items[i];
|
||||
const itemPath = path.join(directory, item);
|
||||
const stats = fs.statSync(itemPath);
|
||||
|
||||
if (regex.test(itemPath)) {
|
||||
output.push(itemPath);
|
||||
}
|
||||
|
||||
if (stats.isDirectory()) {
|
||||
if (recursive) {
|
||||
output = output.concat(exports.scanDirectory(itemPath, regex, recursive));
|
||||
} else {
|
||||
// Move onto the next item
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
@@ -19,15 +19,18 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var log = require('./lib/log'),
|
||||
reqs = require('./lib/check_reqs'),
|
||||
args = process.argv;
|
||||
var log = require('./lib/log');
|
||||
var reqs = require('./lib/check_reqs');
|
||||
var args = process.argv;
|
||||
|
||||
// Usage support for when args are given
|
||||
if(args.length > 2) {
|
||||
if (args.length > 2) {
|
||||
log.help();
|
||||
} else if(reqs.run()) {
|
||||
log.run();
|
||||
} else {
|
||||
process.exit(2);
|
||||
}
|
||||
reqs.run().then(function () {
|
||||
return log.run();
|
||||
}, function (err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0log"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'log' script in 'cordova' folder, aborting...>&2
|
||||
|
||||
18
bin/templates/cordova/loggingHelper.js
vendored
Normal file
18
bin/templates/cordova/loggingHelper.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var CordovaLogger = require('cordova-common').CordovaLogger;
|
||||
|
||||
module.exports = {
|
||||
adjustLoggerLevel: function (opts) {
|
||||
if (opts instanceof Array) {
|
||||
opts.silent = opts.indexOf('--silent') !== -1;
|
||||
opts.verbose = opts.indexOf('--verbose') !== -1;
|
||||
}
|
||||
|
||||
if (opts.silent) {
|
||||
CordovaLogger.get().setLevel('error');
|
||||
}
|
||||
|
||||
if (opts.verbose) {
|
||||
CordovaLogger.get().setLevel('verbose');
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -19,17 +19,36 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var run = require('./lib/run'),
|
||||
reqs = require('./lib/check_reqs'),
|
||||
args = process.argv;
|
||||
var Api = require('./Api');
|
||||
var nopt = require('nopt');
|
||||
var path = require('path');
|
||||
|
||||
// Support basic help commands
|
||||
if (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
|
||||
args[2] == 'help' || args[2] == '-help' || args[2] == '/help') {
|
||||
run.help();
|
||||
} else if(reqs.run()) {
|
||||
run.run(args);
|
||||
process.exit(0);
|
||||
} else {
|
||||
process.exit(2);
|
||||
}
|
||||
if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
|
||||
require('./lib/run').help();
|
||||
}
|
||||
|
||||
// Do some basic argument parsing
|
||||
var runOpts = nopt({
|
||||
verbose: Boolean,
|
||||
silent: Boolean,
|
||||
debug: Boolean,
|
||||
release: Boolean,
|
||||
nobuild: Boolean,
|
||||
buildConfig: path,
|
||||
archs: String,
|
||||
device: Boolean,
|
||||
emulator: Boolean,
|
||||
target: String
|
||||
}, { d: '--verbose' });
|
||||
|
||||
// Make runOptions compatible with PlatformApi run method spec
|
||||
runOpts.argv = runOpts.argv.remain;
|
||||
|
||||
require('./loggingHelper').adjustLoggerLevel(runOpts);
|
||||
|
||||
new Api().run(runOpts)
|
||||
.catch(function (err) {
|
||||
console.error(err, err.stack);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0run"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
// Coho updates this line:
|
||||
var VERSION = '3.1.0-dev';
|
||||
const Api = require('./Api');
|
||||
|
||||
console.log(VERSION);
|
||||
console.log(Api.version());
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: to you under the Apache License, Version 2.0 (the
|
||||
:: "License"); you may not use this file except in compliance
|
||||
:: with the License. You may obtain a copy of the License at
|
||||
::
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing,
|
||||
:: software distributed under the License is distributed on an
|
||||
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0version"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2
|
||||
|
||||
@@ -22,16 +22,20 @@ package __ID__;
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class __ACTIVITY__ extends CordovaActivity
|
||||
public class __ACTIVITY__ extends CordovaActivity
|
||||
{
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
super.init();
|
||||
|
||||
// enable Cordova apps to be started in the background
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
|
||||
moveTaskToBack(true);
|
||||
}
|
||||
|
||||
// Set by <content src="index.html" /> in config.xml
|
||||
super.loadUrl(Config.getStartUrl());
|
||||
//super.loadUrl("file:///android_asset/www/index.html")
|
||||
loadUrl(launchUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
|
||||
package="__PACKAGE__" android:versionName="1.0" android:versionCode="1" android:hardwareAccelerated="true">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="__PACKAGE__" android:versionName="1.0" android:versionCode="1" android:hardwareAccelerated="true">
|
||||
<supports-screens
|
||||
android:largeScreens="true"
|
||||
android:normalScreens="true"
|
||||
@@ -30,18 +30,18 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name"
|
||||
android:hardwareAccelerated="true"
|
||||
android:debuggable="true">
|
||||
<activity android:name="__ACTIVITY__" android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme.Black.NoTitleBar"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
|
||||
<intent-filter>
|
||||
<application android:icon="@mipmap/ic_launcher" android:label="@string/app_name"
|
||||
android:hardwareAccelerated="true" android:supportsRtl="true">
|
||||
<activity android:name="__ACTIVITY__"
|
||||
android:label="@string/activity_name"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode">
|
||||
<intent-filter android:label="@string/launcher_name">
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="__APILEVEL__"/>
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
||||
420
bin/templates/project/app/build.gradle
Normal file
420
bin/templates/project/app/build.gradle
Normal file
@@ -0,0 +1,420 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
if (cdvHelpers.getConfigPreference('GradlePluginKotlinEnabled', 'false').toBoolean()) {
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
}
|
||||
|
||||
buildscript {
|
||||
apply from: '../CordovaLib/cordova.gradle'
|
||||
|
||||
if(cdvHelpers.getConfigPreference('GradlePluginKotlinEnabled', 'false').toBoolean()) {
|
||||
String defaultGradlePluginKotlinVersion = kotlin_version
|
||||
|
||||
/**
|
||||
* Fetches the user's defined Kotlin Version from config.xml.
|
||||
* If the version is not set or invalid, it will default to the ${defaultGradlePluginKotlinVersion}
|
||||
*/
|
||||
String gradlePluginKotlinVersion = cdvHelpers.getConfigPreference('GradlePluginKotlinVersion', defaultGradlePluginKotlinVersion)
|
||||
if(!cdvHelpers.isVersionValid(gradlePluginKotlinVersion)) {
|
||||
println("The defined Kotlin version (${gradlePluginKotlinVersion}) does not appear to be a valid version. Falling back to version: ${defaultGradlePluginKotlinVersion}.")
|
||||
gradlePluginKotlinVersion = defaultGradlePluginKotlinVersion
|
||||
}
|
||||
|
||||
// Change the version to be used.
|
||||
ext.kotlin_version = gradlePluginKotlinVersion
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
apply from: '../CordovaLib/cordova.gradle'
|
||||
|
||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
||||
|
||||
if (cdvHelpers.getConfigPreference('GradlePluginKotlinEnabled', 'false').toBoolean()) {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
|
||||
if(cdvHelpers.getConfigPreference('GradlePluginGoogleServicesEnabled', 'false').toBoolean()) {
|
||||
String defaultGradlePluginGoogleServicesVersion = '4.2.0'
|
||||
|
||||
/**
|
||||
* Fetches the user's defined Google Services Plugin Version from config.xml.
|
||||
* If the version is not set or invalid, it will default to the ${defaultGradlePluginGoogleServicesVersion}
|
||||
*/
|
||||
String gradlePluginGoogleServicesVersion = cdvHelpers.getConfigPreference('GradlePluginGoogleServicesVersion', defaultGradlePluginGoogleServicesVersion)
|
||||
if(!cdvHelpers.isVersionValid(gradlePluginGoogleServicesVersion)) {
|
||||
println("The defined Google Services plugin version (${gradlePluginGoogleServicesVersion}) does not appear to be a valid version. Falling back to version: ${defaultGradlePluginGoogleServicesVersion}.")
|
||||
gradlePluginGoogleServicesVersion = defaultGradlePluginGoogleServicesVersion
|
||||
}
|
||||
|
||||
// Create the Google Services classpath and set it.
|
||||
String gradlePluginGoogleServicesClassPath = "com.google.gms:google-services:${gradlePluginGoogleServicesVersion}"
|
||||
println "Adding classpath: ${gradlePluginGoogleServicesClassPath}"
|
||||
classpath gradlePluginGoogleServicesClassPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Allow plugins to declare Maven dependencies via build-extras.gradle.
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '6.5'
|
||||
}
|
||||
|
||||
// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
|
||||
// Refer to: http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html
|
||||
ext {
|
||||
apply from: '../CordovaLib/cordova.gradle'
|
||||
|
||||
// The value for android.compileSdkVersion.
|
||||
if (!project.hasProperty('cdvCompileSdkVersion')) {
|
||||
cdvCompileSdkVersion = null;
|
||||
}
|
||||
// The value for android.buildToolsVersion.
|
||||
if (!project.hasProperty('cdvBuildToolsVersion')) {
|
||||
cdvBuildToolsVersion = null;
|
||||
}
|
||||
// Sets the versionCode to the given value.
|
||||
if (!project.hasProperty('cdvVersionCode')) {
|
||||
cdvVersionCode = null
|
||||
}
|
||||
// Sets the minSdkVersion to the given value.
|
||||
if (!project.hasProperty('cdvMinSdkVersion')) {
|
||||
cdvMinSdkVersion = null
|
||||
}
|
||||
// Sets the maxSdkVersion to the given value.
|
||||
if (!project.hasProperty('cdvMaxSdkVersion')) {
|
||||
cdvMaxSdkVersion = null
|
||||
}
|
||||
// The value for android.targetSdkVersion.
|
||||
if (!project.hasProperty('cdvTargetSdkVersion')) {
|
||||
cdvTargetSdkVersion = null;
|
||||
}
|
||||
// Whether to build architecture-specific APKs.
|
||||
if (!project.hasProperty('cdvBuildMultipleApks')) {
|
||||
cdvBuildMultipleApks = null
|
||||
}
|
||||
// Whether to append a 0 "abi digit" to versionCode when only a single APK is build
|
||||
if (!project.hasProperty('cdvVersionCodeForceAbiDigit')) {
|
||||
cdvVersionCodeForceAbiDigit = null
|
||||
}
|
||||
// .properties files to use for release signing.
|
||||
if (!project.hasProperty('cdvReleaseSigningPropertiesFile')) {
|
||||
cdvReleaseSigningPropertiesFile = null
|
||||
}
|
||||
// .properties files to use for debug signing.
|
||||
if (!project.hasProperty('cdvDebugSigningPropertiesFile')) {
|
||||
cdvDebugSigningPropertiesFile = null
|
||||
}
|
||||
// Set by build.js script.
|
||||
if (!project.hasProperty('cdvBuildArch')) {
|
||||
cdvBuildArch = null
|
||||
}
|
||||
|
||||
// Plugin gradle extensions can append to this to have code run at the end.
|
||||
cdvPluginPostBuildExtras = []
|
||||
}
|
||||
|
||||
// PLUGIN GRADLE EXTENSIONS START
|
||||
// PLUGIN GRADLE EXTENSIONS END
|
||||
|
||||
def hasBuildExtras1 = file('build-extras.gradle').exists()
|
||||
if (hasBuildExtras1) {
|
||||
apply from: 'build-extras.gradle'
|
||||
}
|
||||
|
||||
def hasBuildExtras2 = file('../build-extras.gradle').exists()
|
||||
if (hasBuildExtras2) {
|
||||
apply from: '../build-extras.gradle'
|
||||
}
|
||||
|
||||
// Set property defaults after extension .gradle files.
|
||||
ext.cdvCompileSdkVersion = cdvCompileSdkVersion == null ? (
|
||||
defaultCompileSdkVersion == null
|
||||
? privateHelpers.getProjectTarget()
|
||||
: defaultCompileSdkVersion
|
||||
) : Integer.parseInt('' + cdvCompileSdkVersion);
|
||||
|
||||
if (ext.cdvBuildToolsVersion == null) {
|
||||
ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
|
||||
//ext.cdvBuildToolsVersion = project.ext.defaultBuildToolsVersion
|
||||
}
|
||||
if (ext.cdvDebugSigningPropertiesFile == null && file('../debug-signing.properties').exists()) {
|
||||
ext.cdvDebugSigningPropertiesFile = '../debug-signing.properties'
|
||||
}
|
||||
if (ext.cdvReleaseSigningPropertiesFile == null && file('../release-signing.properties').exists()) {
|
||||
ext.cdvReleaseSigningPropertiesFile = '../release-signing.properties'
|
||||
}
|
||||
|
||||
// Cast to appropriate types.
|
||||
ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean();
|
||||
ext.cdvVersionCodeForceAbiDigit = cdvVersionCodeForceAbiDigit == null ? false : cdvVersionCodeForceAbiDigit.toBoolean();
|
||||
|
||||
// minSdkVersion, maxSdkVersion and targetSdkVersion
|
||||
ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? defaultMinSdkVersion : Integer.parseInt('' + cdvMinSdkVersion)
|
||||
if (cdvMaxSdkVersion != null) {
|
||||
ext.cdvMaxSdkVersion = Integer.parseInt('' + cdvMaxSdkVersion)
|
||||
}
|
||||
ext.cdvTargetSdkVersion = cdvTargetSdkVersion == null ? defaultTargetSdkVersion : Integer.parseInt('' + cdvTargetSdkVersion)
|
||||
|
||||
ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)
|
||||
|
||||
def computeBuildTargetName(debugBuild) {
|
||||
def ret = 'assemble'
|
||||
if (cdvBuildMultipleApks && cdvBuildArch) {
|
||||
def arch = cdvBuildArch == 'arm' ? 'armv7' : cdvBuildArch
|
||||
ret += '' + arch.toUpperCase().charAt(0) + arch.substring(1);
|
||||
}
|
||||
return ret + (debugBuild ? 'Debug' : 'Release')
|
||||
}
|
||||
|
||||
// Make cdvBuild a task that depends on the debug/arch-sepecific task.
|
||||
task cdvBuildDebug
|
||||
cdvBuildDebug.dependsOn {
|
||||
return computeBuildTargetName(true)
|
||||
}
|
||||
|
||||
task cdvBuildRelease
|
||||
cdvBuildRelease.dependsOn {
|
||||
return computeBuildTargetName(false)
|
||||
}
|
||||
|
||||
task cdvPrintProps {
|
||||
doLast {
|
||||
println('cdvCompileSdkVersion=' + cdvCompileSdkVersion)
|
||||
println('cdvBuildToolsVersion=' + cdvBuildToolsVersion)
|
||||
println('cdvVersionCode=' + cdvVersionCode)
|
||||
println('cdvVersionCodeForceAbiDigit=' + cdvVersionCodeForceAbiDigit)
|
||||
println('cdvMinSdkVersion=' + cdvMinSdkVersion)
|
||||
println('cdvMaxSdkVersion=' + cdvMaxSdkVersion)
|
||||
println('cdvTargetSdkVersion=' + cdvTargetSdkVersion)
|
||||
println('cdvBuildMultipleApks=' + cdvBuildMultipleApks)
|
||||
println('cdvReleaseSigningPropertiesFile=' + cdvReleaseSigningPropertiesFile)
|
||||
println('cdvDebugSigningPropertiesFile=' + cdvDebugSigningPropertiesFile)
|
||||
println('cdvBuildArch=' + cdvBuildArch)
|
||||
println('computedVersionCode=' + android.defaultConfig.versionCode)
|
||||
android.productFlavors.each { flavor ->
|
||||
println('computed' + flavor.name.capitalize() + 'VersionCode=' + flavor.versionCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
defaultConfig {
|
||||
versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
|
||||
applicationId privateHelpers.extractStringFromManifest("package")
|
||||
|
||||
if (cdvMinSdkVersion != null) {
|
||||
minSdkVersion cdvMinSdkVersion
|
||||
}
|
||||
|
||||
if (cdvMaxSdkVersion != null) {
|
||||
maxSdkVersion cdvMaxSdkVersion
|
||||
}
|
||||
|
||||
if(cdvTargetSdkVersion != null) {
|
||||
targetSdkVersion cdvTargetSdkVersion
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false;
|
||||
}
|
||||
|
||||
compileSdkVersion cdvCompileSdkVersion
|
||||
buildToolsVersion cdvBuildToolsVersion
|
||||
|
||||
// This code exists for Crosswalk and other Native APIs.
|
||||
// By default, we multiply the existing version code in the
|
||||
// Android Manifest by 10 and add a number for each architecture.
|
||||
// If you are not using Crosswalk or SQLite, you can
|
||||
// ignore this chunk of code, and your version codes will be respected.
|
||||
|
||||
if (Boolean.valueOf(cdvBuildMultipleApks)) {
|
||||
flavorDimensions "default"
|
||||
|
||||
productFlavors {
|
||||
armeabi {
|
||||
versionCode defaultConfig.versionCode*10 + 1
|
||||
ndk {
|
||||
abiFilters = ["armeabi"]
|
||||
}
|
||||
}
|
||||
armv7 {
|
||||
versionCode defaultConfig.versionCode*10 + 2
|
||||
ndk {
|
||||
abiFilters = ["armeabi-v7a"]
|
||||
}
|
||||
}
|
||||
arm64 {
|
||||
versionCode defaultConfig.versionCode*10 + 3
|
||||
ndk {
|
||||
abiFilters = ["arm64-v8a"]
|
||||
}
|
||||
}
|
||||
x86 {
|
||||
versionCode defaultConfig.versionCode*10 + 4
|
||||
ndk {
|
||||
abiFilters = ["x86"]
|
||||
}
|
||||
}
|
||||
x86_64 {
|
||||
versionCode defaultConfig.versionCode*10 + 5
|
||||
ndk {
|
||||
abiFilters = ["x86_64"]
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Boolean.valueOf(cdvVersionCodeForceAbiDigit)) {
|
||||
// This provides compatibility to the default logic for versionCode before cordova-android 5.2.0
|
||||
defaultConfig {
|
||||
versionCode defaultConfig.versionCode*10
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
if (cdvReleaseSigningPropertiesFile) {
|
||||
signingConfigs {
|
||||
release {
|
||||
// These must be set or Gradle will complain (even if they are overridden).
|
||||
keyAlias = ""
|
||||
keyPassword = "__unset" // And these must be set to non-empty in order to have the signing step added to the task graph.
|
||||
storeFile = null
|
||||
storePassword = "__unset"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
addSigningProps(cdvReleaseSigningPropertiesFile, signingConfigs.release)
|
||||
}
|
||||
|
||||
if (cdvDebugSigningPropertiesFile) {
|
||||
addSigningProps(cdvDebugSigningPropertiesFile, signingConfigs.debug)
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING: Cordova Lib and platform scripts do management inside of this code here,
|
||||
* if you are adding the dependencies manually, do so outside the comments, otherwise
|
||||
* the Cordova tools will overwrite them
|
||||
*/
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: '*.jar')
|
||||
|
||||
if (cdvHelpers.getConfigPreference('GradlePluginKotlinEnabled', 'false').toBoolean()) {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
}
|
||||
|
||||
// SUB-PROJECT DEPENDENCIES START
|
||||
debugCompile(project(path: ":CordovaLib", configuration: "debug"))
|
||||
releaseCompile(project(path: ":CordovaLib", configuration: "release"))
|
||||
// SUB-PROJECT DEPENDENCIES END
|
||||
}
|
||||
|
||||
def promptForReleaseKeyPassword() {
|
||||
if (!cdvReleaseSigningPropertiesFile) {
|
||||
return;
|
||||
}
|
||||
if ('__unset'.equals(android.signingConfigs.release.storePassword)) {
|
||||
android.signingConfigs.release.storePassword = privateHelpers.promptForPassword('Enter key store password: ')
|
||||
}
|
||||
if ('__unset'.equals(android.signingConfigs.release.keyPassword)) {
|
||||
android.signingConfigs.release.keyPassword = privateHelpers.promptForPassword('Enter key password: ');
|
||||
}
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady { taskGraph ->
|
||||
taskGraph.getAllTasks().each() { task ->
|
||||
if(['validateReleaseSigning', 'validateSigningRelease', 'validateSigningArmv7Release', 'validateSigningX76Release'].contains(task.name)) {
|
||||
promptForReleaseKeyPassword()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def addSigningProps(propsFilePath, signingConfig) {
|
||||
def propsFile = file(propsFilePath)
|
||||
def props = new Properties()
|
||||
propsFile.withReader { reader ->
|
||||
props.load(reader)
|
||||
}
|
||||
|
||||
def storeFile = new File(props.get('key.store') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'storeFile'))
|
||||
if (!storeFile.isAbsolute()) {
|
||||
storeFile = RelativePath.parse(true, storeFile.toString()).getFile(propsFile.getParentFile())
|
||||
}
|
||||
if (!storeFile.exists()) {
|
||||
throw new FileNotFoundException('Keystore file does not exist: ' + storeFile.getAbsolutePath())
|
||||
}
|
||||
signingConfig.keyAlias = props.get('key.alias') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'keyAlias')
|
||||
signingConfig.keyPassword = props.get('keyPassword', props.get('key.alias.password', signingConfig.keyPassword))
|
||||
signingConfig.storeFile = storeFile
|
||||
signingConfig.storePassword = props.get('storePassword', props.get('key.store.password', signingConfig.storePassword))
|
||||
def storeType = props.get('storeType', props.get('key.store.type', ''))
|
||||
if (!storeType) {
|
||||
def filename = storeFile.getName().toLowerCase();
|
||||
if (filename.endsWith('.p12') || filename.endsWith('.pfx')) {
|
||||
storeType = 'pkcs12'
|
||||
} else {
|
||||
storeType = signingConfig.storeType // "jks"
|
||||
}
|
||||
}
|
||||
signingConfig.storeType = storeType
|
||||
}
|
||||
|
||||
for (def func : cdvPluginPostBuildExtras) {
|
||||
func()
|
||||
}
|
||||
|
||||
// This can be defined within build-extras.gradle as:
|
||||
// ext.postBuildExtras = { ... code here ... }
|
||||
if (hasProperty('postBuildExtras')) {
|
||||
postBuildExtras()
|
||||
}
|
||||
|
||||
if (cdvHelpers.getConfigPreference('GradlePluginGoogleServicesEnabled', 'false').toBoolean()) {
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
}
|
||||
1904
bin/templates/project/assets/www/cordova.js
vendored
Normal file
1904
bin/templates/project/assets/www/cordova.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -102,13 +102,13 @@ h1 {
|
||||
50% { opacity: 0.4; }
|
||||
to { opacity: 1.0; }
|
||||
}
|
||||
|
||||
|
||||
@-webkit-keyframes fade {
|
||||
from { opacity: 1.0; }
|
||||
50% { opacity: 0.4; }
|
||||
to { opacity: 1.0; }
|
||||
}
|
||||
|
||||
|
||||
.blink {
|
||||
animation:fade 3000ms infinite;
|
||||
-webkit-animation:fade 3000ms infinite;
|
||||
|
||||
@@ -19,10 +19,20 @@
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
|
||||
<link rel="stylesheet" type="text/css" href="css/index.css" />
|
||||
<!--
|
||||
Customize this policy to fit your own app's needs. For more guidance, see:
|
||||
https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
|
||||
Some notes:
|
||||
* gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
|
||||
* https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
|
||||
* Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
|
||||
* Enable inline JS: add 'unsafe-inline' to default-src
|
||||
-->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<meta name="msapplication-tap-highlight" content="no">
|
||||
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
|
||||
<link rel="stylesheet" type="text/css" href="css/index.css">
|
||||
<title>Hello World</title>
|
||||
</head>
|
||||
<body>
|
||||
@@ -35,8 +45,5 @@
|
||||
</div>
|
||||
<script type="text/javascript" src="cordova.js"></script>
|
||||
<script type="text/javascript" src="js/index.js"></script>
|
||||
<script type="text/javascript">
|
||||
app.initialize();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -18,25 +18,25 @@
|
||||
*/
|
||||
var app = {
|
||||
// Application Constructor
|
||||
initialize: function() {
|
||||
initialize: function () {
|
||||
this.bindEvents();
|
||||
},
|
||||
// Bind Event Listeners
|
||||
//
|
||||
// Bind any events that are required on startup. Common events are:
|
||||
// 'load', 'deviceready', 'offline', and 'online'.
|
||||
bindEvents: function() {
|
||||
bindEvents: function () {
|
||||
document.addEventListener('deviceready', this.onDeviceReady, false);
|
||||
},
|
||||
// deviceready Event Handler
|
||||
//
|
||||
// The scope of 'this' is the event. In order to call the 'receivedEvent'
|
||||
// function, we must explicity call 'app.receivedEvent(...);'
|
||||
onDeviceReady: function() {
|
||||
// function, we must explicitly call 'app.receivedEvent(...);'
|
||||
onDeviceReady: function () {
|
||||
app.receivedEvent('deviceready');
|
||||
},
|
||||
// Update DOM on a Received Event
|
||||
receivedEvent: function(id) {
|
||||
receivedEvent: function (id) {
|
||||
var parentElement = document.getElementById(id);
|
||||
var listeningElement = parentElement.querySelector('.listening');
|
||||
var receivedElement = parentElement.querySelector('.received');
|
||||
@@ -47,3 +47,5 @@ var app = {
|
||||
console.log('Received Event: ' + id);
|
||||
}
|
||||
};
|
||||
|
||||
app.initialize();
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var deviceInfo = function() {
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
document.getElementById("name").innerHTML = device.name;
|
||||
document.getElementById("width").innerHTML = screen.width;
|
||||
document.getElementById("height").innerHTML = screen.height;
|
||||
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
|
||||
};
|
||||
|
||||
var getLocation = function() {
|
||||
var suc = function(p) {
|
||||
alert(p.coords.latitude + " " + p.coords.longitude);
|
||||
};
|
||||
var locFail = function() {
|
||||
};
|
||||
navigator.geolocation.getCurrentPosition(suc, locFail);
|
||||
};
|
||||
|
||||
var beep = function() {
|
||||
navigator.notification.beep(2);
|
||||
};
|
||||
|
||||
var vibrate = function() {
|
||||
navigator.notification.vibrate(0);
|
||||
};
|
||||
|
||||
function roundNumber(num) {
|
||||
var dec = 3;
|
||||
var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
|
||||
return result;
|
||||
}
|
||||
|
||||
var accelerationWatch = null;
|
||||
|
||||
function updateAcceleration(a) {
|
||||
document.getElementById('x').innerHTML = roundNumber(a.x);
|
||||
document.getElementById('y').innerHTML = roundNumber(a.y);
|
||||
document.getElementById('z').innerHTML = roundNumber(a.z);
|
||||
}
|
||||
|
||||
var toggleAccel = function() {
|
||||
if (accelerationWatch !== null) {
|
||||
navigator.accelerometer.clearWatch(accelerationWatch);
|
||||
updateAcceleration({
|
||||
x : "",
|
||||
y : "",
|
||||
z : ""
|
||||
});
|
||||
accelerationWatch = null;
|
||||
} else {
|
||||
var options = {};
|
||||
options.frequency = 1000;
|
||||
accelerationWatch = navigator.accelerometer.watchAcceleration(
|
||||
updateAcceleration, function(ex) {
|
||||
alert("accel fail (" + ex.name + ": " + ex.message + ")");
|
||||
}, options);
|
||||
}
|
||||
};
|
||||
|
||||
var preventBehavior = function(e) {
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
function dump_pic(data) {
|
||||
var viewport = document.getElementById('viewport');
|
||||
console.log(data);
|
||||
viewport.style.display = "";
|
||||
viewport.style.position = "absolute";
|
||||
viewport.style.top = "10px";
|
||||
viewport.style.left = "10px";
|
||||
document.getElementById("test_img").src = data;
|
||||
}
|
||||
|
||||
function fail(msg) {
|
||||
alert(msg);
|
||||
}
|
||||
|
||||
function show_pic() {
|
||||
navigator.camera.getPicture(dump_pic, fail, {
|
||||
quality : 50
|
||||
});
|
||||
}
|
||||
|
||||
function close() {
|
||||
var viewport = document.getElementById('viewport');
|
||||
viewport.style.position = "relative";
|
||||
viewport.style.display = "none";
|
||||
}
|
||||
|
||||
function contacts_success(contacts) {
|
||||
alert(contacts.length
|
||||
+ ' contacts returned.'
|
||||
+ (contacts[2] && contacts[2].name ? (' Third contact is ' + contacts[2].name.formatted)
|
||||
: ''));
|
||||
}
|
||||
|
||||
function get_contacts() {
|
||||
var obj = new ContactFindOptions();
|
||||
obj.filter = "";
|
||||
obj.multiple = true;
|
||||
navigator.contacts.find(
|
||||
[ "displayName", "name" ], contacts_success,
|
||||
fail, obj);
|
||||
}
|
||||
|
||||
function check_network() {
|
||||
var networkState = navigator.network.connection.type;
|
||||
|
||||
var states = {};
|
||||
states[Connection.UNKNOWN] = 'Unknown connection';
|
||||
states[Connection.ETHERNET] = 'Ethernet connection';
|
||||
states[Connection.WIFI] = 'WiFi connection';
|
||||
states[Connection.CELL_2G] = 'Cell 2G connection';
|
||||
states[Connection.CELL_3G] = 'Cell 3G connection';
|
||||
states[Connection.CELL_4G] = 'Cell 4G connection';
|
||||
states[Connection.NONE] = 'No network connection';
|
||||
|
||||
confirm('Connection type:\n ' + states[networkState]);
|
||||
}
|
||||
|
||||
var watchID = null;
|
||||
|
||||
function updateHeading(h) {
|
||||
document.getElementById('h').innerHTML = h.magneticHeading;
|
||||
}
|
||||
|
||||
function toggleCompass() {
|
||||
if (watchID !== null) {
|
||||
navigator.compass.clearWatch(watchID);
|
||||
watchID = null;
|
||||
updateHeading({ magneticHeading : "Off"});
|
||||
} else {
|
||||
var options = { frequency: 1000 };
|
||||
watchID = navigator.compass.watchHeading(updateHeading, function(e) {
|
||||
alert('Compass Error: ' + e.code);
|
||||
}, options);
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
// the next line makes it impossible to see Contacts on the HTC Evo since it
|
||||
// doesn't have a scroll button
|
||||
// document.addEventListener("touchmove", preventBehavior, false);
|
||||
document.addEventListener("deviceready", deviceInfo, true);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user