mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 11:21:08 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
378032bf64 | ||
|
|
a19eb0760b | ||
|
|
5cfc62f415 | ||
|
|
1ed1c4bed1 | ||
|
|
616f648f0d | ||
|
|
4fccd4d599 | ||
|
|
bd4f80e803 | ||
|
|
9e9b3f913d | ||
|
|
a2a168e5f3 | ||
|
|
5f982b1908 | ||
|
|
f00202d3e3 | ||
|
|
b4d4033040 | ||
|
|
68deb6335e | ||
|
|
cb965a9d3a | ||
|
|
86262ef424 | ||
|
|
acfa4856b9 | ||
|
|
be8711a7e6 | ||
|
|
7e6a0ff51e | ||
|
|
c989e10293 | ||
|
|
b04d809478 | ||
|
|
219276c182 | ||
|
|
64ff652330 | ||
|
|
75e3ca80bc | ||
|
|
aa48b6f714 | ||
|
|
2603a2e4fd | ||
|
|
05550e7c66 | ||
|
|
99349445b1 | ||
|
|
d768dd0125 | ||
|
|
e376d9156b | ||
|
|
85349b801f | ||
|
|
41d1be9f34 | ||
|
|
ac19d5bfaf | ||
|
|
ae7d005dfc | ||
|
|
04427d962d | ||
|
|
57bc2f6ffb | ||
|
|
059a6a685b | ||
|
|
4ac77ca819 | ||
|
|
d703e86b4b | ||
|
|
6870a59952 | ||
|
|
721dadd34b | ||
|
|
b7061d3e57 | ||
|
|
2f4099863e | ||
|
|
96e0c59371 | ||
|
|
1e910229a8 | ||
|
|
c74031105a | ||
|
|
279678d726 | ||
|
|
46db32524d | ||
|
|
0563034987 | ||
|
|
0baf32151f | ||
|
|
8bd9eebf1f | ||
|
|
b9a5b85c16 | ||
|
|
c98be1ad12 | ||
|
|
67b1fcec06 | ||
|
|
4643f66d1a | ||
|
|
e3aa857b74 | ||
|
|
350fcbd003 | ||
|
|
c6799b1f41 | ||
|
|
f260ff4299 | ||
|
|
7122b78d60 | ||
|
|
52971cce4c | ||
|
|
5dc77749e7 | ||
|
|
472b3e6fca | ||
|
|
59b4c5bc3d | ||
|
|
f105c6d4e7 | ||
|
|
2e637c4cba | ||
|
|
8d44e61042 | ||
|
|
eac9866b2c | ||
|
|
7ada4aec7b | ||
|
|
dacb11a24c | ||
|
|
5c44041365 | ||
|
|
56b901df8f | ||
|
|
582bd35450 | ||
|
|
6057352d91 | ||
|
|
3b450189bb | ||
|
|
7878c22bbf | ||
|
|
674372dd15 | ||
|
|
af804a9305 | ||
|
|
7e2eff0be7 | ||
|
|
7de999655d | ||
|
|
1b84abfcab | ||
|
|
8286cbf198 | ||
|
|
db7d7c47cb | ||
|
|
9445d6e22c | ||
|
|
209c253e3f | ||
|
|
e449d41158 | ||
|
|
9b4a07a69e | ||
|
|
28766cfe96 | ||
|
|
a95adaf53d | ||
|
|
7ae2112edc | ||
|
|
79b99d358b | ||
|
|
12fedc8ee6 | ||
|
|
27589a4031 | ||
|
|
f12adef20c | ||
|
|
049efb2da8 | ||
|
|
d41b9d61c2 | ||
|
|
71b1f58d41 | ||
|
|
f983186526 | ||
|
|
c726c88f32 | ||
|
|
3cb9ce92bc | ||
|
|
2504797e50 | ||
|
|
67ebb6a498 | ||
|
|
d9e839c91b | ||
|
|
fd65ec9388 | ||
|
|
7a0052ae2f | ||
|
|
ec0e9d7771 | ||
|
|
4325b8151a | ||
|
|
482e406319 | ||
|
|
e421b10a3d | ||
|
|
55c4b01d95 | ||
|
|
a5610cbed1 | ||
|
|
fc9e1be0b3 | ||
|
|
9b9fef57d9 | ||
|
|
99b87f07af | ||
|
|
9a69207087 | ||
|
|
4cfb3889f8 | ||
|
|
0a7f80fb0a | ||
|
|
df66c40aaa | ||
|
|
9b3e4f9034 | ||
|
|
89dad63b0f | ||
|
|
9636231dda | ||
|
|
a2d896ec4e | ||
|
|
66187b25b6 | ||
|
|
f3deab1057 | ||
|
|
5a9f5defc3 | ||
|
|
e43a74ae3f | ||
|
|
06cd95ea65 | ||
|
|
7d088a3f17 | ||
|
|
0ddabfc4ab | ||
|
|
8078626d49 | ||
|
|
ffad7f7365 | ||
|
|
da2f5156b2 | ||
|
|
e3578fe451 | ||
|
|
036c395d3c | ||
|
|
474417efb7 | ||
|
|
23263e537f | ||
|
|
c98cedfc91 | ||
|
|
2228af8148 | ||
|
|
c6bbff5b5e | ||
|
|
1b58ec73aa | ||
|
|
f49164bf76 | ||
|
|
1ae6c346f6 | ||
|
|
45064beb94 | ||
|
|
8bd7d107a8 | ||
|
|
d465c35811 | ||
|
|
fcff387c6a | ||
|
|
513122c74e | ||
|
|
d68521e673 | ||
|
|
c5302ba6b6 | ||
|
|
70352e16a9 | ||
|
|
150ea5489d | ||
|
|
dd4afcfa02 | ||
|
|
a15e2d0bec | ||
|
|
1e7567b332 | ||
|
|
1dba37de1c | ||
|
|
bfdd13a52c | ||
|
|
a26b65f6b3 | ||
|
|
36f12fc250 | ||
|
|
8c253ee6c3 | ||
|
|
fb497cbb65 | ||
|
|
11bacf8e1b | ||
|
|
2599353bc0 | ||
|
|
9f92b788d8 | ||
|
|
c584c82e0d | ||
|
|
aa4803c5a4 | ||
|
|
816556dbb8 | ||
|
|
d9ecc66fb6 | ||
|
|
f333e91d0a | ||
|
|
f87620d145 | ||
|
|
8bd567de14 | ||
|
|
28a61a5d55 | ||
|
|
d25c23dc46 | ||
|
|
481881bdf7 | ||
|
|
44ab43948a | ||
|
|
643c0f0cba | ||
|
|
da0d698fce | ||
|
|
6f1458dea4 | ||
|
|
72e554c612 | ||
|
|
e54a124e71 | ||
|
|
62e6bd03f6 | ||
|
|
be2e765af8 | ||
|
|
c5b95f4bbb | ||
|
|
b8e85ce171 | ||
|
|
a2b093a9a1 | ||
|
|
8481eefe9f | ||
|
|
9f612740f7 | ||
|
|
cb4b62c04b | ||
|
|
c51e257674 | ||
|
|
40ca71a120 | ||
|
|
cc81b58a0e | ||
|
|
70640f232b | ||
|
|
949e910102 | ||
|
|
395aae632d | ||
|
|
ce9ff91f78 | ||
|
|
f1861e5cbe | ||
|
|
79bca55588 | ||
|
|
3e48da364b | ||
|
|
8b88042311 | ||
|
|
352e7d076d | ||
|
|
d4a6887c31 | ||
|
|
6813d3f09b | ||
|
|
81d20479d4 | ||
|
|
1ff53bb1ba | ||
|
|
927a76eb30 | ||
|
|
050abd469f | ||
|
|
127c3bf6e0 | ||
|
|
cbd9da1acf | ||
|
|
71b1425fd5 | ||
|
|
89424f5b25 | ||
|
|
86d31a6e3f | ||
|
|
84265522ed | ||
|
|
662a9ac8f7 | ||
|
|
33068b3d07 | ||
|
|
db9f31cbd1 | ||
|
|
5b3336a997 | ||
|
|
6920d7ce86 | ||
|
|
1da10df16c | ||
|
|
7f2cf89aeb | ||
|
|
3e629f2ac7 | ||
|
|
3c5a13fa39 | ||
|
|
46c26749eb | ||
|
|
a2d8112081 | ||
|
|
bb331ddde1 | ||
|
|
300bc2d4b0 | ||
|
|
f88fba3cbd | ||
|
|
7b58e280a5 | ||
|
|
8dd637646f | ||
|
|
77625cbc89 | ||
|
|
b122da385a | ||
|
|
eac15568e2 | ||
|
|
fb67d391a3 | ||
|
|
7129d57c22 | ||
|
|
9e88fe782a | ||
|
|
91de42214b | ||
|
|
02b82fb567 | ||
|
|
9fc2d82c3b | ||
|
|
1aebe941ef | ||
|
|
9c1b923e99 | ||
|
|
6adda4d4c0 | ||
|
|
5a8f29cbcc | ||
|
|
aa2208afee | ||
|
|
a1e3732cef | ||
|
|
8bb3b4db45 | ||
|
|
240c0124a6 | ||
|
|
52965a2b9d | ||
|
|
bed33dd66b | ||
|
|
c0f3997eaf | ||
|
|
29adf41cc2 | ||
|
|
0f6b274a8e | ||
|
|
34b7d3a84d | ||
|
|
3afbf58c92 | ||
|
|
9193bf8f3f | ||
|
|
2b487789c8 | ||
|
|
6b6ce9bd43 | ||
|
|
fbe4e20182 | ||
|
|
d753eb1861 | ||
|
|
aac2016aa9 | ||
|
|
2ec26f2e77 | ||
|
|
9e48c8a2b0 | ||
|
|
f1ab82a7e8 | ||
|
|
c4a3ecad74 | ||
|
|
844d678cba | ||
|
|
d3c5cc1fe5 | ||
|
|
01cf5ded25 | ||
|
|
399a6c779e | ||
|
|
516cbf29c4 | ||
|
|
63fc3530b9 | ||
|
|
0ae09ac40d | ||
|
|
c9cb0a918b | ||
|
|
c538edd457 | ||
|
|
718f02e0d3 | ||
|
|
f3560b3f22 | ||
|
|
8b18364cfb | ||
|
|
e7ff9bcf14 | ||
|
|
546a888f91 | ||
|
|
b0c3795ac4 | ||
|
|
19f4433ef2 | ||
|
|
b09e63d792 | ||
|
|
5e04bc52bb | ||
|
|
2773f9f10a | ||
|
|
cf183438ee | ||
|
|
c18ad33d44 | ||
|
|
9956130fa2 | ||
|
|
50ad936a80 | ||
|
|
acb4203da5 | ||
|
|
a6e6fbbeb3 | ||
|
|
02e0ab3df8 | ||
|
|
a66df5bf91 | ||
|
|
ef49022f97 | ||
|
|
4d2ff35b88 | ||
|
|
1e08457302 | ||
|
|
59dd3fcfe8 | ||
|
|
35a659b435 | ||
|
|
01fff28591 | ||
|
|
acad9c91d0 | ||
|
|
ea73a5a1e4 | ||
|
|
6c5f273c3f | ||
|
|
512ca45eb9 | ||
|
|
67c3b641c2 | ||
|
|
bb61f41996 | ||
|
|
8dfa7d2c7e | ||
|
|
046ff98055 | ||
|
|
cde89bb093 | ||
|
|
9eb77b093b | ||
|
|
5e40958c3b | ||
|
|
82b1e211f8 | ||
|
|
3fd521bd7d | ||
|
|
cdc0fc4d45 | ||
|
|
43c40b6f3d | ||
|
|
2e5417f5bd | ||
|
|
247cef557f | ||
|
|
0f328b26c0 | ||
|
|
415027eedd | ||
|
|
1223efd9ce | ||
|
|
27e1844bb9 | ||
|
|
054738b20f | ||
|
|
58a60f9e5e | ||
|
|
df413084ff | ||
|
|
b029f4e97e | ||
|
|
4b98bcb536 | ||
|
|
c597bb43ac | ||
|
|
f66017dd16 | ||
|
|
0990c54b02 | ||
|
|
1cf432ed50 | ||
|
|
eb9c5951e6 | ||
|
|
6a1de942e0 | ||
|
|
b62fb2816f | ||
|
|
d3a50832b1 | ||
|
|
d911500226 | ||
|
|
657c31a31b | ||
|
|
851c79f6e6 | ||
|
|
3fedcf496b | ||
|
|
1562106ccd | ||
|
|
90922a746d | ||
|
|
e54906aaf2 | ||
|
|
6f9f05df58 | ||
|
|
ce3b0b7564 | ||
|
|
a9777b31fc | ||
|
|
7dcacbb5bf | ||
|
|
5f8f48145d | ||
|
|
b8052728ea | ||
|
|
3f823404fc | ||
|
|
e3658fe73e | ||
|
|
3f43883b30 | ||
|
|
c9f2555f4a | ||
|
|
8fa55bb406 | ||
|
|
ea78b00406 | ||
|
|
fb2c69e852 | ||
|
|
26536ad29f | ||
|
|
24702d5e64 | ||
|
|
79bf69008d | ||
|
|
0d20226656 | ||
|
|
e4f59e1fa0 | ||
|
|
bf77046abc | ||
|
|
985f57d2b4 | ||
|
|
aca8c70648 | ||
|
|
be8a6afd4a | ||
|
|
b313b63718 | ||
|
|
80238cef2f | ||
|
|
776a4cb2b5 | ||
|
|
a96c5dd131 | ||
|
|
c79e051d35 | ||
|
|
0adb5a6dbf | ||
|
|
64ba822460 | ||
|
|
db59c744af | ||
|
|
d0ecf17cec | ||
|
|
86b0b2afed | ||
|
|
db9d1fffba | ||
|
|
c5c488ec9d | ||
|
|
11cee69b5f | ||
|
|
0dd62ba176 | ||
|
|
40f9aba00f | ||
|
|
643148f131 | ||
|
|
099d0f0e34 | ||
|
|
9187dbc0d9 | ||
|
|
a9c68584df | ||
|
|
50dadb263b | ||
|
|
1106b9be5f | ||
|
|
ec6e3150f8 | ||
|
|
824336a958 | ||
|
|
5a414980ea | ||
|
|
7215e2b879 | ||
|
|
12d359a6c4 | ||
|
|
182883c4ba | ||
|
|
1ed5a802a9 | ||
|
|
b0a314db2c | ||
|
|
4234f30930 | ||
|
|
12de169c29 | ||
|
|
cafcafe8d7 | ||
|
|
9dd0c9aaa0 | ||
|
|
8e5e7a293e | ||
|
|
e430abe428 | ||
|
|
8ed33a951d | ||
|
|
ef74fcb6bb | ||
|
|
98cf1c90d4 | ||
|
|
aacbe2f237 | ||
|
|
7ac57f726f | ||
|
|
89fee7d373 | ||
|
|
3d56703e92 | ||
|
|
53523879e8 | ||
|
|
7290370f37 | ||
|
|
5923bba0bf | ||
|
|
c8a824af78 | ||
|
|
bb3e8d2323 | ||
|
|
2c74b21642 | ||
|
|
3e7bd993d8 | ||
|
|
ffbdeac062 | ||
|
|
e72666919a | ||
|
|
e57e16fee4 | ||
|
|
af23f3ee26 | ||
|
|
1e137b7fcb | ||
|
|
5340b41cd1 | ||
|
|
11c5664fb4 | ||
|
|
59d034e8a7 | ||
|
|
b178109c1e | ||
|
|
a2a78ecc5d | ||
|
|
c540e335c3 | ||
|
|
b7aaf47762 | ||
|
|
b80dca6c9b | ||
|
|
3dd79d0752 | ||
|
|
a8cb34edbf | ||
|
|
812ee3308e | ||
|
|
53c2bea069 | ||
|
|
e56d2c760b | ||
|
|
3e9df709c8 | ||
|
|
1bd073b713 | ||
|
|
e60acb3ab0 | ||
|
|
6c94fea797 | ||
|
|
a4ae5ad77a | ||
|
|
a8ef691b71 | ||
|
|
047b8446d4 | ||
|
|
66b152ffe0 | ||
|
|
7f3f7f3d28 | ||
|
|
fcd76072e0 | ||
|
|
b4e8b39a6e | ||
|
|
e22f04bbdc | ||
|
|
ebab6e9fad | ||
|
|
fe220bb14f | ||
|
|
2af17e6d19 | ||
|
|
5bbd6c23f8 | ||
|
|
320abe5356 | ||
|
|
cee9574eec | ||
|
|
6cc6d1f172 | ||
|
|
fd0bfb7e2e | ||
|
|
8f8e0a9b6e | ||
|
|
71f131be40 | ||
|
|
c96c5db231 | ||
|
|
4e0819daab | ||
|
|
07ddd5f698 | ||
|
|
9ec474d427 | ||
|
|
0810ccda41 | ||
|
|
f7a4dbc112 | ||
|
|
a247e53faa | ||
|
|
c86ebb4da5 | ||
|
|
b225c4736c | ||
|
|
992872bb5d | ||
|
|
a4d5c71207 | ||
|
|
958ce2ba14 | ||
|
|
82e0de5779 | ||
|
|
6e20527322 | ||
|
|
9c4c7d85e0 | ||
|
|
c52ce4b572 | ||
|
|
5b9892f071 | ||
|
|
60f34bbaed | ||
|
|
ff39c58bac | ||
|
|
249e6665eb | ||
|
|
3cd7aaf9c8 | ||
|
|
40d02e9a1d | ||
|
|
725ac8d811 | ||
|
|
b34102015d | ||
|
|
b311360048 | ||
|
|
20808baa2c | ||
|
|
b78ad6ad48 | ||
|
|
b93091c617 | ||
|
|
d6b8fed5be | ||
|
|
f12d23c5cc | ||
|
|
f7bbde7bb5 | ||
|
|
0e15d77a17 | ||
|
|
4e01dad1f8 | ||
|
|
406d680f31 | ||
|
|
7bde20118b | ||
|
|
3a7370aefc | ||
|
|
2087d7c1a1 | ||
|
|
ed57d90570 | ||
|
|
fc3f496d1b | ||
|
|
39ece5f8c7 | ||
|
|
b5b8d4a42e | ||
|
|
792bd0b4e3 | ||
|
|
e8e244f839 | ||
|
|
bb58f668b3 | ||
|
|
ecdf344983 | ||
|
|
6623fc543d | ||
|
|
1e38c9d065 | ||
|
|
30719eac23 | ||
|
|
be791133e9 | ||
|
|
ba41a4afc3 | ||
|
|
7001015c8a | ||
|
|
cb86a2cae2 | ||
|
|
2023fd51cf | ||
|
|
ee0c82f938 | ||
|
|
f66c15fa4c | ||
|
|
870a168078 | ||
|
|
f1e5ff5830 | ||
|
|
ec56b2399e | ||
|
|
98567347b0 | ||
|
|
d1ef9e9bc0 | ||
|
|
1d15cb6eab | ||
|
|
2f6c884c39 | ||
|
|
3007742461 | ||
|
|
dd02160e29 | ||
|
|
04ceb5cec2 | ||
|
|
4c251cb528 | ||
|
|
f29c6b4014 | ||
|
|
5d3bd4296d | ||
|
|
7b4e9fe3b3 | ||
|
|
e127fbdbc8 | ||
|
|
da38ea1a3c | ||
|
|
80b18e5e78 | ||
|
|
b08fcbf349 | ||
|
|
4448207b46 | ||
|
|
c183437b77 | ||
|
|
0bc62c64f2 | ||
|
|
f9f20656d9 | ||
|
|
1cf96c874c | ||
|
|
2e938cedc3 | ||
|
|
8aae8a860c | ||
|
|
72c9964603 | ||
|
|
045c255762 | ||
|
|
441e34087e | ||
|
|
b754115f2b | ||
|
|
94398a1154 | ||
|
|
cf3968f176 | ||
|
|
6101dfa1e7 | ||
|
|
2bb69090d7 | ||
|
|
32c89f8e51 | ||
|
|
733baa249e | ||
|
|
1fc9d8bd0b | ||
|
|
c596b87264 | ||
|
|
51ede8ef25 | ||
|
|
92d8d69c21 | ||
|
|
7ccc860767 | ||
|
|
a19eee8543 | ||
|
|
f00f059724 | ||
|
|
db74186f65 | ||
|
|
d6b8f09a9b | ||
|
|
be077e583a | ||
|
|
0a8951258f | ||
|
|
adaeb6075b | ||
|
|
be796b9980 | ||
|
|
6c25b86257 | ||
|
|
1d602e9364 | ||
|
|
a8985dc3ec | ||
|
|
1756d9ea31 | ||
|
|
63e2c4a403 | ||
|
|
35c7e0b062 | ||
|
|
e49c454e06 | ||
|
|
1b676d2766 | ||
|
|
a0e8d07f2b | ||
|
|
9aee6ad25d | ||
|
|
f00c5a545b | ||
|
|
7d67acee8b | ||
|
|
30cf8768c4 | ||
|
|
64c827f318 | ||
|
|
f13dcb35bf | ||
|
|
85f294ee2f | ||
|
|
0e091a62fa | ||
|
|
42e4086945 | ||
|
|
7590b8bb30 | ||
|
|
455746a0ce | ||
|
|
371bc51b1c | ||
|
|
badc22bbae | ||
|
|
2d7a5669d2 | ||
|
|
89209acd58 | ||
|
|
9a4bd9308e | ||
|
|
3527ec8621 | ||
|
|
e812234121 | ||
|
|
b8397a6eeb | ||
|
|
be0b6c8933 | ||
|
|
cbd4fef05a | ||
|
|
4f2774fa80 | ||
|
|
cf967de406 | ||
|
|
5167cc3dae | ||
|
|
12ce3d1370 | ||
|
|
fa5e96cdf7 | ||
|
|
18eb35983b | ||
|
|
b80343fd5b | ||
|
|
34f18b6876 | ||
|
|
c690aa95bc | ||
|
|
9f33f58799 | ||
|
|
e30eeacd70 | ||
|
|
3e9fccb813 | ||
|
|
e25503422b | ||
|
|
69e64f8d72 | ||
|
|
1585b98d92 | ||
|
|
c60c84c55d | ||
|
|
1eae886946 | ||
|
|
4b7ca990ad | ||
|
|
aabd50d5ad | ||
|
|
f56f2a679c | ||
|
|
e3ec5dcffb | ||
|
|
b428261ea6 | ||
|
|
7711cbf01a | ||
|
|
ce550ab14b | ||
|
|
6d67acf0d0 | ||
|
|
82f415e01a | ||
|
|
4b9f33b4d5 | ||
|
|
bf997c57b6 | ||
|
|
4395aab675 | ||
|
|
aad5ac41fa | ||
|
|
9a743feb99 | ||
|
|
353b636e4a | ||
|
|
50f46f1fac | ||
|
|
6e597dfd63 | ||
|
|
1a357d9f4e | ||
|
|
12692327a1 | ||
|
|
e166179eb8 | ||
|
|
294900133a | ||
|
|
df939989d8 | ||
|
|
a1c49cd4e9 | ||
|
|
b374152512 | ||
|
|
bbc79f7b41 | ||
|
|
841b593bd9 | ||
|
|
49805cb00d | ||
|
|
0256398770 | ||
|
|
38855bc712 | ||
|
|
017b4ed819 | ||
|
|
d47c02350c | ||
|
|
4b4f74955d | ||
|
|
211be59492 | ||
|
|
55a91737da | ||
|
|
568b8cf74d | ||
|
|
bee257b69b | ||
|
|
36353034c9 | ||
|
|
b4b3b7b978 | ||
|
|
550ca25837 | ||
|
|
5cb757c95b | ||
|
|
c6fb9f9494 | ||
|
|
1c664cbb1e | ||
|
|
dcc8112e68 | ||
|
|
7f8aafbe7d | ||
|
|
837bf42ce7 | ||
|
|
084a76ecea | ||
|
|
3da978e41b | ||
|
|
e8c3443bd3 | ||
|
|
14b494ed61 | ||
|
|
ef214d3a25 | ||
|
|
5038f10bb6 | ||
|
|
fd2b90b73b | ||
|
|
7225ae8eed | ||
|
|
4f8349919a | ||
|
|
0214f7431a | ||
|
|
dbdcec54b4 | ||
|
|
87cc02a04a | ||
|
|
f5bba434cd | ||
|
|
7048e3f49e | ||
|
|
ac1ad54ded | ||
|
|
a1953b3f77 | ||
|
|
b100e0eed6 | ||
|
|
24e787e9ff | ||
|
|
916943ce1a | ||
|
|
93a4e248be | ||
|
|
8494641805 | ||
|
|
82b37d914c | ||
|
|
8c579dfce2 | ||
|
|
95af93f266 | ||
|
|
41b1fe814e | ||
|
|
ac1e8e16a2 | ||
|
|
e8a578407b | ||
|
|
450b0f1c4a | ||
|
|
d2b840c9fc | ||
|
|
ad9ddef21a | ||
|
|
5c1fe2fedb | ||
|
|
268adea870 | ||
|
|
70910f3f04 | ||
|
|
02f2d4dbf7 | ||
|
|
dcec5908af | ||
|
|
85e594b968 | ||
|
|
c08e02bc59 | ||
|
|
a92669fc05 | ||
|
|
0cce6b2bf5 | ||
|
|
9f29e21ade | ||
|
|
93dd831a8b | ||
|
|
b860a9145c | ||
|
|
c69896b97b | ||
|
|
094614ba92 | ||
|
|
2bbbccf106 | ||
|
|
37589e862a | ||
|
|
80890aa751 | ||
|
|
05745bacdf | ||
|
|
26bbac8c8a | ||
|
|
b60927f21f | ||
|
|
a77fdbe8b5 | ||
|
|
81f2bb71ed | ||
|
|
3d1b4715eb | ||
|
|
df12cf48c6 | ||
|
|
4e37530b60 | ||
|
|
95513a6be4 | ||
|
|
8415e77fbe | ||
|
|
3e593ba735 | ||
|
|
ddd9443f26 | ||
|
|
d0c67f7e87 | ||
|
|
b2e391a309 | ||
|
|
3d4f602354 | ||
|
|
2b62b097df | ||
|
|
b816837188 | ||
|
|
c084efc79e | ||
|
|
07791b1406 | ||
|
|
9ba41cadd2 | ||
|
|
ca02c72ecb | ||
|
|
f5b2849d72 | ||
|
|
8c4808fc36 | ||
|
|
ed23f897c4 | ||
|
|
b636b093d2 | ||
|
|
e433c33f9f | ||
|
|
21528f97be | ||
|
|
a7c3c38901 | ||
|
|
5766da53da | ||
|
|
3e6f82d10c | ||
|
|
01e4a9bb55 | ||
|
|
e09f898428 | ||
|
|
1d3ed22ab2 | ||
|
|
abdc66ca35 | ||
|
|
affd549250 | ||
|
|
a98ce10d71 | ||
|
|
432ed84634 | ||
|
|
b2eaffda65 | ||
|
|
78a1ca7417 | ||
|
|
7372ca74ef | ||
|
|
97bc578e86 | ||
|
|
adc1bd510c | ||
|
|
5ef11410bd | ||
|
|
843a59e2ab | ||
|
|
9bd2159a5f | ||
|
|
0b63e96ade | ||
|
|
17a13200f8 | ||
|
|
b48e7b5988 | ||
|
|
ba4c090467 | ||
|
|
b9b1ae5876 | ||
|
|
223d09ec41 | ||
|
|
e72dcebf98 | ||
|
|
980810dc82 | ||
|
|
6d7b16c0d2 | ||
|
|
d8d5da5c30 | ||
|
|
931c55c115 | ||
|
|
dcd3787a52 | ||
|
|
995d298d00 | ||
|
|
582c628f21 | ||
|
|
10e94f0efa | ||
|
|
f45ca2b65e | ||
|
|
c9231c0248 | ||
|
|
b5491e25d9 | ||
|
|
ea0673de2b | ||
|
|
f8d7872cc4 | ||
|
|
ead615dca5 | ||
|
|
4ed4702907 | ||
|
|
be750c099d | ||
|
|
4b82e7b3b2 | ||
|
|
1e17218a2d | ||
|
|
423f895412 | ||
|
|
d6070f1383 | ||
|
|
f1e818a76f | ||
|
|
a28a9520b5 | ||
|
|
6907827b05 | ||
|
|
6ea68b9128 | ||
|
|
7c37c423e1 | ||
|
|
8854623440 | ||
|
|
7b088dc2a4 | ||
|
|
e19f4be52c | ||
|
|
20b58344cc | ||
|
|
c310cd6556 | ||
|
|
fc074bb4fa | ||
|
|
a7bfba4549 | ||
|
|
a65b6c7523 | ||
|
|
7730c00a02 |
No files matched your search
+2
-2
@@ -57,11 +57,11 @@ function setup ()
|
||||
CROSS_DLL_DIR="$CROSS_DIR/bin"
|
||||
PATH=$CROSS_BIN_DIR:$PATH
|
||||
|
||||
MONO_VERSION=`grep AM_INIT_AUTOMAKE configure.in | cut -d ',' -f 2|tr -d '\)'`
|
||||
MONO_VERSION=`grep AM_INIT_AUTOMAKE configure.in | cut -d ',' -f 2|tr -d '\)'|tr -d '\('`
|
||||
|
||||
if [ -d ./.git ]; then
|
||||
MONO_GIT_COMMIT="`git log -1 --format=format:%t`"
|
||||
MONO_GIT_BRANCH="`git branch|grep '\*'|cut -d ' ' -f 2`"
|
||||
MONO_GIT_BRANCH="`git branch|grep '\*'|cut -d ' ' -f 2|tr -d '\)'|tr -d '\('`"
|
||||
MONO_RELEASE="$MONO_VERSION-$MONO_GIT_BRANCH-$MONO_GIT_COMMIT"
|
||||
else
|
||||
MONO_RELEASE="$MONO_VERSION"
|
||||
|
||||
+125
-10
@@ -6,7 +6,7 @@ AC_CANONICAL_SYSTEM
|
||||
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE(mono,2.10)
|
||||
AM_INIT_AUTOMAKE(mono,2.10.6)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
API_VER=2.0
|
||||
@@ -78,6 +78,7 @@ esac
|
||||
|
||||
host_win32=no
|
||||
target_win32=no
|
||||
platform_android=no
|
||||
case "$host" in
|
||||
*-mingw*|*-*-cygwin*)
|
||||
AC_DEFINE(HOST_WIN32,1,[Host Platform is Win32])
|
||||
@@ -172,6 +173,41 @@ case "$host" in
|
||||
with_sigaltstack=no
|
||||
use_sigposix=yes
|
||||
;;
|
||||
*-*-linux-android*)
|
||||
host_win32=no
|
||||
platform_android=yes
|
||||
AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
|
||||
AC_DEFINE(TARGET_ANDROID,1,[Targeting the Android platform])
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
|
||||
if test "x$disable_munmap" != "xyes"; then
|
||||
CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
|
||||
fi
|
||||
libmono_cflags="-D_REENTRANT"
|
||||
libdl="-ldl"
|
||||
libgc_threads=pthreads
|
||||
use_sigposix=yes
|
||||
|
||||
with_tls=pthread
|
||||
with_sigaltstack=no
|
||||
with_static_mono=no
|
||||
|
||||
# Android doesn't support boehm, as it's missing <link.h>
|
||||
support_boehm=no
|
||||
with_gc=sgen
|
||||
|
||||
# isinf(3) requires -lm; see isinf check below
|
||||
LDFLAGS="$LDFLAGS -lm"
|
||||
|
||||
# Bionic's <pthread.h> sets PTHREAD_STACK_MIN=2*PAGE_SIZE; doesn't define
|
||||
# PAGE_SIZE; breaks mono/io-layer/collection.c
|
||||
# Bionic doesn't provide S_IWRITE; breaks io-layer/io.c
|
||||
CFLAGS="$CFLAGS -DPAGE_SIZE=4096 -DS_IWRITE=S_IWUSR"
|
||||
CXXFLAGS="$CXXFLAGS -DPAGE_SIZE=4096 -DS_IWRITE=S_IWUSR"
|
||||
|
||||
# to bypass the underscore linker check, can't work when cross-compiling
|
||||
mono_cv_uscore=yes
|
||||
;;
|
||||
*-*-linux*)
|
||||
host_win32=no
|
||||
CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
|
||||
@@ -248,12 +284,12 @@ case "$host" in
|
||||
if test "x$cross_compiling" = "xyes"; then
|
||||
has_broken_apple_cpp=yes
|
||||
fi
|
||||
dnl Snow Leopard is horribly broken -- it reports itself as i386-apple-darwin10.0.0, but
|
||||
dnl Snow Leopard is horribly broken -- it reports itself as i386-apple-darwin*, but
|
||||
dnl its gcc defaults to 64-bit mode. They have also deprecated the usage of ucontext
|
||||
dnl we need to set some flags to build our 32-bit binaries on 10.6 properly
|
||||
case "$host" in
|
||||
dnl Snow Leopard config.guess reports as this
|
||||
i*86-*-darwin10*)
|
||||
dnl Snow Leopard and newer config.guess reports as this
|
||||
i*86-*-darwin*)
|
||||
BROKEN_DARWIN_FLAGS="-arch i386 -D_XOPEN_SOURCE -mmacosx-version-min=10.5"
|
||||
CPPFLAGS="$CPPFLAGS $BROKEN_DARWIN_FLAGS"
|
||||
CFLAGS="$CFLAGS $BROKEN_DARWIN_FLAGS"
|
||||
@@ -294,6 +330,7 @@ AM_CONDITIONAL(TARGET_WIN32, test x$target_win32 = xyes)
|
||||
AM_CONDITIONAL(PLATFORM_LINUX, echo x$target_os | grep -q linux)
|
||||
AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
|
||||
AM_CONDITIONAL(PLATFORM_SIGPOSIX, test x$use_sigposix = xyes)
|
||||
AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
|
||||
|
||||
AC_CHECK_TOOL(CC, gcc, gcc)
|
||||
AC_PROG_CC
|
||||
@@ -443,6 +480,20 @@ if test x"$GCC" = xyes; then
|
||||
AC_MSG_RESULT(no)
|
||||
CFLAGS=$ORIG_CFLAGS
|
||||
])
|
||||
|
||||
ORIG_CFLAGS=$CFLAGS
|
||||
# Check for the normal version, since gcc ignores unknown -Wno options
|
||||
CFLAGS="$CFLAGS -Wunused-but-set-variable"
|
||||
AC_MSG_CHECKING(for -Wno-unused-but-set-variable option to gcc)
|
||||
AC_TRY_COMPILE([], [
|
||||
void main () { }
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
CFLAGS="$ORIG_CFLAGS -Wno-unused-but-set-variable"
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
CFLAGS=$ORIG_CFLAGS
|
||||
])
|
||||
else
|
||||
# The Sun Forte compiler complains about inline functions that access static variables
|
||||
# so disable all inlining.
|
||||
@@ -657,7 +708,7 @@ DISABLED_FEATURES=none
|
||||
|
||||
AC_ARG_ENABLE(minimal, [ --enable-minimal=LIST drop support for LIST subsystems.
|
||||
LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug,
|
||||
reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, normalization, assembly_remapping.],
|
||||
reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, normalization, assembly_remapping, shared_perfcounters.],
|
||||
[
|
||||
for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
|
||||
eval "mono_feature_disable_$feature='yes'"
|
||||
@@ -782,6 +833,11 @@ if test "x$mono_feature_disable_assembly_remapping" = "xyes"; then
|
||||
AC_MSG_NOTICE([Disabled Assembly remapping.])
|
||||
fi
|
||||
|
||||
if test "x$mono_feature_disable_shared_perfcounters" = "xyes"; then
|
||||
AC_DEFINE(DISABLE_SHARED_PERFCOUNTERS, 1, [Disable shared perfcounters.])
|
||||
AC_MSG_NOTICE([Disabled Shared perfcounters.])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for visibility __attribute__)
|
||||
AC_TRY_COMPILE([], [
|
||||
void __attribute__ ((visibility ("hidden"))) doit (void) {}
|
||||
@@ -813,6 +869,9 @@ if test x$enable_parallel_mark = xyes; then
|
||||
libgc_configure_args="$libgc_configure_args --enable-parallel-mark"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(boehm, [ --disable-boehm Disable the Boehm GC.], support_boehm=$enableval,support_boehm=${support_boehm:-yes})
|
||||
AM_CONDITIONAL(SUPPORT_BOEHM, test x$support_boehm = xyes)
|
||||
|
||||
dnl
|
||||
dnl Boehm GC configuration
|
||||
dnl
|
||||
@@ -1560,6 +1619,12 @@ if test x$target_win32 = xno; then
|
||||
AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
|
||||
fi
|
||||
|
||||
havekqueue=no
|
||||
AC_CHECK_FUNCS(kqueue, , AC_MSG_CHECKING(for kqueue in sys/event.h)
|
||||
AC_TRY_LINK([#include <sys/event.h>],
|
||||
[ kqueue(); ],
|
||||
AC_DEFINE(HAVE_KQUEUE, 1, [Have kqueue]) AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no)))
|
||||
dnl ******************************
|
||||
dnl *** Checks for SIOCGIFCONF ***
|
||||
dnl ******************************
|
||||
@@ -2262,8 +2327,10 @@ case "$host" in
|
||||
arch_target=arm;
|
||||
ACCESS_UNALIGNED="no"
|
||||
JIT_SUPPORTED=yes
|
||||
CPPFLAGS="$CPPFLAGS -DARM_FPU_NONE=1"
|
||||
CPPFLAGS="$CPPFLAGS -DARM_FPU_VFP=1 -D__ARM_EABI__ -DHAVE_ARMV6=1"
|
||||
jit_wanted=true
|
||||
# libgc's gc_locks.h depends on this
|
||||
NESTED_LIBGC_FLAGS="$NESTED_LIBGC_FLAGS -DHAVE_ARMV6"
|
||||
sgen_supported=true
|
||||
;;
|
||||
arm*-linux*)
|
||||
@@ -2296,12 +2363,12 @@ case "$host" in
|
||||
esac
|
||||
|
||||
if test "x$host" != "x$target"; then
|
||||
AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
|
||||
case "$target" in
|
||||
powerpc64-ps3-linux-gnu)
|
||||
TARGET=POWERPC64
|
||||
arch_target=powerpc64
|
||||
AC_DEFINE(TARGET_PS3, 1, [...])
|
||||
AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
|
||||
# It would be better to just use TARGET_POWERPC64, but lots of code already
|
||||
# uses this define
|
||||
AC_DEFINE(__mono_ppc64__, 1, [...])
|
||||
@@ -2314,7 +2381,6 @@ if test "x$host" != "x$target"; then
|
||||
TARGET=POWERPC64
|
||||
arch_target=powerpc64
|
||||
AC_DEFINE(TARGET_XBOX360, 1, [...])
|
||||
AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
|
||||
# It would be better to just use TARGET_POWERPC64, but lots of code already
|
||||
# uses this define
|
||||
sizeof_register=8
|
||||
@@ -2324,12 +2390,49 @@ if test "x$host" != "x$target"; then
|
||||
TARGET=AMD64
|
||||
arch_target=amd64
|
||||
AC_DEFINE(TARGET_AMD64, 1, [...])
|
||||
AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
|
||||
AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
|
||||
sizeof_register=8
|
||||
;;
|
||||
armv7l-unknown-linux-gnueabi*)
|
||||
# TEGRA
|
||||
TARGET=ARM;
|
||||
arch_target=arm;
|
||||
AC_DEFINE(TARGET_ARM, 1, [...])
|
||||
ACCESS_UNALIGNED="no"
|
||||
JIT_SUPPORTED=yes
|
||||
CPPFLAGS="$CPPFLAGS -DARM_FPU_VFP=1 -D__ARM_EABI__"
|
||||
jit_wanted=true
|
||||
# Can't use tls, since it depends on the runtime detection of tls offsets
|
||||
# in mono-compiler.h
|
||||
with_tls=pthread
|
||||
;;
|
||||
armv5tel-unknown-linux-gnueabi*)
|
||||
TARGET=ARM;
|
||||
arch_target=arm;
|
||||
AC_DEFINE(TARGET_ARM, 1, [...])
|
||||
ACCESS_UNALIGNED="no"
|
||||
JIT_SUPPORTED=yes
|
||||
CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
|
||||
jit_wanted=true
|
||||
# Can't use tls, since it depends on the runtime detection of tls offsets
|
||||
# in mono-compiler.h
|
||||
with_tls=pthread
|
||||
;;
|
||||
armv5-*-linux-androideabi*)
|
||||
TARGET=ARM;
|
||||
arch_target=arm;
|
||||
AC_DEFINE(TARGET_ARM, 1, [...])
|
||||
AC_DEFINE(TARGET_ANDROID, 1, [...])
|
||||
ACCESS_UNALIGNED="no"
|
||||
JIT_SUPPORTED=yes
|
||||
CPPFLAGS="$CPPFLAGS -D__ARM_EABI__ -DARM_FPU_NONE=1"
|
||||
jit_wanted=true
|
||||
# Can't use tls, since it depends on the runtime detection of tls offset
|
||||
# in mono-compiler.h
|
||||
with_tls=pthread
|
||||
;;
|
||||
*)
|
||||
AC_MSG_WARN([Cross compiling is only supported for targets matching 'powerpc64-{ps3,xbox360}-linux-gnu'])
|
||||
AC_MSG_ERROR([Cross compiling is not supported for target $target])
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -2561,6 +2664,18 @@ if test ${TARGET} = ARM && test x$cross_compiling = xno && test x$enable_mcs_bui
|
||||
AC_MSG_RESULT($fpu)
|
||||
CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu=1"
|
||||
unset fpu
|
||||
|
||||
AC_MSG_CHECKING(for ARMV6)
|
||||
AC_TRY_RUN([
|
||||
int main () { __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory"); return 0; }
|
||||
], armv6=yes, armv6=no)
|
||||
|
||||
AC_MSG_RESULT($armv6)
|
||||
if test ${armv6} = yes; then
|
||||
AC_DEFINE(HAVE_ARMV6, 1, "Host supports ARMV6 instructions")
|
||||
# libgc's gc_locks.h depends on this
|
||||
NESTED_LIBGC_FLAGS="$NESTED_LIBGC_FLAGS -DHAVE_ARMV6"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test ${TARGET} = unknown; then
|
||||
|
||||
@@ -3,3 +3,5 @@
|
||||
/config
|
||||
/.cvsignore
|
||||
/*.pc
|
||||
/gdb/mono-sgen-gdb.py
|
||||
/mono-sgen-gdb.py
|
||||
+8
-2
@@ -21,8 +21,10 @@ pkgconfigdir = $(libdir)/pkgconfig
|
||||
|
||||
if SUPPORT_SGEN
|
||||
SGENPCFILE=monosgen-2.pc
|
||||
SGENGDBFILE=mono-sgen-gdb.py
|
||||
else
|
||||
SGENPCFILE=
|
||||
SGENGDBFILE=
|
||||
endif
|
||||
|
||||
if JIT_SUPPORTED
|
||||
@@ -38,11 +40,15 @@ pkgconfig_DATA= mint.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc mon
|
||||
endif
|
||||
|
||||
DISTCLEANFILES= mono-2.pc mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
system.web.extensions.design_1.0.pc mono.web.pc system.web.mvc.pc system.web.mvc2.pc $(SGENPCFILE)
|
||||
system.web.extensions.design_1.0.pc mono.web.pc system.web.mvc.pc system.web.mvc2.pc monosgen-2.pc mono-sgen-gdb.py
|
||||
|
||||
mono_DATA = config \
|
||||
browscap.ini
|
||||
|
||||
gdbdir = $(bindir)
|
||||
|
||||
gdb_DATA = gdb/mono-gdb.py
|
||||
mono-sgen-gdb.py: gdb/mono-gdb.py
|
||||
cp $< $@
|
||||
|
||||
gdb_DATA = gdb/mono-gdb.py $(SGENGDBFILE)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<dllmap dll="sqlite3" target="@SQLITE3@" os="!windows"/>
|
||||
<dllmap dll="libX11" target="@X11@" os="!windows" />
|
||||
<dllmap dll="libcairo-2.dll" target="libcairo.so.2" os="!windows"/>
|
||||
<dllmap dll="libcairo-2.dll" target="libcairo.2.dylib" os="osx"/>
|
||||
<dllmap dll="libcups" target="libcups.so.2" os="!windows"/>
|
||||
<dllmap dll="libcups" target="libcups.dylib" os="osx"/>
|
||||
<dllmap dll="i:kernel32.dll">
|
||||
|
||||
+37
-10
@@ -40,23 +40,35 @@ AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
|
||||
AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
|
||||
|
||||
platform_darwin=no
|
||||
platform_android=no
|
||||
|
||||
case $host in
|
||||
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
|
||||
PATHSEP='\\'
|
||||
SEARCHSEP=';'
|
||||
OS="WIN32"
|
||||
PIDTYPE='void *'
|
||||
;;
|
||||
*-*darwin*)
|
||||
platform_darwin=yes
|
||||
PATHSEP='/'
|
||||
SEARCHSEP=':'
|
||||
OS="UNIX"
|
||||
PIDTYPE='int'
|
||||
;;
|
||||
*-*-linux-android*)
|
||||
platform_android=yes
|
||||
AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
|
||||
PATHSEP='/'
|
||||
SEARCHSEP=':'
|
||||
OS="UNIX"
|
||||
PIDTYPE='int'
|
||||
;;
|
||||
*)
|
||||
PATHSEP='/'
|
||||
SEARCHSEP=':'
|
||||
OS="UNIX"
|
||||
PIDTYPE='int'
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -84,12 +96,16 @@ AC_SUBST(CFLAGS)
|
||||
AC_SUBST(PATHSEP)
|
||||
AC_SUBST(SEARCHSEP)
|
||||
AC_SUBST(OS)
|
||||
AC_SUBST(PIDTYPE)
|
||||
AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
|
||||
AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
|
||||
AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
|
||||
AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
|
||||
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(void *)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_FUNCS(strndup strlcpy getpwuid_r strtok_r rewinddir vasprintf)
|
||||
AM_CONDITIONAL(NEED_VASPRINTF, test x$have_vasprintf = x )
|
||||
AC_CHECK_LIB(iconv, iconv_open, LIBS="$LIBS -liconv")
|
||||
@@ -130,16 +146,7 @@ AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localch
|
||||
AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
|
||||
AC_SUBST(HAVE_ALLOCA_H)
|
||||
|
||||
if test $ac_cv_sizeof_void_p != $ac_cv_sizeof_int; then
|
||||
GPOINTER_TO_INT="((gint)(long) (ptr))"
|
||||
GPOINTER_TO_UINT="((guint)(long) (ptr))"
|
||||
GINT_TO_POINTER="((gpointer)(glong) (v))"
|
||||
GUINT_TO_POINTER="((gpointer)(gulong) (v))"
|
||||
GSIZE="long"
|
||||
GSIZE_FORMAT='"lu"'
|
||||
G_GUINT64_FORMAT='"lu"'
|
||||
G_GINT64_FORMAT='"ld"'
|
||||
else
|
||||
if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
|
||||
GPOINTER_TO_INT="((gint) (ptr))"
|
||||
GPOINTER_TO_UINT="((guint) (ptr))"
|
||||
GINT_TO_POINTER="((gpointer) (v))"
|
||||
@@ -148,6 +155,26 @@ else
|
||||
GSIZE_FORMAT='"u"'
|
||||
G_GUINT64_FORMAT='"llu"'
|
||||
G_GINT64_FORMAT='"lld"'
|
||||
elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
|
||||
GPOINTER_TO_INT="((gint)(long) (ptr))"
|
||||
GPOINTER_TO_UINT="((guint)(long) (ptr))"
|
||||
GINT_TO_POINTER="((gpointer)(glong) (v))"
|
||||
GUINT_TO_POINTER="((gpointer)(gulong) (v))"
|
||||
GSIZE="long"
|
||||
GSIZE_FORMAT='"lu"'
|
||||
G_GUINT64_FORMAT='"lu"'
|
||||
G_GINT64_FORMAT='"ld"'
|
||||
elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
|
||||
GPOINTER_TO_INT="((gint)(long long) (ptr))"
|
||||
GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
|
||||
GINT_TO_POINTER="((gpointer)(long long) (v))"
|
||||
GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
|
||||
GSIZE="long long"
|
||||
GSIZE_FORMAT='"I64u"'
|
||||
G_GUINT64_FORMAT='"I64u"'
|
||||
G_GINT64_FORMAT='"I64i"'
|
||||
else
|
||||
AC_MSG_ERROR([unsupported pointer size])
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||
|
||||
@@ -61,6 +61,10 @@ INCLUDES = -I$(srcdir)
|
||||
|
||||
if HOST_WIN32
|
||||
libeglib_la_LIBADD = -lm $(ICONV_LIBS) -lpsapi
|
||||
else
|
||||
if PLATFORM_ANDROID
|
||||
libeglib_la_LIBADD = -llog
|
||||
endif
|
||||
endif
|
||||
|
||||
libeglib_static_la_LIBADD = $(libeglib_la_LIBADD)
|
||||
|
||||
@@ -42,4 +42,6 @@ typedef signed @GSIZE@ gssize;
|
||||
#define G_BREAKPOINT()
|
||||
#endif
|
||||
|
||||
typedef @PIDTYPE@ GPid;
|
||||
|
||||
#endif
|
||||
@@ -62,8 +62,6 @@ typedef int pid_t;
|
||||
#undef G_HAVE_STRNDUP
|
||||
#define G_HAVE_GETOPT_H 1
|
||||
|
||||
int vasprintf(char **ret, const char *fmt, va_list ap);
|
||||
|
||||
/* disable the following warnings
|
||||
* C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
|
||||
* C4127: conditional expression is constant
|
||||
@@ -71,4 +69,5 @@ int vasprintf(char **ret, const char *fmt, va_list ap);
|
||||
#pragma warning(disable:4100 4127)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
typedef void * GPid;
|
||||
#endif
|
||||
@@ -47,14 +47,14 @@ g_dir_open (const gchar *path, guint flags, GError **error)
|
||||
GDir *dir;
|
||||
gunichar2* path_utf16;
|
||||
gunichar2* path_utf16_search;
|
||||
WIN32_FIND_DATA find_data;
|
||||
WIN32_FIND_DATAW find_data;
|
||||
|
||||
g_return_val_if_fail (path != NULL, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
dir = g_new0 (GDir, 1);
|
||||
path_utf16 = u8to16 (path);
|
||||
path_utf16_search = g_malloc ((wcslen(path_utf16) + 3)*sizeof(gunichar2));
|
||||
path_utf16_search = g_malloc ((wcslen((wchar_t *) path_utf16) + 3)*sizeof(gunichar2));
|
||||
wcscpy (path_utf16_search, path_utf16);
|
||||
wcscat (path_utf16_search, L"\\*");
|
||||
|
||||
@@ -72,7 +72,7 @@ g_dir_open (const gchar *path, guint flags, GError **error)
|
||||
g_free (path_utf16_search);
|
||||
g_free (path_utf16);
|
||||
|
||||
while ((wcscmp (find_data.cFileName, L".") == 0) || (wcscmp (find_data.cFileName, L"..") == 0)) {
|
||||
while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *) find_data.cFileName, L"..") == 0)) {
|
||||
if (!FindNextFileW (dir->handle, &find_data)) {
|
||||
if (error) {
|
||||
gint err = errno;
|
||||
@@ -91,7 +91,7 @@ g_dir_open (const gchar *path, guint flags, GError **error)
|
||||
const gchar *
|
||||
g_dir_read_name (GDir *dir)
|
||||
{
|
||||
WIN32_FIND_DATA find_data;
|
||||
WIN32_FIND_DATAW find_data;
|
||||
|
||||
g_return_val_if_fail (dir != NULL && dir->handle != 0, NULL);
|
||||
|
||||
@@ -111,7 +111,7 @@ g_dir_read_name (GDir *dir)
|
||||
dir->next = NULL;
|
||||
return dir->current;
|
||||
}
|
||||
} while ((wcscmp (find_data.cFileName, L".") == 0) || (wcscmp (find_data.cFileName, L"..") == 0));
|
||||
} while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *) find_data.cFileName, L"..") == 0));
|
||||
|
||||
dir->next = u16to8 (find_data.cFileName);
|
||||
return dir->current;
|
||||
|
||||
@@ -33,9 +33,14 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <direct.h>
|
||||
#endif
|
||||
#ifdef G_OS_WIN32
|
||||
int mkstemp (char *tmp_template);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -39,9 +39,13 @@
|
||||
#ifdef G_OS_WIN32
|
||||
#include <io.h>
|
||||
#define open _open
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(x) ((x & _S_IFMT) == _S_IFREG)
|
||||
#endif
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(x) ((x & _S_IFMT) == _S_IFDIR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int mkstemp (char *tmp_template)
|
||||
{
|
||||
|
||||
+9
-11
@@ -13,14 +13,6 @@
|
||||
#pragma include_alias(<eglib-config.h>, <eglib-config.hw>)
|
||||
#else
|
||||
#include <stdint.h>
|
||||
/* For pid_t */
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <eglib-config.h>
|
||||
@@ -48,6 +40,12 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/* MSC and Cross-compilatin will use this */
|
||||
int vasprintf (char **strp, const char *fmt, va_list ap);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Basic data types
|
||||
*/
|
||||
@@ -116,7 +114,9 @@ typedef int32_t gboolean;
|
||||
|
||||
#define G_USEC_PER_SEC 1000000
|
||||
|
||||
#ifndef ABS
|
||||
#define ABS(a) ((a) > 0 ? (a) : -(a))
|
||||
#endif
|
||||
|
||||
#define G_STRUCT_OFFSET(p_type,field) offsetof(p_type,field)
|
||||
|
||||
@@ -677,7 +677,7 @@ gunichar *g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read,
|
||||
#define u8to16(str) g_utf8_to_utf16(str, (glong)strlen(str), NULL, NULL, NULL)
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#define u16to8(str) g_utf16_to_utf8(str, (glong)wcslen(str), NULL, NULL, NULL)
|
||||
#define u16to8(str) g_utf16_to_utf8((gunichar2 *) (str), (glong)wcslen((wchar_t *) (str)), NULL, NULL, NULL)
|
||||
#else
|
||||
#define u16to8(str) g_utf16_to_utf8(str, (glong)strlen(str), NULL, NULL, NULL)
|
||||
#endif
|
||||
@@ -720,8 +720,6 @@ typedef enum {
|
||||
G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6
|
||||
} GSpawnFlags;
|
||||
|
||||
typedef pid_t GPid;
|
||||
|
||||
typedef void (*GSpawnChildSetupFunc) (gpointer user_data);
|
||||
|
||||
gboolean g_spawn_command_line_sync (const gchar *command_line, gchar **standard_output, gchar **standard_error, gint *exit_status, GError **error);
|
||||
|
||||
@@ -80,7 +80,7 @@ g_unsetenv(const gchar *variable)
|
||||
{
|
||||
gunichar2 *var;
|
||||
var = u8to16(variable);
|
||||
SetEnvironmentVariableW(var, TEXT(""));
|
||||
SetEnvironmentVariableW(var, L"");
|
||||
g_free(var);
|
||||
}
|
||||
|
||||
@@ -98,14 +98,15 @@ g_path_is_absolute (const char *filename)
|
||||
{
|
||||
g_return_val_if_fail (filename != NULL, FALSE);
|
||||
|
||||
if (filename[0] != '\0' && filename[1] != '\0')
|
||||
if (filename[1] == ':' && filename[2] != '\0' &&
|
||||
if (filename[0] != '\0' && filename[1] != '\0') {
|
||||
if (filename[1] == ':' && filename[2] != '\0' &&
|
||||
(filename[2] == '\\' || filename[2] == '/'))
|
||||
return TRUE;
|
||||
/* UNC paths */
|
||||
else if (filename[0] == '\\' && filename[1] == '\\' &&
|
||||
filename[2] != '\0')
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ g_module_open (const gchar *file, GModuleFlags flags)
|
||||
gunichar2 *file16;
|
||||
file16 = u8to16(file);
|
||||
module->main_module = FALSE;
|
||||
module->handle = LoadLibrary (file16);
|
||||
module->handle = LoadLibraryW (file16);
|
||||
g_free(file16);
|
||||
if (!module->handle) {
|
||||
g_free (module);
|
||||
|
||||
+8
-9
@@ -24,6 +24,7 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
@@ -111,28 +112,26 @@ g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask)
|
||||
void
|
||||
g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
|
||||
{
|
||||
#if PLATFORM_ANDROID
|
||||
__android_log_vprint (to_android_priority (log_level), log_domain, format, args);
|
||||
#else
|
||||
char *msg;
|
||||
|
||||
vasprintf (&msg, format, args);
|
||||
#if PLATFORM_ANDROID
|
||||
__android_log_print (to_android_priority (log_level),
|
||||
/* TODO: provide a proper app name */
|
||||
"mono", "%s%s%s",
|
||||
log_domain != NULL ? log_domain : "",
|
||||
log_domain != NULL ? ": " : "",
|
||||
msg);
|
||||
#else
|
||||
printf ("%s%s%s\n",
|
||||
log_domain != NULL ? log_domain : "",
|
||||
log_domain != NULL ? ": " : "",
|
||||
msg);
|
||||
#endif
|
||||
free (msg);
|
||||
if (log_level & fatal){
|
||||
fflush (stdout);
|
||||
fflush (stderr);
|
||||
abort ();
|
||||
}
|
||||
#endif
|
||||
if (log_level & fatal){
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+3
-1
@@ -68,7 +68,9 @@ g_build_path (const gchar *separator, const gchar *first_element, ...)
|
||||
g_string_append_len (result, s, p - s);
|
||||
|
||||
if (next && *next){
|
||||
if (strncmp (separator, result->str + strlen (result->str) - slen, slen))
|
||||
int reslen = strlen (result->str);
|
||||
|
||||
if (reslen >= slen && strncmp (separator, result->str + reslen - slen, slen))
|
||||
g_string_append (result, separator);
|
||||
|
||||
for (; strncmp (next, separator, slen) == 0; )
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error)
|
||||
} else if (quote_char) {
|
||||
if (c == quote_char) {
|
||||
quote_char = '\0';
|
||||
if (fresh && g_ascii_isspace (*ptr)){
|
||||
if (fresh && (g_ascii_isspace (*ptr) || *ptr == '\0')){
|
||||
g_ptr_array_add (array, g_string_free (str, FALSE));
|
||||
str = g_string_new ("");
|
||||
}
|
||||
@@ -225,7 +225,7 @@ g_shell_unquote (const gchar *quoted_string, GError **error)
|
||||
}
|
||||
} else if (*p == '\\'){
|
||||
char c = *(++p);
|
||||
if (!(c == '$' || c == '"' || c == '\\' || c == '`' || c == 0))
|
||||
if (!(c == '$' || c == '"' || c == '\\' || c == '`' || c == '\'' || c == 0 ))
|
||||
g_string_append_c (result, '\\');
|
||||
if (c == 0)
|
||||
break;
|
||||
|
||||
+2
-1
@@ -79,6 +79,7 @@ gchar ***_NSGetEnviron();
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
static int
|
||||
safe_read (int fd, gchar *buffer, gint count, GError **error)
|
||||
{
|
||||
@@ -185,7 +186,7 @@ create_pipe (int *fds, GError **error)
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* G_OS_WIN32 */
|
||||
gboolean
|
||||
g_spawn_command_line_sync (const gchar *command_line,
|
||||
gchar **standard_output,
|
||||
|
||||
@@ -300,13 +300,13 @@ g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gs
|
||||
gboolean
|
||||
g_get_charset (G_CONST_RETURN char **charset)
|
||||
{
|
||||
if (my_charset == NULL) {
|
||||
#ifdef G_OS_WIN32
|
||||
static char buf[14];
|
||||
sprintf (buf, "CP%u", GetACP ());
|
||||
*charset = buf;
|
||||
is_utf8 = FALSE;
|
||||
static char buf [14];
|
||||
sprintf (buf, "CP%u", GetACP ());
|
||||
my_charset = buf;
|
||||
is_utf8 = FALSE;
|
||||
#else
|
||||
if (my_charset == NULL){
|
||||
/* These shouldn't be heap allocated */
|
||||
#if HAVE_LOCALCHARSET_H
|
||||
my_charset = locale_charset ();
|
||||
@@ -316,12 +316,12 @@ g_get_charset (G_CONST_RETURN char **charset)
|
||||
my_charset = "UTF-8";
|
||||
#endif
|
||||
is_utf8 = strcmp (my_charset, "UTF-8") == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (charset != NULL)
|
||||
*charset = my_charset;
|
||||
|
||||
#endif
|
||||
return is_utf8;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -71,7 +71,7 @@ utf8_to_utf16_len (const gchar *str, glong len, glong *items_read, GError **erro
|
||||
ret = 0;
|
||||
|
||||
/* Common case */
|
||||
for (in_pos = 0; in_pos < len && str [in_pos] < 0x80; in_pos++)
|
||||
for (in_pos = 0; in_pos < len && (guchar) str [in_pos] < 0x80; in_pos++)
|
||||
ret ++;
|
||||
|
||||
if (in_pos == len) {
|
||||
@@ -338,6 +338,7 @@ g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *item
|
||||
} else {
|
||||
surrogate = 0;
|
||||
/* invalid surrogate pair */
|
||||
++in_pos;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
@@ -354,6 +355,7 @@ g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *item
|
||||
else if (ch >= 0xD800 && ch <= 0xDBFF)
|
||||
surrogate = ch;
|
||||
else if (ch >= 0xDC00 && ch <= 0xDFFF) {
|
||||
++in_pos;
|
||||
/* invalid surrogate pair */
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ int vasprintf(char **ret, const char *fmt, va_list ap)
|
||||
len = vsnprintf(NULL, 0, fmt, ap2);
|
||||
#endif
|
||||
|
||||
if (len > 0 && (buf = malloc((buflen = (size_t) (len + 1)))) != NULL) {
|
||||
if (len >= 0 && (buf = malloc ((buflen = (size_t) (len + 1)))) != NULL) {
|
||||
len = vsnprintf(buf, buflen, fmt, ap);
|
||||
*ret = buf;
|
||||
} else {
|
||||
@@ -28,3 +28,4 @@ int vasprintf(char **ret, const char *fmt, va_list ap)
|
||||
va_end(ap2);
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ RESULT
|
||||
test_buildpath ()
|
||||
{
|
||||
char *s;
|
||||
char *buffer = "var/private";
|
||||
char *dir = "/";
|
||||
|
||||
s = g_build_path ("/", "hola///", "//mundo", NULL);
|
||||
if (strcmp (s, "hola/mundo") != 0)
|
||||
@@ -99,6 +101,16 @@ test_buildpath ()
|
||||
return FAILED ("must get a non-NULL return");
|
||||
if (s [0] != 0)
|
||||
return FAILED ("must get an empty string");
|
||||
|
||||
// This is to test the regression introduced by Levi for the Windows support
|
||||
// that code errouneously read below the allowed area (in this case dir [-1]).
|
||||
// and caused all kinds of random errors.
|
||||
dir = "//";
|
||||
dir++;
|
||||
s = g_build_filename (dir, buffer, NULL);
|
||||
if (s [0] != '/')
|
||||
return FAILED ("Must have a '/' at the start");
|
||||
|
||||
g_free (s);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -250,6 +250,14 @@
|
||||
#endif
|
||||
}
|
||||
# define GC_TEST_AND_SET_DEFINED
|
||||
inline static void GC_clear(volatile unsigned int *addr) {
|
||||
#ifdef HAVE_ARMV6
|
||||
/* Memory barrier */
|
||||
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory");
|
||||
#endif
|
||||
*(addr) = 0;
|
||||
}
|
||||
# define GC_CLEAR_DEFINED
|
||||
# endif /* ARM32 */
|
||||
# ifdef CRIS
|
||||
inline static int GC_test_and_set(volatile unsigned int *addr) {
|
||||
|
||||
@@ -371,6 +371,8 @@ void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
|
||||
# define GC_MACH_THREAD_STATE_FLAVOR PPC_THREAD_STATE
|
||||
# elif defined(I386)
|
||||
# define GC_MACH_THREAD_STATE_FLAVOR i386_THREAD_STATE
|
||||
# elif defined(X86_64)
|
||||
# define GC_MACH_THREAD_STATE_FLAVOR x86_THREAD_STATE64
|
||||
# else
|
||||
# define GC_MACH_THREAD_STATE_FLAVOR MACHINE_THREAD_STATE
|
||||
# endif
|
||||
|
||||
+8
-1
@@ -2131,7 +2131,14 @@ void GC_unmap_gap(ptr_t start1, word bytes1, ptr_t start2, word bytes2)
|
||||
len -= free_len;
|
||||
}
|
||||
# else
|
||||
if (len != 0 && munmap(start_addr, len) != 0) ABORT("munmap failed");
|
||||
if (len != 0) {
|
||||
/* Immediately remap as above. */
|
||||
void * result;
|
||||
result = mmap(start_addr, len, PROT_NONE,
|
||||
MAP_PRIVATE | MAP_FIXED | OPT_MAP_ANON,
|
||||
zero_fd, 0/* offset */);
|
||||
if (result != (void *)start_addr) ABORT("mmap(...PROT_NONE...) failed");
|
||||
}
|
||||
GC_unmapped_bytes += len;
|
||||
# endif
|
||||
}
|
||||
|
||||
@@ -729,7 +729,7 @@ void nacl_shutdown_gc_thread()
|
||||
/* Caller holds allocation lock. */
|
||||
GC_thread GC_new_thread(pthread_t id)
|
||||
{
|
||||
int hv = ((word)id) % THREAD_TABLE_SZ;
|
||||
int hv = ((unsigned long)id) % THREAD_TABLE_SZ;
|
||||
GC_thread result;
|
||||
static GC_bool first_thread_used = FALSE;
|
||||
|
||||
@@ -760,7 +760,7 @@ GC_thread GC_new_thread(pthread_t id)
|
||||
/* Caller holds allocation lock. */
|
||||
void GC_delete_thread(pthread_t id)
|
||||
{
|
||||
int hv = ((word)id) % THREAD_TABLE_SZ;
|
||||
int hv = ((unsigned long)id) % THREAD_TABLE_SZ;
|
||||
register GC_thread p = GC_threads[hv];
|
||||
register GC_thread prev = 0;
|
||||
|
||||
@@ -796,7 +796,7 @@ void GC_delete_thread(pthread_t id)
|
||||
/* This is OK, but we need a way to delete a specific one. */
|
||||
void GC_delete_gc_thread(pthread_t id, GC_thread gc_id)
|
||||
{
|
||||
int hv = ((word)id) % THREAD_TABLE_SZ;
|
||||
int hv = ((unsigned long)id) % THREAD_TABLE_SZ;
|
||||
register GC_thread p = GC_threads[hv];
|
||||
register GC_thread prev = 0;
|
||||
|
||||
@@ -825,7 +825,7 @@ void GC_delete_gc_thread(pthread_t id, GC_thread gc_id)
|
||||
/* return the most recent one. */
|
||||
GC_thread GC_lookup_thread(pthread_t id)
|
||||
{
|
||||
int hv = ((word)id) % THREAD_TABLE_SZ;
|
||||
int hv = ((unsigned long)id) % THREAD_TABLE_SZ;
|
||||
register GC_thread p = GC_threads[hv];
|
||||
|
||||
while (p != 0 && !pthread_equal(p -> id, id)) p = p -> next;
|
||||
|
||||
+11
-1
@@ -1038,7 +1038,7 @@ method. The right option, unfortunately, requires experimentation.
|
||||
When using Mono with the SGen garbage collector this environment
|
||||
variable can be used to turn on various debugging features of the
|
||||
collector. The value of this variable is a comma separated list of
|
||||
words.
|
||||
words. Do not use these options in production.
|
||||
.RS
|
||||
.ne 8
|
||||
.TP
|
||||
@@ -1063,6 +1063,13 @@ This clears the nursery at GC time instead of doing it when the thread
|
||||
local allocation buffer (TLAB) is created. The default is to clear
|
||||
the nursery at TLAB creation time.
|
||||
.TP
|
||||
\fBdisable-minor\fR
|
||||
Don't do minor collections. If the nursery is full, a major collection
|
||||
is triggered instead, unless it, too, is disabled.
|
||||
.TP
|
||||
\fBdisable-major\fR
|
||||
Don't do major collections.
|
||||
.TP
|
||||
\fBconservative-stack-mark\fR
|
||||
Forces the GC to scan the stack conservatively, even if precise
|
||||
scanning is available.
|
||||
@@ -1403,6 +1410,9 @@ be used when writing messages like this: Console.Error:MyProgramName.
|
||||
See the System.Diagnostics.DefaultTraceListener documentation for more
|
||||
information.
|
||||
.TP
|
||||
\fBMONO_WCF_TRACE\fR
|
||||
This eases WCF diagnostics functionality by simply outputs all log messages from WCF engine to "stdout", "stderr" or any file passed to this environment variable. The log format is the same as usual diagnostic output.
|
||||
.TP
|
||||
\fBMONO_XEXCEPTIONS\fR
|
||||
This throws an exception when a X11 error is encountered; by default a
|
||||
message is displayed but execution continues
|
||||
|
||||
+72
-5
@@ -41,8 +41,32 @@ Validate the project file against the schema
|
||||
.B \//validate:<schema>
|
||||
Validate the project file against the specified schema
|
||||
.TP
|
||||
.B \//consoleloggerparameters:<params>
|
||||
Parameters for the console logger : PerfomanceSummary, NoSummary, NoItemAndPropertyList
|
||||
.B \//consoleloggerparameters:<params> , /clp:<params>
|
||||
Parameters for the console logger : PerfomanceSummary, Summary, NoSummary, NoItemAndPropertyList, Verbosity
|
||||
.TP
|
||||
.B \//filelogger[n] , /fl[n]
|
||||
Logs the output to a file, named 'msbuild.log' by default. If the optional number 'n' is
|
||||
specified, then it logs to 'msbuild[n].log' . Parameters for this logger, including
|
||||
the log file name can be specified via a corresponding /flp[n] option. Default verbosity
|
||||
for file loggers is 'detailed. 'n' can be between 1-9.
|
||||
.TP
|
||||
.B \//fileloggerparameters[n]:<params> , /flp[n]:<params>
|
||||
Parameters for a file logger. This implies a corresponding /fl[n]. 'n' can be between
|
||||
1-9, and is used to add upto 10 file loggers. Parameters can be, besides the ones available
|
||||
for console logger:
|
||||
.RS
|
||||
.TP
|
||||
.I LogFile=<file>
|
||||
File to which the build log will be written.
|
||||
.TP
|
||||
.I Append
|
||||
If this is used, then the log file is appended to, else a new one will be created.
|
||||
.TP
|
||||
.I Encoding=<encoding>
|
||||
Encoding to use for the log file, eg. UTF-8, ASCII.
|
||||
.TP
|
||||
Eg: xbuild foo.csproj /flp:Verbosity=normal "/flp1:LogFile=build.log;Append;Encoding=ASCII"
|
||||
.RE
|
||||
.TP
|
||||
.B \//nologo
|
||||
Don't show the initial xbuild banner
|
||||
@@ -73,8 +97,8 @@ to $prefix/lib/mono/xbuild . When used in Import, like:
|
||||
|
||||
xbuild tries various values for the msbuild property $(MSBuildExtensionsPath), in order:
|
||||
|
||||
1. /Library/Frameworks/Mono.framework/External/xbuild on Mac OSX.
|
||||
2. Paths specified in the environment variable $MSBuildExtensionsPath.
|
||||
1. Paths specified in the environment variable $MSBuildExtensionsPath.
|
||||
2. /Library/Frameworks/Mono.framework/External/xbuild on Mac OSX.
|
||||
3. $XDG_CONFIG_HOME/xbuild/tasks (or Environment.SpecialFolder.ApplicationData)
|
||||
4. $prefix/lib/mono/xbuild (default location)
|
||||
|
||||
@@ -82,6 +106,49 @@ Anywhere else in the project files, $(MSBuildExtensionsPath) will always resolve
|
||||
location. This is a xbuild-only feature.
|
||||
This is also applicable for the properties $(MSBuildExtensionsPath32) and $(MSBuildExtensionsPath64),
|
||||
and the environment variables have the corresponding names - MSBuildExtensionsPath32/64 .
|
||||
.TP
|
||||
.I "XBUILD_FRAMEWORK_FOLDERS_PATH"
|
||||
With ToolsVersion 4.0, projects can target arbitrary frameworks referenced by TargetFrameworkMoniker,
|
||||
which is of the format:
|
||||
|
||||
Identifier,Version=<version>[,Profile=<profile>]
|
||||
|
||||
Eg. ".NETFramework,Version=v4.0"
|
||||
|
||||
The 3 parts of the moniker are given by the msbuild properties:
|
||||
|
||||
$(TargetFrameworkIdentifier), $(TargetFrameworkVersion) and $(TargetFrameworkProfile)
|
||||
|
||||
This moniker maps to a framework description file on disk:
|
||||
|
||||
<framework_root>/Identifier/Version/[Profile]/RedistList/FrameworkList.xml
|
||||
|
||||
This file is used to determine the path where to find the framework assemblies for this particular framework.
|
||||
|
||||
Framework root here is configurable and is resolved in the following order:
|
||||
|
||||
.nf
|
||||
1. Paths specified in the environment variable $XBUILD_FRAMEWORK_FOLDERS_PATH
|
||||
2. /Library/Frameworks/Mono.framework/External/xbuild-frameworks on Mac OSX.
|
||||
3. MSBuild property $(TargetFrameworkRoot)
|
||||
4. $prefix/lib/mono/xbuild-frameworks (default location)
|
||||
.fi
|
||||
|
||||
XBuild tries the paths given above, in order, till it finds a FrameworkList.xml for the moniker.
|
||||
Running with /v:detailed or higher verbosity will show the various paths that it tries.
|
||||
|
||||
The FrameworkList.xml itself just has a root element like:
|
||||
|
||||
<FileList Name=".NET Framework 3.5" TargetFrameworkDirectory="..\\..\\..\\..\\3.5" IncludeFramework="v3.0">
|
||||
</FileList>
|
||||
|
||||
Here the TargetFrameworkDirectory attribute specifies the directory where the assemblies for
|
||||
this particular framework can be found. If this is not set, then the parent of the folder
|
||||
containing the xml file is taken as the framework directory.
|
||||
|
||||
IncludeFramework attribute specifies the version of a framework (under the *same* $(TargetFrameworkIdentifier))
|
||||
which should be included in the final list of Target framework directories.
|
||||
|
||||
.TP
|
||||
.I "XBUILD_COLORS"
|
||||
If this variable is set, it contains a string of the form
|
||||
@@ -119,7 +186,7 @@ looks in "/Library/Frameworks/Mono.framework/External/pkgconfig" .
|
||||
.SH SEE ALSO
|
||||
.BR mono(1), mcs(1)
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 2009 Novell, Inc (http://www.novell.com)
|
||||
Copyright (C) 2011 Novell, Inc (http://www.novell.com)
|
||||
.SH MAILING LISTS
|
||||
Visit http://lists.ximian.com/mailman/listinfo/mono-devel-list for details.
|
||||
.SH WEB SITE
|
||||
|
||||
@@ -26,6 +26,8 @@ PLATFORM_MAKE_CORLIB_CMP = yes
|
||||
PLATFORM_CHANGE_SEPARATOR_CMD=tr '/' '\\\\'
|
||||
PLATFORM_PATH_SEPARATOR = ;
|
||||
|
||||
override CURDIR:=$(shell cygpath -m $(CURDIR))
|
||||
|
||||
## not so simple :-)
|
||||
#PLATFORM_AOT_SUFFIX = .dll
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ EXTRA_DISTFILES = \
|
||||
$(RESOURCE_FILES)
|
||||
|
||||
Commons.Xml.Relaxng.Rnc/RncParser.cs: Commons.Xml.Relaxng.Rnc/RncParser.jay $(topdir)/jay/skeleton.cs
|
||||
$(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs Commons.Xml.Relaxng.Rnc/RncParser.jay > Commons.Xml.Relaxng.Rnc/RncParser.cs
|
||||
$(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $(CURDIR)/Commons.Xml.Relaxng.Rnc/RncParser.jay > Commons.Xml.Relaxng.Rnc/RncParser.cs
|
||||
|
||||
BUILT_SOURCES = Commons.Xml.Relaxng.Rnc/RncParser.cs
|
||||
|
||||
|
||||
@@ -166,33 +166,21 @@ namespace IKVM.Reflection.Emit
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (x.tryOffset >= y.handlerOffset && x.tryOffset + x.tryLength <= y.handlerOffset + y.handlerLength)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (y.tryOffset >= x.handlerOffset && y.tryOffset + y.tryLength <= x.handlerOffset + x.handlerLength)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (x.tryOffset == y.tryOffset && x.tryLength == y.tryLength)
|
||||
else if (x.tryOffset == y.tryOffset && x.tryLength == y.tryLength)
|
||||
{
|
||||
return x.ordinal < y.ordinal ? -1 : 1;
|
||||
}
|
||||
if (x.tryOffset + x.tryLength <= y.tryOffset)
|
||||
else if (x.tryOffset >= y.tryOffset && x.handlerOffset + x.handlerLength <= y.handlerOffset + y.handlerLength)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (y.tryOffset + y.tryLength <= x.tryOffset)
|
||||
else if (y.tryOffset >= x.tryOffset && y.handlerOffset + y.handlerLength <= x.handlerOffset + x.handlerLength)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (x.tryOffset > y.tryOffset || (x.tryOffset == y.tryOffset && x.tryLength < y.tryLength))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
return x.ordinal < y.ordinal ? -1 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -654,6 +654,11 @@ namespace System.Windows.Forms
|
||||
|
||||
public int Init ()
|
||||
{
|
||||
int p = (int) Environment.OSVersion.Platform;
|
||||
if ((p != 4) && (p != 6) && (p != 128))
|
||||
// Not running on Unix.
|
||||
return -1;
|
||||
|
||||
CheckFDOMimePaths ();
|
||||
|
||||
if (!fdo_mime_available)
|
||||
|
||||
@@ -35,14 +35,21 @@ namespace Microsoft.Build.BuildEngine {
|
||||
internal class BuildChoose {
|
||||
|
||||
BuildWhen otherwise;
|
||||
Project project;
|
||||
XmlElement xmlElement;
|
||||
//Project project;
|
||||
//ImportedProject importedProject;
|
||||
//XmlElement xmlElement;
|
||||
List <BuildWhen> whens;
|
||||
|
||||
public BuildChoose (XmlElement xmlElement, Project project)
|
||||
: this (xmlElement, project, null)
|
||||
{
|
||||
this.xmlElement = xmlElement;
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
internal BuildChoose (XmlElement xmlElement, Project project, ImportedProject importedProject)
|
||||
{
|
||||
//this.xmlElement = xmlElement;
|
||||
//this.project = project;
|
||||
//this.importedProject = importedProject;
|
||||
this.whens = new List <BuildWhen> ();
|
||||
|
||||
foreach (XmlNode xn in xmlElement.ChildNodes) {
|
||||
@@ -65,6 +72,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
otherwise = new BuildWhen (xe, project);
|
||||
}
|
||||
}
|
||||
|
||||
DefinedInFileName = importedProject != null ? importedProject.FullFileName :
|
||||
project != null ? project.FullFileName : null;
|
||||
}
|
||||
|
||||
public void Evaluate ()
|
||||
@@ -85,6 +95,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
get { return whens; }
|
||||
set { whens = value; }
|
||||
}
|
||||
|
||||
internal string DefinedInFileName { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
buildItems.Add (bi);
|
||||
project.LastItemGroupContaining [bi.Name] = this;
|
||||
}
|
||||
|
||||
DefinedInFileName = importedProject != null ? importedProject.FullFileName :
|
||||
project != null ? project.FullFileName : null;
|
||||
}
|
||||
|
||||
public BuildItem AddNewItem (string itemName,
|
||||
@@ -303,6 +306,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
}
|
||||
}
|
||||
|
||||
internal string DefinedInFileName { get; private set; }
|
||||
|
||||
internal bool FromXml {
|
||||
get {
|
||||
return itemGroupElement != null;
|
||||
|
||||
@@ -71,6 +71,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
}
|
||||
} else
|
||||
this.propertiesByName = new Dictionary <string, BuildProperty> (StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
DefinedInFileName = importedProject != null ? importedProject.FullFileName :
|
||||
(project != null ? project.FullFileName : null);
|
||||
}
|
||||
|
||||
public BuildProperty AddNewProperty (string propertyName,
|
||||
@@ -287,7 +290,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
propertiesByName [propertyName] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal string DefinedInFileName { get; private set; }
|
||||
|
||||
internal GroupingCollection GroupingCollection {
|
||||
get { return parentCollection; }
|
||||
set { parentCollection = value; }
|
||||
|
||||
@@ -33,13 +33,13 @@ using System.Xml;
|
||||
|
||||
namespace Microsoft.Build.BuildEngine {
|
||||
internal class BuildWhen {
|
||||
Project parentProject;
|
||||
//Project parentProject;
|
||||
GroupingCollection groupingCollection;
|
||||
XmlElement whenElement;
|
||||
|
||||
public BuildWhen (XmlElement whenElement, Project parentProject)
|
||||
{
|
||||
this.parentProject = parentProject;
|
||||
//this.parentProject = parentProject;
|
||||
this.groupingCollection = new GroupingCollection (parentProject);
|
||||
if (whenElement == null)
|
||||
throw new ArgumentNullException ("whenElement");
|
||||
|
||||
+3
-3
@@ -46,7 +46,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
Type t = typeof (ConditionFunctionExpression);
|
||||
string [] names = new string [] { "Exists", "HasTrailingSlash" };
|
||||
|
||||
functions = new Dictionary <string, MethodInfo> ();
|
||||
functions = new Dictionary <string, MethodInfo> (StringComparer.InvariantCultureIgnoreCase);
|
||||
foreach (string name in names)
|
||||
functions.Add (name, t.GetMethod (name, BindingFlags.NonPublic | BindingFlags.Static));
|
||||
}
|
||||
@@ -60,10 +60,10 @@ namespace Microsoft.Build.BuildEngine {
|
||||
public override bool BoolEvaluate (Project context)
|
||||
{
|
||||
if (!functions.ContainsKey (name))
|
||||
throw new InvalidOperationException ();
|
||||
throw new InvalidOperationException ("Unknown function named: " + name);
|
||||
|
||||
if (functions [name] == null)
|
||||
throw new InvalidOperationException ();
|
||||
throw new InvalidOperationException ("Unknown function named: " + name);
|
||||
|
||||
MethodInfo mi = functions [name];
|
||||
object [] argsArr = new object [args.Count + 1];
|
||||
|
||||
@@ -197,8 +197,68 @@ namespace Microsoft.Build.BuildEngine {
|
||||
public void ApplyParameter (string parameterName,
|
||||
string parameterValue)
|
||||
{
|
||||
// FIXME: what we should do here? in msbuild it isn't
|
||||
// changing "parameters" property
|
||||
switch (parameterName) {
|
||||
case "PerformanceSummary":
|
||||
this.performanceSummary = true;
|
||||
break;
|
||||
case "Summary":
|
||||
this.showSummary = true;
|
||||
break;
|
||||
case "NoSummary":
|
||||
this.showSummary = false;
|
||||
break;
|
||||
case "NoItemAndPropertyList":
|
||||
this.noItemAndPropertyList = true;
|
||||
break;
|
||||
default:
|
||||
if (parameterName.StartsWith ("Verbosity="))
|
||||
ParseVerbosity (parameterName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ParseVerbosity (string s)
|
||||
{
|
||||
string key, value;
|
||||
if (!TrySplitKeyValuePair (s, out key, out value))
|
||||
throw new LoggerException ("Unknown Verbosity, should be set as 'Verbosity=<verbosity>'");
|
||||
|
||||
switch (value) {
|
||||
case "q":
|
||||
case "quiet":
|
||||
Verbosity = LoggerVerbosity.Quiet;
|
||||
break;
|
||||
case "m":
|
||||
case "minimal":
|
||||
Verbosity = LoggerVerbosity.Minimal;
|
||||
break;
|
||||
case "n":
|
||||
case "normal":
|
||||
Verbosity = LoggerVerbosity.Normal;
|
||||
break;
|
||||
case "d":
|
||||
case "detailed":
|
||||
Verbosity = LoggerVerbosity.Detailed;
|
||||
break;
|
||||
case "diag":
|
||||
case "diagnostic":
|
||||
Verbosity = LoggerVerbosity.Diagnostic;
|
||||
break;
|
||||
default:
|
||||
throw new LoggerException (String.Format ("Unknown verbosity - '{0}'", s));
|
||||
}
|
||||
}
|
||||
|
||||
bool TrySplitKeyValuePair (string pair, out string key, out string value)
|
||||
{
|
||||
key = value = null;
|
||||
string[] parts = pair.Split ('=');
|
||||
if (parts.Length != 2)
|
||||
return false;
|
||||
|
||||
key = parts [0];
|
||||
value = parts [1];
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void Initialize (IEventSource eventSource)
|
||||
@@ -220,6 +280,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
eventSource.MessageRaised += MessageHandler;
|
||||
eventSource.WarningRaised += WarningHandler;
|
||||
eventSource.ErrorRaised += ErrorHandler;
|
||||
|
||||
if (!String.IsNullOrEmpty (parameters))
|
||||
ParseParameters ();
|
||||
}
|
||||
|
||||
public void BuildStartedHandler (object sender, BuildStartedEventArgs args)
|
||||
@@ -607,21 +670,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
private void ParseParameters ()
|
||||
{
|
||||
string[] splittedParameters = parameters.Split (';');
|
||||
foreach (string s in splittedParameters ) {
|
||||
switch (s) {
|
||||
case "PerformanceSummary":
|
||||
this.performanceSummary = true;
|
||||
break;
|
||||
case "NoSummary":
|
||||
this.showSummary = false;
|
||||
break;
|
||||
case "NoItemAndPropertyList":
|
||||
this.noItemAndPropertyList = true;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException ("Invalid parameter : " + s);
|
||||
}
|
||||
}
|
||||
foreach (string s in splittedParameters )
|
||||
ApplyParameter (s, null);
|
||||
}
|
||||
|
||||
public virtual void Shutdown ()
|
||||
@@ -779,8 +829,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (value == null)
|
||||
throw new ArgumentNullException ();
|
||||
parameters = value;
|
||||
if (parameters != String.Empty)
|
||||
ParseParameters ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
{
|
||||
Dictionary <string, bool> excludedItems;
|
||||
List <ITaskItem> includedItems;
|
||||
string[] splitExclude;
|
||||
|
||||
if (includes == null)
|
||||
throw new ArgumentNullException ("Includes");
|
||||
@@ -84,7 +83,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
FileInfo[] fileInfo;
|
||||
|
||||
string name = include_item.ItemSpec;
|
||||
if (name.IndexOf ('?') == -1 && name.IndexOf ('*') == -1) {
|
||||
if (!HasWildcard (name)) {
|
||||
if (!excludedItems.ContainsKey (Path.GetFullPath(name)))
|
||||
includedItems.Add (include_item);
|
||||
} else {
|
||||
@@ -211,6 +210,11 @@ namespace Microsoft.Build.BuildEngine {
|
||||
return fi;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool HasWildcard (string expression)
|
||||
{
|
||||
return expression.IndexOf ('?') >= 0 || expression.IndexOf ('*') >= 0;
|
||||
}
|
||||
|
||||
public DirectoryInfo BaseDirectory {
|
||||
get { return baseDirectory; }
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
const string defaultTasksProjectName = "Microsoft.Common.tasks";
|
||||
EventSource eventSource;
|
||||
bool buildStarted;
|
||||
ToolsetDefinitionLocations toolsetLocations;
|
||||
//ToolsetDefinitionLocations toolsetLocations;
|
||||
BuildPropertyGroup global_properties;
|
||||
//IDictionary importedProjects;
|
||||
List <ILogger> loggers;
|
||||
@@ -73,7 +73,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
public Engine (ToolsetDefinitionLocations locations)
|
||||
: this (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20))
|
||||
{
|
||||
toolsetLocations = locations;
|
||||
//toolsetLocations = locations;
|
||||
}
|
||||
|
||||
public Engine (BuildPropertyGroup globalProperties)
|
||||
@@ -86,7 +86,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
: this (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20))
|
||||
{
|
||||
this.global_properties = globalProperties;
|
||||
toolsetLocations = locations;
|
||||
//toolsetLocations = locations;
|
||||
}
|
||||
|
||||
// engine should be invoked with path where binary files are
|
||||
@@ -229,6 +229,33 @@ namespace Microsoft.Build.BuildEngine {
|
||||
IDictionary targetOutputs,
|
||||
BuildSettings buildFlags, string toolsVersion)
|
||||
{
|
||||
bool result = false;
|
||||
try {
|
||||
StartEngineBuild ();
|
||||
result = BuildProjectFileInternal (projectFile, targetNames, globalProperties, targetOutputs, buildFlags, toolsVersion);
|
||||
return result;
|
||||
} catch (InvalidProjectFileException ie) {
|
||||
this.LogErrorWithFilename (projectFile, ie.Message);
|
||||
this.LogMessage (MessageImportance.Low, String.Format ("{0}: {1}", projectFile, ie.ToString ()));
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
if (buildStarted) {
|
||||
this.LogErrorWithFilename (projectFile, e.Message);
|
||||
this.LogMessage (MessageImportance.Low, String.Format ("{0}: {1}", projectFile, e.ToString ()));
|
||||
}
|
||||
throw;
|
||||
} finally {
|
||||
EndEngineBuild (result);
|
||||
}
|
||||
}
|
||||
|
||||
bool BuildProjectFileInternal (string projectFile,
|
||||
string[] targetNames,
|
||||
BuildPropertyGroup globalProperties,
|
||||
IDictionary targetOutputs,
|
||||
BuildSettings buildFlags, string toolsVersion)
|
||||
{
|
||||
|
||||
if ((buildFlags & BuildSettings.DoNotResetPreviouslyBuiltTargets) != BuildSettings.DoNotResetPreviouslyBuiltTargets)
|
||||
builtTargetsOutputByName.Clear ();
|
||||
|
||||
@@ -366,12 +393,25 @@ namespace Microsoft.Build.BuildEngine {
|
||||
loggers.Clear ();
|
||||
}
|
||||
|
||||
internal void StartProjectBuild (Project project, string [] target_names)
|
||||
void StartEngineBuild ()
|
||||
{
|
||||
if (!buildStarted) {
|
||||
LogBuildStarted ();
|
||||
buildStarted = true;
|
||||
}
|
||||
}
|
||||
|
||||
void EndEngineBuild (bool succeeded)
|
||||
{
|
||||
if (buildStarted && currentlyBuildingProjectsStack.Count == 0) {
|
||||
LogBuildFinished (succeeded);
|
||||
buildStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
internal void StartProjectBuild (Project project, string [] target_names)
|
||||
{
|
||||
StartEngineBuild ();
|
||||
|
||||
if (currentlyBuildingProjectsStack.Count == 0 ||
|
||||
String.Compare (currentlyBuildingProjectsStack.Peek ().FullFileName, project.FullFileName) != 0)
|
||||
@@ -397,10 +437,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
String.Compare (top_project.FullFileName, currentlyBuildingProjectsStack.Peek ().FullFileName) != 0)
|
||||
LogProjectFinished (top_project, succeeded);
|
||||
|
||||
if (currentlyBuildingProjectsStack.Count == 0) {
|
||||
LogBuildFinished (succeeded);
|
||||
buildStarted = false;
|
||||
}
|
||||
EndEngineBuild (succeeded);
|
||||
}
|
||||
|
||||
internal void ClearBuiltTargetsForProject (Project project)
|
||||
@@ -518,16 +555,14 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
public string DefaultToolsVersion {
|
||||
get {
|
||||
if (String.IsNullOrEmpty (defaultToolsVersion))
|
||||
#if NET_4_0
|
||||
return "4.0";
|
||||
#elif NET_3_5
|
||||
return "3.5";
|
||||
#else
|
||||
return "2.0";
|
||||
#endif
|
||||
|
||||
return defaultToolsVersion;
|
||||
// This is used as the fall back version if the
|
||||
// project can't find a version to use
|
||||
// Hard-coded to 2.0, so it allows even vs2005 projects
|
||||
// to build correctly, as they won't have a ToolsVersion
|
||||
// set!
|
||||
return String.IsNullOrEmpty (defaultToolsVersion)
|
||||
? "2.0"
|
||||
: defaultToolsVersion;
|
||||
}
|
||||
set {
|
||||
if (Toolsets [value] == null)
|
||||
|
||||
@@ -57,69 +57,87 @@ namespace Microsoft.Build.BuildEngine {
|
||||
{
|
||||
if (customEventRaised != null)
|
||||
customEventRaised (sender, cbea);
|
||||
FireAnyEvent (sender, cbea);
|
||||
}
|
||||
public void FireErrorRaised (object sender, BuildErrorEventArgs beea)
|
||||
{
|
||||
if (errorRaised != null)
|
||||
errorRaised (sender, beea);
|
||||
FireAnyEvent (sender, beea);
|
||||
}
|
||||
public void FireMessageRaised (object sender, BuildMessageEventArgs bmea)
|
||||
{
|
||||
if (messageRaised != null)
|
||||
messageRaised (sender, bmea);
|
||||
FireAnyEvent (sender, bmea);
|
||||
}
|
||||
public void FireWarningRaised (object sender, BuildWarningEventArgs bwea)
|
||||
{
|
||||
if (warningRaised != null)
|
||||
warningRaised (sender, bwea);
|
||||
FireAnyEvent (sender, bwea);
|
||||
}
|
||||
|
||||
public void FireTargetStarted (object sender, TargetStartedEventArgs tsea)
|
||||
{
|
||||
if (targetStarted != null)
|
||||
targetStarted (sender, tsea);
|
||||
FireAnyEvent (sender, tsea);
|
||||
}
|
||||
|
||||
public void FireTargetFinished (object sender, TargetFinishedEventArgs tfea)
|
||||
{
|
||||
if (targetFinished != null)
|
||||
targetFinished (sender, tfea);
|
||||
FireAnyEvent (sender, tfea);
|
||||
}
|
||||
|
||||
public void FireBuildStarted (object sender, BuildStartedEventArgs bsea)
|
||||
{
|
||||
if (buildStarted != null)
|
||||
buildStarted (sender, bsea);
|
||||
FireAnyEvent (sender, bsea);
|
||||
}
|
||||
|
||||
public void FireBuildFinished (object sender, BuildFinishedEventArgs bfea)
|
||||
{
|
||||
if (buildFinished != null)
|
||||
buildFinished (sender, bfea);
|
||||
FireAnyEvent (sender, bfea);
|
||||
}
|
||||
|
||||
public void FireProjectStarted (object sender, ProjectStartedEventArgs psea)
|
||||
{
|
||||
if (projectStarted != null)
|
||||
projectStarted (sender, psea);
|
||||
FireAnyEvent (sender, psea);
|
||||
}
|
||||
|
||||
public void FireProjectFinished (object sender, ProjectFinishedEventArgs pfea)
|
||||
{
|
||||
if (projectFinished != null)
|
||||
projectFinished (sender, pfea);
|
||||
FireAnyEvent (sender, pfea);
|
||||
}
|
||||
|
||||
public void FireTaskStarted (object sender, TaskStartedEventArgs tsea)
|
||||
{
|
||||
if (taskStarted != null)
|
||||
taskStarted (sender, tsea);
|
||||
FireAnyEvent (sender, tsea);
|
||||
}
|
||||
|
||||
public void FireTaskFinished (object sender, TaskFinishedEventArgs tfea)
|
||||
{
|
||||
if (taskFinished != null)
|
||||
taskFinished (sender, tfea);
|
||||
FireAnyEvent (sender, tfea);
|
||||
}
|
||||
|
||||
public void FireAnyEvent (object sender, BuildEventArgs bea)
|
||||
{
|
||||
if (anyEventRaised != null)
|
||||
anyEventRaised (sender, bea);
|
||||
}
|
||||
|
||||
public event AnyEventHandler AnyEventRaised {
|
||||
@@ -283,4 +301,4 @@ namespace Microsoft.Build.BuildEngine {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -66,6 +66,20 @@ namespace Microsoft.Build.BuildEngine {
|
||||
this.expressionCollection = new ExpressionCollection ();
|
||||
}
|
||||
|
||||
public static T ParseAs<T> (string expression, ParseOptions options, Project project)
|
||||
{
|
||||
Expression expr = new Expression ();
|
||||
expr.Parse (expression, options);
|
||||
return (T)expr.ConvertTo (project, typeof (T));
|
||||
}
|
||||
|
||||
public static T ParseAs<T> (string expression, ParseOptions options, Project project, ExpressionOptions exprOptions)
|
||||
{
|
||||
Expression expr = new Expression ();
|
||||
expr.Parse (expression, options);
|
||||
return (T)expr.ConvertTo (project, typeof (T), exprOptions);
|
||||
}
|
||||
|
||||
// Split: Split on ';'
|
||||
// Eg. Property values don't need to be split
|
||||
//
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
//
|
||||
// Author:
|
||||
// Marek Sieradzki ([email protected])
|
||||
// Ankit Jain ([email protected])
|
||||
//
|
||||
// (C) 2005 Marek Sieradzki
|
||||
// Copyright 2011 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
@@ -27,23 +29,125 @@
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.Build.Framework;
|
||||
|
||||
namespace Microsoft.Build.BuildEngine {
|
||||
public class FileLogger : ConsoleLogger {
|
||||
StreamWriter sw;
|
||||
string logfile;
|
||||
string encoding = null;
|
||||
IEventSource eventSource;
|
||||
|
||||
public FileLogger ()
|
||||
{
|
||||
base.Verbosity = LoggerVerbosity.Detailed;
|
||||
}
|
||||
|
||||
// FIXME: add our handlers to the events
|
||||
public override void Initialize (IEventSource eventSource)
|
||||
{
|
||||
this.eventSource = eventSource;
|
||||
logfile = "msbuild.log";
|
||||
|
||||
bool append = false;
|
||||
string key, value;
|
||||
string[] splittedParameters = Parameters.Split (new char [] {';'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string s in splittedParameters) {
|
||||
if (String.Compare (s, "Append") == 0) {
|
||||
append = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (s.StartsWith ("Encoding")) {
|
||||
if (!TrySplitKeyValuePair (s, out key, out value))
|
||||
throw new LoggerException ("Encoding should be specified as: Encoding=<encoding>, eg. Encoding=UTF-8");
|
||||
|
||||
if (String.IsNullOrEmpty (value))
|
||||
throw new LoggerException ("Encoding must be non-empty");
|
||||
|
||||
encoding = value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (s.StartsWith ("LogFile")) {
|
||||
if (!TrySplitKeyValuePair (s, out key, out value))
|
||||
throw new LoggerException ("LogFile should be specified as: LogFile=<encoding>, eg. LogFile=foo.log");
|
||||
|
||||
if (String.IsNullOrEmpty (value))
|
||||
throw new LoggerException ("LogFile value must be non-empty");
|
||||
|
||||
logfile = value;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Attach *our* HandleBuildStarted as the first one,
|
||||
// as it needs to create the writer!
|
||||
eventSource.BuildStarted += HandleBuildStarted;
|
||||
base.Initialize (eventSource);
|
||||
// Attach *our* HandleBuildFinished as the last one,
|
||||
// as it needs to close the writer!
|
||||
eventSource.BuildFinished += HandleBuildFinished;
|
||||
|
||||
CreateWriter (append);
|
||||
}
|
||||
|
||||
void CreateWriter (bool append_to)
|
||||
{
|
||||
if (sw != null)
|
||||
return;
|
||||
|
||||
if (!String.IsNullOrEmpty (encoding))
|
||||
sw = new StreamWriter (logfile, append_to, Encoding.GetEncoding (encoding));
|
||||
else
|
||||
sw = new StreamWriter (logfile, append_to, Encoding.Default);
|
||||
WriteHandler = sw.WriteLine;
|
||||
}
|
||||
|
||||
void HandleBuildStarted (object sender, BuildStartedEventArgs args)
|
||||
{
|
||||
CreateWriter (true);
|
||||
}
|
||||
|
||||
void HandleBuildFinished (object sender, BuildFinishedEventArgs args)
|
||||
{
|
||||
base.WriteHandler = null;
|
||||
if (sw != null) {
|
||||
sw.Close ();
|
||||
sw = null;
|
||||
}
|
||||
}
|
||||
|
||||
bool TrySplitKeyValuePair (string pair, out string key, out string value)
|
||||
{
|
||||
key = value = null;
|
||||
string[] parts = pair.Split ('=');
|
||||
if (parts.Length != 2)
|
||||
return false;
|
||||
|
||||
key = parts [0];
|
||||
value = parts [1];
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Shutdown ()
|
||||
{
|
||||
base.WriteHandler = null;
|
||||
if (sw != null) {
|
||||
sw.Close ();
|
||||
sw = null;
|
||||
}
|
||||
|
||||
if (eventSource != null) {
|
||||
eventSource.BuildStarted -= HandleBuildStarted;
|
||||
eventSource.BuildFinished -= HandleBuildFinished;
|
||||
}
|
||||
|
||||
base.Shutdown ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+29
-14
@@ -180,8 +180,13 @@ namespace Microsoft.Build.BuildEngine {
|
||||
while (evaluate_iterator != null) {
|
||||
if (evaluate_iterator.Value is BuildPropertyGroup) {
|
||||
bpg = (BuildPropertyGroup) evaluate_iterator.Value;
|
||||
if (ConditionParser.ParseAndEvaluate (bpg.Condition, project))
|
||||
bpg.Evaluate ();
|
||||
project.PushThisFileProperty (bpg.DefinedInFileName);
|
||||
try {
|
||||
if (ConditionParser.ParseAndEvaluate (bpg.Condition, project))
|
||||
bpg.Evaluate ();
|
||||
} finally {
|
||||
project.PopThisFileProperty ();
|
||||
}
|
||||
}
|
||||
|
||||
// if it wasn't moved by adding anything because of evaluating a Import shift it
|
||||
@@ -197,8 +202,13 @@ namespace Microsoft.Build.BuildEngine {
|
||||
while (evaluate_iterator != null) {
|
||||
if (evaluate_iterator.Value is BuildItemGroup) {
|
||||
big = (BuildItemGroup) evaluate_iterator.Value;
|
||||
if (ConditionParser.ParseAndEvaluate (big.Condition, project))
|
||||
big.Evaluate ();
|
||||
project.PushThisFileProperty (big.DefinedInFileName);
|
||||
try {
|
||||
if (ConditionParser.ParseAndEvaluate (big.Condition, project))
|
||||
big.Evaluate ();
|
||||
} finally {
|
||||
project.PopThisFileProperty ();
|
||||
}
|
||||
}
|
||||
|
||||
evaluate_iterator = evaluate_iterator.Next;
|
||||
@@ -210,17 +220,22 @@ namespace Microsoft.Build.BuildEngine {
|
||||
while (evaluate_iterator != null) {
|
||||
if (evaluate_iterator.Value is BuildChoose) {
|
||||
BuildChoose bc = (BuildChoose)evaluate_iterator.Value;
|
||||
bool whenUsed = false;
|
||||
foreach (BuildWhen bw in bc.Whens) {
|
||||
if (ConditionParser.ParseAndEvaluate (bw.Condition, project)) {
|
||||
bw.Evaluate ();
|
||||
whenUsed = true;
|
||||
break;
|
||||
project.PushThisFileProperty (bc.DefinedInFileName);
|
||||
try {
|
||||
bool whenUsed = false;
|
||||
foreach (BuildWhen bw in bc.Whens) {
|
||||
if (ConditionParser.ParseAndEvaluate (bw.Condition, project)) {
|
||||
bw.Evaluate ();
|
||||
whenUsed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!whenUsed && bc.Otherwise != null &&
|
||||
ConditionParser.ParseAndEvaluate (bc.Otherwise.Condition, project)) {
|
||||
bc.Otherwise.Evaluate ();
|
||||
if (!whenUsed && bc.Otherwise != null &&
|
||||
ConditionParser.ParseAndEvaluate (bc.Otherwise.Condition, project)) {
|
||||
bc.Otherwise.Evaluate ();
|
||||
}
|
||||
} finally {
|
||||
project.PopThisFileProperty ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
//
|
||||
// Author:
|
||||
// Marek Sieradzki ([email protected])
|
||||
// Ankit Jain ([email protected])
|
||||
//
|
||||
// (C) 2006 Marek Sieradzki
|
||||
// Copyright 2011 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
@@ -28,10 +30,13 @@
|
||||
#if NET_2_0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Mono.XBuild.Utilities;
|
||||
|
||||
namespace Microsoft.Build.BuildEngine {
|
||||
@@ -44,8 +49,14 @@ namespace Microsoft.Build.BuildEngine {
|
||||
static string DotConfigExtensionsPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
|
||||
Path.Combine ("xbuild", "tasks"));
|
||||
const string MacOSXExternalXBuildDir = "/Library/Frameworks/Mono.framework/External/xbuild";
|
||||
static string PathSeparatorAsString = Path.PathSeparator.ToString ();
|
||||
|
||||
internal Import (XmlElement importElement, Project project, ImportedProject originalProject)
|
||||
: this (importElement, null, project, originalProject)
|
||||
{}
|
||||
|
||||
// if @alternateProjectPath is available then that it used as the EvaluatedProjectPath!
|
||||
internal Import (XmlElement importElement, string alternateProjectPath, Project project, ImportedProject originalProject)
|
||||
{
|
||||
if (importElement == null)
|
||||
throw new ArgumentNullException ("importElement");
|
||||
@@ -60,7 +71,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
throw new InvalidProjectFileException ("The required attribute \"Project\" is missing from element <Import>.");
|
||||
|
||||
if (ConditionParser.ParseAndEvaluate (Condition, project)) {
|
||||
evaluatedProjectPath = EvaluateProjectPath (ProjectPath);
|
||||
evaluatedProjectPath = String.IsNullOrEmpty (alternateProjectPath) ? EvaluateProjectPath (ProjectPath) : alternateProjectPath;
|
||||
|
||||
evaluatedProjectPath = GetFullPath ();
|
||||
if (EvaluatedProjectPath == String.Empty)
|
||||
throw new InvalidProjectFileException ("The required attribute \"Project\" is missing from element <Import>.");
|
||||
@@ -72,9 +84,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
{
|
||||
string filename = evaluatedProjectPath;
|
||||
// NOTE: it's a hack to transform Microsoft.CSharp.Targets to Microsoft.CSharp.targets
|
||||
if (Path.HasExtension (filename))
|
||||
filename = Path.ChangeExtension (filename, Path.GetExtension (filename));
|
||||
|
||||
if (!File.Exists (filename) && Path.GetFileName (filename) == "Microsoft.CSharp.Targets")
|
||||
filename = Path.ChangeExtension (filename, ".targets");
|
||||
|
||||
if (!File.Exists (filename)) {
|
||||
if (ignoreMissingImports) {
|
||||
project.LogWarning (project.FullFileName, "Could not find project file {0}, to import. Ignoring.", filename);
|
||||
@@ -92,91 +104,148 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
string EvaluateProjectPath (string file)
|
||||
{
|
||||
string ret;
|
||||
if (EvaluateAsMSBuildExtensionsPath (file, "MSBuildExtensionsPath", out ret) ||
|
||||
EvaluateAsMSBuildExtensionsPath (file, "MSBuildExtensionsPath32", out ret) ||
|
||||
EvaluateAsMSBuildExtensionsPath (file, "MSBuildExtensionsPath64", out ret))
|
||||
return ret;
|
||||
|
||||
return EvaluatePath (file);
|
||||
}
|
||||
|
||||
bool EvaluateAsMSBuildExtensionsPath (string file, string property_name, out string epath)
|
||||
{
|
||||
epath = null;
|
||||
string property_ref = String.Format ("$({0})", property_name);
|
||||
if (file.IndexOf (property_ref) < 0)
|
||||
return false;
|
||||
|
||||
// This is a *HACK* to support multiple paths for
|
||||
// MSBuildExtensionsPath property. Normally it would
|
||||
// get resolved to a single value, but here we special
|
||||
// case it and try ~/.config/xbuild/tasks and any
|
||||
// paths specified in the env var $MSBuildExtensionsPath .
|
||||
//
|
||||
// The property itself will resolve to the default
|
||||
// location though, so you get in any other part of the
|
||||
// project.
|
||||
|
||||
string envvar = Environment.GetEnvironmentVariable (property_name);
|
||||
envvar = String.Join (":", new string [] {
|
||||
// For mac osx, look in the 'External' dir on macosx,
|
||||
// see bug #663180
|
||||
MSBuildUtils.RunningOnMac ? MacOSXExternalXBuildDir : String.Empty,
|
||||
(envvar ?? String.Empty),
|
||||
DotConfigExtensionsPath});
|
||||
|
||||
string [] paths = envvar.Split (new char [] {':'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string path in paths) {
|
||||
if (!Directory.Exists (path)) {
|
||||
project.ParentEngine.LogMessage (MessageImportance.Low, "Extension path '{0}' not found, ignoring.", path);
|
||||
continue;
|
||||
}
|
||||
|
||||
string pfile = Path.GetFullPath (file.Replace ("\\", "/").Replace (
|
||||
property_ref, path + Path.DirectorySeparatorChar));
|
||||
|
||||
var evaluated_path = EvaluatePath (pfile);
|
||||
if (File.Exists (evaluated_path)) {
|
||||
project.ParentEngine.LogMessage (MessageImportance.Low,
|
||||
"{0}: Importing project {1} from extension path {2}", project.FullFileName, evaluated_path, path);
|
||||
epath = pfile;
|
||||
return true;
|
||||
}
|
||||
project.ParentEngine.LogMessage (MessageImportance.Low,
|
||||
"{0}: Couldn't find project {1} for extension path {2}", project.FullFileName, evaluated_path, path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
string EvaluatePath (string path)
|
||||
{
|
||||
var exp = new Expression ();
|
||||
exp.Parse (path, ParseOptions.Split);
|
||||
return (string) exp.ConvertTo (project, typeof (string));
|
||||
return Expression.ParseAs<string> (file, ParseOptions.Split, project);
|
||||
}
|
||||
|
||||
string GetFullPath ()
|
||||
{
|
||||
string file = EvaluatedProjectPath;
|
||||
if (!Path.IsPathRooted (file) && !String.IsNullOrEmpty (ContainedInProjectFileName))
|
||||
file = Path.Combine (Path.GetDirectoryName (ContainedInProjectFileName), file);
|
||||
|
||||
if (!Path.IsPathRooted (EvaluatedProjectPath)) {
|
||||
string dir = null;
|
||||
if (originalProject == null) {
|
||||
if (project.FullFileName != String.Empty) // Path.GetDirectoryName throws exception on String.Empty
|
||||
dir = Path.GetDirectoryName (project.FullFileName);
|
||||
} else {
|
||||
if (originalProject.FullFileName != String.Empty)
|
||||
dir = Path.GetDirectoryName (originalProject.FullFileName);
|
||||
}
|
||||
if (dir != null)
|
||||
file = Path.Combine (dir, EvaluatedProjectPath);
|
||||
}
|
||||
|
||||
return MSBuildUtils.FromMSBuildPath (file);
|
||||
}
|
||||
|
||||
|
||||
// For every extension path, in order, finds suitable
|
||||
// import filename(s) matching the Import, and calls
|
||||
// @func with them
|
||||
//
|
||||
// func: bool func(importPath, from_source_msg)
|
||||
//
|
||||
// If for an extension path, atleast one file gets imported,
|
||||
// then it stops at that.
|
||||
// So, in case imports like "$(MSBuildExtensionsPath)\foo\*",
|
||||
// for every extension path, it will try to import the "foo\*",
|
||||
// and if atleast one file gets successfully imported, then it
|
||||
// stops at that
|
||||
internal static void ForEachExtensionPathTillFound (XmlElement xmlElement, Project project, ImportedProject importingProject,
|
||||
Func<string, string, bool> func)
|
||||
{
|
||||
string project_attribute = xmlElement.GetAttribute ("Project");
|
||||
string condition_attribute = xmlElement.GetAttribute ("Condition");
|
||||
|
||||
bool has_extn_ref = project_attribute.IndexOf ("$(MSBuildExtensionsPath)") >= 0 ||
|
||||
project_attribute.IndexOf ("$(MSBuildExtensionsPath32)") >= 0 ||
|
||||
project_attribute.IndexOf ("$(MSBuildExtensionsPath64)") >= 0;
|
||||
|
||||
string importingFile = importingProject != null ? importingProject.FullFileName : project.FullFileName;
|
||||
DirectoryInfo base_dir_info = null;
|
||||
if (!String.IsNullOrEmpty (importingFile))
|
||||
base_dir_info = new DirectoryInfo (Path.GetDirectoryName (importingFile));
|
||||
else
|
||||
base_dir_info = new DirectoryInfo (Directory.GetCurrentDirectory ());
|
||||
|
||||
IEnumerable<string> extn_paths = has_extn_ref ? GetExtensionPaths (project) : new string [] {null};
|
||||
try {
|
||||
foreach (string path in extn_paths) {
|
||||
string extn_msg = null;
|
||||
if (has_extn_ref) {
|
||||
project.SetExtensionsPathProperties (path);
|
||||
extn_msg = "from extension path " + path;
|
||||
}
|
||||
|
||||
// do this after setting new Extension properties, as condition might
|
||||
// reference it
|
||||
if (!ConditionParser.ParseAndEvaluate (condition_attribute, project))
|
||||
continue;
|
||||
|
||||
// We stop if atleast one file got imported.
|
||||
// Remaining extension paths are *not* tried
|
||||
bool atleast_one = false;
|
||||
foreach (string importPath in GetImportPathsFromString (project_attribute, project, base_dir_info)) {
|
||||
try {
|
||||
if (func (importPath, extn_msg))
|
||||
atleast_one = true;
|
||||
} catch (Exception e) {
|
||||
throw new InvalidProjectFileException (String.Format (
|
||||
"{0}: Project file could not be imported, it was being imported by " +
|
||||
"{1}: {2}", importPath, importingFile, e.Message), e);
|
||||
}
|
||||
}
|
||||
|
||||
if (atleast_one)
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
if (has_extn_ref)
|
||||
project.SetExtensionsPathProperties (Project.DefaultExtensionsPath);
|
||||
}
|
||||
}
|
||||
|
||||
// Parses the Project attribute from an Import,
|
||||
// and returns the import filenames that match.
|
||||
// This handles wildcards also
|
||||
static IEnumerable<string> GetImportPathsFromString (string import_string, Project project, DirectoryInfo base_dir_info)
|
||||
{
|
||||
string parsed_import = Expression.ParseAs<string> (import_string, ParseOptions.AllowItemsNoMetadataAndSplit, project);
|
||||
if (parsed_import != null)
|
||||
parsed_import = parsed_import.Trim ();
|
||||
|
||||
if (String.IsNullOrEmpty (parsed_import))
|
||||
throw new InvalidProjectFileException ("The required attribute \"Project\" in Import is empty");
|
||||
|
||||
#if NET_4_0
|
||||
if (DirectoryScanner.HasWildcard (parsed_import)) {
|
||||
var directoryScanner = new DirectoryScanner () {
|
||||
Includes = new ITaskItem [] { new TaskItem (parsed_import) },
|
||||
BaseDirectory = base_dir_info
|
||||
};
|
||||
directoryScanner.Scan ();
|
||||
|
||||
foreach (ITaskItem matchedItem in directoryScanner.MatchedItems)
|
||||
yield return matchedItem.ItemSpec;
|
||||
} else
|
||||
#endif
|
||||
yield return parsed_import;
|
||||
}
|
||||
|
||||
// Gives a list of extensions paths to try for $(MSBuildExtensionsPath),
|
||||
// *in-order*
|
||||
static IEnumerable<string> GetExtensionPaths (Project project)
|
||||
{
|
||||
// This is a *HACK* to support multiple paths for
|
||||
// MSBuildExtensionsPath property. Normally it would
|
||||
// get resolved to a single value, but here we special
|
||||
// case it and try various paths, see the code below
|
||||
//
|
||||
// The property itself will resolve to the default
|
||||
// location though, so you get that in any other part of the
|
||||
// project.
|
||||
|
||||
string envvar = Environment.GetEnvironmentVariable ("MSBuildExtensionsPath");
|
||||
envvar = String.Join (PathSeparatorAsString, new string [] {
|
||||
(envvar ?? String.Empty),
|
||||
// For mac osx, look in the 'External' dir on macosx,
|
||||
// see bug #663180
|
||||
MSBuildUtils.RunningOnMac ? MacOSXExternalXBuildDir : String.Empty,
|
||||
DotConfigExtensionsPath,
|
||||
Project.DefaultExtensionsPath});
|
||||
|
||||
var pathsTable = new Dictionary<string, string> ();
|
||||
foreach (string extn_path in envvar.Split (new char [] {Path.PathSeparator}, StringSplitOptions.RemoveEmptyEntries)) {
|
||||
if (pathsTable.ContainsKey (extn_path))
|
||||
continue;
|
||||
|
||||
if (!Directory.Exists (extn_path)) {
|
||||
project.ParentEngine.LogMessage (MessageImportance.Low, "Extension path '{0}' not found, ignoring.", extn_path);
|
||||
continue;
|
||||
}
|
||||
|
||||
pathsTable [extn_path] = extn_path;
|
||||
yield return extn_path;
|
||||
}
|
||||
}
|
||||
|
||||
public string Condition {
|
||||
get {
|
||||
string s = importElement.GetAttribute ("Condition");
|
||||
@@ -195,6 +264,10 @@ namespace Microsoft.Build.BuildEngine {
|
||||
public string ProjectPath {
|
||||
get { return importElement.GetAttribute ("Project"); }
|
||||
}
|
||||
|
||||
internal string ContainedInProjectFileName {
|
||||
get { return originalProject != null ? originalProject.FullFileName : project.FullFileName; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,19 +37,19 @@ namespace Microsoft.Build.BuildEngine {
|
||||
public class ImportCollection : ICollection, IEnumerable {
|
||||
|
||||
GroupingCollection groupingCollection;
|
||||
Dictionary <string, object> filenames;
|
||||
Dictionary <string, Import> filenames;
|
||||
|
||||
internal ImportCollection (GroupingCollection groupingCollection)
|
||||
{
|
||||
this.groupingCollection = groupingCollection;
|
||||
filenames = new Dictionary <string, object> ();
|
||||
filenames = new Dictionary <string, Import> ();
|
||||
}
|
||||
|
||||
internal void Add (Import import)
|
||||
{
|
||||
if (!filenames.ContainsKey (import.EvaluatedProjectPath)) {
|
||||
groupingCollection.Add (import);
|
||||
filenames.Add (import.EvaluatedProjectPath, null);
|
||||
filenames.Add (import.EvaluatedProjectPath, import);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,11 @@ namespace Microsoft.Build.BuildEngine {
|
||||
{
|
||||
return filenames.ContainsKey (import.EvaluatedProjectPath);
|
||||
}
|
||||
|
||||
internal bool TryGetImport (Import keyImport, out Import valueImport)
|
||||
{
|
||||
return filenames.TryGetValue (keyImport.EvaluatedProjectPath, out valueImport);
|
||||
}
|
||||
|
||||
public void CopyTo (Import[] array, int index)
|
||||
{
|
||||
|
||||
@@ -57,9 +57,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
lastWrite = File.GetLastWriteTime (filename);
|
||||
fullFileName = filename;
|
||||
}
|
||||
catch (Exception) {
|
||||
throw;
|
||||
}
|
||||
finally {
|
||||
sr.Close ();
|
||||
}
|
||||
|
||||
@@ -47,15 +47,21 @@ namespace Microsoft.Build.BuildEngine
|
||||
else
|
||||
return String.Format (unformatted, args);
|
||||
}
|
||||
|
||||
|
||||
public static void LogError (this Engine engine, string message,
|
||||
params object[] messageArgs)
|
||||
{
|
||||
engine.LogErrorWithFilename (null, message, messageArgs);
|
||||
}
|
||||
|
||||
public static void LogErrorWithFilename (this Engine engine, string filename, string message,
|
||||
params object[] messageArgs)
|
||||
{
|
||||
if (message == null)
|
||||
throw new ArgumentNullException ("message");
|
||||
|
||||
BuildErrorEventArgs beea = new BuildErrorEventArgs (
|
||||
null, null, null, 0, 0, 0, 0, FormatString (message, messageArgs),
|
||||
null, null, filename, 0, 0, 0, 0, FormatString (message, messageArgs),
|
||||
null, null);
|
||||
engine.EventSource.FireErrorRaised (engine, beea);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
//
|
||||
// Author:
|
||||
// Marek Sieradzki ([email protected])
|
||||
// Ankit Jain ([email protected])
|
||||
//
|
||||
// (C) 2005 Marek Sieradzki
|
||||
// Copyright 2011 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
@@ -32,6 +34,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
@@ -76,6 +79,11 @@ namespace Microsoft.Build.BuildEngine {
|
||||
bool building;
|
||||
BuildSettings current_settings;
|
||||
Stack<Batch> batches;
|
||||
|
||||
// This is used to keep track of "current" file,
|
||||
// which is then used to set the reserved properties
|
||||
// $(MSBuildThisFile*)
|
||||
Stack<string> this_file_property_stack;
|
||||
ProjectLoadSettings project_load_settings;
|
||||
|
||||
|
||||
@@ -113,6 +121,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
initialTargets = new List<string> ();
|
||||
defaultTargets = new string [0];
|
||||
batches = new Stack<Batch> ();
|
||||
this_file_property_stack = new Stack<string> ();
|
||||
|
||||
globalProperties = new BuildPropertyGroup (null, this, null, false);
|
||||
foreach (BuildProperty bp in parentEngine.GlobalProperties)
|
||||
@@ -135,8 +144,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (!String.IsNullOrEmpty (importCondition))
|
||||
importElement.SetAttribute ("Condition", importCondition);
|
||||
|
||||
Import import = new Import (importElement, this, null);
|
||||
imports.Add (import);
|
||||
AddImport (importElement, null, false);
|
||||
MarkProjectAsDirty ();
|
||||
NeedToReevaluate ();
|
||||
}
|
||||
@@ -268,7 +276,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
{
|
||||
return Build (targetNames, targetOutputs, BuildSettings.None);
|
||||
}
|
||||
|
||||
|
||||
[MonoTODO ("Not tested")]
|
||||
public bool Build (string [] targetNames,
|
||||
IDictionary targetOutputs,
|
||||
@@ -289,6 +297,13 @@ namespace Microsoft.Build.BuildEngine {
|
||||
Directory.SetCurrentDirectory (Path.GetDirectoryName (fullFileName));
|
||||
building = true;
|
||||
result = BuildInternal (targetNames, targetOutputs, buildFlags);
|
||||
} catch (InvalidProjectFileException ie) {
|
||||
ParentEngine.LogErrorWithFilename (fullFileName, ie.Message);
|
||||
ParentEngine.LogMessage (MessageImportance.Low, String.Format ("{0}: {1}", fullFileName, ie.ToString ()));
|
||||
} catch (Exception e) {
|
||||
ParentEngine.LogErrorWithFilename (fullFileName, e.Message);
|
||||
ParentEngine.LogMessage (MessageImportance.Low, String.Format ("{0}: {1}", fullFileName, e.ToString ()));
|
||||
throw;
|
||||
} finally {
|
||||
ParentEngine.EndProjectBuild (this, result);
|
||||
current_settings = BuildSettings.None;
|
||||
@@ -308,7 +323,11 @@ namespace Microsoft.Build.BuildEngine {
|
||||
needToReevaluate = false;
|
||||
Reevaluate ();
|
||||
}
|
||||
|
||||
|
||||
#if NET_4_0
|
||||
ProcessBeforeAndAfterTargets ();
|
||||
#endif
|
||||
|
||||
if (targetNames == null || targetNames.Length == 0) {
|
||||
if (defaultTargets != null && defaultTargets.Length != 0) {
|
||||
targetNames = defaultTargets;
|
||||
@@ -332,9 +351,13 @@ namespace Microsoft.Build.BuildEngine {
|
||||
initialTargetsBuilt = true;
|
||||
}
|
||||
|
||||
foreach (string target in targetNames)
|
||||
foreach (string target in targetNames) {
|
||||
if (target == null)
|
||||
throw new ArgumentNullException ("Target name cannot be null");
|
||||
|
||||
if (!BuildTarget (target.Trim (), targetOutputs))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -382,6 +405,44 @@ namespace Microsoft.Build.BuildEngine {
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
void ProcessBeforeAndAfterTargets ()
|
||||
{
|
||||
var beforeTable = Targets.AsIEnumerable ()
|
||||
.SelectMany (target => GetTargetNamesFromString (target.BeforeTargets),
|
||||
(target, before_target) => new {before_target, name = target.Name})
|
||||
.ToLookup (x => x.before_target, x => x.name)
|
||||
.ToDictionary (x => x.Key, x => x.Distinct ().ToList ());
|
||||
|
||||
foreach (var pair in beforeTable) {
|
||||
if (targets.Exists (pair.Key))
|
||||
targets [pair.Key].BeforeThisTargets = pair.Value;
|
||||
else
|
||||
LogWarning (FullFileName, "Target '{0}', not found in the project", pair.Key);
|
||||
}
|
||||
|
||||
var afterTable = Targets.AsIEnumerable ()
|
||||
.SelectMany (target => GetTargetNamesFromString (target.AfterTargets),
|
||||
(target, after_target) => new {after_target, name = target.Name})
|
||||
.ToLookup (x => x.after_target, x => x.name)
|
||||
.ToDictionary (x => x.Key, x => x.Distinct ().ToList ());
|
||||
|
||||
foreach (var pair in afterTable) {
|
||||
if (targets.Exists (pair.Key))
|
||||
targets [pair.Key].AfterThisTargets = pair.Value;
|
||||
else
|
||||
LogWarning (FullFileName, "Target '{0}', not found in the project", pair.Key);
|
||||
}
|
||||
}
|
||||
|
||||
string[] GetTargetNamesFromString (string targets)
|
||||
{
|
||||
Expression expr = new Expression ();
|
||||
expr.Parse (targets, ParseOptions.AllowItemsNoMetadataAndSplit);
|
||||
return (string []) expr.ConvertTo (this, typeof (string []));
|
||||
}
|
||||
#endif
|
||||
|
||||
[MonoTODO]
|
||||
public string [] GetConditionedPropertyValues (string propertyName)
|
||||
{
|
||||
@@ -463,10 +524,12 @@ namespace Microsoft.Build.BuildEngine {
|
||||
"projectFileName");
|
||||
|
||||
this.fullFileName = Utilities.FromMSBuildPath (Path.GetFullPath (projectFileName));
|
||||
PushThisFileProperty (fullFileName);
|
||||
|
||||
string filename = fullFileName;
|
||||
if (String.Compare (Path.GetExtension (fullFileName), ".sln", true) == 0) {
|
||||
Project tmp_project = ParentEngine.CreateNewProject ();
|
||||
tmp_project.FullFileName = filename;
|
||||
SolutionParser sln_parser = new SolutionParser ();
|
||||
sln_parser.ParseSolution (fullFileName, tmp_project, delegate (int errorNumber, string message) {
|
||||
LogWarning (filename, message);
|
||||
@@ -872,7 +935,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
AddUsingTask (xe, ip);
|
||||
break;
|
||||
case "Import":
|
||||
AddImport (xe, ip);
|
||||
AddImport (xe, ip, true);
|
||||
break;
|
||||
case "ItemGroup":
|
||||
AddItemGroup (xe, ip);
|
||||
@@ -881,7 +944,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
AddPropertyGroup (xe, ip);
|
||||
break;
|
||||
case "Choose":
|
||||
AddChoose (xe);
|
||||
AddChoose (xe, ip);
|
||||
break;
|
||||
default:
|
||||
throw new InvalidProjectFileException (String.Format ("Invalid element '{0}' in project file.", xe.Name));
|
||||
@@ -922,6 +985,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
BuildProperty bp;
|
||||
|
||||
evaluatedProperties = new BuildPropertyGroup (null, null, null, true);
|
||||
conditionedProperties = new Dictionary<string, List<string>> ();
|
||||
|
||||
foreach (BuildProperty gp in GlobalProperties) {
|
||||
bp = new BuildProperty (gp.Name, gp.Value, PropertyType.Global);
|
||||
@@ -960,10 +1024,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
throw new Exception (String.Format ("Invalid tools version '{0}', no tools path set for this.", effective_tools_version));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildBinPath", toolsPath, PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsPath", toolsPath, PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsRoot", Path.GetDirectoryName (toolsPath), PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsVersion", effective_tools_version, PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath", ExtensionsPath, PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath32", ExtensionsPath, PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath64", ExtensionsPath, PropertyType.Reserved));
|
||||
SetExtensionsPathProperties (DefaultExtensionsPath);
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectDefaultTargets", DefaultTargets, PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("OS", OS, PropertyType.Environment));
|
||||
|
||||
@@ -975,6 +1038,20 @@ namespace Microsoft.Build.BuildEngine {
|
||||
projectDir = Path.GetDirectoryName (FullFileName);
|
||||
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectDirectory", projectDir, PropertyType.Reserved));
|
||||
|
||||
if (this_file_property_stack.Count > 0)
|
||||
// Just re-inited the properties, but according to the stack,
|
||||
// we should have a MSBuild*This* property set
|
||||
SetMSBuildThisFileProperties (this_file_property_stack.Peek ());
|
||||
}
|
||||
|
||||
internal void SetExtensionsPathProperties (string extn_path)
|
||||
{
|
||||
if (!String.IsNullOrEmpty (extn_path)) {
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath", extn_path, PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath32", extn_path, PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath64", extn_path, PropertyType.Reserved));
|
||||
}
|
||||
}
|
||||
|
||||
// precedence:
|
||||
@@ -1023,23 +1100,52 @@ namespace Microsoft.Build.BuildEngine {
|
||||
usingTask = new UsingTask (xmlElement, this, importedProject);
|
||||
UsingTasks.Add (usingTask);
|
||||
}
|
||||
|
||||
void AddImport (XmlElement xmlElement, ImportedProject importingProject)
|
||||
|
||||
void AddImport (XmlElement xmlElement, ImportedProject importingProject, bool evaluate_properties)
|
||||
{
|
||||
// eval all the properties etc till the import
|
||||
groupingCollection.Evaluate (EvaluationType.Property);
|
||||
if (evaluate_properties)
|
||||
groupingCollection.Evaluate (EvaluationType.Property);
|
||||
|
||||
Import import = new Import (xmlElement, this, importingProject);
|
||||
if (!ConditionParser.ParseAndEvaluate (import.Condition, this))
|
||||
return;
|
||||
try {
|
||||
PushThisFileProperty (importingProject != null ? importingProject.FullFileName : FullFileName);
|
||||
|
||||
if (Imports.Contains (import)) {
|
||||
LogWarning (importingProject != null ? importingProject.FullFileName : fullFileName,
|
||||
"A circular reference was found involving the import of {0}. Only" +
|
||||
" the first import of this file will be used, ignoring others.",
|
||||
import.ProjectPath);
|
||||
string project_attribute = xmlElement.GetAttribute ("Project");
|
||||
if (String.IsNullOrEmpty (project_attribute))
|
||||
throw new InvalidProjectFileException ("The required attribute \"Project\" is missing from element <Import>.");
|
||||
|
||||
return;
|
||||
Import.ForEachExtensionPathTillFound (xmlElement, this, importingProject,
|
||||
(importPath, from_source_msg) => AddSingleImport (xmlElement, importPath, importingProject, from_source_msg));
|
||||
} finally {
|
||||
PopThisFileProperty ();
|
||||
}
|
||||
}
|
||||
|
||||
bool AddSingleImport (XmlElement xmlElement, string projectPath, ImportedProject importingProject, string from_source_msg)
|
||||
{
|
||||
Import import = new Import (xmlElement, projectPath, this, importingProject);
|
||||
if (!ConditionParser.ParseAndEvaluate (import.Condition, this)) {
|
||||
ParentEngine.LogMessage (MessageImportance.Low,
|
||||
"Not importing project '{0}' as the condition '{1}' is false",
|
||||
import.ProjectPath, import.Condition);
|
||||
return false;
|
||||
}
|
||||
|
||||
Import existingImport;
|
||||
if (Imports.TryGetImport (import, out existingImport)) {
|
||||
if (importingProject == null)
|
||||
LogWarning (fullFileName,
|
||||
"Cannot import project '{0}' again. It was already imported by " +
|
||||
"'{1}'. Ignoring.",
|
||||
projectPath, existingImport.ContainedInProjectFileName);
|
||||
else
|
||||
LogWarning (importingProject != null ? importingProject.FullFileName : fullFileName,
|
||||
"A circular reference was found involving the import of '{0}'. " +
|
||||
"It was earlier imported by '{1}'. Only " +
|
||||
"the first import of this file will be used, ignoring others.",
|
||||
import.EvaluatedProjectPath, existingImport.ContainedInProjectFileName);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (String.Compare (fullFileName, import.EvaluatedProjectPath) == 0) {
|
||||
@@ -1047,13 +1153,19 @@ namespace Microsoft.Build.BuildEngine {
|
||||
"The main project file was imported here, which creates a circular " +
|
||||
"reference. Ignoring this import.");
|
||||
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
Imports.Add (import);
|
||||
string importingFile = importingProject != null ? importingProject.FullFileName : FullFileName;
|
||||
ParentEngine.LogMessage (MessageImportance.Low,
|
||||
"{0}: Importing project {1} {2}",
|
||||
importingFile, import.EvaluatedProjectPath, from_source_msg);
|
||||
|
||||
import.Evaluate (project_load_settings == ProjectLoadSettings.IgnoreMissingImports);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void AddItemGroup (XmlElement xmlElement, ImportedProject importedProject)
|
||||
{
|
||||
BuildItemGroup big = new BuildItemGroup (xmlElement, this, importedProject, false);
|
||||
@@ -1066,9 +1178,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
PropertyGroups.Add (bpg);
|
||||
}
|
||||
|
||||
void AddChoose (XmlElement xmlElement)
|
||||
void AddChoose (XmlElement xmlElement, ImportedProject importedProject)
|
||||
{
|
||||
BuildChoose bc = new BuildChoose (xmlElement, this);
|
||||
BuildChoose bc = new BuildChoose (xmlElement, this, importedProject);
|
||||
groupingCollection.Add (bc);
|
||||
}
|
||||
|
||||
@@ -1261,6 +1373,41 @@ namespace Microsoft.Build.BuildEngine {
|
||||
return default (T);
|
||||
}
|
||||
|
||||
// Used for MSBuild*This* set of properties
|
||||
internal void PushThisFileProperty (string full_filename)
|
||||
{
|
||||
string last_file = this_file_property_stack.Count == 0 ? String.Empty : this_file_property_stack.Peek ();
|
||||
this_file_property_stack.Push (full_filename);
|
||||
if (last_file != full_filename)
|
||||
// first time, or different from previous one
|
||||
SetMSBuildThisFileProperties (full_filename);
|
||||
}
|
||||
|
||||
internal void PopThisFileProperty ()
|
||||
{
|
||||
string last_file = this_file_property_stack.Pop ();
|
||||
if (this_file_property_stack.Count > 0 && last_file != this_file_property_stack.Peek ())
|
||||
SetMSBuildThisFileProperties (this_file_property_stack.Peek ());
|
||||
}
|
||||
|
||||
void SetMSBuildThisFileProperties (string full_filename)
|
||||
{
|
||||
if (String.IsNullOrEmpty (full_filename))
|
||||
return;
|
||||
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFile", Path.GetFileName (full_filename), PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFileFullPath", full_filename, PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFileName", Path.GetFileNameWithoutExtension (full_filename), PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFileExtension", Path.GetExtension (full_filename), PropertyType.Reserved));
|
||||
|
||||
string project_dir = Path.GetDirectoryName (full_filename) + Path.DirectorySeparatorChar;
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFileDirectory", project_dir, PropertyType.Reserved));
|
||||
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFileDirectoryNoRoot",
|
||||
project_dir.Substring (Path.GetPathRoot (project_dir).Length),
|
||||
PropertyType.Reserved));
|
||||
}
|
||||
|
||||
|
||||
internal void LogWarning (string filename, string message, params object[] messageArgs)
|
||||
{
|
||||
BuildWarningEventArgs bwea = new BuildWarningEventArgs (
|
||||
@@ -1278,7 +1425,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
ParentEngine.EventSource.FireErrorRaised (this, beea);
|
||||
}
|
||||
|
||||
static string ExtensionsPath {
|
||||
internal static string DefaultExtensionsPath {
|
||||
get {
|
||||
if (extensions_path == null) {
|
||||
// NOTE: code from mcs/tools/gacutil/driver.cs
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
@@ -122,6 +123,16 @@ namespace Microsoft.Build.BuildEngine {
|
||||
}
|
||||
|
||||
bool Build (string built_targets_key, out bool executeOnErrors)
|
||||
{
|
||||
project.PushThisFileProperty (TargetFile);
|
||||
try {
|
||||
return BuildActual (built_targets_key, out executeOnErrors);
|
||||
} finally {
|
||||
project.PopThisFileProperty ();
|
||||
}
|
||||
}
|
||||
|
||||
bool BuildActual (string built_targets_key, out bool executeOnErrors)
|
||||
{
|
||||
bool result = false;
|
||||
executeOnErrors = false;
|
||||
@@ -147,14 +158,15 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
try {
|
||||
buildState = BuildState.Started;
|
||||
result = BuildDependencies (GetDependencies (), out executeOnErrors);
|
||||
|
||||
if (!result && executeOnErrors)
|
||||
ExecuteOnErrors ();
|
||||
|
||||
if (result)
|
||||
// deps built fine, do main build
|
||||
result = DoBuild (out executeOnErrors);
|
||||
#if NET_4_0
|
||||
result = BuildDependencies (out executeOnErrors) &&
|
||||
BuildBeforeThisTargets (out executeOnErrors) &&
|
||||
DoBuild (out executeOnErrors) && // deps & Before targets built fine, do main build
|
||||
BuildAfterThisTargets (out executeOnErrors);
|
||||
#else
|
||||
result = BuildDependencies (out executeOnErrors) && DoBuild (out executeOnErrors);
|
||||
#endif
|
||||
|
||||
buildState = BuildState.Finished;
|
||||
} catch (Exception e) {
|
||||
@@ -164,41 +176,80 @@ namespace Microsoft.Build.BuildEngine {
|
||||
project.PopBatch ();
|
||||
}
|
||||
|
||||
project.ParentEngine.BuiltTargetsOutputByName [built_targets_key] = (ITaskItem[]) Outputs.Clone ();
|
||||
ITaskItem[] outputs = (ITaskItem[]) OutputsAsITaskItems.Clone ();
|
||||
foreach (ITaskItem item in outputs) {
|
||||
item.SetMetadata ("MSBuildProjectFile", TargetFile);
|
||||
item.SetMetadata ("MSBuildTargetName", Name);
|
||||
}
|
||||
project.ParentEngine.BuiltTargetsOutputByName [built_targets_key] = outputs;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
List <Target> GetDependencies ()
|
||||
{
|
||||
List <Target> list = new List <Target> ();
|
||||
Target t;
|
||||
string [] targetNames;
|
||||
Expression deps;
|
||||
|
||||
if (DependsOnTargets != String.Empty) {
|
||||
deps = new Expression ();
|
||||
deps.Parse (DependsOnTargets, ParseOptions.AllowItemsNoMetadataAndSplit);
|
||||
targetNames = (string []) deps.ConvertTo (Project, typeof (string []));
|
||||
foreach (string dep_name in targetNames) {
|
||||
t = project.Targets [dep_name.Trim ()];
|
||||
if (t == null)
|
||||
throw new InvalidProjectFileException (String.Format (
|
||||
"Target '{0}', a dependency of target '{1}', not found.",
|
||||
dep_name.Trim (), Name));
|
||||
list.Add (t);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
bool BuildDependencies (List <Target> deps, out bool executeOnErrors)
|
||||
bool BuildDependencies (out bool executeOnErrors)
|
||||
{
|
||||
executeOnErrors = false;
|
||||
foreach (Target t in deps) {
|
||||
|
||||
if (String.IsNullOrEmpty (DependsOnTargets))
|
||||
return true;
|
||||
|
||||
var expr = new Expression ();
|
||||
expr.Parse (DependsOnTargets, ParseOptions.AllowItemsNoMetadataAndSplit);
|
||||
string [] targetNames = (string []) expr.ConvertTo (Project, typeof (string []));
|
||||
|
||||
bool result = BuildOtherTargets (targetNames,
|
||||
tname => engine.LogError ("Target '{0}', a dependency of target '{1}', not found.",
|
||||
tname, Name),
|
||||
out executeOnErrors);
|
||||
if (!result && executeOnErrors)
|
||||
ExecuteOnErrors ();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
bool BuildBeforeThisTargets (out bool executeOnErrors)
|
||||
{
|
||||
executeOnErrors = false;
|
||||
bool result = BuildOtherTargets (BeforeThisTargets, null, out executeOnErrors);
|
||||
if (!result && executeOnErrors)
|
||||
ExecuteOnErrors ();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool BuildAfterThisTargets (out bool executeOnErrors)
|
||||
{
|
||||
executeOnErrors = false;
|
||||
//missing_target handler not required as these are picked from actual target's
|
||||
//"Before/AfterTargets attributes!
|
||||
bool result = BuildOtherTargets (AfterThisTargets, null, out executeOnErrors);
|
||||
if (!result && executeOnErrors)
|
||||
ExecuteOnErrors ();
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool BuildOtherTargets (IEnumerable<string> targetNames, Action<string> missing_target, out bool executeOnErrors)
|
||||
{
|
||||
executeOnErrors = false;
|
||||
if (targetNames == null)
|
||||
// nothing to build
|
||||
return true;
|
||||
|
||||
foreach (string target_name in targetNames) {
|
||||
var t = project.Targets [target_name.Trim ()];
|
||||
if (t == null) {
|
||||
if (missing_target != null)
|
||||
missing_target (target_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.BuildState == BuildState.NotStarted)
|
||||
if (!t.Build (null, out executeOnErrors))
|
||||
return false;
|
||||
|
||||
if (t.BuildState == BuildState.Started)
|
||||
throw new InvalidProjectFileException ("Cycle in target dependencies detected");
|
||||
}
|
||||
@@ -311,6 +362,19 @@ namespace Microsoft.Build.BuildEngine {
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
internal string BeforeTargets {
|
||||
get { return targetElement.GetAttribute ("BeforeTargets"); }
|
||||
}
|
||||
|
||||
internal string AfterTargets {
|
||||
get { return targetElement.GetAttribute ("AfterTargets"); }
|
||||
}
|
||||
|
||||
internal List<string> BeforeThisTargets { get; set; }
|
||||
internal List<string> AfterThisTargets { get; set; }
|
||||
#endif
|
||||
|
||||
internal List<BuildTask> BuildTasks {
|
||||
get { return buildTasks; }
|
||||
}
|
||||
@@ -323,7 +387,12 @@ namespace Microsoft.Build.BuildEngine {
|
||||
get { return buildState; }
|
||||
}
|
||||
|
||||
internal ITaskItem [] Outputs {
|
||||
public string Outputs {
|
||||
get { return targetElement.GetAttribute ("Outputs"); }
|
||||
set { targetElement.SetAttribute ("Outputs", value); }
|
||||
}
|
||||
|
||||
ITaskItem [] OutputsAsITaskItems {
|
||||
get {
|
||||
string outputs = targetElement.GetAttribute ("Outputs");
|
||||
if (outputs == String.Empty)
|
||||
|
||||
@@ -86,6 +86,12 @@ namespace Microsoft.Build.BuildEngine {
|
||||
yield return kvp.Value;
|
||||
}
|
||||
|
||||
internal IEnumerable<Target> AsIEnumerable ()
|
||||
{
|
||||
foreach (KeyValuePair <string, Target> kvp in targetsByName)
|
||||
yield return kvp.Value;
|
||||
}
|
||||
|
||||
public void RemoveTarget (Target targetToRemove)
|
||||
{
|
||||
if (targetToRemove == null)
|
||||
|
||||
@@ -177,10 +177,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
throw new InvalidProjectFileException ("This is not output property.");
|
||||
|
||||
o = propertyInfo.GetValue (task, null);
|
||||
// FIXME: maybe we should throw an exception here?
|
||||
if (o == null)
|
||||
continue;
|
||||
|
||||
if (itemName != String.Empty) {
|
||||
PublishItemGroup (propertyInfo, o, itemName);
|
||||
} else {
|
||||
@@ -198,6 +194,11 @@ namespace Microsoft.Build.BuildEngine {
|
||||
object o,
|
||||
string propertyName)
|
||||
{
|
||||
if (o == null) {
|
||||
parentProject.EvaluatedProperties.RemoveProperty (propertyName);
|
||||
return;
|
||||
}
|
||||
|
||||
BuildProperty bp;
|
||||
try {
|
||||
bp = ChangeType.ToBuildProperty (o, propertyInfo.PropertyType, propertyName);
|
||||
@@ -214,6 +215,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
object o,
|
||||
string itemName)
|
||||
{
|
||||
if (o == null)
|
||||
return;
|
||||
|
||||
BuildItemGroup newItems;
|
||||
try {
|
||||
newItems = ChangeType.ToBuildItemGroup (o, propertyInfo.PropertyType, itemName);
|
||||
|
||||
@@ -783,7 +783,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
logger.DumpMessages ();
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
logger.DumpMessages ();
|
||||
|
||||
CheckMetadata (project, "A", "Meta", new string[] { "@(B)", "" }, "K1");
|
||||
CheckEvaluatedMetadata (project, "A", "Meta", new string[] { "", "" }, "K2");
|
||||
|
||||
+4
-2
@@ -374,9 +374,11 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
|
||||
xd = new XmlDocument ();
|
||||
xd.LoadXml (project.Xml);
|
||||
Console.WriteLine(project.Xml);
|
||||
node = xd.SelectSingleNode ("tns:Project/tns:PropertyGroup/tns:XmlProp/tns:XmlStuff", TestNamespaceManager.NamespaceManager);
|
||||
Assert.IsNotNull (node, "A1");
|
||||
if (node == null) {
|
||||
Console.WriteLine (project.Xml);
|
||||
Assert.Fail ("Expected node to be non-null");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -342,6 +342,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
bt [0].AddOutputItem ("Property", "ItemName");
|
||||
project.Build ("T");
|
||||
|
||||
Assert.IsNotNull (project.EvaluatedItems [0], "No items found");
|
||||
Assert.AreEqual ("ItemName", project.EvaluatedItems [0].Name, "A1");
|
||||
Assert.AreEqual ("some_text", project.EvaluatedItems [0].FinalItemSpec, "A2");
|
||||
}
|
||||
|
||||
@@ -209,5 +209,62 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
project.LoadXml (documentString);
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void TestImportWildcard ()
|
||||
{
|
||||
string main_project_xml = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""4.0"">
|
||||
<ItemGroup>
|
||||
<FooItem Include=""From main.proj""/>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project=""tmp\*""/>
|
||||
|
||||
<Target Name=""Build"">
|
||||
<Message Text=""FooItem: @(FooItem)""/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
string other_project_xml = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""4.0"">
|
||||
<ItemGroup>
|
||||
<FooItem Include=""From $(MSBuildThisFile)""/>
|
||||
</ItemGroup>
|
||||
</Project>";
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
string base_dir = Path.GetFullPath (Path.Combine ("Test", "resources")) + Path.DirectorySeparatorChar;
|
||||
string tmp_dir = Path.GetFullPath (Path.Combine (base_dir, "tmp")) + Path.DirectorySeparatorChar;
|
||||
|
||||
string main_project = Path.Combine (base_dir, "main.proj");
|
||||
string first_project = Path.Combine (tmp_dir, "first.proj");
|
||||
string second_project = Path.Combine (tmp_dir, "second.proj");
|
||||
|
||||
Directory.CreateDirectory (tmp_dir);
|
||||
File.WriteAllText (main_project, main_project_xml);
|
||||
File.WriteAllText (first_project, other_project_xml);
|
||||
File.WriteAllText (second_project, other_project_xml);
|
||||
|
||||
Project project = engine.CreateNewProject ();
|
||||
project.Load (main_project);
|
||||
try {
|
||||
Assert.IsTrue (project.Build ("Build"), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("FooItem: From main.proj;From first.proj;From second.proj", "A1");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
} finally {
|
||||
File.Delete (main_project);
|
||||
File.Delete (first_project);
|
||||
File.Delete (second_project);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
Assert.AreEqual (false, project.IsDirty, "A4");
|
||||
Assert.AreEqual (false, project.IsValidated, "A5");
|
||||
Assert.AreEqual (engine, project.ParentEngine, "A6");
|
||||
Console.WriteLine ("time: {0} p.t: {1}", time, project.TimeOfLastDirty);
|
||||
//Console.WriteLine ("time: {0} p.t: {1}", time, project.TimeOfLastDirty);
|
||||
Assert.IsTrue (time <= project.TimeOfLastDirty, "A7");
|
||||
Assert.IsTrue (String.Empty != project.Xml, "A8");
|
||||
return;
|
||||
@@ -1487,7 +1487,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
logger.DumpMessages ();
|
||||
Assert.Fail ("A1: Build failed");
|
||||
}
|
||||
logger.DumpMessages ();
|
||||
BuildItemGroup include = project.GetEvaluatedItemsByName ("FinalList");
|
||||
Assert.AreEqual (3, include.Count, "A2");
|
||||
}
|
||||
@@ -1831,6 +1830,97 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMSBuildThisProperties ()
|
||||
{
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
string base_dir = Path.GetFullPath (Path.Combine ("Test", "resources")) + Path.DirectorySeparatorChar;
|
||||
string tmp_dir = Path.GetFullPath (Path.Combine (base_dir, "tmp")) + Path.DirectorySeparatorChar;
|
||||
|
||||
string first_project = Path.Combine (base_dir, "first.proj");
|
||||
string second_project = Path.Combine (tmp_dir, "second.proj");
|
||||
string third_project = Path.Combine (tmp_dir, "third.proj");
|
||||
|
||||
string first = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
|
||||
<PropertyGroup>
|
||||
<FooInMain>$(MSBuildThisFileDirectory)</FooInMain>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ItemInMain Include=""$(MSBuildThisFileFullPath)"" />
|
||||
</ItemGroup>
|
||||
<Import Project=""tmp\second.proj""/>
|
||||
</Project>";
|
||||
|
||||
string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
|
||||
<PropertyGroup>
|
||||
<FooInImport1>$(MSBuildThisFileDirectory)</FooInImport1>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<FooInImport2>$(MSBuildThisFileDirectory)</FooInImport2>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ItemInImport1 Include=""$(MSBuildThisFileFullPath)"" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project=""third.proj""/>
|
||||
</Project>";
|
||||
|
||||
string third = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
|
||||
<PropertyGroup>
|
||||
<FooInTwo>$(MSBuildThisFileFullPath)</FooInTwo>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ItemInTwo Include=""$(MSBuildThisFileFullPath)"" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name=""TargetInTwo"">
|
||||
<Message Text=""FooInMain: $(FooInMain)""/>
|
||||
<Message Text=""FooInImport1: $(FooInImport1)""/>
|
||||
<Message Text=""FooInImport2: $(FooInImport2)""/>
|
||||
<Message Text=""FooInTwo: $(FooInTwo)""/>
|
||||
|
||||
<Message Text=""ItemInMain: %(ItemInMain.Identity)""/>
|
||||
<Message Text=""ItemInImport1: %(ItemInImport1.Identity)""/>
|
||||
<Message Text=""ItemInTwo: %(ItemInTwo.Identity)""/>
|
||||
<Message Text=""Full path: $(MSBuildThisFileFullPath)""/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
File.WriteAllText (first_project, first);
|
||||
|
||||
Directory.CreateDirectory (Path.Combine (base_dir, "tmp"));
|
||||
File.WriteAllText (second_project, second);
|
||||
File.WriteAllText (third_project, third);
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
project.Load (first_project);
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("FooInMain: " + base_dir, "A1");
|
||||
logger.CheckLoggedMessageHead ("FooInImport1: " + tmp_dir, "A2");
|
||||
logger.CheckLoggedMessageHead ("FooInImport2: " + tmp_dir, "A3");
|
||||
logger.CheckLoggedMessageHead ("FooInTwo: " + third_project, "A4");
|
||||
logger.CheckLoggedMessageHead ("ItemInMain: " + first_project, "A5");
|
||||
logger.CheckLoggedMessageHead ("ItemInImport1: " + second_project, "A6");
|
||||
logger.CheckLoggedMessageHead ("ItemInTwo: " + third_project, "A7");
|
||||
logger.CheckLoggedMessageHead ("Full path: " + third_project, "A8");
|
||||
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
} finally {
|
||||
File.Delete (first_project);
|
||||
File.Delete (second_project);
|
||||
File.Delete (third_project);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequiredTask_String1 ()
|
||||
@@ -2013,7 +2103,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
logger.DumpMessages ();
|
||||
Assert.Fail ("A1: Build failed");
|
||||
}
|
||||
logger.DumpMessages ();
|
||||
|
||||
logger.CheckLoggedMessageHead ("Full item: foo;FOO;hmm;bar", "#A2");
|
||||
logger.CheckLoggedMessageHead ("metadata1 :md1 metadata2: md2", "#A3");
|
||||
@@ -2174,7 +2263,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
logger.CheckLoggedMessageHead (expected_output_msg, "A");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected messages found");
|
||||
}
|
||||
} finally {
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
}
|
||||
return project;
|
||||
|
||||
@@ -420,5 +420,61 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void TestBeforeAndAfterTargets ()
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""4.0"">
|
||||
<Target Name=""DefaultBeforeTarget1"" BeforeTargets=""Default"">
|
||||
<Message Text=""Hello from DefaultBeforeTarget1""/>
|
||||
</Target>
|
||||
|
||||
<Target Name=""DefaultBeforeTarget2"" BeforeTargets=""Default;Default;NonExistant"">
|
||||
<Message Text=""Hello from DefaultBeforeTarget2""/>
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name=""DefaultAfterTarget"" AfterTargets=""Default ; Foo"">
|
||||
<Message Text=""Hello from DefaultAfterTarget""/>
|
||||
</Target>
|
||||
|
||||
<Target Name=""Default"" DependsOnTargets=""DefaultDependsOn"">
|
||||
<Message Text=""Hello from Default""/>
|
||||
</Target>
|
||||
|
||||
<Target Name=""DefaultDependsOn"">
|
||||
<Message Text=""Hello from DefaultDependsOn""/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
engine = new Engine ();
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (projectString);
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
if (!project.Build ("Default")) {
|
||||
logger.DumpMessages ();
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
|
||||
logger.CheckLoggedMessageHead ("Hello from DefaultDependsOn", "A1");
|
||||
logger.CheckLoggedMessageHead ("Hello from DefaultBeforeTarget1", "A1");
|
||||
logger.CheckLoggedMessageHead ("Hello from DefaultBeforeTarget2", "A1");
|
||||
logger.CheckLoggedMessageHead ("Hello from Default", "A1");
|
||||
logger.CheckLoggedMessageHead ("Hello from DefaultAfterTarget", "A1");
|
||||
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected messages found");
|
||||
|
||||
//warnings for referencing unknown targets: NonExistant and Foo
|
||||
Assert.AreEqual (2, logger.WarningsCount, "Expected warnings not raised");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
@@ -575,7 +575,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
|
||||
logger.DumpMessages ();
|
||||
logger.CheckLoggedMessageHead ("Prop2: File1", "A1");
|
||||
logger.CheckLoggedMessageHead ("Files: File1", "A1");
|
||||
logger.CheckLoggedMessageHead ("Files: File1", "A1");
|
||||
@@ -710,7 +709,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
|
||||
logger.DumpMessages ();
|
||||
logger.CheckLoggedMessageHead ("Item1: Item1OldVal", "A1");
|
||||
logger.CheckLoggedMessageHead ("Item1: Val", "A2");
|
||||
logger.CheckLoggedMessageHead ("Item2: Item2OldVal", "A3");
|
||||
@@ -787,7 +785,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
|
||||
logger.DumpMessages ();
|
||||
logger.CheckLoggedMessageHead ("output1: property: null ## array: null", "A1");
|
||||
logger.CheckLoggedMessageHead ("output2: property: ## array: null", "A2");
|
||||
logger.CheckLoggedMessageHead ("output3: property: null ## array: null", "A3");
|
||||
@@ -1494,7 +1491,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
|
||||
logger.DumpMessages ();
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
logger.DumpMessages ();
|
||||
|
||||
logger.CheckLoggedMessageHead ("file1: " + Path.Combine ("bar", "foo.dll"), "A1");
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ Microsoft.Build.Tasks/GenerateTrustInfo.cs
|
||||
Microsoft.Build.Tasks/GetAssemblyIdentity.cs
|
||||
Microsoft.Build.Tasks/GetFrameworkPath.cs
|
||||
Microsoft.Build.Tasks/GetFrameworkSdkPath.cs
|
||||
Microsoft.Build.Tasks/GetReferenceAssemblyPaths.cs
|
||||
Microsoft.Build.Tasks.Hosting/ICscHostObject.cs
|
||||
Microsoft.Build.Tasks.Hosting/IVbcHostObject.cs
|
||||
Microsoft.Build.Tasks/LC.cs
|
||||
|
||||
@@ -37,8 +37,6 @@ using Mono.XBuild.Utilities;
|
||||
namespace Microsoft.Build.Tasks {
|
||||
public class AL : ToolTaskExtension {
|
||||
|
||||
Process alProcess;
|
||||
|
||||
public AL ()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace Microsoft.Build.Tasks {
|
||||
Dictionary<string, TargetFrameworkAssemblies> target_framework_cache;
|
||||
Dictionary<string, Dictionary<Version, string>> gac;
|
||||
TaskLoggingHelper log;
|
||||
StringWriter sw;
|
||||
List<string> search_log;
|
||||
|
||||
static LibraryPcFileCache cache;
|
||||
@@ -121,7 +120,10 @@ namespace Microsoft.Build.Tasks {
|
||||
if (!Directory.Exists (framework_dir))
|
||||
return null;
|
||||
|
||||
AssemblyName key_aname = new AssemblyName (reference.ItemSpec);
|
||||
AssemblyName key_aname;
|
||||
if (!TryGetAssemblyNameFromFullName (reference.ItemSpec, out key_aname))
|
||||
return null;
|
||||
|
||||
TargetFrameworkAssemblies gac_asm;
|
||||
if (!target_framework_cache.TryGetValue (framework_dir, out gac_asm)) {
|
||||
// fill gac_asm
|
||||
@@ -160,7 +162,9 @@ namespace Microsoft.Build.Tasks {
|
||||
|
||||
// Try as a filename
|
||||
string path = Path.GetFullPath (Path.Combine (directory, filename));
|
||||
AssemblyName aname = specific_version ? new AssemblyName (reference.ItemSpec) : null;
|
||||
AssemblyName aname = null;
|
||||
if (specific_version && !TryGetAssemblyNameFromFullName (reference.ItemSpec, out aname))
|
||||
return null;
|
||||
|
||||
ResolvedReference resolved_ref = ResolveReferenceForPath (path, reference, aname, null, SearchPath.Directory, specific_version);
|
||||
if (resolved_ref != null)
|
||||
@@ -181,8 +185,8 @@ namespace Microsoft.Build.Tasks {
|
||||
ResolvedReference ResolveReferenceForPath (string filename, ITaskItem reference, AssemblyName aname,
|
||||
string error_message, SearchPath spath, bool specific_version)
|
||||
{
|
||||
AssemblyName found_aname = GetAssemblyNameFromFile (filename);
|
||||
if (found_aname == null) {
|
||||
AssemblyName found_aname;
|
||||
if (!TryGetAssemblyNameFromFile (filename, out found_aname)) {
|
||||
if (error_message != null)
|
||||
log.LogMessage (MessageImportance.Low, error_message);
|
||||
return null;
|
||||
@@ -204,8 +208,8 @@ namespace Microsoft.Build.Tasks {
|
||||
{
|
||||
TargetFrameworkAssemblies gac_asm = new TargetFrameworkAssemblies (directory);
|
||||
foreach (string file in Directory.GetFiles (directory, "*.dll")) {
|
||||
AssemblyName aname = GetAssemblyNameFromFile (file);
|
||||
if (aname != null)
|
||||
AssemblyName aname;
|
||||
if (TryGetAssemblyNameFromFile (file, out aname))
|
||||
gac_asm.NameToAssemblyNameCache [aname.Name] =
|
||||
new KeyValuePair<AssemblyName, string> (aname, file);
|
||||
}
|
||||
@@ -215,7 +219,10 @@ namespace Microsoft.Build.Tasks {
|
||||
|
||||
public ResolvedReference ResolveGacReference (ITaskItem reference, bool specific_version)
|
||||
{
|
||||
AssemblyName name = new AssemblyName (reference.ItemSpec);
|
||||
AssemblyName name;
|
||||
if (!TryGetAssemblyNameFromFullName (reference.ItemSpec, out name))
|
||||
return null;
|
||||
|
||||
if (!gac.ContainsKey (name.Name)) {
|
||||
LogSearchMessage ("Considered {0}, but could not find in the GAC.",
|
||||
reference.ItemSpec);
|
||||
@@ -264,7 +271,11 @@ namespace Microsoft.Build.Tasks {
|
||||
return null;
|
||||
}
|
||||
|
||||
ResolvedReference rr = GetResolvedReference (reference, pkg.File, new AssemblyName (pkg.FullName),
|
||||
AssemblyName aname;
|
||||
if (!TryGetAssemblyNameFromFullName (pkg.FullName, out aname))
|
||||
return null;
|
||||
|
||||
ResolvedReference rr = GetResolvedReference (reference, pkg.File, aname,
|
||||
false, SearchPath.PkgConfig);
|
||||
rr.FoundInSearchPathAsString = String.Format ("{{PkgConfig}} provided by package named {0}",
|
||||
pkg.ParentPackage.Name);
|
||||
@@ -291,14 +302,18 @@ namespace Microsoft.Build.Tasks {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ResolveReferenceForPath (hintpath, reference, new AssemblyName (reference.ItemSpec),
|
||||
AssemblyName aname;
|
||||
if (!TryGetAssemblyNameFromFullName (reference.ItemSpec, out aname))
|
||||
return null;
|
||||
|
||||
return ResolveReferenceForPath (hintpath, reference, aname,
|
||||
String.Format ("File at HintPath {0}, is either an invalid assembly or the file does not exist.", hintpath),
|
||||
SearchPath.HintPath, specific_version);
|
||||
}
|
||||
|
||||
public AssemblyName GetAssemblyNameFromFile (string filename)
|
||||
public bool TryGetAssemblyNameFromFile (string filename, out AssemblyName aname)
|
||||
{
|
||||
AssemblyName aname = null;
|
||||
aname = null;
|
||||
filename = Path.GetFullPath (filename);
|
||||
try {
|
||||
aname = AssemblyName.GetAssemblyName (filename);
|
||||
@@ -310,7 +325,19 @@ namespace Microsoft.Build.Tasks {
|
||||
filename);
|
||||
}
|
||||
|
||||
return aname;
|
||||
return aname != null;
|
||||
}
|
||||
|
||||
bool TryGetAssemblyNameFromFullName (string full_name, out AssemblyName aname)
|
||||
{
|
||||
aname = null;
|
||||
try {
|
||||
aname = new AssemblyName (full_name);
|
||||
} catch (FileLoadException) {
|
||||
LogSearchMessage ("Considered '{0}' as an assembly name, but it is invalid.", full_name);
|
||||
}
|
||||
|
||||
return aname != null;
|
||||
}
|
||||
|
||||
internal static bool AssemblyNamesCompatible (AssemblyName a, AssemblyName b, bool specificVersion)
|
||||
@@ -341,11 +368,8 @@ namespace Microsoft.Build.Tasks {
|
||||
bool a_is_empty = (a_bytes == null || a_bytes.Length == 0);
|
||||
bool b_is_empty = (b_bytes == null || b_bytes.Length == 0);
|
||||
|
||||
if (a_is_empty && b_is_empty)
|
||||
return true;
|
||||
|
||||
if (a_is_empty || b_is_empty)
|
||||
return false;
|
||||
return true;
|
||||
|
||||
for (int i = 0; i < a_bytes.Length; i++)
|
||||
if (a_bytes [i] != b_bytes [i])
|
||||
|
||||
@@ -54,24 +54,30 @@ namespace Microsoft.Build.Tasks {
|
||||
assignedFiles = new ITaskItem [files.Length];
|
||||
for (int i = 0; i < files.Length; i ++) {
|
||||
string file = files [i].ItemSpec;
|
||||
string link = files [i].GetMetadata ("Link");
|
||||
string afile = null;
|
||||
//FIXME: Hack!
|
||||
string normalized_root = Path.GetFullPath (rootFolder);
|
||||
|
||||
// cur dir should already be set to
|
||||
// the project dir
|
||||
file = Path.GetFullPath (file);
|
||||
if (String.IsNullOrEmpty (link)) {
|
||||
//FIXME: Hack!
|
||||
string normalized_root = Path.GetFullPath (rootFolder);
|
||||
|
||||
if (file.StartsWith (normalized_root)) {
|
||||
afile = Path.GetFullPath (file).Substring (
|
||||
normalized_root.Length);
|
||||
// skip over "root/"
|
||||
if (afile [0] == '\\' ||
|
||||
afile [0] == '/')
|
||||
afile = afile.Substring (1);
|
||||
// cur dir should already be set to
|
||||
// the project dir
|
||||
file = Path.GetFullPath (file);
|
||||
|
||||
if (file.StartsWith (normalized_root)) {
|
||||
afile = Path.GetFullPath (file).Substring (
|
||||
normalized_root.Length);
|
||||
// skip over "root/"
|
||||
if (afile [0] == '\\' ||
|
||||
afile [0] == '/')
|
||||
afile = afile.Substring (1);
|
||||
|
||||
} else {
|
||||
afile = Path.GetFileName (file);
|
||||
}
|
||||
} else {
|
||||
afile = Path.GetFileName (file);
|
||||
afile = link;
|
||||
}
|
||||
|
||||
assignedFiles [i] = new TaskItem (files [i]);
|
||||
|
||||
@@ -43,7 +43,8 @@ namespace Microsoft.Build.Tasks {
|
||||
public override bool Execute ()
|
||||
{
|
||||
if (Log != null)
|
||||
Log.LogError (null, code, helpKeyword, BuildEngine.ProjectFileOfTaskNode,
|
||||
Log.LogError (null, code, helpKeyword,
|
||||
String.IsNullOrEmpty (File) ? BuildEngine.ProjectFileOfTaskNode : File,
|
||||
BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
|
||||
BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
|
||||
text ?? String.Empty, null);
|
||||
@@ -64,6 +65,8 @@ namespace Microsoft.Build.Tasks {
|
||||
get { return text; }
|
||||
set { text = value; }
|
||||
}
|
||||
|
||||
public string File { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
@@ -49,6 +50,10 @@ namespace Microsoft.Build.Tasks {
|
||||
string stdOutEncoding;
|
||||
string workingDirectory;
|
||||
string scriptFile;
|
||||
|
||||
#if NET_4_0
|
||||
Func<string, bool> errorMatcher, warningMatcher;
|
||||
#endif
|
||||
|
||||
public Exec ()
|
||||
{
|
||||
@@ -77,6 +82,10 @@ namespace Microsoft.Build.Tasks {
|
||||
string commandLineCommands)
|
||||
{
|
||||
try {
|
||||
#if NET_4_0
|
||||
errorMatcher = GetTryMatchRegexFunc (CustomErrorRegularExpression, true);
|
||||
warningMatcher = GetTryMatchRegexFunc (CustomWarningRegularExpression, false);
|
||||
#endif
|
||||
return base.ExecuteTool (pathToTool, responseFileCommands, commandLineCommands);
|
||||
} finally {
|
||||
if (scriptFile != null)
|
||||
@@ -117,9 +126,48 @@ namespace Microsoft.Build.Tasks {
|
||||
|
||||
protected override void LogEventsFromTextOutput (string singleLine, MessageImportance importance)
|
||||
{
|
||||
Log.LogMessage (importance, singleLine);
|
||||
#if NET_4_0
|
||||
if (IgnoreStandardErrorWarningFormat ||
|
||||
(!errorMatcher (singleLine) && !warningMatcher (singleLine)))
|
||||
#endif
|
||||
Log.LogMessage (importance, singleLine);
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
// @is_error_type - log as errors, else warnings
|
||||
Func<string, bool> GetTryMatchRegexFunc (string regex_str, bool is_error_type)
|
||||
{
|
||||
bool is_bad = false;
|
||||
Regex regex = null;
|
||||
return (singleLine) => {
|
||||
if (String.IsNullOrEmpty (regex_str) || is_bad)
|
||||
return false;
|
||||
|
||||
try {
|
||||
if (regex == null)
|
||||
regex = new Regex (regex_str, RegexOptions.Compiled);
|
||||
} catch (ArgumentException ae) {
|
||||
Log.LogError ("The regular expression specified for '{0}' is invalid : {1}",
|
||||
is_error_type ? "errors" : "warnings", ae.Message);
|
||||
Log.LogMessage (MessageImportance.Low, "The regular expression specified for '{0}' is invalid : {1}",
|
||||
is_error_type ? "errors" : "warnings", ae.ToString ());
|
||||
|
||||
is_bad = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!regex.Match (singleLine).Success)
|
||||
return false;
|
||||
|
||||
if (is_error_type)
|
||||
Log.LogError (singleLine);
|
||||
else
|
||||
Log.LogWarning (singleLine);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
[MonoTODO]
|
||||
protected override bool ValidateParameters ()
|
||||
{
|
||||
@@ -162,6 +210,14 @@ namespace Microsoft.Build.Tasks {
|
||||
protected override MessageImportance StandardOutputLoggingImportance {
|
||||
get { return base.StandardOutputLoggingImportance; }
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
public bool IgnoreStandardErrorWarningFormat { get; set; }
|
||||
|
||||
public string CustomErrorRegularExpression { get; set; }
|
||||
|
||||
public string CustomWarningRegularExpression { get; set; }
|
||||
#endif
|
||||
|
||||
[MonoTODO]
|
||||
[Output]
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
//
|
||||
// GetReferenceAssemblyPaths.cs: Gets the target framework directories corresponding
|
||||
// to target framework moniker
|
||||
//
|
||||
// Author:
|
||||
// Ankit Jain ([email protected])
|
||||
//
|
||||
// Copyright 2011 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using Microsoft.Build.Framework;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Mono.XBuild.Utilities;
|
||||
|
||||
#if NET_4_0
|
||||
|
||||
namespace Microsoft.Build.Tasks
|
||||
{
|
||||
public class GetReferenceAssemblyPaths : TaskExtension
|
||||
{
|
||||
static string framework_base_path;
|
||||
static string PathSeparatorAsString = Path.PathSeparator.ToString ();
|
||||
const string MacOSXExternalXBuildDir = "/Library/Frameworks/Mono.framework/External/xbuild-frameworks";
|
||||
|
||||
public GetReferenceAssemblyPaths ()
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Execute ()
|
||||
{
|
||||
FrameworkMoniker moniker = null;
|
||||
if (!TryParseTargetFrameworkMoniker (TargetFrameworkMoniker, out moniker))
|
||||
return false;
|
||||
|
||||
var framework = GetFrameworkDirectoriesForMoniker (moniker);
|
||||
if (framework == null) {
|
||||
Log.LogWarning ("Unable to find framework corresponding to the target framework moniker '{0}'. " +
|
||||
"Framework assembly references will be resolved from the GAC, which might not be " +
|
||||
"the intended behavior.", TargetFrameworkMoniker);
|
||||
return true;
|
||||
}
|
||||
|
||||
ReferenceAssemblyPaths = FullFrameworkReferenceAssemblyPaths = framework.Directories;
|
||||
TargetFrameworkMonikerDisplayName = framework.DisplayName;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Framework GetFrameworkDirectoriesForMoniker (FrameworkMoniker moniker)
|
||||
{
|
||||
string dirs = String.Join (PathSeparatorAsString, new string [] {
|
||||
Environment.GetEnvironmentVariable ("XBUILD_FRAMEWORK_FOLDERS_PATH") ?? String.Empty,
|
||||
MSBuildUtils.RunningOnMac ? MacOSXExternalXBuildDir : String.Empty,
|
||||
RootPath,
|
||||
DefaultFrameworksBasePath });
|
||||
|
||||
string [] paths = dirs.Split (new char [] {Path.PathSeparator}, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string path in paths) {
|
||||
var framework = GetFrameworkDirectoriesForMoniker (moniker, path);
|
||||
if (framework != null)
|
||||
return framework;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//@base_path must be absolute
|
||||
Framework GetFrameworkDirectoriesForMoniker (FrameworkMoniker moniker, string base_path)
|
||||
{
|
||||
if (String.IsNullOrEmpty (base_path)) {
|
||||
Log.LogMessage (MessageImportance.Low, "Invalid *empty* base path, ignoring. " + Environment.StackTrace);
|
||||
return null;
|
||||
}
|
||||
|
||||
Log.LogMessage (MessageImportance.Low, "Looking for framework '{0}' in root path '{1}'",
|
||||
moniker, base_path);
|
||||
string framework_path = Path.Combine (base_path, Path.Combine (moniker.Identifier, moniker.Version));
|
||||
if (!String.IsNullOrEmpty (moniker.Profile))
|
||||
framework_path = Path.Combine (framework_path, moniker.Profile);
|
||||
|
||||
string redistlist_dir = Path.Combine (framework_path, "RedistList");
|
||||
string framework_list = Path.Combine (redistlist_dir, "FrameworkList.xml");
|
||||
if (!File.Exists (framework_list)) {
|
||||
Log.LogMessage (MessageImportance.Low,
|
||||
"Unable to find framework definition file '{0}' for Target Framework Moniker '{1}'",
|
||||
framework_list, moniker);
|
||||
return null;
|
||||
}
|
||||
|
||||
Log.LogMessage (MessageImportance.Low, "Found framework definition list '{0}' for framework '{1}'",
|
||||
framework_list, moniker);
|
||||
XmlReader xr = XmlReader.Create (framework_list);
|
||||
try {
|
||||
xr.MoveToContent ();
|
||||
if (xr.LocalName != "FileList") {
|
||||
Log.LogMessage (MessageImportance.Low, "Invalid frameworklist '{0}', expected a 'FileList' root element.",
|
||||
framework_list);
|
||||
return null;
|
||||
}
|
||||
|
||||
var framework = new Framework ();
|
||||
framework.DisplayName = xr.GetAttribute ("Name");
|
||||
string framework_dir = xr.GetAttribute ("TargetFrameworkDirectory");
|
||||
if (String.IsNullOrEmpty (framework_dir))
|
||||
framework_dir = Path.Combine (redistlist_dir, "..");
|
||||
else
|
||||
framework_dir = Path.Combine (redistlist_dir, framework_dir);
|
||||
|
||||
var directories = new List<string> ();
|
||||
directories.Add (MSBuildUtils.FromMSBuildPath (framework_dir));
|
||||
|
||||
string include = xr.GetAttribute ("IncludeFramework");
|
||||
if (!String.IsNullOrEmpty (include)) {
|
||||
var included_framework = GetFrameworkDirectoriesForMoniker (new FrameworkMoniker (moniker.Identifier, include, null));
|
||||
|
||||
if (included_framework != null && included_framework.Directories != null)
|
||||
directories.AddRange (included_framework.Directories);
|
||||
}
|
||||
|
||||
framework.Directories = directories.ToArray ();
|
||||
|
||||
return framework;
|
||||
} catch (XmlException xe) {
|
||||
Log.LogWarning ("Error reading framework definition file '{0}': {1}", framework_list, xe.Message);
|
||||
Log.LogMessage (MessageImportance.Low, "Error reading framework definition file '{0}': {1}", framework_list,
|
||||
xe.ToString ());
|
||||
return null;
|
||||
} finally {
|
||||
if (xr != null)
|
||||
((IDisposable)xr).Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
bool TryParseTargetFrameworkMoniker (string moniker_literal, out FrameworkMoniker moniker)
|
||||
{
|
||||
moniker = null;
|
||||
if (String.IsNullOrEmpty (moniker_literal))
|
||||
throw new ArgumentException ("Empty moniker string");
|
||||
|
||||
string [] parts = moniker_literal.Split (new char [] {','}, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (parts.Length < 2 || parts.Length > 3) {
|
||||
LogInvalidMonikerError (null, moniker_literal);
|
||||
return false;
|
||||
}
|
||||
|
||||
string identifier = parts [0];
|
||||
string version = null;
|
||||
string profile = null;
|
||||
|
||||
if (!parts [1].StartsWith ("Version=")) {
|
||||
LogInvalidMonikerError ("Invalid framework name", moniker_literal);
|
||||
return false;
|
||||
}
|
||||
|
||||
version = parts [1].Substring (8);
|
||||
if (String.IsNullOrEmpty (version)) {
|
||||
LogInvalidMonikerError ("Invalid framework version", moniker_literal);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parts.Length > 2) {
|
||||
if (!parts [2].StartsWith ("Profile=")) {
|
||||
LogInvalidMonikerError ("Invalid framework version", moniker_literal);
|
||||
return false;
|
||||
}
|
||||
|
||||
profile = parts [2].Substring (8);
|
||||
if (String.IsNullOrEmpty (profile)) {
|
||||
LogInvalidMonikerError ("Invalid framework profile", moniker_literal);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
moniker = new FrameworkMoniker (identifier, version, profile);
|
||||
return true;
|
||||
}
|
||||
|
||||
void LogInvalidMonikerError (string msg, string moniker_literal)
|
||||
{
|
||||
if (msg != null)
|
||||
Log.LogError ("{0} in the Target Framework Moniker '{1}'. Expected format: 'Identifier,Version=<version>[,Profile=<profile>]'. " +
|
||||
"It should have either 2 or 3 comma separated components.", msg, moniker_literal);
|
||||
else
|
||||
Log.LogError ("Invalid Target Framework Moniker '{0}'. Expected format: 'Identifier,Version=<version>[,Profile=<profile>]'. " +
|
||||
"It should have either 2 or 3 comma separated components.", moniker_literal);
|
||||
}
|
||||
|
||||
[Required]
|
||||
public string TargetFrameworkMoniker { get; set; }
|
||||
|
||||
public string RootPath { get; set; }
|
||||
|
||||
public bool BypassFrameworkInstallChecks { get; set; }
|
||||
|
||||
[Output]
|
||||
public string TargetFrameworkMonikerDisplayName { get; set; }
|
||||
|
||||
[Output]
|
||||
public string[] ReferenceAssemblyPaths { get; set; }
|
||||
|
||||
[Output]
|
||||
public string[] FullFrameworkReferenceAssemblyPaths { get; set; }
|
||||
|
||||
static string DefaultFrameworksBasePath {
|
||||
get {
|
||||
if (framework_base_path == null) {
|
||||
// NOTE: code from mcs/tools/gacutil/driver.cs
|
||||
PropertyInfo gac = typeof (System.Environment).GetProperty (
|
||||
"GacPath", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
|
||||
if (gac != null) {
|
||||
MethodInfo get_gac = gac.GetGetMethod (true);
|
||||
string gac_path = (string) get_gac.Invoke (null, null);
|
||||
framework_base_path = Path.GetFullPath (Path.Combine (
|
||||
gac_path, Path.Combine ("..", "xbuild-frameworks")));
|
||||
}
|
||||
}
|
||||
return framework_base_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FrameworkMoniker {
|
||||
public readonly string Identifier;
|
||||
public readonly string Version;
|
||||
public readonly string Profile;
|
||||
|
||||
public FrameworkMoniker (string identifier, string version, string profile)
|
||||
{
|
||||
this.Identifier = identifier;
|
||||
this.Version = version;
|
||||
this.Profile = profile;
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
if (String.IsNullOrEmpty (Profile))
|
||||
return String.Format ("{0},Version={1}", Identifier, Version);
|
||||
return String.Format ("{0},Version={1},Profile={2}", Identifier, Version, Profile);
|
||||
}
|
||||
}
|
||||
|
||||
class Framework {
|
||||
public string[] Directories;
|
||||
public string DisplayName;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -99,6 +99,8 @@ namespace Microsoft.Build.Tasks {
|
||||
// nothing to resolve
|
||||
return true;
|
||||
|
||||
LogTaskParameters ();
|
||||
|
||||
assembly_resolver.Log = Log;
|
||||
tempResolvedFiles = new List<ITaskItem> ();
|
||||
tempCopyLocalFiles = new Dictionary<string, ITaskItem> ();
|
||||
@@ -212,8 +214,8 @@ namespace Microsoft.Build.Tasks {
|
||||
resolved = assembly_resolver.ResolveGacReference (item, specific_version);
|
||||
} else if (String.Compare (spath, "{RawFileName}") == 0) {
|
||||
//FIXME: identify assembly names, as extract the name, and try with that?
|
||||
AssemblyName aname = assembly_resolver.GetAssemblyNameFromFile (item.ItemSpec);
|
||||
if (aname != null)
|
||||
AssemblyName aname;
|
||||
if (assembly_resolver.TryGetAssemblyNameFromFile (item.ItemSpec, out aname))
|
||||
resolved = assembly_resolver.GetResolvedReference (item, item.ItemSpec, aname, true,
|
||||
SearchPath.RawFileName);
|
||||
} else if (String.Compare (spath, "{CandidateAssemblyFiles}") == 0) {
|
||||
@@ -280,8 +282,8 @@ namespace Microsoft.Build.Tasks {
|
||||
LogWithPrecedingNewLine (MessageImportance.Low, "Primary Reference from AssemblyFiles {0}", item.ItemSpec);
|
||||
string copy_local;
|
||||
|
||||
AssemblyName aname = assembly_resolver.GetAssemblyNameFromFile (item.ItemSpec);
|
||||
if (aname == null) {
|
||||
AssemblyName aname;
|
||||
if (!assembly_resolver.TryGetAssemblyNameFromFile (item.ItemSpec, out aname)) {
|
||||
Log.LogWarning ("Reference '{0}' not resolved", item.ItemSpec);
|
||||
assembly_resolver.LogSearchLoggerMessages (MessageImportance.Normal);
|
||||
continue;
|
||||
@@ -523,6 +525,19 @@ namespace Microsoft.Build.Tasks {
|
||||
rr.FoundInSearchPath == SearchPath.TargetFrameworkDirectory;
|
||||
}
|
||||
|
||||
void LogTaskParameters ()
|
||||
{
|
||||
Log.LogMessage (MessageImportance.Low, "TargetFrameworkDirectories:");
|
||||
if (TargetFrameworkDirectories != null)
|
||||
foreach (string dir in TargetFrameworkDirectories)
|
||||
Log.LogMessage (MessageImportance.Low, "\t{0}", dir);
|
||||
|
||||
Log.LogMessage (MessageImportance.Low, "SearchPaths:");
|
||||
if (SearchPaths != null)
|
||||
foreach (string path in SearchPaths)
|
||||
Log.LogMessage (MessageImportance.Low, "\t{0}", path);
|
||||
}
|
||||
|
||||
public bool AutoUnify {
|
||||
get { return autoUnify; }
|
||||
set { autoUnify = value; }
|
||||
@@ -644,7 +659,15 @@ namespace Microsoft.Build.Tasks {
|
||||
public ITaskItem[] SuggestedRedirects {
|
||||
get { return suggestedRedirects; }
|
||||
}
|
||||
|
||||
|
||||
#if NET_4_0
|
||||
public string TargetFrameworkMoniker { get; set; }
|
||||
|
||||
public string TargetFrameworkMonikerDisplayName { get; set; }
|
||||
#endif
|
||||
|
||||
public string TargetFrameworkVersion { get; set; }
|
||||
|
||||
public string[] TargetFrameworkDirectories {
|
||||
get { return targetFrameworkDirectories; }
|
||||
set { targetFrameworkDirectories = value; }
|
||||
@@ -655,6 +678,7 @@ namespace Microsoft.Build.Tasks {
|
||||
set { targetProcessorArchitecture = value; }
|
||||
}
|
||||
|
||||
|
||||
static Dictionary<string, string> cultureNamesTable;
|
||||
static Dictionary<string, string> CultureNamesTable {
|
||||
get {
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace Microsoft.Build.Tasks {
|
||||
string col = match.Result ("${column}");
|
||||
int columnNumber = 0;
|
||||
if (!string.IsNullOrEmpty (col))
|
||||
columnNumber = col == "255+" ? -1 : Int32.Parse (col);
|
||||
columnNumber = col.IndexOf ("+") >= 0 ? -1 : Int32.Parse (col);
|
||||
|
||||
string category = match.Result ("${level}");
|
||||
string code = match.Result ("${number}");
|
||||
|
||||
@@ -47,7 +47,8 @@ namespace Microsoft.Build.Tasks {
|
||||
if (String.IsNullOrEmpty (text))
|
||||
return true;
|
||||
|
||||
Log.LogWarning (null, code, helpKeyword, BuildEngine.ProjectFileOfTaskNode,
|
||||
Log.LogWarning (null, code, helpKeyword,
|
||||
String.IsNullOrEmpty (File) ? BuildEngine.ProjectFileOfTaskNode : File,
|
||||
BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
|
||||
BuildEngine.LineNumberOfTaskNode, BuildEngine.ColumnNumberOfTaskNode,
|
||||
text, null);
|
||||
@@ -68,6 +69,8 @@ namespace Microsoft.Build.Tasks {
|
||||
get { return text; }
|
||||
set { text = value; }
|
||||
}
|
||||
|
||||
public string File { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
|
||||
string [] files;
|
||||
Project project;
|
||||
Engine engine;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
@@ -63,7 +64,7 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
"sample.txt", @"bar\sample.txt",
|
||||
"sample.it.png", @"dir\sample.en.png", "sample.inv.txt"};
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
}
|
||||
|
||||
@@ -141,7 +142,14 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
{
|
||||
string projectText = CreateProjectString (files_list);
|
||||
project.LoadXml (projectText);
|
||||
Assert.IsTrue (project.Build ("1"), "A1 : Error in building");
|
||||
|
||||
TestMessageLogger testLogger = new TestMessageLogger ();
|
||||
engine.RegisterLogger (testLogger);
|
||||
|
||||
if (!project.Build ("1")) {
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("A1 : Error in building");
|
||||
}
|
||||
}
|
||||
|
||||
void CheckItems (string [] values, string [] cultures, string itemlist_name, string prefix)
|
||||
|
||||
-1
@@ -118,7 +118,6 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
|
||||
try {
|
||||
Assert.AreEqual (build_result, project.Build (), "Build " + (build_result ? "failed" : "should've failed"));
|
||||
testLogger.DumpMessages ();
|
||||
if (!build_result || messages == null)
|
||||
// build failed as expected, don't check outputs
|
||||
return;
|
||||
|
||||
@@ -115,6 +115,69 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLink ()
|
||||
{
|
||||
string projectText = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<ItemGroup>
|
||||
<FooFiles Include=""xyz.cs"">
|
||||
<Child>Cxyz.cs</Child>
|
||||
<Link>Test\Link\xyz.cs</Link>
|
||||
</FooFiles>
|
||||
<FooFiles Include=""rel\bar.resx"">
|
||||
<Child>Crel\bar.resx</Child>
|
||||
<Link>Test\Link\bar.resx</Link>
|
||||
</FooFiles>
|
||||
<FooFiles Include=""rel\qwe.txt"">
|
||||
<Child>Crel\qwe.txt</Child>
|
||||
<Link>..\Test\Link\qwe.txt</Link>
|
||||
</FooFiles>
|
||||
</ItemGroup>
|
||||
<Target Name=""1"">
|
||||
<AssignTargetPath Files=""@(FooFiles)"" RootFolder=""/"">
|
||||
<Output TaskParameter=""AssignedFiles"" ItemName=""FooPath"" />
|
||||
</AssignTargetPath>
|
||||
</Target>
|
||||
</Project>";
|
||||
Engine engine = new Engine(Consts.BinPath);
|
||||
Project project = engine.CreateNewProject();
|
||||
|
||||
project.LoadXml(projectText);
|
||||
|
||||
string id = "A";
|
||||
Assert.IsTrue(project.Build("1"), id + "1 : Error in building");
|
||||
|
||||
string [] files = new string [] { "xyz.cs", "rel/bar.resx", "rel/qwe.txt"};
|
||||
string [] assignedFiles = new string [] {
|
||||
PathCombine ("Test", "Link", "xyz.cs"),
|
||||
PathCombine ("Test", "Link", "bar.resx"),
|
||||
PathCombine ("..", "Test", "Link", "qwe.txt")
|
||||
};
|
||||
|
||||
BuildItemGroup include = project.GetEvaluatedItemsByName("FooPath");
|
||||
Assert.AreEqual(files.Length, include.Count, id + "2");
|
||||
|
||||
for (int i = 0; i < files.Length; i++) {
|
||||
Assert.AreEqual (files [i], include [i].FinalItemSpec, id + "3, file #" + i);
|
||||
Assert.IsTrue (include[i].HasMetadata ("TargetPath"), id + "4, file #" + i + ", TargetPath metadata missing");
|
||||
Assert.AreEqual (assignedFiles [i], include[i].GetMetadata("TargetPath"), id + "5, file #" + i);
|
||||
Assert.IsTrue (include [i].HasMetadata ("Child"), id + "6, file #" + i + ", Child metadata missing");
|
||||
Assert.AreEqual ("C" + files [i], include [i].GetMetadata ("Child"), id + "7, file #" + i + ", Child metadata value incorrect");
|
||||
}
|
||||
}
|
||||
|
||||
string PathCombine (string path1, params string[] parts)
|
||||
{
|
||||
if (parts == null || parts.Length == 0)
|
||||
return path1;
|
||||
|
||||
string final_path = path1;
|
||||
foreach (string part in parts)
|
||||
final_path = Path.Combine (final_path, part);
|
||||
|
||||
return final_path;
|
||||
}
|
||||
|
||||
void CheckTargetPath(string[] files, string[] assignedFiles, string rootFolder, string id)
|
||||
{
|
||||
Engine engine = new Engine(Consts.BinPath);
|
||||
|
||||
@@ -210,7 +210,6 @@ namespace MonoTests.Microsoft.Build.Tasks {
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
testLogger.DumpMessages ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -127,5 +127,45 @@ namespace MonoTests.Microsoft.Build.Tasks {
|
||||
Assert.AreEqual ("@(IG)", project.EvaluatedProperties["C"].FinalValue, "A6");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEmptyPropertyValue ()
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<PropertyGroup>
|
||||
<A>1</A>
|
||||
</PropertyGroup>
|
||||
<Target Name='1'>
|
||||
<Message Text='Before: $(A)'/>
|
||||
<CreateProperty Value=''>
|
||||
<Output
|
||||
TaskParameter='Value'
|
||||
PropertyName='A'
|
||||
/>
|
||||
</CreateProperty>
|
||||
<Message Text='After: $(A)'/>
|
||||
</Target>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
|
||||
TestMessageLogger testLogger = new TestMessageLogger ();
|
||||
engine.RegisterLogger (testLogger);
|
||||
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
if (!project.Build ("1")) {
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
|
||||
testLogger.CheckLoggedMessageHead ("Before: 1", "A1");
|
||||
testLogger.CheckLoggedMessageHead ("After: ", "A2");
|
||||
Assert.AreEqual (0, testLogger.NormalMessageCount, "Unexpected messages found");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,6 @@ namespace MonoTests.Microsoft.Build.Tasks {
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
testLogger.DumpMessages ();
|
||||
|
||||
Assert.AreEqual (1, testLogger.NormalMessageCount, "Expected number of messages");
|
||||
testLogger.CheckLoggedMessageHead (expected, "A1");
|
||||
|
||||
@@ -95,7 +95,6 @@ namespace MonoTests.Microsoft.Build.Tasks {
|
||||
Assert.Fail ("Build should have failed");
|
||||
}
|
||||
|
||||
testLogger.DumpMessages ();
|
||||
Assert.AreEqual (0, testLogger.CheckAny ("Text1", MessageImportance.Low), "A1");
|
||||
Assert.AreEqual (0, testLogger.CheckAny ("Text2", MessageImportance.Normal), "A2");
|
||||
Assert.AreEqual (0, testLogger.CheckAny ("Text3", MessageImportance.High), "A3");
|
||||
@@ -104,7 +103,6 @@ namespace MonoTests.Microsoft.Build.Tasks {
|
||||
Assert.AreEqual (0, testLogger.CheckAny ("Text6", MessageImportance.High), "A6");
|
||||
Assert.AreEqual (0, testLogger.CheckAny ("Text7", MessageImportance.Normal), "A7");
|
||||
Assert.AreEqual (1, testLogger.CheckAny ("Text8", MessageImportance.Normal), "A8");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -905,7 +905,6 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
testLogger.DumpMessages ();
|
||||
|
||||
try {
|
||||
testLogger.CheckLoggedAny ("For md: 3 Item1: Item1Ref: Item2: Three Item2Ref: Three Prop1: Prop1Ref: Prop2: Three Prop2Ref: Three", MessageImportance.Normal, "A1");
|
||||
|
||||
@@ -69,6 +69,9 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
set { task_finished = value; }
|
||||
}
|
||||
|
||||
public int WarningsCount { get; set; }
|
||||
public int ErrorsCount { get; set; }
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return messages.Count; }
|
||||
@@ -81,14 +84,19 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
public void Initialize (IEventSource eventSource)
|
||||
{
|
||||
eventSource.MessageRaised += new BuildMessageEventHandler (MessageHandler);
|
||||
|
||||
eventSource.ErrorRaised += new BuildErrorEventHandler (AllMessagesHandler);
|
||||
eventSource.ErrorRaised += (e,o) => ErrorsCount ++;
|
||||
|
||||
eventSource.WarningRaised += new BuildWarningEventHandler(AllMessagesHandler);
|
||||
eventSource.WarningRaised += (e,o) => WarningsCount ++;
|
||||
|
||||
eventSource.TargetStarted += delegate { target_started++; };
|
||||
eventSource.TargetFinished += delegate { target_finished++; };
|
||||
eventSource.TaskStarted += delegate { task_started++; };
|
||||
eventSource.TaskFinished += delegate { task_finished++; };
|
||||
eventSource.ProjectStarted += delegate(object sender, ProjectStartedEventArgs args) { project_started++; Console.WriteLine ("Project started: {0}", args.ProjectFile); };
|
||||
eventSource.ProjectFinished += delegate (object sender, ProjectFinishedEventArgs args) { project_finished++; Console.WriteLine ("Project finished: {0}", args.ProjectFile); };
|
||||
eventSource.ProjectStarted += delegate(object sender, ProjectStartedEventArgs args) { project_started++; };
|
||||
eventSource.ProjectFinished += delegate (object sender, ProjectFinishedEventArgs args) { project_finished++; };
|
||||
eventSource.BuildStarted += delegate { build_started ++; };
|
||||
eventSource.BuildFinished += delegate { build_finished++; };
|
||||
}
|
||||
|
||||
@@ -114,22 +114,16 @@ namespace Microsoft.Build.Utilities
|
||||
toolOutput = new StringBuilder ();
|
||||
|
||||
try {
|
||||
string arguments = commandLineCommands;
|
||||
string responseFileSwitch = String.Empty;
|
||||
if (!String.IsNullOrEmpty (responseFileCommands)) {
|
||||
responseFileName = Path.GetTempFileName ();
|
||||
File.WriteAllText (responseFileName, responseFileCommands);
|
||||
arguments = arguments + " " + GetResponseFileSwitch (responseFileName);
|
||||
responseFileSwitch = GetResponseFileSwitch (responseFileName);
|
||||
}
|
||||
|
||||
var pinfo = GetProcessStartInfo (pathToTool, commandLineCommands, responseFileSwitch);
|
||||
LogToolCommand (String.Format ("Tool {0} execution started with arguments: {1} {2}",
|
||||
pathToTool, commandLineCommands, responseFileCommands));
|
||||
|
||||
ProcessStartInfo pinfo = new ProcessStartInfo (pathToTool, arguments);
|
||||
pinfo.WorkingDirectory = GetWorkingDirectory () ?? Environment.CurrentDirectory;
|
||||
|
||||
pinfo.UseShellExecute = false;
|
||||
pinfo.RedirectStandardOutput = true;
|
||||
pinfo.RedirectStandardError = true;
|
||||
pinfo.FileName, commandLineCommands, responseFileCommands));
|
||||
|
||||
var pendingLineFragmentOutput = new StringBuilder ();
|
||||
var pendingLineFragmentError = new StringBuilder ();
|
||||
@@ -264,7 +258,7 @@ namespace Microsoft.Build.Utilities
|
||||
string col = match.Result ("${column}");
|
||||
int columnNumber = 0;
|
||||
if (!string.IsNullOrEmpty (col))
|
||||
columnNumber = col == "255+" ? -1 : Int32.Parse (col);
|
||||
columnNumber = col.IndexOf ("+") >= 0 ? -1 : Int32.Parse (col);
|
||||
|
||||
string category = match.Result ("${level}");
|
||||
string code = match.Result ("${number}");
|
||||
@@ -298,6 +292,18 @@ namespace Microsoft.Build.Utilities
|
||||
return String.Format ("@{0}", responseFilePath);
|
||||
}
|
||||
|
||||
protected virtual ProcessStartInfo GetProcessStartInfo (string pathToTool, string commandLineCommands, string responseFileSwitch)
|
||||
{
|
||||
var pinfo = new ProcessStartInfo (pathToTool, String.Format ("{0} {1}", commandLineCommands, responseFileSwitch));
|
||||
|
||||
pinfo.WorkingDirectory = GetWorkingDirectory () ?? Environment.CurrentDirectory;
|
||||
pinfo.UseShellExecute = false;
|
||||
pinfo.RedirectStandardOutput = true;
|
||||
pinfo.RedirectStandardError = true;
|
||||
|
||||
return pinfo;
|
||||
}
|
||||
|
||||
protected virtual bool HandleTaskExecutionErrors ()
|
||||
{
|
||||
if (!Log.HasLoggedErrors && exitCode != 0)
|
||||
|
||||
+73
@@ -23,7 +23,9 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web;
|
||||
using System.Web.Util;
|
||||
|
||||
@@ -43,6 +45,42 @@ namespace Microsoft.Web.Infrastructure.DynamicValidationHelper
|
||||
this.wrapped = wrapped;
|
||||
}
|
||||
|
||||
public new string this [int index] {
|
||||
get { return Get (index); }
|
||||
}
|
||||
|
||||
public new string this [string name] {
|
||||
get { return Get (name); }
|
||||
set{ Set (name,value); }
|
||||
}
|
||||
|
||||
public override string[] AllKeys {
|
||||
get { return wrapped.AllKeys; }
|
||||
}
|
||||
|
||||
public override int Count {
|
||||
get { return wrapped.Count; }
|
||||
}
|
||||
|
||||
public override NameObjectCollectionBase.KeysCollection Keys {
|
||||
get { return wrapped.Keys; }
|
||||
}
|
||||
|
||||
public new void Add (NameValueCollection c)
|
||||
{
|
||||
wrapped.Add (c);
|
||||
}
|
||||
|
||||
public override void Add (string name, string val)
|
||||
{
|
||||
wrapped.Add (name, val);
|
||||
}
|
||||
|
||||
public override void Clear ()
|
||||
{
|
||||
wrapped.Clear ();
|
||||
}
|
||||
|
||||
public override string Get (string name)
|
||||
{
|
||||
return Validate (name, wrapped.Get (name));
|
||||
@@ -53,6 +91,41 @@ namespace Microsoft.Web.Infrastructure.DynamicValidationHelper
|
||||
return Validate (wrapped.GetKey (index), wrapped.Get (index));
|
||||
}
|
||||
|
||||
public override void GetObjectData (SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
wrapped.GetObjectData (info, context);
|
||||
}
|
||||
|
||||
public override IEnumerator GetEnumerator ()
|
||||
{
|
||||
return wrapped.GetEnumerator ();
|
||||
}
|
||||
|
||||
public override string GetKey (int index)
|
||||
{
|
||||
return wrapped.GetKey (index);
|
||||
}
|
||||
|
||||
public override string[] GetValues (int index)
|
||||
{
|
||||
return wrapped.GetValues (index);
|
||||
}
|
||||
|
||||
public override string[] GetValues (string name)
|
||||
{
|
||||
return wrapped.GetValues (name);
|
||||
}
|
||||
|
||||
public override void OnDeserialization (object sender)
|
||||
{
|
||||
wrapped.OnDeserialization (sender);
|
||||
}
|
||||
|
||||
public override void Set (string name, string value)
|
||||
{
|
||||
wrapped.Set (name, value);
|
||||
}
|
||||
|
||||
string Validate (string key, string value)
|
||||
{
|
||||
if (String.IsNullOrEmpty (value))
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
2011-05-05 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
** Fixes #681916
|
||||
* Tds70.cs (WriteParameterInfo): Handle null value for Image
|
||||
or varbinary(max) parameters as well.
|
||||
|
||||
2010-09-29 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
** Fixes failed test for smallmoney
|
||||
|
||||
@@ -615,7 +615,8 @@ namespace Mono.Data.Tds.Protocol
|
||||
// types if param value is NULL
|
||||
if ((colType == TdsColumnType.BigVarChar ||
|
||||
colType == TdsColumnType.BigNVarChar ||
|
||||
colType == TdsColumnType.BigVarBinary) &&
|
||||
colType == TdsColumnType.BigVarBinary ||
|
||||
colType == TdsColumnType.Image) &&
|
||||
(param.Value == null || param.Value == DBNull.Value))
|
||||
size = -1;
|
||||
else
|
||||
|
||||
@@ -85,5 +85,5 @@
|
||||
<Type Name="VMStartEvent" Kind="Class" />
|
||||
</Namespace>
|
||||
</Types>
|
||||
<Title>Mono.Debugger</Title>
|
||||
<Title>Mono.Debugger.Soft</Title>
|
||||
</Overview>
|
||||
@@ -356,7 +356,8 @@ namespace Mono.Debugger.Soft
|
||||
BREAKPOINT = 10,
|
||||
STEP = 11,
|
||||
TYPE_LOAD = 12,
|
||||
EXCEPTION = 13
|
||||
EXCEPTION = 13,
|
||||
KEEPALIVE = 14
|
||||
}
|
||||
|
||||
enum ModifierKind {
|
||||
@@ -377,7 +378,8 @@ namespace Mono.Debugger.Soft
|
||||
DISPOSE = 6,
|
||||
INVOKE_METHOD = 7,
|
||||
SET_PROTOCOL_VERSION = 8,
|
||||
ABORT_INVOKE = 9
|
||||
ABORT_INVOKE = 9,
|
||||
SET_KEEPALIVE = 10
|
||||
}
|
||||
|
||||
enum CmdEvent {
|
||||
@@ -1166,6 +1168,8 @@ namespace Mono.Debugger.Soft
|
||||
long id = r.ReadId ();
|
||||
events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
|
||||
//EventHandler.AppDomainUnload (req_id, thread_id, id);
|
||||
} else if (kind == EventKind.KEEPALIVE) {
|
||||
events [i] = new EventInfo (etype, req_id) { };
|
||||
} else {
|
||||
throw new NotImplementedException ("Unknown event kind: " + kind);
|
||||
}
|
||||
@@ -1381,6 +1385,13 @@ namespace Mono.Debugger.Soft
|
||||
SendReceive (CommandSet.VM, (int)CmdVM.ABORT_INVOKE, new PacketWriter ().WriteId (thread).WriteInt (id));
|
||||
}
|
||||
|
||||
public void SetSocketTimeouts (int send_timeout, int receive_timeout, int keepalive_interval)
|
||||
{
|
||||
socket.SendTimeout = send_timeout;
|
||||
socket.ReceiveTimeout = receive_timeout;
|
||||
SendReceive (CommandSet.VM, (int)CmdVM.SET_KEEPALIVE, new PacketWriter ().WriteId (keepalive_interval));
|
||||
}
|
||||
|
||||
/*
|
||||
* DOMAIN
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace Mono.Debugger.Soft
|
||||
Step = 11,
|
||||
TypeLoad = 12,
|
||||
Exception = 13,
|
||||
KeepAlive = 14,
|
||||
// Not part of the wire protocol
|
||||
VMDisconnect = 99
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,6 +160,16 @@ namespace Mono.Debugger.Soft
|
||||
return new EnumMirror (this, type, value);
|
||||
}
|
||||
|
||||
//
|
||||
// Enable send and receive timeouts on the connection and send a keepalive event
|
||||
// every 'keepalive_interval' milliseconds.
|
||||
//
|
||||
|
||||
public void SetSocketTimeouts (int send_timeout, int receive_timeout, int keepalive_interval)
|
||||
{
|
||||
conn.SetSocketTimeouts (send_timeout, receive_timeout, keepalive_interval);
|
||||
}
|
||||
|
||||
//
|
||||
// Methods to create event request objects
|
||||
//
|
||||
@@ -200,8 +210,8 @@ namespace Mono.Debugger.Soft
|
||||
|
||||
public void EnableEvents (params EventType[] events) {
|
||||
foreach (EventType etype in events) {
|
||||
if (etype == EventType.Breakpoint)
|
||||
throw new ArgumentException ("Breakpoint events cannot be requested using EnableEvents", "events");
|
||||
if (etype == EventType.Breakpoint || etype == EventType.Step)
|
||||
throw new ArgumentException ("Breakpoint/Step events cannot be requested using EnableEvents", "events");
|
||||
conn.EnableEvent (etype, SuspendPolicy.All, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,6 +584,14 @@ public class Tests : TestsBase
|
||||
return 42;
|
||||
}
|
||||
|
||||
public int? invoke_return_nullable () {
|
||||
return 42;
|
||||
}
|
||||
|
||||
public int? invoke_return_nullable_null () {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void invoke_type_load () {
|
||||
new Class3 ();
|
||||
}
|
||||
|
||||
@@ -1739,6 +1739,16 @@ public class DebuggerTests
|
||||
v = this_obj.InvokeMethod (e.Thread, m, null);
|
||||
AssertValue (42, v);
|
||||
|
||||
// return nullable
|
||||
m = t.GetMethod ("invoke_return_nullable");
|
||||
v = this_obj.InvokeMethod (e.Thread, m, null);
|
||||
Assert.IsInstanceOfType (typeof (StructMirror), v);
|
||||
|
||||
// return nullable null
|
||||
m = t.GetMethod ("invoke_return_nullable_null");
|
||||
v = this_obj.InvokeMethod (e.Thread, m, null);
|
||||
AssertValue (null, v);
|
||||
|
||||
// pass primitive
|
||||
m = t.GetMethod ("invoke_pass_primitive");
|
||||
Value[] args = new Value [] {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// MonoTaskScheduler.cs
|
||||
//
|
||||
// Author:
|
||||
// Jérémie "Garuma" Laval <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2011 Jérémie "Garuma" Laval
|
||||
//
|
||||
// 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.
|
||||
|
||||
#if NET_4_0
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Mono.Threading.Tasks
|
||||
{
|
||||
public interface IMonoTaskScheduler
|
||||
{
|
||||
void MonoParticipateUntil (Task task);
|
||||
bool MonoParticipateUntil (Task task, ManualResetEventSlim predicateEvt, int millisecondsTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -39,9 +39,7 @@ namespace Mono.Security.Protocol.Tls
|
||||
|
||||
#region Fields
|
||||
|
||||
static ManualResetEvent record_processing = new ManualResetEvent (true);
|
||||
|
||||
private const int WaitTimeOut = 5 * 60 * 1000;
|
||||
static ManualResetEvent record_processing = new ManualResetEvent (true);
|
||||
|
||||
internal Stream innerStream;
|
||||
internal MemoryStream inputBuffer;
|
||||
@@ -875,7 +873,7 @@ namespace Mono.Security.Protocol.Tls
|
||||
// Always wait until the read is complete
|
||||
if (!asyncResult.IsCompleted)
|
||||
{
|
||||
if (!asyncResult.AsyncWaitHandle.WaitOne (WaitTimeOut, false))
|
||||
if (!asyncResult.AsyncWaitHandle.WaitOne ())
|
||||
throw new TlsException (AlertDescription.InternalError, "Couldn't complete EndRead");
|
||||
}
|
||||
|
||||
@@ -900,7 +898,7 @@ namespace Mono.Security.Protocol.Tls
|
||||
|
||||
if (!asyncResult.IsCompleted)
|
||||
{
|
||||
if (!internalResult.AsyncWaitHandle.WaitOne (WaitTimeOut, false))
|
||||
if (!internalResult.AsyncWaitHandle.WaitOne ())
|
||||
throw new TlsException (AlertDescription.InternalError, "Couldn't complete EndWrite");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,56 +1,18 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
// General Information about the assembly
|
||||
|
||||
[assembly: AssemblyTitle("Mono.WebBrowser")]
|
||||
[assembly: AssemblyDescription("Managed Wrapper for xulrunner engine, to support WebBrowser")]
|
||||
[assembly: AssemblyConfiguration("Development version")]
|
||||
[assembly: AssemblyCompany("MONO development team")]
|
||||
|
||||
[assembly: AssemblyProduct("Mono.WebBrowser")]
|
||||
[assembly: AssemblyCopyright("(c) 2007, 2008 Andreia Gaita")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion (Consts.FxVersion)]
|
||||
[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
|
||||
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
|
||||
|
||||
[assembly: AssemblyVersion("0.5.0.0")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(true)]
|
||||
[assembly: AssemblyKeyFile("../mono.snk")]
|
||||
@@ -28,13 +28,13 @@ Mono.Xml.XPath2/XQueryParser.jay: Mono.Xml.XPath2/ParserBase.jay $(SKELETON)
|
||||
Mono.Xml.XPath2/XPath2Parser.cs: Mono.Xml.XPath2/XPath2Parser.jay
|
||||
echo "#define XPATH2_PARSER" > $@
|
||||
echo "#if NET_2_0" >> $@
|
||||
$(topdir)/jay/jay -ct < $(SKELETON) $< >>$@
|
||||
$(topdir)/jay/jay -ct < $(SKELETON) $(CURDIR)/$< >>$@
|
||||
echo "#endif" >> $@
|
||||
|
||||
Mono.Xml.XPath2/XQueryParser.cs: Mono.Xml.XPath2/XQueryParser.jay $(SKELETON)
|
||||
echo "#define XQUERY_PARSER" > $@
|
||||
echo "#if NET_2_0" >> $@
|
||||
$(topdir)/jay/jay -ct < $(SKELETON) $< >>$@
|
||||
$(topdir)/jay/jay -ct < $(SKELETON) $(CURDIR)/$< >>$@
|
||||
echo "#endif" >> $@
|
||||
|
||||
Mono.Xml.XPath2/XPath2Tokenizer.cs: Mono.Xml.XPath2/TokenizerBase.cs
|
||||
|
||||
+83
-7
@@ -2,9 +2,9 @@
|
||||
// CustomValidationAttribute.cs
|
||||
//
|
||||
// Authors:
|
||||
// Marek Habersack <[email protected]>
|
||||
// Marek Habersack <[email protected]>
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. (http://novell.com)
|
||||
// Copyright (C) 2010-2011 Novell Inc. (http://novell.com)
|
||||
//
|
||||
|
||||
//
|
||||
@@ -30,35 +30,111 @@
|
||||
#if NET_4_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.ComponentModel.DataAnnotations
|
||||
{
|
||||
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = true)]
|
||||
public sealed class CustomValidationAttribute : ValidationAttribute
|
||||
{
|
||||
Tuple <string, Type> typeId;
|
||||
MethodInfo validationMethod;
|
||||
bool validationMethodChecked;
|
||||
bool validationMethodSignatureValid;
|
||||
int validationMethodParamCount;
|
||||
|
||||
public string Method { get; private set; }
|
||||
|
||||
public override object TypeId {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
get { return typeId; }
|
||||
}
|
||||
|
||||
public Type ValidatorType { get; private set; }
|
||||
|
||||
public CustomValidationAttribute (Type validatorType, string method)
|
||||
{
|
||||
this.ValidatorType = validatorType;
|
||||
this.Method = method;
|
||||
this.typeId = new Tuple <string, Type> (method, validatorType);
|
||||
}
|
||||
|
||||
public override string FormatErrorMessage (string name)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
ThrowIfAttributeNotWellFormed ();
|
||||
return String.Format ("{0} is not valid.", name);
|
||||
}
|
||||
|
||||
// LAMESPEC: MSDN doesn't document it at all, but corcompare shows it in the type
|
||||
protected override ValidationResult IsValid (object value, ValidationContext validationContext)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
ThrowIfAttributeNotWellFormed ();
|
||||
object[] p;
|
||||
|
||||
if (validationMethodParamCount == 2)
|
||||
p = new object [] {value, validationContext};
|
||||
else
|
||||
p = new object [] {value};
|
||||
try {
|
||||
return validationMethod.Invoke (null, p) as ValidationResult;
|
||||
} catch (TargetInvocationException ex) {
|
||||
if (ex.InnerException != null)
|
||||
throw ex.InnerException;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void ThrowIfAttributeNotWellFormed ()
|
||||
{
|
||||
Type type = ValidatorType;
|
||||
if (type == null)
|
||||
throw new InvalidOperationException ("The CustomValidationAttribute.ValidatorType was not specified.");
|
||||
|
||||
if (type.IsNotPublic)
|
||||
throw new InvalidOperationException (String.Format ("The custom validation type '{0}' must be public.", type.Name));
|
||||
|
||||
string method = Method;
|
||||
if (String.IsNullOrEmpty (method))
|
||||
throw new InvalidOperationException ("The CustomValidationAttribute.Method was not specified.");
|
||||
|
||||
if (validationMethod == null) {
|
||||
if (!validationMethodChecked) {
|
||||
validationMethod = type.GetMethod (method, BindingFlags.Public | BindingFlags.Static);
|
||||
validationMethodChecked = true;
|
||||
}
|
||||
|
||||
if (validationMethod == null)
|
||||
throw new InvalidOperationException (
|
||||
String.Format ("The CustomValidationAttribute method '{0}' does not exist in type '{1}' or is not public and static.",
|
||||
method, type.Name));
|
||||
|
||||
if (!typeof (ValidationResult).IsAssignableFrom (validationMethod.ReturnType))
|
||||
throw new InvalidOperationException (String.Format ("The CustomValidationAttribute method '{0}' in type '{1}' must return System.ComponentModel.DataAnnotations.ValidationResult. Use System.ComponentModel.DataAnnotations.ValidationResult.Success to represent success.", method, type.Name));
|
||||
|
||||
validationMethodSignatureValid = true;
|
||||
ParameterInfo[] parameters = validationMethod.GetParameters ();
|
||||
if (parameters == null)
|
||||
validationMethodSignatureValid = false;
|
||||
else {
|
||||
validationMethodParamCount = parameters.Length;
|
||||
switch (validationMethodParamCount) {
|
||||
case 1:
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (parameters [1].ParameterType != typeof (ValidationContext))
|
||||
validationMethodSignatureValid = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
validationMethodSignatureValid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!validationMethodSignatureValid)
|
||||
throw new InvalidOperationException (String.Format ("The CustomValidationAttribute method '{0}' in type '{1}' must match the expected signature: public static ValidationResult MethodTwo(object value, ValidationContext context). The value can be strongly typed. The ValidationContext parameter is optional.", method, type.Name));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+42
-9
@@ -37,7 +37,10 @@ namespace System.ComponentModel.DataAnnotations
|
||||
public abstract class ValidationAttribute : Attribute
|
||||
{
|
||||
const string DEFAULT_ERROR_MESSAGE = "The field {0} is invalid.";
|
||||
#if !NET_4_0
|
||||
#if NET_4_0
|
||||
object nestedCallLock = new object ();
|
||||
bool nestedCall;
|
||||
#else
|
||||
string errorMessageResourceName;
|
||||
string errorMessageString;
|
||||
Type errorMessageResourceType;
|
||||
@@ -127,20 +130,50 @@ namespace System.ComponentModel.DataAnnotations
|
||||
get { return GetStringFromResourceAccessor (); }
|
||||
}
|
||||
#if NET_4_0
|
||||
NotImplementedException NestedNIEX ()
|
||||
{
|
||||
return new NotImplementedException ("IsValid(object value) has not been implemented by this class. The preferred entry point is GetValidationResult() and classes should override IsValid(object value, ValidationContext context).");
|
||||
}
|
||||
|
||||
//
|
||||
// This is the weirdest (to be gentle) idea ever... The IsValid (object) overload
|
||||
// throws the NIEX when it is called from the default IsValid (object,
|
||||
// ValidationContext) overload, but not when directly. And the reverse situation is
|
||||
// true as well. That means, the calls detect the "nested" calls and that we need to
|
||||
// protect the nestedCall flag... ugh
|
||||
//
|
||||
public virtual bool IsValid (object value)
|
||||
{
|
||||
throw new NotImplementedException ("IsValid(object value) has not been implemented by this class. The preferred entry point is GetValidationResult() and classes should override IsValid(object value, ValidationContext context).");
|
||||
lock (nestedCallLock) {
|
||||
if (nestedCall)
|
||||
throw NestedNIEX ();
|
||||
try {
|
||||
nestedCall = true;
|
||||
return IsValid (value, null) == ValidationResult.Success;
|
||||
} finally {
|
||||
nestedCall = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual ValidationResult IsValid (object value, ValidationContext validationContext)
|
||||
{
|
||||
// .NET emulation
|
||||
if (validationContext == null)
|
||||
throw new NullReferenceException (".NET emulation.");
|
||||
|
||||
if (!IsValid (value)) {
|
||||
string memberName = validationContext.MemberName;
|
||||
return new ValidationResult (FormatErrorMessage (validationContext.DisplayName), memberName != null ? new string[] { memberName } : new string[] {});
|
||||
lock (nestedCallLock) {
|
||||
if (nestedCall)
|
||||
throw NestedNIEX ();
|
||||
|
||||
try {
|
||||
nestedCall = true;
|
||||
if (!IsValid (value)) {
|
||||
// .NET emulation
|
||||
if (validationContext == null)
|
||||
throw new NullReferenceException (".NET emulation.");
|
||||
string memberName = validationContext.MemberName;
|
||||
return new ValidationResult (FormatErrorMessage (validationContext.DisplayName), memberName != null ? new string[] { memberName } : new string[] {});
|
||||
}
|
||||
} finally {
|
||||
nestedCall = false;
|
||||
}
|
||||
}
|
||||
|
||||
return ValidationResult.Success;
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// Authors:
|
||||
// Marek Habersack <[email protected]>
|
||||
//
|
||||
// Copyright (C) 2011 Novell Inc. http://novell.com
|
||||
//
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.ComponentModel.DataAnnotations
|
||||
{
|
||||
static class ValidationAttributeCollectionExtensions
|
||||
{
|
||||
public static void Validate <TAttribute> (this AttributeCollection attributes, object value, ValidationContext validationContext,
|
||||
ICollection <ValidationResult> validationResults, ref bool valid)
|
||||
where TAttribute: ValidationAttribute
|
||||
{
|
||||
if (attributes == null || attributes == AttributeCollection.Empty || attributes.Count <= 0)
|
||||
return;
|
||||
|
||||
ValidationResult result;
|
||||
foreach (TAttribute attr in attributes.OfType <TAttribute> ()) {
|
||||
result = attr.GetValidationResult (value, validationContext);
|
||||
if (result != ValidationResult.Success) {
|
||||
valid = false;
|
||||
if (validationResults != null)
|
||||
validationResults.Add (result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ValidateExcept <TAttribute> (this AttributeCollection attributes, object value, ValidationContext validationContext,
|
||||
ICollection <ValidationResult> validationResults, ref bool valid)
|
||||
where TAttribute: ValidationAttribute
|
||||
{
|
||||
if (attributes == null || attributes == AttributeCollection.Empty || attributes.Count <= 0)
|
||||
return;
|
||||
|
||||
ValidationResult result;
|
||||
ValidationAttribute vattr;
|
||||
foreach (Attribute attr in attributes) {
|
||||
if (attr is TAttribute)
|
||||
continue;
|
||||
vattr = attr as ValidationAttribute;
|
||||
if (vattr == null)
|
||||
continue;
|
||||
|
||||
result = vattr.GetValidationResult (value, validationContext);
|
||||
if (result != ValidationResult.Success) {
|
||||
valid = false;
|
||||
if (validationResults != null)
|
||||
validationResults.Add (result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -4,7 +4,7 @@
|
||||
// Author:
|
||||
// Atsushi Enomoto <[email protected]>
|
||||
//
|
||||
// Copyright (C) 2008 Novell Inc. http://novell.com
|
||||
// Copyright (C) 2008-2011 Novell Inc. http://novell.com
|
||||
//
|
||||
|
||||
//
|
||||
@@ -63,8 +63,12 @@ namespace System.ComponentModel.DataAnnotations
|
||||
}
|
||||
#if NET_4_0
|
||||
public ValidationException (ValidationResult validationResult, ValidationAttribute validatingAttribute, object value)
|
||||
: this (validationResult != null ? validationResult.ErrorMessage : null, validatingAttribute, value)
|
||||
{
|
||||
this.ValidationResult = validationResult;
|
||||
}
|
||||
|
||||
public ValidationResult ValidationResult { get; private set; }
|
||||
#endif
|
||||
public ValidationAttribute ValidationAttribute { get; private set; }
|
||||
public object Value { get; private set; }
|
||||
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
//
|
||||
// Authors:
|
||||
// Marek Habersack <[email protected]>
|
||||
//
|
||||
// Copyright (C) 2011 Novell Inc. http://novell.com
|
||||
//
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.ComponentModel.DataAnnotations
|
||||
{
|
||||
// TODO: we could probably use some kind of type cache here
|
||||
public static class Validator
|
||||
{
|
||||
public static bool TryValidateObject (object instance, ValidationContext validationContext, ICollection <ValidationResult> validationResults)
|
||||
{
|
||||
return TryValidateObject (instance, validationContext, validationResults, false);
|
||||
}
|
||||
|
||||
public static bool TryValidateObject (object instance, ValidationContext validationContext, ICollection <ValidationResult> validationResults, bool validateAllProperties)
|
||||
{
|
||||
if (instance == null)
|
||||
throw new ArgumentNullException ("instance");
|
||||
|
||||
if (validationContext == null)
|
||||
throw new ArgumentNullException ("validationContext");
|
||||
|
||||
if (!Object.ReferenceEquals (instance, validationContext.ObjectInstance))
|
||||
throw new ArgumentException ("The instance provided must match the ObjectInstance on the ValidationContext supplied.", "instance");
|
||||
|
||||
ValidationResult result;
|
||||
bool valid = true;
|
||||
Type instanceType = instance.GetType ();
|
||||
TypeDescriptor.GetAttributes (instanceType).Validate <ValidationAttribute> (instance, validationContext, validationResults, ref valid);
|
||||
|
||||
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (instance);
|
||||
if (properties != PropertyDescriptorCollection.Empty && properties.Count > 0) {
|
||||
foreach (PropertyDescriptor pdesc in properties) {
|
||||
object value = pdesc.GetValue (instance);
|
||||
ValidateProperty (pdesc, value, validationContext, validationResults, validateAllProperties, ref valid);
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
static void ValidateProperty (PropertyDescriptor pdesc, object value, ValidationContext validationContext, ICollection <ValidationResult> validationResults,
|
||||
bool validateAll, ref bool valid)
|
||||
{
|
||||
AttributeCollection attributes = pdesc.Attributes;
|
||||
attributes.Validate <RequiredAttribute> (value, validationContext, validationResults, ref valid);
|
||||
if (validateAll)
|
||||
attributes.ValidateExcept <RequiredAttribute> (value, validationContext, validationResults, ref valid);
|
||||
}
|
||||
|
||||
static PropertyDescriptor GetProperty (Type type, string propertyName, object value)
|
||||
{
|
||||
if (String.IsNullOrEmpty (propertyName))
|
||||
throw new ArgumentNullException ("propertyName");
|
||||
|
||||
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (type);
|
||||
PropertyDescriptor pdesc = null;
|
||||
if (properties != PropertyDescriptorCollection.Empty && properties.Count > 0)
|
||||
pdesc = properties.Find (propertyName, false);
|
||||
|
||||
if (pdesc == null)
|
||||
throw new ArgumentException (String.Format ("The type '{0}' does not contain a public property named '{1}'.", type.Name, propertyName), "propertyName");
|
||||
|
||||
Type valueType = value == null ? null : value.GetType ();
|
||||
Type propertyType = pdesc.PropertyType;
|
||||
bool invalidType = false;
|
||||
|
||||
Console.WriteLine ("valueType == {0}; propertyType == {1} (reference? {2})", valueType == null ? "<null>" : valueType.FullName,
|
||||
propertyType, !propertyType.IsValueType || (Nullable.GetUnderlyingType (propertyType) != null));
|
||||
if (valueType == null)
|
||||
invalidType = !(!propertyType.IsValueType || (Nullable.GetUnderlyingType (propertyType) != null));
|
||||
else if (propertyType != valueType)
|
||||
invalidType = true;
|
||||
|
||||
if (invalidType)
|
||||
throw new ArgumentException (String.Format ("The value of property '{0}' must be of type '{1}'.", propertyName, type.FullName), "propertyName");
|
||||
|
||||
return pdesc;
|
||||
}
|
||||
|
||||
public static bool TryValidateProperty (object value, ValidationContext validationContext, ICollection <ValidationResult> validationResults)
|
||||
{
|
||||
// LAMESPEC: value can be null, validationContext must not
|
||||
if (validationContext == null)
|
||||
throw new ArgumentNullException ("validationContext");
|
||||
|
||||
PropertyDescriptor pdesc = GetProperty (validationContext.ObjectType, validationContext.MemberName, value);
|
||||
if (value == null)
|
||||
return true;
|
||||
|
||||
bool valid = true;
|
||||
ValidateProperty (pdesc, value, validationContext, validationResults, true, ref valid);
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
public static bool TryValidateValue (object value, ValidationContext validationContext, ICollection<ValidationResult> validationResults,
|
||||
IEnumerable <ValidationAttribute> validationAttributes)
|
||||
{
|
||||
if (validationContext == null)
|
||||
throw new ArgumentNullException ("validationContext");
|
||||
|
||||
ValidationResult result;
|
||||
|
||||
// It appears .NET makes this call before checking whether
|
||||
// validationAttributes is null...
|
||||
ValidationAttribute vattr = validationAttributes.FirstOrDefault <ValidationAttribute> (attr => attr is RequiredAttribute);
|
||||
if (vattr != null) {
|
||||
result = vattr.GetValidationResult (value, validationContext);
|
||||
if (result != ValidationResult.Success) {
|
||||
if (validationResults != null)
|
||||
validationResults.Add (result);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (validationAttributes == null)
|
||||
return true;
|
||||
|
||||
bool valid = true;
|
||||
foreach (ValidationAttribute attr in validationAttributes) {
|
||||
if (attr == null || (attr is RequiredAttribute))
|
||||
continue;
|
||||
|
||||
result = attr.GetValidationResult (value, validationContext);
|
||||
if (result != ValidationResult.Success) {
|
||||
valid = false;
|
||||
if (validationResults != null)
|
||||
validationResults.Add (result);
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
public static void ValidateObject (object instance, ValidationContext validationContext)
|
||||
{
|
||||
ValidateObject (instance, validationContext, false);
|
||||
}
|
||||
|
||||
public static void ValidateObject (object instance, ValidationContext validationContext, bool validateAllProperties)
|
||||
{
|
||||
if (instance == null)
|
||||
throw new ArgumentNullException ("instance");
|
||||
if (validationContext == null)
|
||||
throw new ArgumentNullException ("validationContext");
|
||||
|
||||
var validationResults = new List <ValidationResult> ();
|
||||
if (TryValidateObject (instance, validationContext, validationResults, validateAllProperties))
|
||||
return;
|
||||
|
||||
ValidationResult result = validationResults.Count > 0 ? validationResults [0] : null;
|
||||
throw new ValidationException (result, null, instance);
|
||||
}
|
||||
|
||||
public static void ValidateProperty (object value, ValidationContext validationContext)
|
||||
{
|
||||
if (validationContext == null)
|
||||
throw new ArgumentNullException ("validationContext");
|
||||
|
||||
var validationResults = new List <ValidationResult> ();
|
||||
if (TryValidateProperty (value, validationContext, validationResults))
|
||||
return;
|
||||
|
||||
ValidationResult result = validationResults.Count > 0 ? validationResults [0] : null;
|
||||
throw new ValidationException (result, null, value);
|
||||
}
|
||||
|
||||
public static void ValidateValue (object value, ValidationContext validationContext, IEnumerable <ValidationAttribute> validationAttributes)
|
||||
{
|
||||
if (validationContext == null)
|
||||
throw new ArgumentNullException ("validationContext");
|
||||
|
||||
var validationResults = new List <ValidationResult> ();
|
||||
if (TryValidateValue (value, validationContext, validationResults, validationAttributes))
|
||||
return;
|
||||
|
||||
ValidationResult result = validationResults.Count > 0 ? validationResults [0] : null;
|
||||
throw new ValidationException (result, null, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -1,6 +1,7 @@
|
||||
../../System.Web.DynamicData/Test/Common/AssertExtensions.cs
|
||||
System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptionProviderTests.cs
|
||||
System.ComponentModel.DataAnnotations/AssociationAttributeTest.cs
|
||||
System.ComponentModel.DataAnnotations/CustomValidationAttributeTest.cs
|
||||
System.ComponentModel.DataAnnotations/DisplayAttributeTest.cs
|
||||
System.ComponentModel.DataAnnotations/EnumDataTypeAttributeTest.cs
|
||||
System.ComponentModel.DataAnnotations/RangeAttributeTest.cs
|
||||
@@ -9,4 +10,5 @@ System.ComponentModel.DataAnnotations/StringLengthAttributeTest.cs
|
||||
System.ComponentModel.DataAnnotations/ValidationAttributeTest.cs
|
||||
System.ComponentModel.DataAnnotations/ValidationContextTest.cs
|
||||
System.ComponentModel.DataAnnotations/ValidationResultTest.cs
|
||||
System.ComponentModel.DataAnnotations/ValidatorTest.cs
|
||||
System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs
|
||||
+332
@@ -0,0 +1,332 @@
|
||||
//
|
||||
// Authors:
|
||||
// Marek Habersack <[email protected]>
|
||||
//
|
||||
// Copyright (C) 2011 Novell, Inc. (http://novell.com/)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Text;
|
||||
|
||||
using NUnit.Framework;
|
||||
using MonoTests.Common;
|
||||
|
||||
namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
{
|
||||
#if NET_4_0
|
||||
[TestFixture]
|
||||
public class CustomValidationAttributeTest
|
||||
{
|
||||
[Test]
|
||||
public void Constructor ()
|
||||
{
|
||||
var attr = new CustomValidationAttribute (null, "MyMethod");
|
||||
Assert.IsNull (attr.ValidatorType, "#A1-1");
|
||||
Assert.AreEqual ("MyMethod", attr.Method, "#A1-2");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (string), null);
|
||||
Assert.AreEqual (typeof (string), attr.ValidatorType, "#A2-1");
|
||||
Assert.IsNull (attr.Method, "#A2-2");
|
||||
|
||||
attr = new CustomValidationAttribute (null, null);
|
||||
Assert.IsNull (attr.ValidatorType, "#A3-1");
|
||||
Assert.IsNull (attr.Method, "#A3-2");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (string), "NoSuchMethod");
|
||||
Assert.AreEqual (typeof (string), attr.ValidatorType, "#A5-1");
|
||||
Assert.AreEqual ("NoSuchMethod", attr.Method, "#A5-2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TypeId ()
|
||||
{
|
||||
var attr = new CustomValidationAttribute (null, "MyMethod");
|
||||
Assert.IsNotNull (attr.TypeId, "#A1-1");
|
||||
Assert.AreEqual (typeof (Tuple<string, Type>), attr.TypeId.GetType (), "#A1-2");
|
||||
|
||||
var typeid = attr.TypeId as Tuple <string, Type>;
|
||||
Assert.IsNotNull (typeid.Item1, "#A2-1");
|
||||
Assert.AreEqual ("MyMethod", typeid.Item1, "#A2-2");
|
||||
Assert.IsNull (typeid.Item2, "#A2-3");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (CustomValidationAttributeTest), "MyMethod");
|
||||
typeid = attr.TypeId as Tuple<string, Type>;
|
||||
Assert.IsNotNull (typeid.Item1, "#A3-1");
|
||||
Assert.AreEqual ("MyMethod", typeid.Item1, "#A3-2");
|
||||
Assert.IsNotNull (typeid.Item2, "#A3-3");
|
||||
Assert.AreEqual (typeof (CustomValidationAttributeTest), typeid.Item2, "#A3-4");
|
||||
|
||||
var typeid2 = attr.TypeId as Tuple<string, Type>;
|
||||
Assert.IsTrue (Object.ReferenceEquals (typeid, typeid2), "#A4");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FormatErrorMessage ()
|
||||
{
|
||||
var attr = new CustomValidationAttribute (null, null);
|
||||
string msg = null;
|
||||
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
// MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage:
|
||||
// System.InvalidOperationException : The CustomValidationAttribute.ValidatorType was not specified.
|
||||
//
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.ThrowIfAttributeNotWellFormed()
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.FormatErrorMessage(String name)
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\CustomValidationAttributeTest.cs:line 88
|
||||
|
||||
msg = attr.FormatErrorMessage (null);
|
||||
}, "#A1");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (string), null);
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
// MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage:
|
||||
// System.InvalidOperationException : The CustomValidationAttribute.Method was not specified.
|
||||
//
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.ThrowIfAttributeNotWellFormed()
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.FormatErrorMessage(String name)
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\CustomValidationAttributeTest.cs:line 102
|
||||
|
||||
msg = attr.FormatErrorMessage (null);
|
||||
}, "#A2");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (string), String.Empty);
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
// MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage:
|
||||
// System.InvalidOperationException : The CustomValidationAttribute.Method was not specified.
|
||||
//
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.ThrowIfAttributeNotWellFormed()
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.FormatErrorMessage(String name)
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\CustomValidationAttributeTest.cs:line 117
|
||||
|
||||
msg = attr.FormatErrorMessage (null);
|
||||
}, "#A3");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (string), "NoSuchMethod");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
// MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage:
|
||||
// System.InvalidOperationException : The CustomValidationAttribute method 'NoSuchMethod' does not exist in type 'String' or is not public and static.
|
||||
//
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.ThrowIfAttributeNotWellFormed()
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.FormatErrorMessage(String name)
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\CustomValidationAttributeTest.cs:line 126
|
||||
|
||||
msg = attr.FormatErrorMessage (null);
|
||||
}, "#A4");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PrivateValidatorMethodContainer), "MethodOne");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
// MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage:
|
||||
// System.InvalidOperationException : The custom validation type 'PrivateValidatorMethodContainer' must be public.
|
||||
//
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.ThrowIfAttributeNotWellFormed()
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.FormatErrorMessage(String name)
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\CustomValidationAttributeTest.cs:line 138
|
||||
|
||||
msg = attr.FormatErrorMessage (null);
|
||||
}, "#A5");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodOne");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
// MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage:
|
||||
// System.InvalidOperationException : The CustomValidationAttribute method 'MethodOne' in type 'PublicValidatorMethodContainer'
|
||||
// must return System.ComponentModel.DataAnnotations.ValidationResult. Use System.ComponentModel.DataAnnotations.ValidationResult.Success
|
||||
// to represent success.
|
||||
//
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.ThrowIfAttributeNotWellFormed()
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.FormatErrorMessage(String name)
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\CustomValidationAttributeTest.cs:line 150
|
||||
msg = attr.FormatErrorMessage (null);
|
||||
}, "#A6");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodTwo");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
// MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage:
|
||||
// System.InvalidOperationException : The CustomValidationAttribute method 'MethodTwo' in type 'PublicValidatorMethodContainer' must match the expected signature: public static ValidationResult MethodTwo(object value, ValidationContext context). The value can be strongly typed. The ValidationContext parameter is optional.
|
||||
//
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.ThrowIfAttributeNotWellFormed()
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.FormatErrorMessage(String name)
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\CustomValidationAttributeTest.cs:line 163
|
||||
msg = attr.FormatErrorMessage (null);
|
||||
}, "#A7");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodThree");
|
||||
msg = attr.FormatErrorMessage (null);
|
||||
Assert.IsNotNull (msg, "#A8-1");
|
||||
Assert.IsTrue (msg.Length > 0, "#A8-2");
|
||||
Assert.AreEqual (" is not valid.", msg, "#A8-3");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodFour");
|
||||
msg = attr.FormatErrorMessage ("test");
|
||||
Assert.IsNotNull (msg, "#A9-1");
|
||||
Assert.IsTrue (msg.Length > 0, "#A9-2");
|
||||
Assert.AreEqual ("test is not valid.", msg, "#A9-3");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodFive");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
// MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage:
|
||||
// System.InvalidOperationException : The CustomValidationAttribute method 'MethodFive' in type 'PublicValidatorMethodContainer' must match the expected signature: public static ValidationResult MethodFive(object value, ValidationContext context). The value can be strongly typed. The ValidationContext parameter is optional.
|
||||
//
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.ThrowIfAttributeNotWellFormed()
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.FormatErrorMessage(String name)
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\CustomValidationAttributeTest.cs:line 180
|
||||
msg = attr.FormatErrorMessage (null);
|
||||
}, "#A10");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodSix");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
// MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage:
|
||||
// System.InvalidOperationException : The CustomValidationAttribute method 'MethodSix' in type 'PublicValidatorMethodContainer' must match the expected signature: public static ValidationResult MethodSix(object value, ValidationContext context). The value can be strongly typed. The ValidationContext parameter is optional.
|
||||
//
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.ThrowIfAttributeNotWellFormed()
|
||||
// at System.ComponentModel.DataAnnotations.CustomValidationAttribute.FormatErrorMessage(String name)
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\CustomValidationAttributeTest.cs:line 191
|
||||
msg = attr.FormatErrorMessage (null);
|
||||
}, "#A11");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsValid ()
|
||||
{
|
||||
var attr = new CustomValidationAttribute (null, null);
|
||||
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
attr.IsValid ("test");
|
||||
}, "#A1");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (string), null);
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
attr.IsValid ("test");
|
||||
}, "#A2");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (string), String.Empty);
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
attr.IsValid ("test");
|
||||
}, "#A3");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (string), "NoSuchMethod");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
attr.IsValid ("test");
|
||||
}, "#A4");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PrivateValidatorMethodContainer), "MethodOne");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
attr.IsValid ("test");
|
||||
}, "#A5");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodOne");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
attr.IsValid ("test");
|
||||
}, "#A6");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodTwo");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
attr.IsValid ("test");
|
||||
}, "#A7");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodThree");
|
||||
bool valid = attr.IsValid ("test");
|
||||
Assert.IsTrue (valid, "#A8-1");
|
||||
valid = attr.IsValid (null);
|
||||
Assert.IsFalse (valid, "#A8-2");
|
||||
valid = attr.IsValid ("failTest");
|
||||
Assert.IsFalse (valid, "#A8-3");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodFour");
|
||||
valid = attr.IsValid ("test");
|
||||
Assert.IsTrue (valid, "#A9-1");
|
||||
valid = attr.IsValid (null);
|
||||
Assert.IsFalse (valid, "#A9-2");
|
||||
valid = attr.IsValid ("failTest");
|
||||
Assert.IsFalse (valid, "#A9-3");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodFive");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
attr.IsValid ("test");
|
||||
}, "#A10");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodSix");
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
attr.IsValid ("test");
|
||||
}, "#A11");
|
||||
|
||||
attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodSeven");
|
||||
AssertExtensions.Throws<ApplicationException> (() => {
|
||||
attr.IsValid ("test");
|
||||
}, "#A12");
|
||||
}
|
||||
|
||||
class PrivateValidatorMethodContainer
|
||||
{
|
||||
public static void MethodOne ()
|
||||
{ }
|
||||
}
|
||||
|
||||
public class PublicValidatorMethodContainer
|
||||
{
|
||||
public static void MethodOne ()
|
||||
{ }
|
||||
|
||||
public static ValidationResult MethodTwo ()
|
||||
{
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
|
||||
public static ValidationResult MethodThree (object o)
|
||||
{
|
||||
if (o == null)
|
||||
return new ValidationResult ("Object cannot be null");
|
||||
string s = o as string;
|
||||
if (s == null || s != "failTest")
|
||||
return ValidationResult.Success;
|
||||
return new ValidationResult ("Test failed as requested");
|
||||
}
|
||||
|
||||
public static ValidationResult MethodFour (object o, ValidationContext ctx)
|
||||
{
|
||||
if (o == null)
|
||||
return new ValidationResult ("Object cannot be null");
|
||||
string s = o as string;
|
||||
if (s == null || s != "failTest")
|
||||
return ValidationResult.Success;
|
||||
return new ValidationResult ("Test failed as requested");
|
||||
}
|
||||
|
||||
public static ValidationResult MethodFive (object o, string s)
|
||||
{
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
|
||||
public static ValidationResult MethodSix (object o, ValidationContext ctx, string s)
|
||||
{
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
|
||||
public static ValidationResult MethodSeven (object o, ValidationContext ctx)
|
||||
{
|
||||
throw new ApplicationException ("SNAFU");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Loaded 100 of 851 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user