mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 11:21:39 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27589b59b9 | ||
|
|
8f4c7c9e1a | ||
|
|
950b5dc41b | ||
|
|
5901f1de17 | ||
|
|
84c1469a25 | ||
|
|
e08028625d | ||
|
|
acbaa50498 | ||
|
|
b92652fb0c | ||
|
|
b400a612a4 | ||
|
|
f75dddbe61 | ||
|
|
ce5c0e651e | ||
|
|
11cd4f09ed | ||
|
|
15c1fae0ea | ||
|
|
b712e0ae63 | ||
|
|
7304ee6ef0 | ||
|
|
ef23c9aaeb | ||
|
|
5eecf6b197 | ||
|
|
74dcf0f4e7 | ||
|
|
2a21dbb533 | ||
|
|
fdf4913561 | ||
|
|
a1ea9b3ab8 | ||
|
|
d22d581784 | ||
|
|
7ff68d17a2 | ||
|
|
ebbca31e3c | ||
|
|
fbe5f68924 | ||
|
|
aca813ba8d | ||
|
|
d4955be897 | ||
|
|
84ada866ad | ||
|
|
d7e563dd87 | ||
|
|
2085fa219c | ||
|
|
8d34f01dfc | ||
|
|
ac1aa9d309 | ||
|
|
97434a0a9b | ||
|
|
1c03c661b4 | ||
|
|
7e204d02b5 | ||
|
|
34d0ee8c95 | ||
|
|
05442e11d7 | ||
|
|
42f06c7663 | ||
|
|
8c002790f7 | ||
|
|
7172bcccf8 | ||
|
|
4ff65f3ac1 | ||
|
|
de4d2ec78b | ||
|
|
6e6489d471 | ||
|
|
986524c0bb | ||
|
|
ffe099d2fc | ||
|
|
a317249bec | ||
|
|
fc98dcc51c | ||
|
|
48ee1b70a0 | ||
|
|
ab154c2bdb | ||
|
|
e2bde717f8 | ||
|
|
e34e7f2de8 | ||
|
|
1e30039a0a | ||
|
|
4881df3014 | ||
|
|
38af1d1400 | ||
|
|
6a50c9ec35 | ||
|
|
5e0f8cda9a | ||
|
|
a094e9a735 | ||
|
|
816e0e8fdd | ||
|
|
47e1dbf970 | ||
|
|
aa19449ebb | ||
|
|
90041dc378 | ||
|
|
922912292b | ||
|
|
c92fff7043 | ||
|
|
e3931f38b6 | ||
|
|
493e003258 | ||
|
|
32bf6cac04 | ||
|
|
0c8aa2ee8b | ||
|
|
0ee8a2414d | ||
|
|
eb08b06215 | ||
|
|
88b7acff98 | ||
|
|
84fd92865b | ||
|
|
400afe1a8f | ||
|
|
d9755b89e6 | ||
|
|
8c8593fd96 | ||
|
|
200118c485 | ||
|
|
8575b3983a | ||
|
|
d99e8f21af | ||
|
|
df53237ac6 | ||
|
|
24ad061817 | ||
|
|
76ffb82a48 | ||
|
|
53cc1f8d6d | ||
|
|
0489b56686 | ||
|
|
4f856e94a3 | ||
|
|
a927203608 | ||
|
|
4313c50b3d | ||
|
|
09a2a27d27 | ||
|
|
c6c5c7c8b6 | ||
|
|
8a19ec3273 | ||
|
|
32d603eda4 | ||
|
|
11b4aef454 | ||
|
|
b1b4f52b34 | ||
|
|
bff28446a2 | ||
|
|
08df38ca1b | ||
|
|
21eef2e77e | ||
|
|
cff463913d | ||
|
|
e040c39674 | ||
|
|
eeca83c94d | ||
|
|
1a66d85f3b | ||
|
|
8508387f81 | ||
|
|
cd41807bcb | ||
|
|
fff850ae00 | ||
|
|
c4af40f5cf | ||
|
|
ace3196c2b | ||
|
|
890a4f46f5 | ||
|
|
fd89397e70 | ||
|
|
50c7e593cb | ||
|
|
c06c09bd60 | ||
|
|
4a3bf3d995 | ||
|
|
f59cfce9df | ||
|
|
b73876a464 | ||
|
|
836e73df60 | ||
|
|
c524bc933b | ||
|
|
9d136bfc7c | ||
|
|
ac220e9c0e | ||
|
|
ee8370eb8d | ||
|
|
bdffeb6712 | ||
|
|
eb24cb0d59 | ||
|
|
034798235b | ||
|
|
f049ca86f7 | ||
|
|
bcd05ee327 | ||
|
|
4ed001307d | ||
|
|
4b4f5466cd | ||
|
|
914d38a33e | ||
|
|
8e677f9921 | ||
|
|
12815c0c7e | ||
|
|
b535b7d4c0 | ||
|
|
3f1a1dbdfe | ||
|
|
eceec54500 | ||
|
|
c3335e6f62 | ||
|
|
d8feb83640 | ||
|
|
3a520d36c4 | ||
|
|
3fe2bf4538 | ||
|
|
00f2704267 | ||
|
|
150b04b1b9 | ||
|
|
098fc0b907 | ||
|
|
1b5cea04fc | ||
|
|
e61b2cd43d | ||
|
|
69b329a4a5 | ||
|
|
8cc06e5e77 | ||
|
|
4fd91bf1c0 | ||
|
|
6b9376a9bf | ||
|
|
c457bcfa42 | ||
|
|
63d82ffc3c | ||
|
|
2bdd7e92d3 | ||
|
|
5bb5d1d407 | ||
|
|
ca426640a8 | ||
|
|
718382bad7 | ||
|
|
32bf4798e3 | ||
|
|
dcff2f2285 | ||
|
|
17c171a0f9 | ||
|
|
2debaf6612 | ||
|
|
42d8948ea3 | ||
|
|
6b01c59030 | ||
|
|
00acd5fd49 | ||
|
|
f434ba459c | ||
|
|
34c5d71769 | ||
|
|
53acf05e01 | ||
|
|
be859b75ff | ||
|
|
f958258d28 | ||
|
|
a5d0787137 | ||
|
|
fc990b1fdc | ||
|
|
f97835553c | ||
|
|
9dd4b35d13 | ||
|
|
5a440ac217 | ||
|
|
67cbfb1f5c | ||
|
|
90a94a6b8b | ||
|
|
f6479e150f | ||
|
|
1208b12f69 | ||
|
|
d3d80927e1 | ||
|
|
73146ea69a | ||
|
|
f7d427a360 | ||
|
|
2b8f2bd2eb | ||
|
|
11d0202305 | ||
|
|
a755dfc8ab | ||
|
|
2c9a79735d | ||
|
|
abc43192bf | ||
|
|
791e158847 | ||
|
|
35022b4629 | ||
|
|
13e7da0b12 | ||
|
|
31d1906af8 | ||
|
|
e8030a1270 | ||
|
|
81732363f2 | ||
|
|
e47086ae2c | ||
|
|
adb5812097 | ||
|
|
a629d14e14 | ||
|
|
455afec78e | ||
|
|
cee2f48565 | ||
|
|
3a1003365a | ||
|
|
d8f224fa77 | ||
|
|
22492c37cc | ||
|
|
a9e7fb0abd | ||
|
|
02284d8008 | ||
|
|
0b4c366520 | ||
|
|
f5c7491d79 | ||
|
|
4dd31c484d | ||
|
|
48c4359548 | ||
|
|
3d48548a24 | ||
|
|
bfb47f0422 | ||
|
|
c5e9df9a7d | ||
|
|
4bfa3b8cb4 | ||
|
|
d0cfd383a1 | ||
|
|
236f5b982c | ||
|
|
082abf401a | ||
|
|
bc2585699c | ||
|
|
6dad7702ea | ||
|
|
84031f8584 | ||
|
|
243a027520 | ||
|
|
5b78093eef | ||
|
|
4b6d5edc78 | ||
|
|
b9d3e3262c | ||
|
|
77c4302bdf | ||
|
|
7f13ce00ce | ||
|
|
643a83b9a0 | ||
|
|
25b50b1c80 | ||
|
|
2e3f003f5f | ||
|
|
b8a1e12c73 | ||
|
|
95ca868476 | ||
|
|
58c2baf6a6 | ||
|
|
3fc405788c | ||
|
|
79d7ad5921 | ||
|
|
4809f77419 | ||
|
|
71b8786ee9 | ||
|
|
0c0fa5ec89 | ||
|
|
57e29afeaf | ||
|
|
c1577730af | ||
|
|
e22310c6b8 | ||
|
|
dc34921ff7 | ||
|
|
c4c2071766 | ||
|
|
16e7814ee4 | ||
|
|
568d44fd06 | ||
|
|
bcdc624995 | ||
|
|
f2b360fc5d | ||
|
|
f913aabf5c | ||
|
|
3cd16ddbdb | ||
|
|
8edff05440 | ||
|
|
bd3a3e1ec5 | ||
|
|
330dee9522 | ||
|
|
e65b5f396b | ||
|
|
5c4721c3d5 | ||
|
|
3f7fdcc82d | ||
|
|
a3d384dbbf | ||
|
|
699f408478 | ||
|
|
332943e496 | ||
|
|
204dc4ea04 | ||
|
|
49bbf1f4c3 | ||
|
|
401cabfc6a | ||
|
|
a2e8d38fa6 | ||
|
|
099b6e3c26 | ||
|
|
9979ab1f91 | ||
|
|
f11abca644 | ||
|
|
c12233306a | ||
|
|
5995136419 | ||
|
|
2441d1f521 | ||
|
|
410a27b2bf | ||
|
|
a05f9f8b5e | ||
|
|
6e5c11cd30 | ||
|
|
b1c0dfa135 | ||
|
|
3653a83b39 | ||
|
|
cb0c6ba813 | ||
|
|
16eaf2a641 | ||
|
|
516a0835f0 | ||
|
|
7ff67aa81a | ||
|
|
6f0d5440ce | ||
|
|
06c1a5f74c | ||
|
|
572fa90350 | ||
|
|
9a7ac8152c | ||
|
|
9468c9429f | ||
|
|
0c702ece52 | ||
|
|
8b2e70be67 | ||
|
|
8ee63bd04a | ||
|
|
30f6ae193f | ||
|
|
6d52bd6446 | ||
|
|
85b4874919 | ||
|
|
ab52d70383 | ||
|
|
64d093c92a | ||
|
|
b0af86bfc2 | ||
|
|
655579cbb1 | ||
|
|
2809fe1936 | ||
|
|
e5590d4ff5 | ||
|
|
4d259921aa | ||
|
|
0043b1fd2b | ||
|
|
8b50ed4dbb | ||
|
|
7727921d34 | ||
|
|
56c1d33ae4 | ||
|
|
cad348bcb2 | ||
|
|
c643703e79 | ||
|
|
9c234e78b1 | ||
|
|
85c63ecffe | ||
|
|
86877ecd25 | ||
|
|
a228d05aec | ||
|
|
19503869ca | ||
|
|
9e91c826fd | ||
|
|
ebb82987f6 | ||
|
|
e311191ef7 | ||
|
|
ab819e4118 | ||
|
|
dc3f9d3f6d | ||
|
|
451bc2a8a8 | ||
|
|
84b2d6bfec | ||
|
|
a498cddad7 | ||
|
|
03c6b6918b | ||
|
|
dc279e74dc |
No files matched your search
@@ -1,49 +1,14 @@
|
||||
2009-02-26 Marek Habersack <[email protected]>
|
||||
|
||||
* data/mono.web.pc.in: added. Fixes bug #479760
|
||||
|
||||
* data/Makefile.am: added mono.pc{.in} wherever necessary
|
||||
|
||||
2009-02-07 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* configure.in: include stdio so that NULL is defined when checking
|
||||
for ifreq.
|
||||
|
||||
2009-02-06 Miguel De Icaza <[email protected]>
|
||||
|
||||
* Disable parallel marking on OSX as it hangs during collections
|
||||
in the bootstrap stage of Mono.
|
||||
|
||||
As we find more platforms that hang, we should disable it there as
|
||||
well.
|
||||
|
||||
2009-02-03 Miguel de Icaza <[email protected]>
|
||||
|
||||
* configure.in (PLATFORM_NO_SYMLINKS): New define that replaces
|
||||
PLATFORM_WIN32.
|
||||
|
||||
2009-02-02 Rodrigo Kumpera <[email protected]>
|
||||
|
||||
* configure.in: Add --with-mcs-docs to make it possible to disable building of documentation under mcs.
|
||||
|
||||
2009-01-29 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Remove -Wcast-align from the warning list, it leads to a lot of
|
||||
useless warnings which can only be fixed by casting a pointer to (void*).
|
||||
|
||||
2009-01-29 Miguel de Icaza <[email protected]>
|
||||
|
||||
* configure.in: Add a couple of new AM conditionals for POSIX and
|
||||
DARWIN, these are used to conditionally include some files in
|
||||
mono/mini.
|
||||
|
||||
2009-01-27 Jb Evain <[email protected]>
|
||||
|
||||
* configure.in: bump Mono's version to 2.5 now that 2.4
|
||||
has been branched.
|
||||
|
||||
2009-01-25 Zoltan Varga <[email protected]>
|
||||
|
||||
* acinclude.m4 (dolt_supported): Handle ARM as well.
|
||||
|
||||
2009-01-23 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Make --enable-parallel-mark=yes the default.
|
||||
|
||||
2009-01-17 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Complete the OPROFILE checks.
|
||||
|
||||
@@ -37,8 +37,8 @@ For comments, corrections and updates, please contact [email protected]
|
||||
|
||||
We consider non-LGPL use instances where you use this on an
|
||||
embedded system where the end user is not able to upgrade the
|
||||
Mono VM or Moonlight installation or distribution that is part
|
||||
of your product (Section 6 and 7), you would have to obtain a
|
||||
Moonlight installation or distribution that is part of your
|
||||
product (Section 6 and 7), you would have to obtain a
|
||||
commercial license from Novell (consider software burned into
|
||||
a ROM, systems where end users would not be able to upgrade,
|
||||
an embedded console, a game console that imposes limitations
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ if test x$GCC != xyes; then
|
||||
fi
|
||||
case $host in
|
||||
i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux* \
|
||||
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*)
|
||||
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*)
|
||||
pic_options='-fPIC'
|
||||
;;
|
||||
i?86-apple-darwin*)
|
||||
|
||||
+18
-42
@@ -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.5)
|
||||
AM_INIT_AUTOMAKE(mono,2.4)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
API_VER=1.0
|
||||
@@ -64,13 +64,10 @@ need_link_unlink=no
|
||||
AC_MSG_CHECKING([host platform characteristics])
|
||||
libgc_threads=no
|
||||
has_dtrace=no
|
||||
parallel_mark=yes
|
||||
case "$host" in
|
||||
*-*-mingw*|*-*-cygwin*)
|
||||
platform_win32=yes
|
||||
AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
|
||||
AC_DEFINE(DISABLE_PORTABILITY,1,[Disable the io-portability layer])
|
||||
AC_DEFINE(PLATFORM_NO_SYMLINKS,1,[This platform does not support symlinks])
|
||||
if test "x$cross_compiling" = "xno"; then
|
||||
CC="gcc -mno-cygwin -g"
|
||||
# So libgc configure gets -mno-cygwin
|
||||
@@ -100,7 +97,6 @@ case "$host" in
|
||||
libdl="-ldl"
|
||||
libgc_threads=pthreads
|
||||
with_sigaltstack=no
|
||||
use_sigposix=yes
|
||||
;;
|
||||
*-*-*freebsd*)
|
||||
platform_win32=no
|
||||
@@ -129,11 +125,10 @@ case "$host" in
|
||||
# but NOT library support)
|
||||
#
|
||||
with_tls=pthread
|
||||
use_sigposix=yes
|
||||
;;
|
||||
*-*-*openbsd*)
|
||||
platform_win32=no
|
||||
CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS -DPLATFORM_BSD"
|
||||
CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
|
||||
libmono_cflags="-D_THREAD_SAFE"
|
||||
LDFLAGS="$LDFLAGS -pthread"
|
||||
libmono_ldflags="-pthread"
|
||||
@@ -141,7 +136,6 @@ case "$host" in
|
||||
AC_DEFINE(PTHREAD_POINTER_ID)
|
||||
libdl=
|
||||
libgc_threads=pthreads
|
||||
use_sigposix=yes
|
||||
;;
|
||||
*-*-linux*)
|
||||
platform_win32=no
|
||||
@@ -151,10 +145,9 @@ case "$host" in
|
||||
libdl="-ldl"
|
||||
libgc_threads=pthreads
|
||||
AOT_SUPPORTED="yes"
|
||||
use_sigposix=yes
|
||||
;;
|
||||
*-*-hpux*)
|
||||
platform_win32=no
|
||||
platform_win32=no
|
||||
CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
|
||||
# +ESdbgasm only valid on bundled cc on RISC
|
||||
# silently ignored for ia64
|
||||
@@ -170,7 +163,6 @@ case "$host" in
|
||||
libmono_ldflags="-lpthread"
|
||||
libgc_threads=pthreads
|
||||
need_link_unlink=yes
|
||||
use_sigposix=yes
|
||||
;;
|
||||
*-*-solaris*)
|
||||
platform_win32=no
|
||||
@@ -181,10 +173,8 @@ case "$host" in
|
||||
# This doesn't seem to work on solaris/x86, but the configure test runs
|
||||
with_tls=pthread
|
||||
has_dtrace=yes
|
||||
use_sigposix=yes
|
||||
;;
|
||||
*-*-darwin*)
|
||||
parallel_mark="Disabled_Currently_Hangs_On_MacOSX"
|
||||
platform_win32=no
|
||||
platform_darwin=yes
|
||||
CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP"
|
||||
@@ -217,8 +207,6 @@ fi
|
||||
|
||||
AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_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)
|
||||
|
||||
AC_CHECK_TOOL(CC, gcc, gcc)
|
||||
AC_PROG_CC
|
||||
@@ -334,7 +322,7 @@ AC_CHECK_SIZEOF(void *, 4)
|
||||
|
||||
WARN=''
|
||||
if test x"$GCC" = xyes; then
|
||||
WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings'
|
||||
WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
|
||||
# The runtime code does not respect ANSI C strict aliasing rules
|
||||
CFLAGS="$CFLAGS -fno-strict-aliasing"
|
||||
|
||||
@@ -652,7 +640,7 @@ AC_TRY_COMPILE([], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(parallel-mark, [ --enable-parallel-mark Enables GC Parallel Marking], enable_parallel_mark=$enableval, enable_parallel_mark=$parallel_mark)
|
||||
AC_ARG_ENABLE(parallel-mark, [ --enable-parallel-mark Enables GC Parallel Marking])
|
||||
if test x$enable_parallel_mark = xyes; then
|
||||
libgc_configure_args="$libgc_configure_args --enable-parallel-mark"
|
||||
fi
|
||||
@@ -2183,14 +2171,6 @@ AC_ARG_WITH(malloc_mempools,[ --with-malloc-mempools=yes,no Use malloc for each
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
DISABLE_MCS_DOCS=no
|
||||
AC_ARG_WITH(mcs_docs,[ --with-mcs-docs=yes,no If you want to build the documentation under mcs (defaults to YES)],[
|
||||
if test x$with_mcs_docs != xyes; then
|
||||
DISABLE_MCS_DOCS=yes
|
||||
fi
|
||||
])
|
||||
|
||||
AM_CONDITIONAL(HAVE_OPROFILE, test x$OPROFILE = xyes)
|
||||
AC_SUBST(OPROFILE_CFLAGS)
|
||||
AC_SUBST(OPROFILE_LIBS)
|
||||
@@ -2388,6 +2368,7 @@ data/mono-nunit.pc
|
||||
data/mono-options.pc
|
||||
data/mono-lineeditor.pc
|
||||
data/monodoc.pc
|
||||
data/mono.web.pc
|
||||
data/dotnet.pc
|
||||
data/dotnet35.pc
|
||||
data/wcf.pc
|
||||
@@ -2482,10 +2463,6 @@ fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$DISABLE_MCS_DOCS = xyes; then
|
||||
echo "DISABLE_MCS_DOCS = yes" >> $srcdir/$mcsdir/build/config.make
|
||||
fi
|
||||
)
|
||||
|
||||
libgdiplus_msg=${libgdiplus_loc:-assumed to be installed}
|
||||
@@ -2494,19 +2471,18 @@ echo "
|
||||
mcs source: $mcs_topdir
|
||||
olive source: $olive_topdir
|
||||
|
||||
GC: $gc
|
||||
TLS: $with_tls
|
||||
SIGALTSTACK: $with_sigaltstack
|
||||
Engine: $jit_status
|
||||
2.0 Beta: $PREVIEW
|
||||
2.1 Alpha: $MOONLIGHT
|
||||
JNI support: $jdk_headers_found
|
||||
libgdiplus: $libgdiplus_msg
|
||||
zlib: $zlib_msg
|
||||
oprofile: $OPROFILE
|
||||
BigArrays: $enable_big_arrays
|
||||
DTrace: $enable_dtrace
|
||||
Parallel Mark: $enable_parallel_mark
|
||||
GC: $gc
|
||||
TLS: $with_tls
|
||||
SIGALTSTACK: $with_sigaltstack
|
||||
Engine: $jit_status
|
||||
2.0 Beta: $PREVIEW
|
||||
2.1 Alpha: $MOONLIGHT
|
||||
JNI support: $jdk_headers_found
|
||||
libgdiplus: $libgdiplus_msg
|
||||
zlib: $zlib_msg
|
||||
oprofile: $OPROFILE
|
||||
BigArrays: $enable_big_arrays
|
||||
DTrace: $enable_dtrace
|
||||
$disabled
|
||||
|
||||
"
|
||||
|
||||
+4
-4
@@ -8,24 +8,24 @@ EXTRA_DIST = \
|
||||
mono.pc.in mint.pc.in dotnet.pc.in dotnet35.pc.in wcf.pc.in monodoc.pc.in \
|
||||
mono-nunit.pc.in mono-cairo.pc.in mono-options.pc.in cecil.pc.in smcs.pc.in \
|
||||
mono-lineeditor.pc.in system.web.extensions_1.0.pc.in system.web.extensions.design_1.0.pc.in\
|
||||
dtrace-prelink.sh
|
||||
dtrace-prelink.sh mono.web.pc.in
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
|
||||
if JIT_SUPPORTED
|
||||
if INTERP_SUPPORTED
|
||||
pkgconfig_DATA= mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
system.web.extensions.design_1.0.pc
|
||||
system.web.extensions.design_1.0.pc mono.web.pc
|
||||
else
|
||||
pkgconfig_DATA= mono.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
system.web.extensions.design_1.0.pc
|
||||
system.web.extensions.design_1.0.pc mono.web.pc
|
||||
endif
|
||||
else
|
||||
pkgconfig_DATA= mint.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc
|
||||
endif
|
||||
|
||||
DISTCLEANFILES= mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
system.web.extensions.design_1.0.pc
|
||||
system.web.extensions.design_1.0.pc mono.web.pc
|
||||
|
||||
mono_DATA = config \
|
||||
browscap.ini
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
2009-02-03 Zoltan Varga <[email protected]>
|
||||
|
||||
* mono-gdb.py: Remove the --64 argument to as, it is not needed.
|
||||
|
||||
* mono-gdb.py (stringify_class_name): Helper function to print base types
|
||||
using their short name. Also add a prototype implementation of registering
|
||||
the hooks from python code instead of needing the mono-gdbinit file.
|
||||
|
||||
* gdb-python.diff: Changes against the gdb archer branch at
|
||||
http://sourceware.org/gdb/wiki/PythonGdb to fix some problems/add functionality.
|
||||
|
||||
2009-02-03 Geoff Norton <[email protected]>
|
||||
|
||||
* mono-gdbinit: Hook into backtrace as hook-stop seems to crash gdb
|
||||
* mono-gdb.py: Find the gdbinit name from the executable name instead of
|
||||
hardcoding mono
|
||||
|
||||
2009-01-29 Zoltan Varga <[email protected]>
|
||||
|
||||
* mono-gdb.py mono-gdbinit: Support files to help debugging mono/mono apps
|
||||
using a python enabled gdb.
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
|
||||
index 640998b..fb73e9d 100644
|
||||
--- a/gdb/ChangeLog
|
||||
+++ b/gdb/ChangeLog
|
||||
@@ -1,3 +1,10 @@
|
||||
+2009-02-03 Zoltan Varga <[email protected]>
|
||||
+
|
||||
+ * cil-script.c python/python-cmd.c: Allow registration of pre/post hooks from
|
||||
+ python.
|
||||
+
|
||||
+ * symfile.c (add_symbol_file_command): Comment out verbose messages.
|
||||
+
|
||||
2009-02-03 Thiago Jung Bauermann <[email protected]>
|
||||
|
||||
* gdb/c-lang.c (c_get_string): Remove superfluous parenthesis from
|
||||
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
|
||||
index 835d29c..3941aa5 100644
|
||||
--- a/gdb/cli/cli-script.c
|
||||
+++ b/gdb/cli/cli-script.c
|
||||
@@ -299,6 +299,13 @@ execute_user_command (struct cmd_list_element *c, char *args)
|
||||
static int user_call_depth = 0;
|
||||
extern int max_user_call_depth;
|
||||
|
||||
+ /* Might be a user defined command implemented in Python */
|
||||
+ if (!c->user_commands && c->func)
|
||||
+ {
|
||||
+ (*c->func) (c, args, FALSE);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
old_chain = setup_user_args (args);
|
||||
|
||||
cmdlines = c->user_commands;
|
||||
diff --git a/gdb/python/python-cmd.c b/gdb/python/python-cmd.c
|
||||
index 61d5e5d..a3fbc08 100644
|
||||
--- a/gdb/python/python-cmd.c
|
||||
+++ b/gdb/python/python-cmd.c
|
||||
@@ -339,7 +339,8 @@ gdbpy_parse_command_name (char *text, struct cmd_list_element ***base_list,
|
||||
|
||||
/* Object initializer; sets up gdb-side structures for command.
|
||||
|
||||
- Use: __init__(NAME, CMDCLASS, [COMPLETERCLASS, [PREFIX]]).
|
||||
+ Use: __init__(NAME, CMDCLASS, [completerclass=COMPLETERCLASS, prefix=PREFIX,
|
||||
+ pre_hook_of=PREHOOK_OF, post_hook_of=POSTHOOK_OF]).
|
||||
|
||||
NAME is the name of the command. It may consist of multiple words,
|
||||
in which case the final word is the name of the new command, and
|
||||
@@ -354,6 +355,11 @@ gdbpy_parse_command_name (char *text, struct cmd_list_element ***base_list,
|
||||
|
||||
If PREFIX is True, then this command is a prefix command.
|
||||
|
||||
+ PREHOOK_OF is the name of a gdb command this command becomes a
|
||||
+ pre-execution hook of, same as if this command was defined using
|
||||
+ "define hook-<cmdname>"
|
||||
+ POSTHOOK_OF is the same for post-execution hooks.
|
||||
+
|
||||
The documentation for the command is taken from the doc string for
|
||||
the python class.
|
||||
|
||||
@@ -362,15 +368,18 @@ static int
|
||||
cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
cmdpy_object *obj = (cmdpy_object *) self;
|
||||
- char *name;
|
||||
+ char *name, *pre_hook_of = NULL, *post_hook_of = NULL;
|
||||
int cmdtype;
|
||||
int completetype = -1;
|
||||
char *docstring = NULL;
|
||||
volatile struct gdb_exception except;
|
||||
struct cmd_list_element **cmd_list;
|
||||
+ struct cmd_list_element *pre_hookc = NULL, *post_hookc = NULL;
|
||||
char *cmd_name, *pfx_name;
|
||||
PyObject *is_prefix = NULL;
|
||||
int cmp;
|
||||
+ static char *kwlist[] = {"name", "cmdclass", "completerclass", "prefix",
|
||||
+ "pre_hook_of", "post_hook_of", NULL};
|
||||
|
||||
if (obj->command)
|
||||
{
|
||||
@@ -381,8 +390,9 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (! PyArg_ParseTuple (args, "si|iO", &name, &cmdtype,
|
||||
- &completetype, &is_prefix))
|
||||
+ if (! PyArg_ParseTupleAndKeywords (args, kwds, "si|iOss", kwlist, &name, &cmdtype,
|
||||
+ &completetype, &is_prefix, &pre_hook_of,
|
||||
+ &post_hook_of))
|
||||
return -1;
|
||||
|
||||
if (cmdtype != no_class && cmdtype != class_run
|
||||
@@ -402,6 +412,30 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (pre_hook_of)
|
||||
+ {
|
||||
+ char *text = pre_hook_of;
|
||||
+
|
||||
+ pre_hookc = lookup_cmd_1 (&text, cmdlist, NULL, 1);
|
||||
+ if (! pre_hookc)
|
||||
+ {
|
||||
+ PyErr_Format (PyExc_RuntimeError, _("command name given by pre_hook argument not found"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (post_hook_of)
|
||||
+ {
|
||||
+ char *text = post_hook_of;
|
||||
+
|
||||
+ post_hookc = lookup_cmd_1 (&text, cmdlist, NULL, 1);
|
||||
+ if (! post_hookc)
|
||||
+ {
|
||||
+ PyErr_Format (PyExc_RuntimeError, _("command name given by post_hook argument not found"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
cmd_name = gdbpy_parse_command_name (name, &cmd_list, &cmdlist);
|
||||
if (! cmd_name)
|
||||
return -1;
|
||||
@@ -470,6 +504,18 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
|
||||
cmd->func = cmdpy_function;
|
||||
cmd->destroyer = cmdpy_destroyer;
|
||||
|
||||
+ if (pre_hookc)
|
||||
+ {
|
||||
+ pre_hookc->hook_pre = cmd;
|
||||
+ cmd->hookee_pre = pre_hookc;
|
||||
+ }
|
||||
+
|
||||
+ if (post_hookc)
|
||||
+ {
|
||||
+ post_hookc->hook_post = cmd;
|
||||
+ cmd->hookee_post = post_hookc;
|
||||
+ }
|
||||
+
|
||||
obj->command = cmd;
|
||||
set_cmd_context (cmd, self);
|
||||
set_cmd_completer (cmd, ((completetype == -1) ? cmdpy_completer
|
||||
diff --git a/gdb/symfile.c b/gdb/symfile.c
|
||||
index 14cb7b8..6d0bb40 100644
|
||||
--- a/gdb/symfile.c
|
||||
+++ b/gdb/symfile.c
|
||||
@@ -2196,7 +2196,7 @@ add_symbol_file_command (char *args, int from_tty)
|
||||
statements because hex_string returns a local static
|
||||
string. */
|
||||
|
||||
- printf_unfiltered (_("add symbol table from file \"%s\" at\n"), filename);
|
||||
+ /* printf_unfiltered (_("add symbol table from file \"%s\" at\n"), filename); */
|
||||
section_addrs = alloc_section_addr_info (section_index);
|
||||
make_cleanup (xfree, section_addrs);
|
||||
for (i = 0; i < section_index; i++)
|
||||
@@ -2211,7 +2211,7 @@ add_symbol_file_command (char *args, int from_tty)
|
||||
entered on the command line. */
|
||||
section_addrs->other[sec_num].name = sec;
|
||||
section_addrs->other[sec_num].addr = addr;
|
||||
- printf_unfiltered ("\t%s_addr = %s\n", sec, paddress (addr));
|
||||
+ /* printf_unfiltered ("\t%s_addr = %s\n", sec, paddress (addr)); */
|
||||
sec_num++;
|
||||
|
||||
/* The object's sections are initialized when a
|
||||
@@ -1,181 +0,0 @@
|
||||
#
|
||||
# Author: Zoltan Varga ([email protected])
|
||||
# License: MIT/X11
|
||||
#
|
||||
|
||||
#
|
||||
# This is a mono support mode for a python-enabled gdb:
|
||||
# http://sourceware.org/gdb/wiki/PythonGdb
|
||||
# Usage:
|
||||
# - copy/symlink this file, plus mono-gdbinit to the directory where the mono
|
||||
# executable lives.
|
||||
# - run mono under gdb, or attach to a mono process using gdb
|
||||
# - Type 'xdb' in gdb to load/reload the debugging info emitted by the runtime.
|
||||
# - The debug info is emitted to a file called xdb.s in the current working directory.
|
||||
# When attaching to a mono process, make sure you are in the same directory.
|
||||
#
|
||||
|
||||
import os
|
||||
|
||||
class StringPrinter:
|
||||
"Print a C# string"
|
||||
|
||||
def __init__(self, val):
|
||||
self.val = val
|
||||
|
||||
def to_string(self):
|
||||
if int(self.val.cast (gdb.Type ("guint64"))) == 0:
|
||||
return "null"
|
||||
|
||||
obj = self.val.cast (gdb.Type ("MonoString").pointer ()).dereference ()
|
||||
len = obj ['length']
|
||||
chars = obj ['chars']
|
||||
i = 0
|
||||
res = ['"']
|
||||
while i < len:
|
||||
c = chr ((chars.cast(gdb.Type ("gint64")) + (i * 2)).cast(gdb.Type ("gunichar2").pointer ()).dereference ())
|
||||
res.append (c)
|
||||
i = i + 1
|
||||
res.append ('"')
|
||||
return ''.join (res)
|
||||
|
||||
def stringify_class_name(ns, name):
|
||||
if ns == "System":
|
||||
if name == "Byte":
|
||||
return "byte"
|
||||
if name == "String":
|
||||
return "string"
|
||||
return "%s.%s" % (ns, name)
|
||||
|
||||
class ArrayPrinter:
|
||||
"Print a C# array"
|
||||
|
||||
def __init__(self, val, class_ns, class_name):
|
||||
self.val = val
|
||||
self.class_ns = class_ns
|
||||
self.class_name = class_name
|
||||
|
||||
def to_string(self):
|
||||
obj = self.val.cast (gdb.Type ("MonoArray").pointer ()).dereference ()
|
||||
length = obj ['max_length']
|
||||
return "%s [%d]" % (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
|
||||
|
||||
class ObjectPrinter:
|
||||
"Print a C# object"
|
||||
|
||||
def __init__(self, val):
|
||||
self.val = val
|
||||
|
||||
class _iterator:
|
||||
def __init__(self,obj):
|
||||
self.obj = obj
|
||||
self.iter = self.obj.type ().fields ().__iter__ ()
|
||||
pass
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def next(self):
|
||||
field = self.iter.next ()
|
||||
return (field.name, self.obj [field.name])
|
||||
|
||||
def children(self):
|
||||
# FIXME: It would be easier if gdb.Value would support iteration itself
|
||||
# It would also be better if we could return None
|
||||
if int(self.val.cast (gdb.Type ("guint64"))) == 0:
|
||||
return {}.__iter__ ()
|
||||
try:
|
||||
obj = self.val.cast (gdb.Type ("MonoObject").pointer ()).dereference ()
|
||||
class_ns = obj ['vtable'].dereference ()['klass'].dereference ()['name_space'].string ()
|
||||
class_name = obj ['vtable'].dereference ()['klass'].dereference ()['name'].string ()
|
||||
gdb_type = gdb.Type ("struct %s.%s" % (class_ns, class_name))
|
||||
return self._iterator(obj.cast (gdb_type))
|
||||
except:
|
||||
return {}.__iter__ ()
|
||||
|
||||
def to_string(self):
|
||||
if int(self.val.cast (gdb.Type ("guint64"))) == 0:
|
||||
return "null"
|
||||
try:
|
||||
obj = self.val.cast (gdb.Type ("MonoObject").pointer ()).dereference ()
|
||||
class_ns = obj ['vtable'].dereference ()['klass'].dereference ()['name_space'].string ()
|
||||
class_name = obj ['vtable'].dereference ()['klass'].dereference ()['name'].string ()
|
||||
if class_ns == "System" and class_name == "String":
|
||||
return StringPrinter (self.val).to_string ()
|
||||
if class_name [-2:len(class_name)] == "[]":
|
||||
return ArrayPrinter (self.val,class_ns,class_name).to_string ()
|
||||
if class_ns != "":
|
||||
try:
|
||||
gdb_type = gdb.Type ("struct %s.%s" % (class_ns, class_name))
|
||||
except:
|
||||
# Maybe there is no debug info for that type
|
||||
return "%s.%s" % (class_ns, class_name)
|
||||
#return obj.cast (gdb_type)
|
||||
return "%s.%s" % (class_ns, class_name)
|
||||
return class_name
|
||||
except:
|
||||
print sys.exc_info ()[0]
|
||||
print sys.exc_info ()[1]
|
||||
# FIXME: This can happen because we don't have liveness information
|
||||
return self.val.cast (gdb.Type ("guint64"))
|
||||
|
||||
def register_csharp_printers(obj):
|
||||
"Register C# pretty-printers with objfile Obj."
|
||||
|
||||
if obj == None:
|
||||
obj = gdb
|
||||
|
||||
obj.pretty_printers['object'] = ObjectPrinter
|
||||
obj.pretty_printers['string'] = StringPrinter
|
||||
|
||||
register_csharp_printers (gdb.current_objfile())
|
||||
|
||||
class MonoSupport(object):
|
||||
|
||||
def __init__(self):
|
||||
self.s_size = 0
|
||||
|
||||
def run_hook(self):
|
||||
if os.access ("xdb.s", os.F_OK):
|
||||
os.remove ("xdb.s")
|
||||
gdb.execute ("set environment MONO_XDEBUG 1")
|
||||
|
||||
def stop_hook(self):
|
||||
# Called when the program is stopped
|
||||
# Need to recompile+reload the xdb.s file if needed
|
||||
# FIXME: Need to detect half-written files created when the child is
|
||||
# interrupted while executing the xdb.s writing code
|
||||
# FIXME: Handle appdomain unload
|
||||
if os.access ("xdb.s", os.F_OK):
|
||||
new_size = os.stat ("xdb.s").st_size
|
||||
if new_size > self.s_size:
|
||||
sofile = "xdb.so"
|
||||
gdb.execute ("shell as -o xdb.o xdb.s && ld -shared -o %s xdb.o" % sofile)
|
||||
# FIXME: This prints messages which couldn't be turned off
|
||||
gdb.execute ("add-symbol-file %s 0" % sofile)
|
||||
self.s_size = new_size
|
||||
|
||||
class RunHook (gdb.Command):
|
||||
def __init__ (self):
|
||||
super (RunHook, self).__init__ ("hook-run", gdb.COMMAND_NONE,
|
||||
gdb.COMPLETE_COMMAND, pre_hook_of="run")
|
||||
|
||||
def invoke(self, arg, from_tty):
|
||||
mono_support.run_hook ()
|
||||
|
||||
print "Mono support loaded."
|
||||
|
||||
mono_support = MonoSupport ()
|
||||
|
||||
# This depends on the changes in gdb-python.diff to work
|
||||
#RunHook ()
|
||||
|
||||
# Register our hooks
|
||||
# This currently cannot be done from python code
|
||||
|
||||
exec_file = gdb.current_objfile ().filename
|
||||
# FIXME: Is there a way to detect symbolic links ?
|
||||
if os.stat (exec_file).st_size != os.lstat (exec_file).st_size:
|
||||
exec_file = os.readlink (exec_file)
|
||||
exec_dir = os.path.dirname (exec_file)
|
||||
gdb.execute ("source %s/%s-gdbinit" % (exec_dir, os.path.basename (exec_file)))
|
||||
@@ -1,20 +0,0 @@
|
||||
# Loaded by mono-gdb.py
|
||||
|
||||
# FIXME: According to gdb docs, this is called _before_ anything is printed
|
||||
# Got broken by this patch:
|
||||
# http://sourceware.org/ml/gdb-patches/2008-09/msg00193.html
|
||||
# FIXME: This seems to cause crashes inside gdb
|
||||
#define hook-stop
|
||||
# python mono_support.stop_hook ()
|
||||
#end
|
||||
define hook-backtrace
|
||||
python mono_support.stop_hook ()
|
||||
end
|
||||
|
||||
define hook-run
|
||||
python mono_support.run_hook ()
|
||||
end
|
||||
|
||||
define xdb
|
||||
python mono_support.stop_hook ()
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
Name: Mono.Web
|
||||
Description: Mono ASP.NET extension classes
|
||||
Version: 2.0.0.0
|
||||
Libs: -r:@prefix@/lib/mono/gac/Mono.Web/2.0.0.0__0738eb9f132ed756/Mono.Web.dll
|
||||
@@ -1,7 +1,3 @@
|
||||
2009-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* web.config : added .svc handler.
|
||||
|
||||
2009-01-07 Kornél Pál <[email protected]>
|
||||
|
||||
* DefaultWsdlHelpGenerator.aspx: Move <script> at the end of <head> that
|
||||
|
||||
@@ -37,9 +37,8 @@
|
||||
<add verb="*" path="*.vbproj" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.licx" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.dll" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="*" path="*.svc" type="System.ServiceModel.Channels.SvcHttpHandlerFactory, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</httpHandlers>
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
2009-02-12 Zoltan Varga <[email protected]>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Remove removed files.
|
||||
|
||||
* README: Point to the documentation on the wiki.
|
||||
|
||||
* call-sites.txt: Remove this, its contents is in jit-trampolines.
|
||||
|
||||
* memory-management.txt thread-safety.txt aot-compiler.txt jit-regalloc
|
||||
exception-handling.txt: Remove documents which are now on the wiki.
|
||||
|
||||
2009-02-11 Rodrigo Kumpera <[email protected]>
|
||||
|
||||
* thread-safety.txt: Improve the docs about image lock.
|
||||
|
||||
2009-02-11 Rodrigo Kumpera <[email protected]>
|
||||
|
||||
* thread-safety.txt: Document the new image lock.
|
||||
|
||||
2008-12-12 Mark Probst <[email protected]>
|
||||
|
||||
* mini-porting.txt: Added some details about function descriptors
|
||||
|
||||
@@ -14,6 +14,7 @@ ASSEMBLED_DOCS = \
|
||||
EXTRA_DIST = \
|
||||
abc-removal.txt \
|
||||
AgilityPack.dll \
|
||||
aot-compiler.txt \
|
||||
api-style.css \
|
||||
assembly-bundle \
|
||||
check-exports \
|
||||
@@ -24,6 +25,7 @@ EXTRA_DIST = \
|
||||
docs.make \
|
||||
documented \
|
||||
embedded-api \
|
||||
exception-handling.txt \
|
||||
exceptions \
|
||||
exdoc \
|
||||
file-share-modes \
|
||||
@@ -34,6 +36,7 @@ EXTRA_DIST = \
|
||||
internal-calls \
|
||||
ir-desc \
|
||||
jit-imt \
|
||||
jit-regalloc \
|
||||
jit-thoughts \
|
||||
jit-trampolines \
|
||||
local-regalloc.txt \
|
||||
@@ -60,6 +63,7 @@ EXTRA_DIST = \
|
||||
ssapre.txt \
|
||||
stack-alignment \
|
||||
stack-overflow.txt \
|
||||
thread-safety.txt \
|
||||
threading \
|
||||
toc.xml \
|
||||
TODO \
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
Documentation is now maintained on the mono wiki:
|
||||
|
||||
http://www.mono-project.com/Mono:Runtime:Documentation
|
||||
|
||||
Older documents or documents which were not yet migrated to the wiki are kept here.
|
||||
|
||||
* Scripts to maintain the Mono VM internal API
|
||||
|
||||
Layout
|
||||
|
||||
@@ -0,0 +1,393 @@
|
||||
Mono Ahead Of Time Compiler
|
||||
===========================
|
||||
|
||||
The Ahead of Time compilation feature in Mono allows Mono to
|
||||
precompile assemblies to minimize JIT time, reduce memory
|
||||
usage at runtime and increase the code sharing across multiple
|
||||
running Mono application.
|
||||
|
||||
To precompile an assembly use the following command:
|
||||
|
||||
mono --aot -O=all assembly.exe
|
||||
|
||||
The `--aot' flag instructs Mono to ahead-of-time compile your
|
||||
assembly, while the -O=all flag instructs Mono to use all the
|
||||
available optimizations.
|
||||
|
||||
* Caching metadata
|
||||
------------------
|
||||
|
||||
Besides code, the AOT file also contains cached metadata information which allows
|
||||
the runtime to avoid certain computations at runtime, like the computation of
|
||||
generic vtables. This reduces both startup time, and memory usage. It is possible
|
||||
to create an AOT image which contains only this cached information and no code by
|
||||
using the 'metadata-only' option during compilation:
|
||||
|
||||
mono --aot=metadata-only assembly.exe
|
||||
|
||||
This works even on platforms where AOT is not normally supported.
|
||||
|
||||
* Position Independent Code
|
||||
---------------------------
|
||||
|
||||
On x86 and x86-64 the code generated by Ahead-of-Time compiled
|
||||
images is position-independent code. This allows the same
|
||||
precompiled image to be reused across multiple applications
|
||||
without having different copies: this is the same way in which
|
||||
ELF shared libraries work: the code produced can be relocated
|
||||
to any address.
|
||||
|
||||
The implementation of Position Independent Code had a
|
||||
performance impact on Ahead-of-Time compiled images but
|
||||
compiler bootstraps are still faster than JIT-compiled images,
|
||||
specially with all the new optimizations provided by the Mono
|
||||
engine.
|
||||
|
||||
* How to support Position Independent Code in new Mono Ports
|
||||
------------------------------------------------------------
|
||||
|
||||
Generated native code needs to reference various runtime
|
||||
structures/functions whose address is only known at run
|
||||
time. JITted code can simple embed the address into the native
|
||||
code, but AOT code needs to do an indirection. This
|
||||
indirection is done through a table called the Global Offset
|
||||
Table (GOT), which is similar to the GOT table in the Elf
|
||||
spec. When the runtime saves the AOT image, it saves some
|
||||
information for each method describing the GOT table entries
|
||||
used by that method. When loading a method from an AOT image,
|
||||
the runtime will fill out the GOT entries needed by the
|
||||
method.
|
||||
|
||||
* Computing the address of the GOT
|
||||
|
||||
Methods which need to access the GOT first need to compute its
|
||||
address. On the x86 it is done by code like this:
|
||||
|
||||
call <IP + 5>
|
||||
pop ebx
|
||||
add <OFFSET TO GOT>, ebx
|
||||
<save got addr to a register>
|
||||
|
||||
The variable representing the got is stored in
|
||||
cfg->got_var. It is allways allocated to a global register to
|
||||
prevent some problems with branches + basic blocks.
|
||||
|
||||
* Referencing GOT entries
|
||||
|
||||
Any time the native code needs to access some other runtime
|
||||
structure/function (i.e. any time the backend calls
|
||||
mono_add_patch_info ()), the code pointed by the patch needs
|
||||
to load the value from the got. For example, instead of:
|
||||
|
||||
call <ABSOLUTE ADDR>
|
||||
it needs to do:
|
||||
call *<OFFSET>(<GOT REG>)
|
||||
|
||||
Here, the <OFFSET> can be 0, it will be fixed up by the AOT compiler.
|
||||
|
||||
For more examples on the changes required, see
|
||||
|
||||
svn diff -r 37739:38213 mini-x86.c
|
||||
|
||||
* The Program Linkage Table
|
||||
|
||||
As in ELF, calls made from AOT code do not go through the GOT. Instead, a direct call is
|
||||
made to an entry in the Program Linkage Table (PLT). This is based on the fact that on
|
||||
most architectures, call instructions use a displacement instead of an absolute address, so
|
||||
they are already position independent. An PLT entry is usually a jump instruction, which
|
||||
initially points to some trampoline code which transfers control to the AOT loader, which
|
||||
will compile the called method, and patch the PLT entry so that further calls are made
|
||||
directly to the called method.
|
||||
If the called method is in the same assembly, and does not need initialization (i.e. it
|
||||
doesn't have GOT slots etc), then the call is made directly, bypassing the PLT.
|
||||
|
||||
* Implementation
|
||||
----------------
|
||||
|
||||
** The Precompiled File Format
|
||||
-----------------------------
|
||||
|
||||
We use the native object format of the platform. That way it
|
||||
is possible to reuse existing tools like objdump and the
|
||||
dynamic loader. All we need is a working assembler, i.e. we
|
||||
write out a text file which is then passed to gas (the gnu
|
||||
assembler) to generate the object file.
|
||||
|
||||
The precompiled image is stored in a file next to the original
|
||||
assembly that is precompiled with the native extension for a shared
|
||||
library (on Linux its ".so" to the generated file).
|
||||
|
||||
For example: basic.exe -> basic.exe.so; corlib.dll -> corlib.dll.so
|
||||
|
||||
To avoid symbol lookup overhead and to save space, some things like the
|
||||
compiled code of the individual methods are not identified by specific symbols
|
||||
like method_code_1234. Instead, they are stored in one big array and the
|
||||
offsets inside this array are stored in another array, requiring just two
|
||||
symbols. The offsets array is usually named 'FOO_offsets', where FOO is the
|
||||
array the offsets refer to, like 'methods', and 'method_offsets'.
|
||||
|
||||
Generating code using an assembler and linker has some disadvantages:
|
||||
- it requires GNU binutils or an equivalent package to be installed on the
|
||||
machine running the aot compilation.
|
||||
- it is slow.
|
||||
|
||||
There is some support in the aot compiler for directly emitting elf files, but
|
||||
its not complete (yet).
|
||||
|
||||
The following things are saved in the object file and can be
|
||||
looked up using the equivalent to dlsym:
|
||||
|
||||
mono_assembly_guid
|
||||
|
||||
A copy of the assembly GUID.
|
||||
|
||||
mono_aot_version
|
||||
|
||||
The format of the AOT file format.
|
||||
|
||||
mono_aot_opt_flags
|
||||
|
||||
The optimizations flags used to build this
|
||||
precompiled image.
|
||||
|
||||
method_infos
|
||||
|
||||
Contains additional information needed by the runtime for using the
|
||||
precompiled method, like the GOT entries it uses.
|
||||
|
||||
method_info_offsets
|
||||
|
||||
Maps method indexes to offsets in the method_infos array.
|
||||
|
||||
mono_icall_table
|
||||
|
||||
A table that lists all the internal calls
|
||||
references by the precompiled image.
|
||||
|
||||
mono_image_table
|
||||
|
||||
A list of assemblies referenced by this AOT
|
||||
module.
|
||||
|
||||
methods
|
||||
|
||||
The precompiled code itself.
|
||||
|
||||
method_offsets
|
||||
|
||||
Maps method indexes to offsets in the methods array.
|
||||
|
||||
ex_info
|
||||
|
||||
Contains information about methods which is rarely used during normal execution,
|
||||
like exception and debug info.
|
||||
|
||||
ex_info_offsets
|
||||
|
||||
Maps method indexes to offsets in the ex_info array.
|
||||
|
||||
class_info
|
||||
|
||||
Contains precomputed metadata used to speed up various runtime functions.
|
||||
|
||||
class_info_offsets
|
||||
|
||||
Maps class indexes to offsets in the class_info array.
|
||||
|
||||
class_name_table
|
||||
|
||||
A hash table mapping class names to class indexes. Used to speed up
|
||||
mono_class_from_name ().
|
||||
|
||||
plt
|
||||
|
||||
The Program Linkage Table
|
||||
|
||||
plt_info
|
||||
|
||||
Contains information needed to find the method belonging to a given PLT entry.
|
||||
|
||||
** Source file structure
|
||||
-----------------------------
|
||||
|
||||
The AOT infrastructure is split into two files, aot-compiler.c and
|
||||
aot-runtime.c. aot-compiler.c contains the AOT compiler which is invoked by
|
||||
--aot, while aot-runtime.c contains the runtime support needed for loading
|
||||
code and other things from the aot files.
|
||||
|
||||
** Compilation process
|
||||
----------------------------
|
||||
|
||||
AOT compilation consists of the following stages:
|
||||
- collecting the methods to be compiled.
|
||||
- compiling them using the JIT.
|
||||
- emitting the JITted code and other information into an assembly file (.s).
|
||||
- assembling the file using the system assembler.
|
||||
- linking the resulting object file into a shared library using the system
|
||||
linker.
|
||||
|
||||
** Handling compiled code
|
||||
----------------------------
|
||||
|
||||
Each method is identified by a method index. For normal methods, this is
|
||||
equivalent to its index in the METHOD metadata table. For runtime generated
|
||||
methods (wrappers), it is an arbitrary number.
|
||||
Compiled code is created by invoking the JIT, requesting it to created AOT
|
||||
code instead of normal code. This is done by the compile_method () function.
|
||||
The output of the JIT is compiled code and a set of patches (relocations). Each
|
||||
relocation specifies an offset inside the compiled code, and a runtime object
|
||||
whose address is accessed at that offset.
|
||||
Patches are described by a MonoJumpInfo structure. From the perspective
|
||||
of the AOT compiler, there are two kinds of patches:
|
||||
- calls, which require an entry in the PLT table.
|
||||
- everything else, which require an entry in the GOT table.
|
||||
How patches is handled is described in the next section.
|
||||
After all the method are compiled, they are emitted into the output file into
|
||||
a byte array called 'methods', The emission
|
||||
is done by the emit_method_code () and emit_and_reloc_code () functions. Each
|
||||
piece of compiled code is identified by the local symbol .Lm_<method index>.
|
||||
While compiled code is emitted, all the locations which have an associated patch
|
||||
are rewritten using a platform specific process so the final generated code will
|
||||
refer to the plt and got entries belonging to the patches.
|
||||
The compiled code array
|
||||
can be accessed using the 'methods' global symbol.
|
||||
|
||||
** Handling patches
|
||||
----------------------------
|
||||
|
||||
Before a piece of AOTed code can be used, the GOT entries used by it must be
|
||||
filled out with the addresses of runtime objects. Those objects are identified
|
||||
by MonoJumpInfo structures. These stuctures are saved in a serialized form in
|
||||
the AOT file, so the AOT loader can deconstruct them. The serialization is done
|
||||
by the encode_patch () function, while the deserialization is done by the
|
||||
decode_patch_info () function.
|
||||
Every method has an associated method info blob inside the 'method_info' byte
|
||||
array in the AOT file. This contains all the information required to load the
|
||||
method at runtime:
|
||||
- the first got entry used by the method.
|
||||
- the number of got entries used by the method.
|
||||
- the serialized patch info for the got entries.
|
||||
Some patches, like vtables, icalls are very common, so instead of emitting their
|
||||
info every time they are used by a method, we emit the info only once into a
|
||||
byte array named 'got_info', and only emit an index into this array for every
|
||||
access.
|
||||
|
||||
** The Procedure Linkage Table (PLT)
|
||||
------------------------------------
|
||||
|
||||
Our PLT is similar to the elf PLT, it is used to handle calls between methods.
|
||||
If method A needs to call method B, then an entry is allocated in the PLT for
|
||||
method B, and A calls that entry instead of B directly. This is useful because
|
||||
in some cases the runtime needs to do some processing the first time B is
|
||||
called.
|
||||
There are two cases:
|
||||
- if B is in another assembly, then it needs to be looked up, then JITted or the
|
||||
corresponding AOT code needs to be found.
|
||||
- if B is in the same assembly, but has got slots, then the got slots need to be
|
||||
initialized.
|
||||
If none of these cases is true, then the PLT is not used, and the call is made
|
||||
directly to the native code of the target method.
|
||||
A PLT entry is usually implemented by a jump though a jump table, where the
|
||||
jump table entries are initially filled up with the address of a trampoline so
|
||||
the runtime can get control, and after the native code of the called method is
|
||||
created/found, the jump table entry is changed to point to the native code.
|
||||
All PLT entries also embed a integer offset after the jump which indexes into
|
||||
the 'plt_info' table, which stores the information required to find the called
|
||||
method. The PLT is emitted by the emit_plt () function.
|
||||
|
||||
** Exception/Debug info
|
||||
----------------------------
|
||||
|
||||
Each compiled method has some additional info generated by the JIT, usable
|
||||
for debugging (IL offset-native offset maps) and exception handling
|
||||
(saved registers, native offsets of try/catch clauses). Since this info is
|
||||
rarely needed, it is saved into a separate byte array called 'ex_info'.
|
||||
|
||||
** Cached metadata
|
||||
---------------------------
|
||||
|
||||
When the runtime loads a class, it needs to compute a variety of information
|
||||
which is not readily available in the metadata, like the instance size,
|
||||
vtable, whenever the class has a finalizer/type initializer etc. Computing this
|
||||
information requires a lot of time, causes the loading of lots of metadata,
|
||||
and it usually involves the creation of many runtime data structures
|
||||
(MonoMethod/MonoMethodSignature etc), which are long living, and usually persist
|
||||
for the lifetime of the app. To avoid this, we compute the required information
|
||||
at aot compilation time, and save it into the aot image, into an array called
|
||||
'class_info'. The runtime can query this information using the
|
||||
mono_aot_get_cached_class_info () function, and if the information is available,
|
||||
it can avoid computing it.
|
||||
|
||||
** Full AOT mode
|
||||
-------------------------
|
||||
|
||||
Some platforms like the iphone prohibit JITted code, using technical and/or
|
||||
legal means. This is a significant problem for the mono runtime, since it
|
||||
generates a lot of code dynamically, using either the JIT or more low-level
|
||||
code generation macros. To solve this, the AOT compiler is able to function in
|
||||
full-aot or aot-only mode, where it generates and saves all the neccesary code
|
||||
in the aot image, so at runtime, no code needs to be generated.
|
||||
There are two kinds of code which needs to be considered:
|
||||
- wrapper methods, that is methods whose IL is generated dynamically by the
|
||||
runtime. They are handled by generating them in the add_wrappers () function,
|
||||
then emitting them the same way as the 'normal' methods. The only problem is
|
||||
that these methods do not have a methoddef token, so we need a separate table
|
||||
in the aot image ('wrapper_info') to find their method index.
|
||||
- trampolines and other small hand generated pieces of code. They are handled
|
||||
in an ad-hoc way in the emit_trampolines () function.
|
||||
|
||||
* Performance considerations
|
||||
----------------------------
|
||||
|
||||
Using AOT code is a trade-off which might lead to higher or
|
||||
slower performance, depending on a lot of circumstances. Some
|
||||
of these are:
|
||||
|
||||
- AOT code needs to be loaded from disk before being used, so
|
||||
cold startup of an application using AOT code MIGHT be
|
||||
slower than using JITed code. Warm startup (when the code is
|
||||
already in the machines cache) should be faster. Also,
|
||||
JITing code takes time, and the JIT compiler also need to
|
||||
load additional metadata for the method from the disk, so
|
||||
startup can be faster even in the cold startup case.
|
||||
|
||||
- AOT code is usually compiled with all optimizations turned
|
||||
on, while JITted code is usually compiled with default
|
||||
optimizations, so the generated code in the AOT case should
|
||||
be faster.
|
||||
|
||||
- JITted code can directly access runtime data structures and
|
||||
helper functions, while AOT code needs to go through an
|
||||
indirection (the GOT) to access them, so it will be slower
|
||||
and somewhat bigger as well.
|
||||
|
||||
- When JITting code, the JIT compiler needs to load a lot of
|
||||
metadata about methods and types into memory.
|
||||
|
||||
- JITted code has better locality, meaning that if A method
|
||||
calls B, then the native code for A and B is usually quite
|
||||
close in memory, leading to better cache behaviour thus
|
||||
improved performance. In contrast, the native code of
|
||||
methods inside the AOT file is in a somewhat random order.
|
||||
|
||||
* Future Work
|
||||
-------------
|
||||
|
||||
- Currently, when an AOT module is loaded, all of its
|
||||
dependent assemblies are also loaded eagerly, and these
|
||||
assemblies need to be exactly the same as the ones loaded
|
||||
when the AOT module was created ('hard binding'). Non-hard
|
||||
binding should be allowed.
|
||||
|
||||
- On x86, the generated code uses call 0, pop REG, add
|
||||
GOTOFFSET, REG to materialize the GOT address. Newer
|
||||
versions of gcc use a separate function to do this, maybe we
|
||||
need to do the same.
|
||||
|
||||
- Currently, we get vtable addresses from the GOT. Another
|
||||
solution would be to store the data from the vtables in the
|
||||
.bss section, so accessing them would involve less
|
||||
indirection.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
Call Sites
|
||||
Extracted from emails from Paolo Molaro
|
||||
|
||||
|
||||
There are 3 basic different kinds of call sites:
|
||||
|
||||
1) normal calls:
|
||||
call relative_displacement
|
||||
|
||||
2) virtual calls:
|
||||
call *positive_offset(%register)
|
||||
|
||||
3) interface calls:
|
||||
mov constant, %imt_register
|
||||
call *negative_offset(%register)
|
||||
|
||||
The above is what happens on x86 and amd64, with different values of
|
||||
%imt_register for each arch (this register is a constant, but it could
|
||||
change with different mono builds, it should be likely one of
|
||||
constants the runtime comunicates to the debugger). %register can
|
||||
change depending on the callsite based on the register allocator
|
||||
choices. Note that the constant for the interface calls won't
|
||||
necessarily be a MonoMethod address: this could change in the future
|
||||
to a simple number.
|
||||
|
||||
In all the 3 cases the JIT trampolines will need to inspect the call
|
||||
site, but only in the first case the call site will be changed.
|
||||
@@ -0,0 +1,330 @@
|
||||
|
||||
Exception Handling In the Mono Runtime
|
||||
--------------------------------------
|
||||
|
||||
* Introduction
|
||||
--------------
|
||||
|
||||
There are many types of exceptions which the runtime needs to
|
||||
handle. These are:
|
||||
|
||||
- exceptions thrown from managed code using the 'throw' or 'rethrow' CIL
|
||||
instructions.
|
||||
|
||||
- exceptions thrown by some IL instructions like InvalidCastException thrown
|
||||
by the 'castclass' CIL instruction.
|
||||
|
||||
- exceptions thrown by runtime code
|
||||
|
||||
- synchronous signals received while in managed code
|
||||
|
||||
- synchronous signals received while in native code
|
||||
|
||||
- asynchronous signals
|
||||
|
||||
Since exception handling is very arch dependent, parts of the
|
||||
exception handling code reside in the arch specific
|
||||
exceptions-<ARCH>.c files. The architecture independent parts
|
||||
are in mini-exceptions.c. The different exception types listed
|
||||
above are generated in different parts of the runtime, but
|
||||
ultimately, they all end up in the mono_handle_exception ()
|
||||
function in mini-exceptions.c.
|
||||
|
||||
* Exceptions throw programmatically from managed code
|
||||
-----------------------------------------------------
|
||||
|
||||
These exceptions are thrown from managed code using 'throw' or
|
||||
'rethrow' CIL instructions. The JIT compiler will translate
|
||||
them to a call to a helper function called
|
||||
'mono_arch_throw/rethrow_exception'.
|
||||
|
||||
These helper functions do not exist at compile time, they are
|
||||
created dynamically at run time by the code in the
|
||||
exceptions-<ARCH>.c files.
|
||||
|
||||
They perform various stack manipulation magic, then call a
|
||||
helper function usually named throw_exception (), which does
|
||||
further processing in C code, then calls
|
||||
mono_handle_exception() to do the rest.
|
||||
|
||||
* Exceptions thrown implicitly from managed code
|
||||
------------------------------------------------
|
||||
|
||||
These exceptions are thrown by some IL instructions when
|
||||
something goes wrong. When the JIT needs to throw such an
|
||||
exception, it emits a forward conditional branch and remembers
|
||||
its position, along with the exception which needs to be
|
||||
emitted. This is usually done in macros named
|
||||
EMIT_COND_SYSTEM_EXCEPTION in the mini-<ARCH>.c files.
|
||||
|
||||
After the machine code for the method is emitted, the JIT
|
||||
calls the arch dependent mono_arch_emit_exceptions () function
|
||||
which will add the exception throwing code to the end of the
|
||||
method, and patches up the previous forward branches so they
|
||||
will point to this code.
|
||||
|
||||
This has the advantage that the rarely-executed exception
|
||||
throwing code is kept separate from the method body, leading
|
||||
to better icache performance.
|
||||
|
||||
The exception throwing code braches to the dynamically
|
||||
generated mono_arch_throw_corlib_exception helper function,
|
||||
which will create the proper exception object, does some stack
|
||||
manipulation, then calls throw_exception ().
|
||||
|
||||
* Exceptions thrown by runtime code
|
||||
-----------------------------------
|
||||
|
||||
These exceptions are usually thrown by the implementations of
|
||||
InternalCalls (icalls). First an appropriate exception object
|
||||
is created with the help of various helper functions in
|
||||
metadata/exception.c, which has a separate helper function for
|
||||
allocating each kind of exception object used by the runtime
|
||||
code. Then the mono_raise_exception () function is called to
|
||||
actually throw the exception. That function never returns.
|
||||
|
||||
An example:
|
||||
|
||||
if (something_is_wrong)
|
||||
mono_raise_exception (mono_get_exception_index_out_of_range ());
|
||||
|
||||
mono_raise_exception () simply passes the exception to the JIT
|
||||
side through an API, where it will be received by helper
|
||||
created by mono_arch_throw_exception (). From now on, it is
|
||||
treated as an exception thrown from managed code.
|
||||
|
||||
* Synchronous signals
|
||||
---------------------
|
||||
|
||||
For performance reasons, the runtime does not do same checks
|
||||
required by the CLI spec. Instead, it relies on the CPU to do
|
||||
them. The two main checks which are omitted are null-pointer
|
||||
checks, and arithmetic checks. When a null pointer is
|
||||
dereferenced by JITted code, the CPU will notify the kernel
|
||||
through an interrupt, and the kernel will send a SIGSEGV
|
||||
signal to the process. The runtime installs a signal handler
|
||||
for SIGSEGV, which is sigsegv_signal_handler () in mini.c. The
|
||||
signal handler creates the appropriate exception object and
|
||||
calls mono_handle_exception () with it. Arithmetic exceptions
|
||||
like division by zero are handled similarly.
|
||||
|
||||
* Synchronous signals in native code
|
||||
------------------------------------
|
||||
|
||||
Receiving a signal such as SIGSEGV while in native code means
|
||||
something very bad has happened. Because of this, the runtime
|
||||
will abort after trying to print a managed plus a native stack
|
||||
trace. The logic is in the mono_handle_native_sigsegv ()
|
||||
function.
|
||||
|
||||
Note that there are two kinds of native code which can be the
|
||||
source of the signal:
|
||||
|
||||
- code inside the runtime
|
||||
- code inside a native library loaded by an application, ie. libgtk+
|
||||
|
||||
* Stack overflow checking
|
||||
-------------------------
|
||||
|
||||
Stack overflow exceptions need special handling. When a thread
|
||||
overflows its stack, the kernel sends it a normal SIGSEGV
|
||||
signal, but the signal handler tries to execute on the same as
|
||||
the thread leading to a further SIGSEGV which will terminate
|
||||
the thread. A solution is to use an alternative signal stack
|
||||
supported by UNIX operating systems through the sigaltstack
|
||||
(2) system call. When a thread starts up, the runtime will
|
||||
install an altstack using the mono_setup_altstack () function
|
||||
in mini-exceptions.c. When a SIGSEGV is received, the signal
|
||||
handler checks whenever the fault address is near the bottom
|
||||
of the threads normal stack. If it is, a
|
||||
StackOverflowException is created instead of a
|
||||
NullPointerException. This exception is handled like any other
|
||||
exception, with some minor differences.
|
||||
|
||||
There are two reasons why sigaltstack is disabled by default:
|
||||
|
||||
* The main problem with sigaltstack() is that the stack
|
||||
employed by it is not visible to the GC and it is possible
|
||||
that the GC will miss it.
|
||||
|
||||
* Working sigaltstack support is very much os/kernel/libc
|
||||
dependent, so it is disabled by default.
|
||||
|
||||
|
||||
* Asynchronous signals
|
||||
----------------------
|
||||
|
||||
Async signals are used by the runtime to notify a thread that
|
||||
it needs to change its state somehow. Currently, it is used
|
||||
for implementing thread abort/suspend/resume.
|
||||
|
||||
Handling async signals correctly is a very hard problem,
|
||||
since the receiving thread can be in basically any state upon
|
||||
receipt of the signal. It can execute managed code, native
|
||||
code, it can hold various managed/native locks, or it can be
|
||||
in a process of acquiring them, it can be starting up,
|
||||
shutting down etc. Most of the C APIs used by the runtime are
|
||||
not asynch-signal safe, meaning it is not safe to call them
|
||||
from an async signal handler. In particular, the pthread
|
||||
locking functions are not async-safe, so if a signal handler
|
||||
interrupted code which was in the process of acquiring a lock,
|
||||
and the signal handler tries to acquire a lock, the thread
|
||||
will deadlock. Unfortunately, the current signal handling
|
||||
code does acquire locks, so sometimes it does deadlock.
|
||||
|
||||
When receiving an async signal, the signal handler first tries
|
||||
to determine whenever the thread was executing managed code
|
||||
when it was interrupted. If it did, then it is safe to
|
||||
interrupt it, so a ThreadAbortException is constructed and
|
||||
thrown. If the thread was executing native code, then it is
|
||||
generally not safe to interrupt it. In this case, the runtime
|
||||
sets a flag then returns from the signal handler. That flag is
|
||||
checked every time the runtime returns from native code to
|
||||
managed code, and the exception is thrown then. Also, a
|
||||
platform specific mechanism is used to cause the thread to
|
||||
interrupt any blocking operation it might be doing.
|
||||
|
||||
The async signal handler is in sigusr1_signal_handler () in
|
||||
mini.c, while the logic which determines whenever an exception
|
||||
is safe to be thrown is in mono_thread_request_interruption
|
||||
().
|
||||
|
||||
* Stack unwinding during exception handling
|
||||
-------------------------------------------
|
||||
|
||||
The execution state of a thread during exception handling is
|
||||
stored in an arch-specific structure called MonoContext. This
|
||||
structure contains the values of all the CPU registers
|
||||
relevant during exception handling, which usually means:
|
||||
|
||||
- IP (instruction pointer)
|
||||
- SP (stack pointer)
|
||||
- FP (frame pointer)
|
||||
- callee saved registers
|
||||
|
||||
Callee saved registers are the registers which are required by
|
||||
any procedure to be saved/restored before/after using
|
||||
them. They are usually defined by each platforms ABI
|
||||
(Application Binary Interface). For example, on x86, they are
|
||||
EBX, ESI and EDI.
|
||||
|
||||
The code which calls mono_handle_exception () is required to
|
||||
construct the initial MonoContext. How this is done depends on
|
||||
the caller. For exceptions thrown from managed code, the
|
||||
mono_arch_throw_exception helper function saves the values of
|
||||
the required registers and passes them to throw_exception (),
|
||||
which will save them in the MonoContext structure. For
|
||||
exceptions thrown from signal handlers, the MonoContext
|
||||
stucture is initialized from the signal info received from the
|
||||
kernel.
|
||||
|
||||
During exception handling, the runtime needs to 'unwind' the
|
||||
stack, i.e. given the state of the thread at a stack frame,
|
||||
construct the state at its callers. Since this is platform
|
||||
specific, it is done by a platform specific function called
|
||||
mono_arch_find_jit_info ().
|
||||
|
||||
Two kinds of stack frames need handling:
|
||||
|
||||
- Managed frames are easier. The JIT will store some
|
||||
information about each managed method, like which
|
||||
callee-saved registers it uses. Based on this information,
|
||||
mono_arch_find_jit_info () can find the values of the
|
||||
registers on the thread stack, and restore them.
|
||||
|
||||
- Native frames are problematic, since we have no information
|
||||
about how to unwind through them. Some compilers generate
|
||||
unwind information for code, some don't. Also, there is no
|
||||
general purpose library to obtain and decode this unwind
|
||||
information. So the runtime uses a different solution. When
|
||||
managed code needs to call into native code, it does through
|
||||
a managed->native wrapper function, which is generated by
|
||||
the JIT. This function is responsible for saving the machine
|
||||
state into a per-thread structure called MonoLMF (Last
|
||||
Managed Frame). These LMF structures are stored on the
|
||||
threads stack, and are linked together using one of their
|
||||
fields. When the unwinder encounters a native frame, it
|
||||
simply pops one entry of the LMF 'stack', and uses it to
|
||||
restore the frame state to the moment before control passed
|
||||
to native code. In effect, all successive native frames are
|
||||
skipped together.
|
||||
|
||||
Problems/future work
|
||||
--------------------
|
||||
|
||||
1. Async signal safety
|
||||
----------------------
|
||||
|
||||
The current async signal handling code is not async safe, so
|
||||
it can and does deadlock in practice. It needs to be rewritten
|
||||
to avoid taking locks at least until it can determine that it
|
||||
was interrupting managed code.
|
||||
|
||||
Another problem is the managed stack frame unwinding code. It
|
||||
blindly assumes that if the IP points into a managed frame,
|
||||
then all the callee saved registers + the stack pointer are
|
||||
saved on the stack. This is not true if the thread was
|
||||
interrupted while executing the method prolog/epilog.
|
||||
|
||||
2. Raising exceptions from native code
|
||||
--------------------------------------
|
||||
|
||||
Currently, exceptions are raised by calling
|
||||
mono_raise_exception () in the middle of runtime code. This
|
||||
has two problems:
|
||||
|
||||
- No cleanup is done, ie. if the caller of the function which
|
||||
throws an exception has taken locks, or allocated memory,
|
||||
that is not cleaned up. For this reason, it is only safe to
|
||||
call mono_raise_exception () 'very close' to managed code,
|
||||
ie. in the icall functions themselves.
|
||||
|
||||
- To allow mono_raise_exception () to unwind through native
|
||||
code, we need to save the LMF structures which can add a lot
|
||||
of overhead even in the common case when no exception is
|
||||
thrown. So this is not zero-cost exception handling.
|
||||
|
||||
An alternative might be to use a JNI style
|
||||
set-pending-exception API. Runtime code could call
|
||||
mono_set_pending_exception (), then return to its caller with
|
||||
an error indication allowing the caller to clean up. When
|
||||
execution returns to managed code, then managed->native
|
||||
wrapper could check whenever there is a pending exception and
|
||||
throw it if neccesary. Since we already check for pending
|
||||
thread interruption, this would have no overhead, allowing us
|
||||
to drop the LMF saving/restoring code, or significant parts of
|
||||
it.
|
||||
|
||||
4. libunwind
|
||||
------------
|
||||
|
||||
There is an OSS project called libunwind which is a standalone
|
||||
stack unwinding library. It is currently in development, but
|
||||
it is used by default by gcc on ia64 for its stack
|
||||
unwinding. The mono runtime also uses it on ia64. It has
|
||||
several advantages in relation to our current unwinding code:
|
||||
|
||||
- it has a platform independent API, i.e. the same unwinding
|
||||
code can be used on multiple platforms.
|
||||
|
||||
- it can generate unwind tables which are correct at every
|
||||
instruction, i.e. can be used for unwinding from async
|
||||
signals.
|
||||
|
||||
- given sufficient unwind info generated by a C compiler, it
|
||||
can unwind through C code.
|
||||
|
||||
- most of its API is async-safe
|
||||
|
||||
- it implements the gcc C++ exception handling API, so in
|
||||
theory it can be used to implement mixed-language exception
|
||||
handling (i.e. C++ exception caught in mono, mono exception
|
||||
caught in C++).
|
||||
|
||||
- it is MIT licensed
|
||||
|
||||
The biggest problem with libuwind is its platform support. ia64 support is
|
||||
complete/well tested, while support for other platforms is missing/incomplete.
|
||||
|
||||
http://www.hpl.hp.com/research/linux/libunwind/
|
||||
|
||||
@@ -0,0 +1,283 @@
|
||||
Register Allocation
|
||||
===================
|
||||
|
||||
The current JIT implementation uses a tree matcher to generate code. We use a
|
||||
simple algorithm to allocate registers in trees, and limit the number of used
|
||||
temporary register to 4 when evaluating trees. So we can use 2 registers for
|
||||
global register allocation.
|
||||
|
||||
Register Allocation for Trees
|
||||
=============================
|
||||
|
||||
We always evaluate trees from left to right. When there are no more registers
|
||||
available we need to spill values to memory. Here is the simplified algorithm.
|
||||
|
||||
gboolean
|
||||
tree_allocate_regs (tree, exclude_reg)
|
||||
{
|
||||
if (!tree_allocate_regs (tree->left, -1))
|
||||
return FALSE;
|
||||
|
||||
if (!tree_allocate_regs (tree->right, -1)) {
|
||||
|
||||
tree->left->spilled == TRUE;
|
||||
|
||||
free_used_regs (tree->left);
|
||||
|
||||
if (!tree_allocate_regs (tree->right, tree->left->reg))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
free_used_regs (tree->left);
|
||||
free_used_regs (tree->right);
|
||||
|
||||
/* try to allocate a register (reg != exclude_reg) */
|
||||
if ((tree->reg = next_free_reg (exclude_reg)) != -1)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
The emit routing actually spills the registers:
|
||||
|
||||
tree_emit (tree)
|
||||
{
|
||||
|
||||
tree_emit (tree->left);
|
||||
|
||||
if (tree->left->spilled)
|
||||
save_reg (tree->left->reg);
|
||||
|
||||
tree_emit (tree->right);
|
||||
|
||||
if (tree->left->spilled)
|
||||
restore_reg (tree->left->reg);
|
||||
|
||||
|
||||
emit_code (tree);
|
||||
}
|
||||
|
||||
|
||||
Global Register Allocation
|
||||
==========================
|
||||
|
||||
TODO.
|
||||
|
||||
Local Register Allocation
|
||||
=========================
|
||||
|
||||
This section describes the cross-platform local register allocator which is
|
||||
in the file mini-codegen.c.
|
||||
|
||||
The input to the allocator is a basic block which contains linear IL, ie.
|
||||
instructions of the form:
|
||||
|
||||
DEST <- SRC1 OP SRC2
|
||||
|
||||
where DEST, SRC1, and SRC2 are virtual registers (vregs). The job of the
|
||||
allocator is to assign hard or physical registers (hregs) to each virtual
|
||||
registers so the vreg references in the instructions can be replaced with their
|
||||
assigned hreg, allowing machine code to be generated later.
|
||||
|
||||
The allocator needs information about the number and types of arguments of
|
||||
instructions. It takes this information from the machine description files. It
|
||||
also needs arch specific information, like the number and type of the hard
|
||||
registers. It gets this information from arch-specific macros.
|
||||
|
||||
Currently, the vregs and hregs are partitioned into two classes: integer and
|
||||
floating point.
|
||||
|
||||
The allocator consists of two phases: In the first phase, a forward pass is
|
||||
made over the instructions, collecting liveness information for vregs. In the
|
||||
second phase, a backward pass is made over the instructions, assigning
|
||||
registers. This backward mode of operation makes understanding the allocator
|
||||
somewhat difficult to understand, but leads to better code in most cases.
|
||||
|
||||
Allocator state
|
||||
===============
|
||||
|
||||
The state of the allocator is stored in two arrays: iassign and isymbolic.
|
||||
iassign maps vregs to hregs, while isymbolic is the opposite.
|
||||
For a vreg, iassign [vreg] can contain the following values:
|
||||
|
||||
* -1 vreg has no assigned hreg
|
||||
|
||||
* hreg index (>= 0) vreg is assigned to the given hreg. This means
|
||||
later instructions (which we have already
|
||||
processed due to the backward direction) expect
|
||||
the value of vreg to be found in hreg.
|
||||
|
||||
* spill slot index (< -1) vreg is spilled to the given spill slot. This
|
||||
means later instructions expect the value of
|
||||
vreg to be found on the stack in the given
|
||||
spill slot.
|
||||
|
||||
Also, the allocator keeps track of which hregs are free and which are used.
|
||||
This information is stored in a bitmask called ifree_mask.
|
||||
|
||||
There is a similar set of data structures for floating point registers.
|
||||
|
||||
Spilling
|
||||
========
|
||||
|
||||
When an allocator needs a free hreg, but all of them are assigned, it needs to
|
||||
free up one of them. It does this by spilling the contents of the vreg which
|
||||
is currently assigned to the selected hreg. Since later instructions expect
|
||||
the vreg to be found in the selected hreg, the allocator emits a spill-load
|
||||
instruction to load the value from the spill slot into the hreg after the
|
||||
currently processed instruction. When the vreg which is spilled is a
|
||||
destination in an instruction, the allocator will emit a spill-store to store
|
||||
the value into the spill slot.
|
||||
|
||||
Fixed registers
|
||||
===============
|
||||
|
||||
Some architectures, notably x86/amd64 require that the arguments/results of
|
||||
some instructions be assigned to specific hregs. An example is the shift
|
||||
opcodes on x86, where the second argument must be in ECX. The allocator
|
||||
has support for this. It tries to allocate the vreg to the required hreg. If
|
||||
thats not possible, then it will emit compensation code which moves values to
|
||||
the correct registers before/after the instruction.
|
||||
|
||||
Fixed registers are mainly used on x86, but they are useful on more regular
|
||||
architectures on well, for example to model that after a call instruction, the
|
||||
return of the call is in a specific register.
|
||||
|
||||
A special case of fixed registers is two address architectures, like the x86,
|
||||
where the instructions place their results into their first argument. This is
|
||||
modelled in the allocator by allocating SRC1 and DEST to the same hreg.
|
||||
|
||||
Global registers
|
||||
================
|
||||
|
||||
Some variables might already be allocated to hardware registers during the
|
||||
global allocation phase. In this case, SRC1, SRC2 and DEST might already be
|
||||
a hardware register. The allocator needs to do nothing in this case, except
|
||||
when the architecture uses fixed registers, in which case it needs to emit
|
||||
compensation code.
|
||||
|
||||
Register pairs
|
||||
==============
|
||||
|
||||
64 bit arithmetic on 32 bit machines requires instructions whose arguments are
|
||||
not registers, but register pairs. The allocator has support for this, both
|
||||
for freely allocatable register pairs, and for register pairs which are
|
||||
constrained to specific hregs (EDX:EAX on x86).
|
||||
|
||||
Floating point stack
|
||||
====================
|
||||
|
||||
The x86 architecture uses a floating point register stack instead of a set of
|
||||
fp registers. The allocator supports this by keeping track of the height of the
|
||||
fp stack, and spilling/loading values from the stack as neccesary.
|
||||
|
||||
Calls
|
||||
=====
|
||||
|
||||
Calls need special handling for two reasons: first, they will clobber all
|
||||
caller-save registers, meaning their contents will need to be spilled. Also,
|
||||
some architectures pass arguments in registers. The registers used for
|
||||
passing arguments are usually the same as the ones used for local allocation,
|
||||
so the allocator needs to handle them specially. This is done as follows:
|
||||
the MonoInst for the call instruction contains a map mapping vregs which
|
||||
contain the argument values to hregs where the argument needs to be placed,
|
||||
like this (on amd64):
|
||||
|
||||
R33 -> RDI
|
||||
R34 -> RSI
|
||||
...
|
||||
|
||||
When the allocator processes the call instruction, it allocates the vregs
|
||||
in the map to their associated hregs. So the call instruction is processed as
|
||||
if having a variable number of arguments which fixed register assignments.
|
||||
|
||||
An example:
|
||||
|
||||
R33 <- 1
|
||||
R34 <- 2
|
||||
call
|
||||
|
||||
When the call instruction is processed, R33 is assigned to RDI, and R34 is
|
||||
assigned to RSI. Later, when the two assignment instructions are processed,
|
||||
R33 and R34 are already assigned to a hreg, so they are replaced with the
|
||||
associated hreg leading to the following final code:
|
||||
|
||||
RDI <- 1
|
||||
RSI <- 1
|
||||
call
|
||||
|
||||
Machine description files
|
||||
=========================
|
||||
|
||||
A typical entry in the machine description files looks like this:
|
||||
|
||||
shl: dest:i src1:i src2:s clob:1 len:2
|
||||
|
||||
The allocator is only interested in the dest,src1,src2 and clob fields.
|
||||
It understands the following values for the dest, src1, src2 fields:
|
||||
|
||||
i - integer register
|
||||
f - fp register
|
||||
b - base register (same as i, but the instruction does not modify the reg)
|
||||
m - fp register, even if an fp stack is used (no fp stack tracking)
|
||||
|
||||
It understands the following values for the clob field:
|
||||
|
||||
1 - sreg1 needs to be the same as dreg
|
||||
c - instruction clobbers the caller-save registers
|
||||
|
||||
Beside these values, an architecture can define additional values (like the 's'
|
||||
in the example). The allocator depends on a set of arch-specific macros to
|
||||
convert these values to information it needs during allocation.
|
||||
|
||||
Arch specific macros
|
||||
====================
|
||||
|
||||
These macros usually receive a value from the machine description file (like
|
||||
the 's' in the example). The examples below are for x86.
|
||||
|
||||
/*
|
||||
* A bitmask selecting the caller-save registers (these are used for local
|
||||
* allocation).
|
||||
*/
|
||||
#define MONO_ARCH_CALLEE_REGS X86_CALLEE_REGS
|
||||
|
||||
/*
|
||||
* A bitmask selecting the callee-saved registers (these are usually used for
|
||||
* global allocation).
|
||||
*/
|
||||
#define MONO_ARCH_CALLEE_SAVED_REGS X86_CALLER_REGS
|
||||
|
||||
/* Same for the floating point registers */
|
||||
#define MONO_ARCH_CALLEE_FREGS 0
|
||||
#define MONO_ARCH_CALLEE_SAVED_FREGS 0
|
||||
|
||||
/* Whenever the target uses a floating point stack */
|
||||
#define MONO_ARCH_USE_FPSTACK TRUE
|
||||
|
||||
/* The size of the floating point stack */
|
||||
#define MONO_ARCH_FPSTACK_SIZE 6
|
||||
|
||||
/*
|
||||
* Given a descriptor value from the machine description file, return the fixed
|
||||
* hard reg corresponding to that value.
|
||||
*/
|
||||
#define MONO_ARCH_INST_FIXED_REG(desc) ((desc == 's') ? X86_ECX : ((desc == 'a') ? X86_EAX : ((desc == 'd') ? X86_EDX : ((desc == 'y') ? X86_EAX : ((desc == 'l') ? X86_EAX : -1)))))
|
||||
|
||||
/*
|
||||
* A bitmask selecting the hregs which can be used for allocating sreg2 for
|
||||
* a given instruction.
|
||||
*/
|
||||
#define MONO_ARCH_INST_SREG2_MASK(ins) (((ins [MONO_INST_CLOB] == 'a') || (ins [MONO_INST_CLOB] == 'd')) ? (1 << X86_EDX) : 0)
|
||||
|
||||
/*
|
||||
* Given a descriptor value, return whenever it denotes a register pair.
|
||||
*/
|
||||
#define MONO_ARCH_INST_IS_REGPAIR(desc) (desc == 'l' || desc == 'L')
|
||||
|
||||
/*
|
||||
* Given a descriptor value, and the first register of a regpair, return a
|
||||
* bitmask selecting the hregs which can be used for allocating the second
|
||||
* register of the regpair.
|
||||
*/
|
||||
#define MONO_ARCH_INST_REGPAIR_REG2(desc,hreg1) (desc == 'l' ? X86_EDX : -1)
|
||||
@@ -0,0 +1,32 @@
|
||||
Metadata memory management
|
||||
--------------------------
|
||||
|
||||
Most metadata structures have a lifetime which is equal to the MonoImage where they are
|
||||
loaded from. These structures should be allocated from the memory pool of the
|
||||
corresponding MonoImage. The memory pool is protected by the loader lock.
|
||||
Examples of metadata structures in this category:
|
||||
- MonoClass
|
||||
- MonoMethod
|
||||
- MonoType
|
||||
Memory owned by these structures should be allocated from the image mempool as well.
|
||||
Examples include: klass->methods, klass->fields, method->signature etc.
|
||||
|
||||
Generics complicates things. A generic class could have many instantinations where the
|
||||
generic arguments are from different assemblies. Where should we allocate memory for
|
||||
instantinations ? We can allocate from the mempool of the image which contains the
|
||||
generic type definition, but that would mean that the instantinations would remain in
|
||||
memory even after the assemblies containing their type arguments are unloaded, leading
|
||||
to a memory leak. Therefore, we do the following:
|
||||
- data structures representing the generic definitions are allocated from the image
|
||||
mempool as usual. These include:
|
||||
- generic class definition (MonoGenericClass->container_class)
|
||||
- generic method definitions
|
||||
- type parameters (MonoGenericParam)
|
||||
- data structures representing inflated classes/images are allocated from the heap. These
|
||||
structures are kept in a cache, indexed by type arguments of the instantinations. When
|
||||
an assembly is unloaded, this cache is searched and all instantinations referencing
|
||||
types from the assembly are freed. This is done by mono_metadata_clean_for_image ()
|
||||
in metadata.c. The structures handled this way include:
|
||||
- MonoGenericClass
|
||||
- MonoGenericInst
|
||||
- inflated MonoMethods
|
||||
@@ -0,0 +1,113 @@
|
||||
|
||||
1. Thread safety of metadata structures
|
||||
----------------------------------------
|
||||
|
||||
1.1 Synchronization of read-only data
|
||||
-------------------------------------
|
||||
|
||||
Read-only data is data which is not modified after creation, like the
|
||||
actual binary metadata in the metadata tables.
|
||||
|
||||
There are three kinds of threads with regards to read-only data:
|
||||
- readers
|
||||
- the creator of the data
|
||||
- the destroyer of the data
|
||||
|
||||
Most threads are readers.
|
||||
|
||||
- synchronization between readers is not neccesary
|
||||
- synchronization between the writers is done using locks.
|
||||
- synchronization between the readers and the creator is done by not exposing
|
||||
the data to readers before it is fully constructed.
|
||||
- synchronization between the readers and the destroyer: TBD.
|
||||
|
||||
1.2 Deadlock prevention plan
|
||||
----------------------------
|
||||
|
||||
Hold locks for the shortest time possible. Avoid calling functions inside
|
||||
locks which might obtain global locks (i.e. locks known outside this module).
|
||||
|
||||
1.3 Locks
|
||||
----------
|
||||
|
||||
1.3.1 Simple locks
|
||||
------------------
|
||||
|
||||
There are a lot of global data structures which can be protected by a 'simple' lock. Simple means:
|
||||
- the lock protects only this data structure or it only protects the data structures in a given C module.
|
||||
An example would be the appdomains list in domain.c
|
||||
- the lock is only held for a short amount of time, and no other lock is acquired inside this simple lock. Thus there is
|
||||
no possibility of deadlock.
|
||||
|
||||
1.3.2 The class loader lock
|
||||
---------------------------
|
||||
|
||||
This locks is held by the class loading routines in class.c and loader.c. It
|
||||
protects the various caches inside MonoImage which are used by these modules.
|
||||
|
||||
1.3.3 The domain lock
|
||||
---------------------
|
||||
|
||||
Each appdomain has a lock which protects the per-domain data structures.
|
||||
|
||||
1.3.4 The locking hierarchy
|
||||
---------------------------
|
||||
|
||||
It is useful to model locks by a locking hierarchy, which is a relation between locks, which is reflexive, transitive,
|
||||
and antisymmetric, in other words, a lattice. If a thread wants to acquire a lock B, while already holding A, it can only
|
||||
do it if A < B. If all threads work this way, then no deadlocks can occur.
|
||||
|
||||
Our locking hierarchy so far looks like this:
|
||||
<DOMAIN LOCK>
|
||||
\
|
||||
<CLASS LOADER LOCK>
|
||||
\ \
|
||||
<SIMPLE LOCK 1> <SIMPLE LOCK 2>
|
||||
|
||||
1.4 Notes
|
||||
----------
|
||||
|
||||
Some common scenarios:
|
||||
- if a function needs to access a data structure, then it should lock it itself, and do not count on its caller locking it.
|
||||
So for example, the image->class_cache hash table would be locked by mono_class_get().
|
||||
|
||||
- there are lots of places where a runtime data structure is created and stored in a cache. In these places, care must be
|
||||
taken to avoid multiple threads creating the same runtime structure, for example, two threads might call mono_class_get ()
|
||||
with the same class name. There are two choices here:
|
||||
|
||||
<enter mutex>
|
||||
<check that item is created>
|
||||
if (created) {
|
||||
<leave mutex>
|
||||
return item
|
||||
}
|
||||
<create item>
|
||||
<store it in cache>
|
||||
<leave mutex>
|
||||
|
||||
This is the easiest solution, but it requires holding the lock for the whole time which might create a scalability problem, and could also lead to deadlock.
|
||||
|
||||
<enter mutex>
|
||||
<check that item is created>
|
||||
<leave mutex>
|
||||
if (created) {
|
||||
return item
|
||||
}
|
||||
<create item>
|
||||
<enter mutex>
|
||||
<check that item is created>
|
||||
if (created) {
|
||||
/* Another thread already created and stored the same item */
|
||||
<free our item>
|
||||
<leave mutex>
|
||||
return orig item
|
||||
}
|
||||
else {
|
||||
<store item in cache>
|
||||
<leave mutex>
|
||||
return item
|
||||
}
|
||||
|
||||
This solution does not present scalability problems, but the created item might be hard to destroy (like a MonoClass).
|
||||
|
||||
- lazy initialization of hashtables etc. is not thread safe
|
||||
@@ -1,9 +1,3 @@
|
||||
2009-02-05 Miguel de Icaza <[email protected]>
|
||||
|
||||
* src/gstr.c: Add g_strnfill
|
||||
|
||||
* src/glib.h: Add g_list_previous
|
||||
|
||||
2009-01-19 Bill Holmes <[email protected]>
|
||||
|
||||
* gmisc-win32.c (g_path_is_absolute): Adding support for UNC
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ AC_INIT(README)
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE(eglib,0.3)
|
||||
AM_INIT_AUTOMAKE(eglib,0.2)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AC_PROG_CC
|
||||
|
||||
@@ -39,7 +39,6 @@ libeglib_la_SOURCES = \
|
||||
gmarkup.c \
|
||||
gutf8.c \
|
||||
gunicode.c \
|
||||
unicode-data.h \
|
||||
$(os_files)
|
||||
|
||||
libeglib_la_CFLAGS = -Wall -D_FORTIFY_SOURCE=2
|
||||
|
||||
@@ -234,7 +234,6 @@ gchar *g_strjoinv (const gchar *separator, gchar **str_array);
|
||||
gchar *g_strchug (gchar *str);
|
||||
gchar *g_strchomp (gchar *str);
|
||||
void g_strdown (gchar *string);
|
||||
gchar *g_strnfill (gsize length, gchar fill_char);
|
||||
|
||||
gchar *g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter);
|
||||
gchar *g_strescape (const gchar *source, const gchar *exceptions);
|
||||
@@ -367,7 +366,6 @@ struct _GList {
|
||||
};
|
||||
|
||||
#define g_list_next(list) ((list) ? (((GList *) (list))->next) : NULL)
|
||||
#define g_list_previous(list) ((list) ? (((GList *) (list))->prev) : NULL)
|
||||
|
||||
GList *g_list_alloc (void);
|
||||
GList *g_list_append (GList *list,
|
||||
@@ -841,8 +839,6 @@ glong g_utf8_strlen (const gchar *str, gssize max);
|
||||
#define G_TRYLOCK(name)
|
||||
#define G_UNLOCK(name)
|
||||
|
||||
#define GUINT16_SWAP_LE_BE_CONSTANT(x) ((((guint16) x) >> 8) | ((((guint16) x) << 8)))
|
||||
|
||||
#define GUINT16_SWAP_LE_BE(x) ((guint16) (((guint16) x) >> 8) | ((((guint16)(x)) & 0xff) << 8))
|
||||
#define GUINT32_SWAP_LE_BE(x) ((guint32) \
|
||||
( (((guint32) (x)) << 24)| \
|
||||
|
||||
+2
-5
@@ -47,9 +47,7 @@ g_build_path (const gchar *separator, const gchar *first_element, ...)
|
||||
va_list args;
|
||||
|
||||
g_return_val_if_fail (separator != NULL, NULL);
|
||||
|
||||
if (first_element == NULL)
|
||||
return g_strdup ("");
|
||||
g_return_val_if_fail (first_element != NULL, NULL);
|
||||
|
||||
result = g_string_sized_new (48);
|
||||
|
||||
@@ -68,8 +66,7 @@ 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))
|
||||
g_string_append (result, separator);
|
||||
g_string_append (result, separator);
|
||||
|
||||
for (; strncmp (next, separator, slen) == 0; )
|
||||
next += slen;
|
||||
|
||||
+2
-11
@@ -826,15 +826,6 @@ g_ascii_xdigit_value (gchar c)
|
||||
(c - 'A' + 10))));
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_strnfill (gsize length, gchar fill_char)
|
||||
{
|
||||
gchar *ret = g_new (gchar, length + 1);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
ret [i] = fill_char;
|
||||
|
||||
ret [length] = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+2
-23
@@ -92,14 +92,7 @@ test_buildpath ()
|
||||
if (strcmp (s, "/a/c/") != 0)
|
||||
return FAILED ("14 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
/* Null */
|
||||
s = g_build_path ("/", NULL);
|
||||
if (s == NULL)
|
||||
return FAILED ("must get a non-NULL return");
|
||||
if (s [0] != 0)
|
||||
return FAILED ("must get an empty string");
|
||||
g_free (s);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -116,20 +109,6 @@ test_buildfname ()
|
||||
#endif
|
||||
return FAILED ("1 Got wrong result, got: %s", s);
|
||||
g_free (s);
|
||||
|
||||
s = g_build_filename ("/", "a", NULL);
|
||||
#ifdef G_OS_WIN32
|
||||
if (strcmp (s, "\\a") != 0)
|
||||
#else
|
||||
if (strcmp (s, "/a") != 0)
|
||||
#endif
|
||||
return FAILED ("1 Got wrong result, got: %s", s);
|
||||
|
||||
#ifndef OS_WIN32
|
||||
s = g_build_filename ("/", "foo", "/bar", "tolo/", "/meo/", NULL);
|
||||
if (strcmp (s, "/foo/bar/tolo/meo/") != 0)
|
||||
return FAILED ("1 Got wrong result, got: %s", s);
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -305,8 +284,8 @@ test_misc ()
|
||||
}
|
||||
|
||||
static Test path_tests [] = {
|
||||
{"g_build_filename", test_buildfname},
|
||||
{"g_buildpath", test_buildpath},
|
||||
{"g_build_filename", test_buildfname},
|
||||
{"g_path_get_dirname", test_dirname},
|
||||
{"g_path_get_basename", test_basename},
|
||||
{"g_find_program_in_path", test_ppath},
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
#include <malloc.h>
|
||||
#define ALLOCA _alloca
|
||||
#else
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <alloca.h>
|
||||
|
||||
+6
-13
@@ -1,17 +1,10 @@
|
||||
2009-02-03 Rodrigo Kumpera <rkumpera@novell.com>
|
||||
2009-02-24 Jonathan Pryor <jpryor@novell.com>
|
||||
|
||||
* docs/Makefile: Fix install-local and uninstall-local if
|
||||
DISABLE_MCS_DOCS is defined.
|
||||
|
||||
2009-02-02 Rodrigo Kumpera <[email protected]>
|
||||
|
||||
* docs/Makefile: Don't build build-documentation if DISABLE_MCS_DOCS
|
||||
is defined.
|
||||
|
||||
2009-01-31 Rodrigo Kumpera <[email protected]>
|
||||
|
||||
* docs/Makefile: use -f with rm on the clean target so
|
||||
rm doesn't complain about missing files.
|
||||
* docs/Makefile: Remove and don't install nunit-docs.source. As
|
||||
Atsushi Enomoto said on 2008-11-26, Mono's NUnit is for internal use
|
||||
only, and installing nunit-docs.source causes an warning message
|
||||
during monodoc startup.
|
||||
* docs/nunit-docs.source: Remove.
|
||||
|
||||
2008-12-10 Atsushi Enomoto <[email protected]>
|
||||
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
2009-01-22 Marek Habersack <[email protected]>
|
||||
|
||||
* Makefile (net_2_0_dirs): added System.Web - it now depends on
|
||||
System.Core, so it needs to be recompiled one more time after
|
||||
System.Core is done.
|
||||
|
||||
2008-12-08 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Makefile : revert previous one and retry before I revert everything.
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
2009-02-17 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* XsdDatatypeProvider.cs : workaround .NET/Mono Regex bug that
|
||||
does not handle \p{Latin-1Supplement} to work with OOXML grammar.
|
||||
|
||||
2009-01-20 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RelaxngReader.cs : fixed wrong text skip and ns/datatypeLibrary
|
||||
|
||||
@@ -138,7 +138,6 @@ namespace Commons.Xml.Relaxng.XmlSchema
|
||||
r.BaseTypeName = new XmlQualifiedName (primitive.Name, ns);
|
||||
foreach (RelaxngParam p in parameters) {
|
||||
XmlSchemaFacet f = null;
|
||||
string value = p.Value;
|
||||
switch (p.Name) {
|
||||
case "maxExclusive":
|
||||
f = new XmlSchemaMaxExclusiveFacet ();
|
||||
@@ -154,9 +153,6 @@ namespace Commons.Xml.Relaxng.XmlSchema
|
||||
break;
|
||||
case "pattern":
|
||||
f = new XmlSchemaPatternFacet ();
|
||||
// .NET/Mono Regex has a bug that it does not support "IsLatin-1Supplement"
|
||||
// (it somehow breaks at '-').
|
||||
value = value.Replace ("\\p{IsLatin-1Supplement}", "[\\x80-\\xFF]");
|
||||
break;
|
||||
case "whiteSpace":
|
||||
f = new XmlSchemaWhiteSpaceFacet ();
|
||||
@@ -179,7 +175,7 @@ namespace Commons.Xml.Relaxng.XmlSchema
|
||||
default:
|
||||
throw new RelaxngException (String.Format ("XML Schema facet {0} is not recognized or not supported.", p.Name));
|
||||
}
|
||||
f.Value = value;
|
||||
f.Value = p.Value;
|
||||
r.Facets.Add (f);
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,6 @@ net_2_0_dirs := \
|
||||
System.Xml.Linq \
|
||||
System.Data.DataSetExtensions \
|
||||
System.Data.Linq \
|
||||
System.Web \
|
||||
System.Web.Abstractions \
|
||||
System.Web.Routing \
|
||||
System.Web.Extensions_1.0 \
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
* Makefile: here is another nunit24 option breakage.
|
||||
|
||||
2008-11-11 Andrés G. Aragoneses <[email protected]>
|
||||
2008-11-11 Andres G. Aragoneses <[email protected]>
|
||||
|
||||
* Application.cs: After UIA assembly is successfully loaded,
|
||||
dump any exception that happens on initialization to stderr.
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
2009-02-04 Jonathan Pobst <[email protected]>
|
||||
|
||||
* FlowLayout.cs: When laying out ToolStripItems, they should be
|
||||
the height of the ToolStrip, not their preferred height.
|
||||
[Fixes bug #469196]
|
||||
|
||||
2008-11-07 Jonathan Pobst <[email protected]>
|
||||
|
||||
* DefaultLayout.cs: Apply patch from Jonathan Anderson that keeps
|
||||
|
||||
@@ -358,13 +358,9 @@ namespace System.Windows.Forms.Layout
|
||||
// Only apply layout to visible controls.
|
||||
if (!c.Available) { continue; }
|
||||
|
||||
// Resize any AutoSize controls to their preferred width
|
||||
// (the height should fill the ToolStrip)
|
||||
if (c.AutoSize == true) {
|
||||
Size preferred_size = c.GetPreferredSize (c.Size);
|
||||
preferred_size.Height = parentDisplayRectangle.Height;
|
||||
c.SetBounds (new Rectangle (c.Location, preferred_size));
|
||||
}
|
||||
// Resize any AutoSize controls to their preferred size
|
||||
if (c.AutoSize == true)
|
||||
c.SetBounds (new Rectangle (c.Location, c.GetPreferredSize (c.Size)));
|
||||
|
||||
switch (settings.FlowDirection) {
|
||||
case FlowDirection.BottomUp:
|
||||
|
||||
@@ -1,36 +1,27 @@
|
||||
2009-02-17 Andrés G. Aragoneses <[email protected]>
|
||||
2009-02-24 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* ToolBarButton.cs: Event for Enabled property (needed to fix
|
||||
UIA #474197).
|
||||
* DataGridViewCell.cs: Invalidate the datagrid when the cell is selected
|
||||
or deselected.
|
||||
[Fixes bug #479124]
|
||||
|
||||
2009-02-16 Carlos Alberto Cortez <[email protected]>
|
||||
2009-02-23 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* TextBox.cs: When handling WndProc with autocomplete activated,
|
||||
event if the new text is not causing any change in the look up
|
||||
algorithm, save it as we normally do when numbers and letters.
|
||||
Fixes #469967.
|
||||
* DataGridView.cs: Make the ScrollBars property work properly.
|
||||
|
||||
2009-02-16 Carlos Alberto Cortez <[email protected]>
|
||||
2009-02-22 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* TreeNode.cs: When Text/StateImageIndex/StateImageKey/NodeFont change
|
||||
Invalidate the proper bounds in the TreeView, not only resetting the
|
||||
width.
|
||||
Fixes #475542.
|
||||
* DataGridView.cs: Fix row removal in the data-bound scenario.
|
||||
|
||||
2009-02-09 Carlos Alberto Cortez <[email protected]>
|
||||
2009-02-19 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* TreeNode.cs: Don't return TreeView.BackColor when retrieving our own
|
||||
BackColor property. This is what .net does in both 1.1 and 2.0.
|
||||
* TreeView.cs: When selected_node is not the same as highlighted_node,
|
||||
we need to handle the back color in a different way, trying to use the
|
||||
node's BackColor if it's not Color.Empty.
|
||||
Fixes #464200.
|
||||
* DataGridViewCell.cs: Use strict equality comparison in order to
|
||||
prevent superfluous CellValueChanged events.
|
||||
|
||||
2009-02-09 Carlos Alberto Cortez <[email protected]>
|
||||
2009-02-19 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* TreeView.cs: When canceling selection in our MouseUp handler,
|
||||
invalidate also the previous selected node bounds.
|
||||
Fixes #464191.
|
||||
* DataGridView.cs: Do not reset the columns when the data list changes,
|
||||
but only the rows. Fixes multiple bugs related to sorting, custom
|
||||
column styles being reset and more.
|
||||
|
||||
2009-02-07 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
@@ -42,19 +33,6 @@
|
||||
* DataGridView.cs: Data-bind only after the handle is created.
|
||||
[Fixes bug #473680]
|
||||
|
||||
2009-02-06 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeView.cs: When handling the MouseMove event, check if
|
||||
focused_node and selected_node fields are null - usually they are non
|
||||
null, since we have always a selected node, but canceling selection by
|
||||
handling BeforeSelect event leaves the two of them as null.
|
||||
Fixes #470451.
|
||||
|
||||
2009-02-06 Neville Gao <[email protected]>
|
||||
|
||||
* TabControl.cs: Control enabled to support accessibility.
|
||||
[Fixes Bug #472428]
|
||||
|
||||
2009-02-05 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridViewRowCollection.cs, DataGridView.cs: Fix row insertation:
|
||||
@@ -67,30 +45,8 @@
|
||||
|
||||
2009-02-05 Andrés G. Aragoneses <[email protected]>
|
||||
|
||||
* ToolBarButton.cs: Doh, fire OnUIATextChanged *after* setting
|
||||
the value.
|
||||
|
||||
2009-02-04 Andrés G. Aragoneses <[email protected]>
|
||||
|
||||
* ToolBarButton.cs: Add another event (OnUIATextChanged).
|
||||
|
||||
2009-02-04 Andrés G. Aragoneses <[email protected]>
|
||||
|
||||
* ToolBarButton: Fix typo in previous commit (r125704).
|
||||
|
||||
2009-02-04 Andrés G. Aragoneses <[email protected]>
|
||||
|
||||
* ToolBar.cs, ToolBarButton.cs: Add new UIA events to know
|
||||
when a button gets focus, firing the events from the ToolBar.
|
||||
r: jpobst
|
||||
|
||||
2009-02-04 Mario Carrion <[email protected]>
|
||||
|
||||
* ColumnHeader.cs: Raising ListView.ColumnWidthChanged when setting
|
||||
Width.
|
||||
* ListView.cs: Internal method added: RaiseColumnWidthChanged, used by
|
||||
ColumnHeader to raise ColumnWidthChanged.
|
||||
[Fixes Bug #467086]
|
||||
* ToolBarButton.cs: OnTextChanged added.
|
||||
(Backport of r125802.) r: jpobst
|
||||
|
||||
2009-02-03 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
@@ -105,26 +61,11 @@
|
||||
row, because it has already become a real one. Instead add a new one.
|
||||
[Fixes bug #471754]
|
||||
|
||||
2009-02-02 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeView.cs: When drawing the node's image, check that the index
|
||||
specified by the node is valid for the ImageList.
|
||||
Fixes #471094.
|
||||
|
||||
2009-02-02 Andrés G. Aragoneses <[email protected]>
|
||||
|
||||
* ToolBar.cs: Add new UIAPerformClick method to be called by
|
||||
UIAutomationWinforms when someone calls Invoke() on the
|
||||
ToolBarButtonProvider. r: jpobst
|
||||
|
||||
2009-02-02 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* XplatUIX11.cs: Don't send a WM_SHOWWINDOW message when receiving
|
||||
MapNotify/UnmapNotify events - we are already firing those events in
|
||||
the proper places, so we avoid this way to send the same message two
|
||||
times. I'm leaving the handling code in case we could break something
|
||||
in the future, as this change seems dangerous (but needed).
|
||||
Fixes #467546.
|
||||
* ToolBar.cs: Add new UIAPerformClick method to be called by
|
||||
UIAutomationWinforms when someone calls Invoke() on the
|
||||
ToolBarButtonProvider. (Backport of r125354.) r: jpobst
|
||||
|
||||
2009-02-01 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
@@ -147,16 +88,12 @@
|
||||
- Default to MiddleCenter alignment for image cells.
|
||||
[Fixes bug #471101]
|
||||
|
||||
2009-01-30 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* UpDownBase.cs: Force Height to PreferredHeight.
|
||||
|
||||
2009-01-29 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* XplatUIX11.cs: We should use utf8 handling clipboard transference
|
||||
with other x11 applications, and use utf16 when handling clipboard
|
||||
data in the class library. Update the related points as well.
|
||||
Fixes #468683.
|
||||
* XplatUIX11.cs: We should use utf8 handling clipboard transference
|
||||
with other x11 applications, and use utf16 when handling clipboard
|
||||
data in the class library. Update the related points as well.
|
||||
Fixes #468683.
|
||||
|
||||
2009-01-28 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
@@ -169,6 +106,39 @@
|
||||
* DataGridView.cs: Reset the hover cell if it gets moved due to row(s)
|
||||
addition or removal. Fixes multiple crashes in OnMouseMove.
|
||||
|
||||
2009-01-28 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeNode.cs: NextVisibleNode and PrevVisibleNode properties don't
|
||||
take into account the fact that OpenTreeNodeEnumerator needs to call
|
||||
MoveNext/MovePrevious to actually put the passed node as the one
|
||||
retrieved in Current. This way this property should work as really
|
||||
expected in .net.
|
||||
Fixes part of #467225.
|
||||
|
||||
2009-01-28 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeView.cs: When calculating the scrollbars, don't use
|
||||
TreeNode.Bounds, since it still can have the values of the previous
|
||||
-and now invalid- layout -which depends on TreeView.skipped_nodes, and
|
||||
could not have been updated as well-, and use the actual number of
|
||||
visible number of nodes to compute the height needed to contain all
|
||||
the nodes. Also reset the value of vbar to 0 when disabled - this way
|
||||
we make sure that, when re-enabled, it will update the visible area of
|
||||
the treeview, even if the previous value before disabling it is the
|
||||
same as now. Finally don't do anything for the vbar.ValueChanged
|
||||
handler - for the case wheer we manually set the value but don't the
|
||||
vbar is disabled already.
|
||||
Fixes part of #467225.
|
||||
|
||||
2009-01-28 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeView.cs: In CollapseAll, set vbar to the maximum value, instead
|
||||
of trying to set as top node the highest parent of the previous
|
||||
top node. Moving to the bottom of the TreeView after a call
|
||||
to CollapseAll is exactly what .net does. This should avoid some
|
||||
nasty issue when CollapseAll is called and we don't need the
|
||||
vertical scroll bar.
|
||||
|
||||
2009-01-27 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: Fix a NRE when setting the CurrentCell to null.
|
||||
@@ -195,35 +165,6 @@
|
||||
when the first row is added as this is not what MS does. Fixes the
|
||||
failing unit tests.
|
||||
|
||||
2009-01-26 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeNode.cs: NextVisibleNode and PrevVisibleNode properties don't
|
||||
take into account the fact that OpenTreeNodeEnumerator needs to call
|
||||
MoveNext/MovePrevious to actually put the passed node as the one
|
||||
retrieved in Current. This way this property should work as really
|
||||
expected in .net.
|
||||
Fixes part of #467225.
|
||||
|
||||
2000-01-26 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeView.cs: When calculating the scrollbars, don't use
|
||||
TreeNode.Bounds, since it still can have the values of the previous
|
||||
-and now invalid- layout -which depends on TreeView.skipped_nodes, and
|
||||
could not have been updated as well-, and use the actual number of
|
||||
visible number of nodes to compute the height needed to contain all
|
||||
the nodes. Also reset the value of vbar to 0 when disabled - this way
|
||||
we make sure that, when re-enabled, it will update the visible area of
|
||||
the treeview, even if the previous value before disabling it is the
|
||||
same as now. Finally don't do anything for the vbar.ValueChanged
|
||||
handler - for the case wheer we manually set the value but don't the
|
||||
vbar is disabled already.
|
||||
Fixes part of #467225.
|
||||
|
||||
2009-01-23 Jonathan Pobst <[email protected]>
|
||||
|
||||
* ToolStrip.cs: Switch from foreach to for, in case the collection
|
||||
somehow changes while enumerating it.
|
||||
|
||||
2009-01-23 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs, DataGridViewCell.cs: Fix crashes when there is no
|
||||
@@ -234,24 +175,22 @@
|
||||
* DataGridView.cs: Fix new row adding/editing in the non-databound
|
||||
scenario.
|
||||
|
||||
2009-01-21 Neville Gao <[email protected]>
|
||||
|
||||
* ToolBar.cs: Backported r124045: Control enabled to support
|
||||
accessibility. Added UIACollectionChangedEvent.
|
||||
[Fixes Bug #455950]
|
||||
|
||||
2009-01-21 Mike Gorse <[email protected]>
|
||||
|
||||
* TrackBar.cs: Make LargeIncrement/Decrement internal so that UIA can
|
||||
use them.
|
||||
* TrackBar.cs: Backported R124116: Make LargeIncrement/Decrement
|
||||
internal so that UIA can use them.
|
||||
Added UIAValueParamChangedEvent.
|
||||
|
||||
2009-01-21 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeView.cs: In CollapseAll, set vbar to the maximum value, instead
|
||||
of trying to set as top node the highest parent of the previous top
|
||||
node. Moving to the bottom of the TreeView after a call to CollapseAll
|
||||
is exactly what .net does. This should avoid some nasty issue when
|
||||
CollapseAll is called and we don't need the vertical scroll bar.
|
||||
|
||||
2009-01-21 Mario Carrion <[email protected]>
|
||||
|
||||
* Form.cs: UIA Support: Internal events added: UIAWindowStateChanged
|
||||
and UIATopMostChanged.
|
||||
|
||||
* Form.cs: Backported r124064: UIA Support: Internal events
|
||||
added: UIAWindowStateChanged and UIATopMostChanged.
|
||||
|
||||
2009-01-21 Sandy Armstrong <[email protected]>
|
||||
|
||||
@@ -263,11 +202,6 @@
|
||||
* Menu.cs:
|
||||
* MenuAPI.cs: Note which internal APIs are being used by UIA.
|
||||
|
||||
2009-01-21 Neville Gao <[email protected]>
|
||||
|
||||
* ToolBar.cs: Control enabled to support accessibility.
|
||||
[Fixes Bug #455950]
|
||||
|
||||
2009-01-19 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeView.cs: When handling mouse up event, check whether
|
||||
|
||||
@@ -322,13 +322,9 @@ namespace System.Windows.Forms
|
||||
public int Width {
|
||||
get { return width; }
|
||||
set {
|
||||
if (width != value) {
|
||||
width = value;
|
||||
if (owner != null) {
|
||||
owner.Redraw (true);
|
||||
owner.RaiseColumnWidthChanged (this);
|
||||
}
|
||||
}
|
||||
width = value;
|
||||
if (owner != null)
|
||||
owner.Redraw (true);
|
||||
}
|
||||
}
|
||||
#endregion // Public Instance Properties
|
||||
|
||||
@@ -215,6 +215,7 @@ namespace System.Windows.Forms {
|
||||
selectionMode = DataGridViewSelectionMode.RowHeaderSelect;
|
||||
showCellErrors = true;
|
||||
showEditingIcon = true;
|
||||
scrollBars = ScrollBars.Both;
|
||||
userSetCursor = Cursor.Current;
|
||||
virtualMode = false;
|
||||
|
||||
@@ -1168,6 +1169,8 @@ namespace System.Windows.Forms {
|
||||
/// or canceled.
|
||||
///////////////////////////////////////////////////////////
|
||||
scrollBars = value;
|
||||
PerformLayout ();
|
||||
Invalidate ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4615,23 +4618,25 @@ namespace System.Windows.Forms {
|
||||
bool verticalVisible = false;
|
||||
|
||||
if (AutoSize) {
|
||||
if (gridWidth > Size.Width || gridHeight > Size.Height) {
|
||||
if (gridWidth > Size.Width || gridHeight > Size.Height)
|
||||
Size = new Size(gridWidth, gridHeight);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (gridWidth > Size.Width) {
|
||||
if (gridWidth > Size.Width)
|
||||
horizontalVisible = true;
|
||||
}
|
||||
if (gridHeight > Size.Height) {
|
||||
if (gridHeight > Size.Height)
|
||||
verticalVisible = true;
|
||||
}
|
||||
if (horizontalScrollBar.Visible && (gridHeight + horizontalScrollBar.Height) > Size.Height) {
|
||||
|
||||
if (horizontalScrollBar.Visible && (gridHeight + horizontalScrollBar.Height) > Size.Height)
|
||||
verticalVisible = true;
|
||||
}
|
||||
if (verticalScrollBar.Visible && (gridWidth + verticalScrollBar.Width) > Size.Width) {
|
||||
if (verticalScrollBar.Visible && (gridWidth + verticalScrollBar.Width) > Size.Width)
|
||||
horizontalVisible = true;
|
||||
}
|
||||
|
||||
if (scrollBars != ScrollBars.Vertical && scrollBars != ScrollBars.Both)
|
||||
verticalVisible = false;
|
||||
if (scrollBars != ScrollBars.Horizontal && scrollBars != ScrollBars.Both)
|
||||
horizontalVisible = false;
|
||||
|
||||
if (horizontalVisible) {
|
||||
horizontalScrollBar.Minimum = 0;
|
||||
horizontalScrollBar.Maximum = gridWidth;
|
||||
@@ -5033,7 +5038,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
protected bool ProcessDeleteKey (Keys keyData)
|
||||
{
|
||||
if (!allowUserToDeleteRows || SelectedRows.Count == 0)
|
||||
if (!AllowUserToDeleteRows || SelectedRows.Count == 0)
|
||||
return false;
|
||||
|
||||
int index = Math.Max (selected_row - SelectedRows.Count + 1, 0);
|
||||
@@ -5047,8 +5052,8 @@ namespace System.Windows.Forms {
|
||||
if (hover_cell != null && hover_cell.OwningRow == row)
|
||||
hover_cell = null;
|
||||
|
||||
if (DataSource != null && DataSource is DataSet)
|
||||
(DataSource as DataSet).Tables[dataMember].Rows.RemoveAt (row.Index);
|
||||
if (DataManager != null)
|
||||
DataManager.RemoveAt (row.Index);
|
||||
else
|
||||
Rows.RemoveAt (row.Index);
|
||||
}
|
||||
@@ -5889,6 +5894,18 @@ namespace System.Windows.Forms {
|
||||
RemoveEditingRow ();
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetRows ()
|
||||
{
|
||||
rows.Clear ();
|
||||
RemoveEditingRow ();
|
||||
if (DataManager != null) {
|
||||
foreach (object element in DataManager.List)
|
||||
AddBoundRow (element);
|
||||
}
|
||||
PrepareEditingRow (false, true);
|
||||
OnListPositionChanged (this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void DoBinding ()
|
||||
{
|
||||
@@ -6069,7 +6086,7 @@ namespace System.Windows.Forms {
|
||||
case ListChangedType.ItemChanged:
|
||||
break;
|
||||
default:
|
||||
ReBind ();
|
||||
ResetRows ();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -316,11 +316,11 @@ namespace System.Windows.Forms {
|
||||
return false;
|
||||
}
|
||||
set {
|
||||
bool changed = selected != value;
|
||||
selected = value;
|
||||
|
||||
if (value != ((State & DataGridViewElementStates.Selected) != 0)) {
|
||||
if (value != ((State & DataGridViewElementStates.Selected) != 0))
|
||||
SetState(State ^ DataGridViewElementStates.Selected);
|
||||
}
|
||||
|
||||
// If our row is selected, unselect it and select
|
||||
// the first cell in it that isn't us
|
||||
@@ -332,6 +332,9 @@ namespace System.Windows.Forms {
|
||||
else if (OwningRow.Cells.Count > 1)
|
||||
OwningRow.Cells[1].Selected = true;
|
||||
}
|
||||
|
||||
if (changed && DataGridView != null && DataGridView.IsHandleCreated)
|
||||
DataGridView.Invalidate ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1300,7 +1303,7 @@ namespace System.Windows.Forms {
|
||||
else
|
||||
valuex = value;
|
||||
|
||||
if (oldValue != value) {
|
||||
if (!Object.ReferenceEquals (oldValue, value) || !Object.Equals (oldValue, value)) {
|
||||
RaiseCellValueChanged (new DataGridViewCellEventArgs (ColumnIndex, RowIndex));
|
||||
|
||||
// Set this dirty flag back to false
|
||||
|
||||
@@ -1381,7 +1381,6 @@ namespace System.Windows.Forms {
|
||||
if (old_state != window_state)
|
||||
OnUIAWindowStateChanged ();
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6244,12 +6244,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
#endif
|
||||
|
||||
internal void RaiseColumnWidthChanged (ColumnHeader column)
|
||||
{
|
||||
int index = Columns.IndexOf (column);
|
||||
RaiseColumnWidthChanged (index);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
#region UIA Framework: Methods, Properties and Events
|
||||
|
||||
@@ -66,48 +66,6 @@ namespace System.Windows.Forms {
|
||||
#endif
|
||||
#endregion // Fields
|
||||
|
||||
#region UIA Framework Events
|
||||
#if NET_2_0
|
||||
static object UIAHorizontallyScrollableChangedEvent = new object ();
|
||||
|
||||
internal event EventHandler UIAHorizontallyScrollableChanged {
|
||||
add { Events.AddHandler (UIAHorizontallyScrollableChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIAHorizontallyScrollableChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal void OnUIAHorizontallyScrollableChanged (EventArgs e)
|
||||
{
|
||||
EventHandler eh
|
||||
= (EventHandler) Events [UIAHorizontallyScrollableChangedEvent];
|
||||
if (eh != null)
|
||||
eh (this, e);
|
||||
}
|
||||
|
||||
static object UIAHorizontallyScrolledEvent = new object ();
|
||||
|
||||
internal event EventHandler UIAHorizontallyScrolled {
|
||||
add { Events.AddHandler (UIAHorizontallyScrolledEvent, value); }
|
||||
remove { Events.RemoveHandler (UIAHorizontallyScrolledEvent, value); }
|
||||
}
|
||||
|
||||
internal void OnUIAHorizontallyScrolled (EventArgs e)
|
||||
{
|
||||
EventHandler eh
|
||||
= (EventHandler) Events [UIAHorizontallyScrolledEvent];
|
||||
if (eh != null)
|
||||
eh (this, e);
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
#region UIA Framework Property
|
||||
#if NET_2_0
|
||||
internal double UIAHorizontalViewSize {
|
||||
get { return LeftScrollButtonArea.Left * 100 / TabPages [TabCount - 1].TabBounds.Right; }
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
#region Public Constructors
|
||||
public TabControl ()
|
||||
{
|
||||
@@ -492,14 +450,7 @@ namespace System.Windows.Forms {
|
||||
#region Internal Properties
|
||||
internal bool ShowSlider {
|
||||
get { return show_slider; }
|
||||
set {
|
||||
show_slider = value;
|
||||
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: HorizontallyScrollable Changed
|
||||
OnUIAHorizontallyScrollableChanged (EventArgs.Empty);
|
||||
#endif
|
||||
}
|
||||
set { show_slider = value; }
|
||||
}
|
||||
|
||||
internal int SliderPos {
|
||||
@@ -969,11 +920,6 @@ namespace System.Windows.Forms {
|
||||
slider_pos++;
|
||||
SizeTabs ();
|
||||
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Horizontally Scrolled
|
||||
OnUIAHorizontallyScrolled (EventArgs.Empty);
|
||||
#endif
|
||||
|
||||
switch (this.Alignment) {
|
||||
case TabAlignment.Top:
|
||||
Invalidate (new Rectangle (0, 0, Width, ItemSize.Height));
|
||||
@@ -999,11 +945,6 @@ namespace System.Windows.Forms {
|
||||
slider_pos--;
|
||||
SizeTabs ();
|
||||
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Horizontally Scrolled
|
||||
OnUIAHorizontallyScrolled (EventArgs.Empty);
|
||||
#endif
|
||||
|
||||
switch (this.Alignment) {
|
||||
case TabAlignment.Top:
|
||||
Invalidate (new Rectangle (0, 0, Width, ItemSize.Height));
|
||||
|
||||
@@ -681,12 +681,8 @@ namespace System.Windows.Forms {
|
||||
break;
|
||||
|
||||
bool is_backspace = m.WParam.ToInt32 () == 8;
|
||||
if (!Char.IsLetterOrDigit ((char)m.WParam) && !is_backspace) {
|
||||
// Update Text and save it before returning
|
||||
base.WndProc (ref m);
|
||||
auto_complete_original_text = Text;
|
||||
return;
|
||||
}
|
||||
if (!Char.IsLetterOrDigit ((char)m.WParam) && !is_backspace)
|
||||
break;
|
||||
|
||||
if (!is_backspace)
|
||||
Text = auto_complete_original_text;
|
||||
|
||||
@@ -525,8 +525,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
private ToolBarButton button_for_focus = null;
|
||||
|
||||
internal void UIAPerformClick (ToolBarButton button)
|
||||
{
|
||||
ToolBarItem previous_item = current_item;
|
||||
@@ -547,7 +545,7 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
protected virtual void OnButtonClick (ToolBarButtonClickEventArgs e)
|
||||
{
|
||||
if (e.Button.Style == ToolBarButtonStyle.ToggleButton) {
|
||||
@@ -560,11 +558,6 @@ namespace System.Windows.Forms
|
||||
current_item.Pressed = false;
|
||||
current_item.Invalidate ();
|
||||
|
||||
#if NET_2_0
|
||||
button_for_focus = current_item.Button;
|
||||
button_for_focus.UIAHasFocus = true;
|
||||
#endif
|
||||
|
||||
ToolBarButtonClickEventHandler eh = (ToolBarButtonClickEventHandler)(Events [ButtonClickEvent]);
|
||||
if (eh != null)
|
||||
eh (this, e);
|
||||
@@ -658,12 +651,6 @@ namespace System.Windows.Forms
|
||||
#region Private Methods
|
||||
private void FocusChanged (object sender, EventArgs args)
|
||||
{
|
||||
#if NET_2_0
|
||||
if (!Focused && button_for_focus != null)
|
||||
button_for_focus.UIAHasFocus = false;
|
||||
button_for_focus = null;
|
||||
#endif
|
||||
|
||||
if (Appearance != ToolBarAppearance.Flat || Buttons.Count == 0)
|
||||
return;
|
||||
|
||||
|
||||
@@ -116,10 +116,6 @@ namespace System.Windows.Forms
|
||||
|
||||
enabled = value;
|
||||
Invalidate ();
|
||||
|
||||
#if NET_2_0
|
||||
OnEnabledChanged (EventArgs.Empty);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,60 +318,23 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
bool uiaHasFocus = false;
|
||||
internal bool UIAHasFocus {
|
||||
get { return uiaHasFocus; }
|
||||
set {
|
||||
uiaHasFocus = value;
|
||||
EventHandler eh =
|
||||
(EventHandler) (value ? Events [UIAGotFocusEvent] : Events [UIALostFocusEvent]);
|
||||
if (eh != null)
|
||||
eh (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
static object UIAGotFocusEvent = new object ();
|
||||
static object UIALostFocusEvent = new object ();
|
||||
static object UIATextChangedEvent = new object ();
|
||||
static object UIAEnabledChangedEvent = new object ();
|
||||
|
||||
internal event EventHandler UIAGotFocus {
|
||||
add { Events.AddHandler (UIAGotFocusEvent, value); }
|
||||
remove { Events.RemoveHandler (UIAGotFocusEvent, value); }
|
||||
}
|
||||
|
||||
internal event EventHandler UIALostFocus {
|
||||
add { Events.AddHandler (UIALostFocusEvent, value); }
|
||||
remove { Events.RemoveHandler (UIALostFocusEvent, value); }
|
||||
}
|
||||
|
||||
internal event EventHandler UIATextChanged {
|
||||
add { Events.AddHandler (UIATextChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIATextChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal event EventHandler UIAEnabledChanged {
|
||||
add { Events.AddHandler (UIATextChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIATextChangedEvent, value); }
|
||||
}
|
||||
|
||||
protected virtual void OnUIATextChanged(EventArgs e)
|
||||
protected virtual void OnUIATextChanged (EventArgs e)
|
||||
{
|
||||
EventHandler eh = (EventHandler)(Events [UIATextChangedEvent]);
|
||||
if (eh != null)
|
||||
eh (this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnEnabledChanged (EventArgs e)
|
||||
{
|
||||
EventHandler eh = (EventHandler)(Events [UIAEnabledChangedEvent]);
|
||||
if (eh != null)
|
||||
eh (this, e);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region methods
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
|
||||
@@ -974,9 +974,7 @@ namespace System.Windows.Forms
|
||||
this.OnPaintGrip (e);
|
||||
|
||||
// Make each item draw itself
|
||||
for (int i = 0; i < displayed_items.Count; i++) {
|
||||
ToolStripItem tsi = displayed_items[i];
|
||||
|
||||
foreach (ToolStripItem tsi in this.displayed_items) {
|
||||
if (tsi.Visible) {
|
||||
e.Graphics.TranslateTransform (tsi.Bounds.Left, tsi.Bounds.Top);
|
||||
tsi.FireEvent (e, ToolStripItemEventType.Paint);
|
||||
|
||||
@@ -214,6 +214,8 @@ namespace System.Windows.Forms
|
||||
get {
|
||||
if (prop_bag != null)
|
||||
return prop_bag.BackColor;
|
||||
if (TreeView != null)
|
||||
return TreeView.BackColor;
|
||||
return Color.Empty;
|
||||
}
|
||||
set {
|
||||
@@ -559,7 +561,7 @@ namespace System.Windows.Forms
|
||||
if (prop_bag == null)
|
||||
prop_bag = new OwnerDrawPropertyBag ();
|
||||
prop_bag.Font = value;
|
||||
Invalidate ();
|
||||
InvalidateWidth ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,7 +657,7 @@ namespace System.Windows.Forms
|
||||
if (state_image_index != value) {
|
||||
state_image_index = value;
|
||||
state_image_key = string.Empty;
|
||||
Invalidate ();
|
||||
InvalidateWidth ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -672,7 +674,7 @@ namespace System.Windows.Forms
|
||||
if (state_image_key != value) {
|
||||
state_image_key = value;
|
||||
state_image_index = -1;
|
||||
Invalidate ();
|
||||
InvalidateWidth ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -698,7 +700,7 @@ namespace System.Windows.Forms
|
||||
if (text == value)
|
||||
return;
|
||||
text = value;
|
||||
Invalidate ();
|
||||
InvalidateWidth ();
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Text Changed
|
||||
TreeView view = TreeView;
|
||||
@@ -1061,22 +1063,6 @@ namespace System.Windows.Forms
|
||||
get { return width == -1; }
|
||||
}
|
||||
|
||||
internal void Invalidate ()
|
||||
{
|
||||
// invalidate width first so Bounds retrieves
|
||||
// the updated value (we don't use it here however)
|
||||
width = -1;
|
||||
|
||||
TreeView tv = TreeView;
|
||||
if (tv == null)
|
||||
return;
|
||||
|
||||
// Use actual TreeView width to invalidate total prev/new area
|
||||
Rectangle bounds = Bounds;
|
||||
bounds.Width = tv.ClientSize.Width;
|
||||
tv.Invalidate (bounds);
|
||||
}
|
||||
|
||||
internal void InvalidateWidth ()
|
||||
{
|
||||
// bounds.Width = 0;
|
||||
|
||||
@@ -810,7 +810,7 @@ namespace System.Windows.Forms {
|
||||
root_node.CollapseAll ();
|
||||
EndUpdate ();
|
||||
|
||||
if (vbar.VisibleInternal)
|
||||
if (IsHandleCreated && vbar.VisibleInternal)
|
||||
vbar.Value = vbar.Maximum - VisibleCount + 1;
|
||||
}
|
||||
|
||||
@@ -1605,7 +1605,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
int use_index = node.Image;
|
||||
|
||||
if (use_index > -1 && use_index < ImageList.Images.Count)
|
||||
if (use_index != -1)
|
||||
ImageList.Draw (dc, x, y, ImageList.ImageSize.Width, ImageList.ImageSize.Height, use_index);
|
||||
}
|
||||
|
||||
@@ -1726,19 +1726,12 @@ namespace System.Windows.Forms {
|
||||
return;
|
||||
|
||||
r.Inflate (-1, -1);
|
||||
|
||||
if (Focused && node == highlighted_node) {
|
||||
// Use the node's BackColor if is not empty, and is not actually the selected one (yet)
|
||||
Color back_color = node != selected_node && node.BackColor != Color.Empty ? node.BackColor :
|
||||
ThemeEngine.Current.ColorHighlight;
|
||||
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (back_color), r);
|
||||
|
||||
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ThemeEngine.Current.ColorHighlight), r);
|
||||
} else if (!hide_selection && node == highlighted_node) {
|
||||
dc.FillRectangle (SystemBrushes.Control, r);
|
||||
} else {
|
||||
// If selected_node is not the current highlighted one, use the color of the TreeView
|
||||
Color back_color = node == selected_node ? BackColor : node.BackColor;
|
||||
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (back_color), r);
|
||||
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (node.BackColor), r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2190,8 +2183,6 @@ namespace System.Windows.Forms {
|
||||
|
||||
highlighted_node = focused_node;
|
||||
selected_node = focused_node;
|
||||
if (selected_node != null)
|
||||
Invalidate (selected_node.Bounds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2236,10 +2227,8 @@ namespace System.Windows.Forms {
|
||||
return;
|
||||
|
||||
Invalidate (highlighted_node.Bounds);
|
||||
if (selected_node != null)
|
||||
Invalidate (selected_node.Bounds);
|
||||
if (focused_node != null)
|
||||
Invalidate (focused_node.Bounds);
|
||||
Invalidate (selected_node.Bounds);
|
||||
Invalidate (focused_node.Bounds);
|
||||
|
||||
highlighted_node = selected_node;
|
||||
focused_node = selected_node;
|
||||
|
||||
@@ -842,11 +842,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
#endif
|
||||
|
||||
internal override void SetBoundsCoreInternal(int x, int y, int width, int height, BoundsSpecified specified)
|
||||
{
|
||||
base.SetBoundsCoreInternal (x, y, width, Math.Min (width, PreferredHeight), specified);
|
||||
}
|
||||
|
||||
protected abstract void UpdateEditText ();
|
||||
|
||||
protected virtual void ValidateEditText ()
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace System.Windows.Forms
|
||||
bool isWebBrowserContextMenuEnabled;
|
||||
object objectForScripting;
|
||||
bool webBrowserShortcutsEnabled;
|
||||
bool scrollbarsEnabled = true;
|
||||
bool scrollbarsEnabled = true;
|
||||
|
||||
WebBrowserReadyState readyState;
|
||||
|
||||
|
||||
@@ -4367,27 +4367,25 @@ namespace System.Windows.Forms {
|
||||
goto ProcessNextMessage;
|
||||
}
|
||||
|
||||
// We are already firing WM_SHOWWINDOW messages in the proper places, but I'm leaving this code
|
||||
// in case we break a scenario not taken into account in the tests
|
||||
case XEventName.MapNotify: {
|
||||
/*if (client && (xevent.ConfigureEvent.xevent == xevent.ConfigureEvent.window)) { // Ignore events for children (SubstructureNotify) and client areas
|
||||
if (client && (xevent.ConfigureEvent.xevent == xevent.ConfigureEvent.window)) { // Ignore events for children (SubstructureNotify) and client areas
|
||||
hwnd.mapped = true;
|
||||
msg.message = Msg.WM_SHOWWINDOW;
|
||||
msg.wParam = (IntPtr) 1;
|
||||
// XXX we're missing the lParam..
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
goto ProcessNextMessage;
|
||||
}
|
||||
|
||||
case XEventName.UnmapNotify: {
|
||||
/*if (client && (xevent.ConfigureEvent.xevent == xevent.ConfigureEvent.window)) { // Ignore events for children (SubstructureNotify) and client areas
|
||||
if (client && (xevent.ConfigureEvent.xevent == xevent.ConfigureEvent.window)) { // Ignore events for children (SubstructureNotify) and client areas
|
||||
hwnd.mapped = false;
|
||||
msg.message = Msg.WM_SHOWWINDOW;
|
||||
msg.wParam = (IntPtr) 0;
|
||||
// XXX we're missing the lParam..
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
goto ProcessNextMessage;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,3 @@
|
||||
2009-02-04 Mario Carrion <[email protected]>
|
||||
|
||||
* ColumnHeaderTest.cs: Testing ListView.ColumnWidthChanged when
|
||||
changing Width (for bug #467086).
|
||||
|
||||
2009-02-02 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* FormEventTest.cs: New test for VisibleChanged event (and children
|
||||
controls as well).
|
||||
|
||||
2009-01-30 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* NumericUpDownTest.cs: Add a test to check Height == PreferredHeight.
|
||||
|
||||
2009-01-19 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* ListBoxTest.cs: New test for RemoveAt and selection.
|
||||
|
||||
@@ -388,16 +388,6 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
col.Width = -2;
|
||||
Assert.IsTrue (col.Width > 0, "#2");
|
||||
|
||||
#if NET_2_0
|
||||
bool eventRaised = false;
|
||||
lv.ColumnWidthChanged += delegate (object sender, ColumnWidthChangedEventArgs e) {
|
||||
Assert.AreEqual (e.ColumnIndex, 0, "#3");
|
||||
eventRaised = true;
|
||||
};
|
||||
col.Width = 100;
|
||||
Assert.IsTrue (eventRaised, "#4");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -479,59 +479,6 @@ namespace MonoTests.System.Windows.Forms
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void VisibleChangedEvent ()
|
||||
{
|
||||
_form = new Form ();
|
||||
_form.VisibleChanged += new EventHandler (FormVisibleChangedHandler);
|
||||
|
||||
Control control1 = new Control ();
|
||||
control1.Location = new Point (5, 5);
|
||||
control1.VisibleChanged += new EventHandler (Control1VisibleChangedHandler);
|
||||
control1_visiblechanged_count = 0;
|
||||
|
||||
Assert.AreEqual (true, control1.Visible, "#A1");
|
||||
Assert.AreEqual (false, _form.Visible, "#A2");
|
||||
|
||||
// case one - change without being added to the form
|
||||
control1.Visible = false;
|
||||
Assert.AreEqual (false, control1.Visible, "#B1");
|
||||
Assert.AreEqual (1, control1_visiblechanged_count, "#B2");
|
||||
|
||||
control1.Visible = true;
|
||||
control1_visiblechanged_count = 0;
|
||||
_form.Controls.Add (control1);
|
||||
Assert.AreEqual (false, control1.Visible, "#C1");
|
||||
Assert.AreEqual (1, control1_visiblechanged_count, "#C2");
|
||||
|
||||
// Add a second control that actually is not visible
|
||||
Control control2 = new Control ();
|
||||
control2.Visible = false;
|
||||
_form.Controls.Add (control2);
|
||||
|
||||
control1_visiblechanged_count = control2_visiblechanged_count = form_visiblechanged_count = 0;
|
||||
_form.Show ();
|
||||
Assert.AreEqual (1, control1_visiblechanged_count, "#D1");
|
||||
Assert.AreEqual (0, control2_visiblechanged_count, "#D2");
|
||||
Assert.AreEqual (1, form_visiblechanged_count, "#D3");
|
||||
|
||||
_form.Dispose ();
|
||||
}
|
||||
|
||||
int control1_visiblechanged_count;
|
||||
int control2_visiblechanged_count;
|
||||
int form_visiblechanged_count;
|
||||
|
||||
void Control1VisibleChangedHandler (object o, EventArgs args)
|
||||
{
|
||||
control1_visiblechanged_count++;
|
||||
}
|
||||
|
||||
void FormVisibleChangedHandler (object o, EventArgs args)
|
||||
{
|
||||
form_visiblechanged_count++;
|
||||
}
|
||||
|
||||
class DelayedCloseForm : Form
|
||||
{
|
||||
private Timer _timer;
|
||||
|
||||
@@ -115,15 +115,6 @@ namespace MonoTests.System.Windows.Forms
|
||||
f.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Height ()
|
||||
{
|
||||
NumericUpDown nud = new NumericUpDown ();
|
||||
Assert.AreEqual (20, nud.PreferredHeight, "#1");
|
||||
nud.Height = 9999;
|
||||
Assert.AreEqual (nud.PreferredHeight, nud.Height, "#2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if NET_2_0
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
2009-02-15 Jonathan Chambers <[email protected]>
|
||||
|
||||
* Microsoft.Build.Engine_test.dll.sources: Add BuildChooseTest.cs.
|
||||
|
||||
2009-01-31 Ankit Jain <[email protected]>
|
||||
|
||||
* Microsoft.Build.Engine_test.dll.sources: Replace BatchingImpl.cs with
|
||||
BatchingImplBase.cs, TargetBatchingImpl.cs and TaskBatchingImpl.cs
|
||||
|
||||
2009-01-06 Ankit Jain <[email protected]>
|
||||
|
||||
* Microsoft.Build.Engine_test.dll.sources: Add TestMessageLogger from
|
||||
|
||||
@@ -0,0 +1,337 @@
|
||||
//
|
||||
// BatchingImpl.cs: Class that implements BatchingAlgorithm from the wiki.
|
||||
//
|
||||
// Author:
|
||||
// Marek Sieradzki ([email protected])
|
||||
// Ankit Jain ([email protected])
|
||||
//
|
||||
// (C) 2005 Marek Sieradzki
|
||||
// Copyright 2008 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.
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
using Microsoft.Build.Framework;
|
||||
|
||||
namespace Microsoft.Build.BuildEngine {
|
||||
internal class BatchingImpl {
|
||||
|
||||
string inputs;
|
||||
string outputs;
|
||||
Project project;
|
||||
|
||||
List<BuildItemGroup> consumedItemNames;
|
||||
List<MetadataReference> consumedMetadataReferences;
|
||||
List<MetadataReference> consumedQMetadataReferences;
|
||||
List<MetadataReference> consumedUQMetadataReferences;
|
||||
Dictionary<string, BuildItemGroup> batchedItemsByName;
|
||||
Dictionary<string, BuildItemGroup> commonItemsByName;
|
||||
|
||||
public BatchingImpl (Project project, XmlElement targetElement)
|
||||
{
|
||||
if (targetElement == null)
|
||||
throw new ArgumentNullException ("targetElement");
|
||||
if (project == null)
|
||||
throw new ArgumentNullException ("project");
|
||||
|
||||
this.project = project;
|
||||
|
||||
inputs = targetElement.GetAttribute ("Inputs");
|
||||
outputs = targetElement.GetAttribute ("Outputs");
|
||||
}
|
||||
|
||||
public bool BuildNeeded ()
|
||||
{
|
||||
// FIXME: change this to ITaskItem instead of string
|
||||
|
||||
Expression inputExpr, outputExpr;
|
||||
string[] inputFiles, outputFiles;
|
||||
DateTime oldestInput, youngestOutput;
|
||||
|
||||
if (inputs == String.Empty)
|
||||
return true;
|
||||
|
||||
if (outputs == String.Empty)
|
||||
return true;
|
||||
|
||||
|
||||
inputExpr = new Expression ();
|
||||
inputExpr.Parse (inputs, true);
|
||||
outputExpr = new Expression ();
|
||||
outputExpr.Parse (outputs, true);
|
||||
|
||||
inputFiles = (string[]) inputExpr.ConvertTo (project, typeof (string[]));
|
||||
outputFiles = (string[]) outputExpr.ConvertTo (project, typeof (string[]));
|
||||
|
||||
if (inputFiles == null)
|
||||
return true;
|
||||
|
||||
if (outputFiles == null)
|
||||
return true;
|
||||
|
||||
if (inputFiles.Length == 0)
|
||||
return true;
|
||||
|
||||
if (outputFiles.Length == 0)
|
||||
return true;
|
||||
|
||||
|
||||
if (File.Exists (inputFiles [0]))
|
||||
oldestInput = File.GetLastWriteTime (inputFiles [0]);
|
||||
else
|
||||
return true;
|
||||
|
||||
if (File.Exists (outputFiles [0]))
|
||||
youngestOutput = File.GetLastWriteTime (outputFiles [0]);
|
||||
else
|
||||
return true;
|
||||
|
||||
|
||||
foreach (string file in inputFiles) {
|
||||
if (file.Trim () == String.Empty)
|
||||
continue;
|
||||
|
||||
if (File.Exists (file.Trim ())) {
|
||||
if (File.GetLastWriteTime (file.Trim ()) > oldestInput)
|
||||
oldestInput = File.GetLastWriteTime (file.Trim ());
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
foreach (string file in outputFiles) {
|
||||
if (file.Trim () == String.Empty)
|
||||
continue;
|
||||
|
||||
if (File.Exists (file.Trim ())) {
|
||||
if (File.GetLastWriteTime (file.Trim ()) < youngestOutput)
|
||||
youngestOutput = File.GetLastWriteTime (file.Trim ());
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
if (oldestInput > youngestOutput)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool BatchBuildTask (BuildTask buildTask)
|
||||
{
|
||||
try {
|
||||
return BatchBuildTaskInternal (buildTask);
|
||||
} finally {
|
||||
consumedItemNames = null;
|
||||
consumedMetadataReferences = null;
|
||||
consumedQMetadataReferences = null;
|
||||
consumedUQMetadataReferences = null;
|
||||
batchedItemsByName = null;
|
||||
commonItemsByName = null;
|
||||
}
|
||||
}
|
||||
|
||||
//FIXME: Target batching
|
||||
bool BatchBuildTaskInternal (BuildTask buildTask)
|
||||
{
|
||||
// all referenced item lists
|
||||
consumedItemNames = new List<BuildItemGroup> ();
|
||||
|
||||
// all referenced metadata
|
||||
consumedMetadataReferences = new List<MetadataReference> ();
|
||||
consumedQMetadataReferences = new List<MetadataReference> ();
|
||||
consumedUQMetadataReferences = new List<MetadataReference> ();
|
||||
|
||||
// populate list of referenced items and metadata
|
||||
ParseAttributesForBatching (buildTask);
|
||||
|
||||
if (consumedMetadataReferences.Count == 0) {
|
||||
// No batching required
|
||||
if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project))
|
||||
return buildTask.Execute ();
|
||||
else // skipped, it should be logged
|
||||
return true;
|
||||
}
|
||||
|
||||
batchedItemsByName = new Dictionary<string, BuildItemGroup> ();
|
||||
|
||||
// These will passed as is for every batch
|
||||
commonItemsByName = new Dictionary<string, BuildItemGroup> ();
|
||||
|
||||
ValidateUnqualifiedMetadataReferences ();
|
||||
|
||||
if (consumedUQMetadataReferences.Count > 0) {
|
||||
// Atleast one unqualified metadata ref is found, so
|
||||
// batching will be done for all referenced item lists
|
||||
foreach (BuildItemGroup group in consumedItemNames)
|
||||
batchedItemsByName [group [0].Name] = group;
|
||||
}
|
||||
|
||||
// All items referred via qualified metadata refs will be batched
|
||||
foreach (MetadataReference mr in consumedQMetadataReferences) {
|
||||
BuildItemGroup group;
|
||||
if (project.EvaluatedItemsByName.TryGetValue (mr.ItemName, out group))
|
||||
batchedItemsByName [mr.ItemName] = group;
|
||||
}
|
||||
|
||||
// CommonItemNames = ConsumedItemNames - BatchedItemNames
|
||||
foreach (BuildItemGroup group in consumedItemNames) {
|
||||
if (!batchedItemsByName.ContainsKey (group [0].Name))
|
||||
commonItemsByName [group [0].Name] = group;
|
||||
}
|
||||
|
||||
// Bucketizing
|
||||
IEnumerable<Dictionary<string, BuildItemGroup>> buckets = Bucketize ();
|
||||
|
||||
// Run the task in batches
|
||||
bool retval = true;
|
||||
foreach (Dictionary<string, BuildItemGroup> bucket in buckets) {
|
||||
project.SetBatchedItems (bucket, commonItemsByName);
|
||||
if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project)) {
|
||||
if (! (retval = buildTask.Execute ()))
|
||||
break;
|
||||
}
|
||||
}
|
||||
project.SetBatchedItems (null, null);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Parse task attributes to get list of referenced metadata and items
|
||||
// to determine batching
|
||||
//
|
||||
void ParseAttributesForBatching (BuildTask buildTask)
|
||||
{
|
||||
foreach (XmlAttribute attrib in buildTask.TaskElement.Attributes) {
|
||||
Expression expr = new Expression ();
|
||||
expr.Parse (attrib.Value, true);
|
||||
|
||||
foreach (object o in expr.Collection) {
|
||||
MetadataReference mr = o as MetadataReference;
|
||||
if (mr != null) {
|
||||
consumedMetadataReferences.Add (mr);
|
||||
if (mr.IsQualified)
|
||||
consumedQMetadataReferences.Add (mr);
|
||||
else
|
||||
consumedUQMetadataReferences.Add (mr);
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemReference ir = o as ItemReference;
|
||||
if (ir != null) {
|
||||
BuildItemGroup group;
|
||||
if (project.EvaluatedItemsByName.TryGetValue (ir.ItemName, out group))
|
||||
consumedItemNames.Add (group);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Ensure that for every metadataReference in consumedUQMetadataReferences,
|
||||
//every item in every itemlist in consumedItemNames has a non-null value
|
||||
//for that metadata
|
||||
void ValidateUnqualifiedMetadataReferences ()
|
||||
{
|
||||
if (consumedUQMetadataReferences.Count > 0 &&
|
||||
consumedItemNames.Count == 0 &&
|
||||
consumedQMetadataReferences.Count == 0) {
|
||||
throw new Exception (String.Format (
|
||||
"Item metadata should be referenced with the item name %(ItemName.{0})",
|
||||
consumedQMetadataReferences [0].MetadataName));
|
||||
}
|
||||
|
||||
foreach (MetadataReference mr in consumedUQMetadataReferences) {
|
||||
foreach (BuildItemGroup group in consumedItemNames) {
|
||||
foreach (BuildItem item in group) {
|
||||
if (item.HasMetadata (mr.MetadataName))
|
||||
continue;
|
||||
|
||||
throw new Exception (String.Format (
|
||||
"Metadata named '{0}' not found in item named {1} in item list named {2}",
|
||||
mr.MetadataName, item.FinalItemSpec, group [0].Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IEnumerable<Dictionary<string, BuildItemGroup>> Bucketize ()
|
||||
{
|
||||
Dictionary<string, Dictionary<string, BuildItemGroup>> buckets = new Dictionary<string, Dictionary<string, BuildItemGroup>> ();
|
||||
|
||||
// For each item list represented in "BatchedItemNames", and then for each item
|
||||
// within that list, get the values for that item for each of the metadata in
|
||||
// "ConsumedMetadataReferences". In the table of metadata values, "%(MyItem.MyMetadata)"
|
||||
// would get a separate entry than "%(MyMetadata)", even though the metadata name is the same.
|
||||
|
||||
foreach (BuildItemGroup group in batchedItemsByName.Values) {
|
||||
string itemName = group [0].Name;
|
||||
foreach (BuildItem item in group) {
|
||||
StringBuilder key_sb = new StringBuilder ();
|
||||
string value = String.Empty;
|
||||
|
||||
// build the bucket key, unique set of metadata values
|
||||
foreach (MetadataReference mr in consumedMetadataReferences) {
|
||||
value = String.Empty;
|
||||
if (mr.IsQualified) {
|
||||
if (String.Compare (mr.ItemName, itemName) == 0)
|
||||
value = item.GetEvaluatedMetadata (mr.MetadataName);
|
||||
} else {
|
||||
if (item.HasMetadata (mr.MetadataName))
|
||||
value = item.GetEvaluatedMetadata (mr.MetadataName);
|
||||
}
|
||||
|
||||
key_sb.AppendFormat ("{0}.{1}:{2},",
|
||||
mr.IsQualified ? mr.ItemName : "",
|
||||
mr.MetadataName,
|
||||
value);
|
||||
}
|
||||
|
||||
// Every bucket corresponds to a unique _set_ of metadata values
|
||||
// So, every bucket would have itemGroups with same set of metadata
|
||||
// values
|
||||
|
||||
string bucket_key = key_sb.ToString ();
|
||||
Dictionary<string, BuildItemGroup> bucket;
|
||||
if (!buckets.TryGetValue (bucket_key, out bucket))
|
||||
// new bucket
|
||||
buckets [bucket_key] = bucket = new Dictionary<string, BuildItemGroup> ();
|
||||
|
||||
string itemGroup_key = item.Name;
|
||||
BuildItemGroup itemGroup;
|
||||
if (!bucket.TryGetValue (itemGroup_key, out itemGroup))
|
||||
bucket [itemGroup_key] = itemGroup = new BuildItemGroup ();
|
||||
|
||||
itemGroup.AddItem (item);
|
||||
}
|
||||
}
|
||||
|
||||
return buckets.Values;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,238 +0,0 @@
|
||||
//
|
||||
// BatchingImplBase.cs: Base class that implements BatchingAlgorithm from the wiki.
|
||||
//
|
||||
// Author:
|
||||
// Marek Sieradzki ([email protected])
|
||||
// Ankit Jain ([email protected])
|
||||
//
|
||||
// (C) 2005 Marek Sieradzki
|
||||
// Copyright 2008 Novell, Inc (http://www.novell.com)
|
||||
// Copyright 2009 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.
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
using Microsoft.Build.Framework;
|
||||
|
||||
namespace Microsoft.Build.BuildEngine {
|
||||
internal class BatchingImplBase {
|
||||
|
||||
protected Dictionary<string, BuildItemGroup> consumedItemsByName;
|
||||
protected List<MetadataReference> consumedMetadataReferences;
|
||||
protected List<MetadataReference> consumedQMetadataReferences;
|
||||
protected List<MetadataReference> consumedUQMetadataReferences;
|
||||
protected Dictionary<string, BuildItemGroup> batchedItemsByName;
|
||||
protected Dictionary<string, BuildItemGroup> commonItemsByName;
|
||||
|
||||
protected Project project;
|
||||
protected ICollection<Dictionary<string, BuildItemGroup>> buckets;
|
||||
|
||||
protected BatchingImplBase (Project project)
|
||||
{
|
||||
if (project == null)
|
||||
throw new ArgumentNullException ("project");
|
||||
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
protected void Init ()
|
||||
{
|
||||
// all referenced item lists
|
||||
consumedItemsByName = new Dictionary<string, BuildItemGroup> ();
|
||||
|
||||
// all referenced metadata
|
||||
consumedMetadataReferences = new List<MetadataReference> ();
|
||||
consumedQMetadataReferences = new List<MetadataReference> ();
|
||||
consumedUQMetadataReferences = new List<MetadataReference> ();
|
||||
}
|
||||
|
||||
protected void BatchAndPrepareBuckets ()
|
||||
{
|
||||
batchedItemsByName = new Dictionary<string, BuildItemGroup> ();
|
||||
|
||||
// These will passed as is for every batch
|
||||
commonItemsByName = new Dictionary<string, BuildItemGroup> ();
|
||||
|
||||
ValidateUnqualifiedMetadataReferences ();
|
||||
|
||||
if (consumedUQMetadataReferences.Count > 0) {
|
||||
// Atleast one unqualified metadata ref is found, so
|
||||
// batching will be done for all referenced item lists
|
||||
foreach (KeyValuePair<string, BuildItemGroup> pair in consumedItemsByName)
|
||||
batchedItemsByName [pair.Key] = pair.Value;
|
||||
}
|
||||
|
||||
// All items referred via qualified metadata refs will be batched
|
||||
foreach (MetadataReference mr in consumedQMetadataReferences) {
|
||||
BuildItemGroup group;
|
||||
if (project.TryGetEvaluatedItemByNameBatched (mr.ItemName, out group))
|
||||
batchedItemsByName [mr.ItemName] = group;
|
||||
}
|
||||
|
||||
// CommonItemNames = ConsumedItemNames - BatchedItemNames
|
||||
foreach (KeyValuePair<string, BuildItemGroup> pair in consumedItemsByName) {
|
||||
if (!batchedItemsByName.ContainsKey (pair.Key))
|
||||
commonItemsByName [pair.Key] = pair.Value;
|
||||
}
|
||||
|
||||
// Bucketizing
|
||||
buckets = Bucketize ();
|
||||
}
|
||||
|
||||
protected void ParseAttribute (string value)
|
||||
{
|
||||
Expression expr = new Expression ();
|
||||
expr.Parse (value, true);
|
||||
|
||||
foreach (object o in expr.Collection) {
|
||||
MetadataReference mr = o as MetadataReference;
|
||||
if (mr != null) {
|
||||
consumedMetadataReferences.Add (mr);
|
||||
if (mr.IsQualified)
|
||||
consumedQMetadataReferences.Add (mr);
|
||||
else
|
||||
consumedUQMetadataReferences.Add (mr);
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemReference ir = o as ItemReference;
|
||||
if (ir != null) {
|
||||
BuildItemGroup group;
|
||||
if (!project.TryGetEvaluatedItemByNameBatched (ir.ItemName, out group))
|
||||
if (!project.EvaluatedItemsByName.TryGetValue (ir.ItemName, out group))
|
||||
group = new BuildItemGroup ();
|
||||
|
||||
consumedItemsByName [ir.ItemName] = group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Ensure that for every metadataReference in consumedUQMetadataReferences,
|
||||
//every item in every itemlist in consumedItemsByName has a non-null value
|
||||
//for that metadata
|
||||
void ValidateUnqualifiedMetadataReferences ()
|
||||
{
|
||||
if (consumedUQMetadataReferences.Count > 0 &&
|
||||
consumedItemsByName.Count == 0 &&
|
||||
consumedQMetadataReferences.Count == 0) {
|
||||
throw new Exception ("Item metadata should be referenced with the item name %(ItemName.MetadataName)");
|
||||
}
|
||||
|
||||
foreach (MetadataReference mr in consumedUQMetadataReferences) {
|
||||
foreach (KeyValuePair<string, BuildItemGroup> pair in consumedItemsByName) {
|
||||
foreach (BuildItem item in pair.Value) {
|
||||
if (item.HasMetadata (mr.MetadataName))
|
||||
continue;
|
||||
|
||||
throw new Exception (String.Format (
|
||||
"Metadata named '{0}' not found in item named {1} in item list named {2}",
|
||||
mr.MetadataName, item.FinalItemSpec, pair.Key));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ICollection<Dictionary<string, BuildItemGroup>> Bucketize ()
|
||||
{
|
||||
Dictionary<string, Dictionary<string, BuildItemGroup>> buckets =
|
||||
new Dictionary<string, Dictionary<string, BuildItemGroup>> ();
|
||||
|
||||
// For each item list represented in "BatchedItemNames", and then for each item
|
||||
// within that list, get the values for that item for each of the metadata in
|
||||
// "ConsumedMetadataReferences". In the table of metadata values, "%(MyItem.MyMetadata)"
|
||||
// would get a separate entry than "%(MyMetadata)", even though the metadata name is the same.
|
||||
|
||||
foreach (KeyValuePair<string, BuildItemGroup> pair in batchedItemsByName) {
|
||||
string itemName = pair.Key;
|
||||
BuildItemGroup group = pair.Value;
|
||||
foreach (BuildItem item in group) {
|
||||
StringBuilder key_sb = new StringBuilder ();
|
||||
string value = String.Empty;
|
||||
|
||||
// build the bucket key, unique set of metadata values
|
||||
foreach (MetadataReference mr in consumedMetadataReferences) {
|
||||
value = String.Empty;
|
||||
if (mr.IsQualified) {
|
||||
if (String.Compare (mr.ItemName, itemName) == 0)
|
||||
value = item.GetEvaluatedMetadata (mr.MetadataName);
|
||||
} else {
|
||||
if (item.HasMetadata (mr.MetadataName))
|
||||
value = item.GetEvaluatedMetadata (mr.MetadataName);
|
||||
}
|
||||
|
||||
key_sb.AppendFormat ("{0}.{1}:{2},",
|
||||
mr.IsQualified ? mr.ItemName : "",
|
||||
mr.MetadataName,
|
||||
value);
|
||||
}
|
||||
|
||||
// Every bucket corresponds to a unique _set_ of metadata values
|
||||
// So, every bucket would have itemGroups with same set of metadata
|
||||
// values
|
||||
|
||||
string bucket_key = key_sb.ToString ();
|
||||
Dictionary<string, BuildItemGroup> bucket;
|
||||
if (!buckets.TryGetValue (bucket_key, out bucket))
|
||||
// new bucket
|
||||
buckets [bucket_key] = bucket = new Dictionary<string, BuildItemGroup> ();
|
||||
|
||||
string itemGroup_key = item.Name;
|
||||
BuildItemGroup itemGroup;
|
||||
if (!bucket.TryGetValue (itemGroup_key, out itemGroup))
|
||||
bucket [itemGroup_key] = itemGroup = new BuildItemGroup ();
|
||||
|
||||
itemGroup.AddItem (item);
|
||||
}
|
||||
}
|
||||
|
||||
if (buckets.Values.Count == 0) {
|
||||
// no buckets
|
||||
buckets.Add ("none", new Dictionary<string, BuildItemGroup> ());
|
||||
AddEmptyGroups (buckets);
|
||||
if (buckets ["none"].Values.Count == 0)
|
||||
buckets.Remove ("none");
|
||||
} else {
|
||||
AddEmptyGroups (buckets);
|
||||
}
|
||||
|
||||
return buckets.Values;
|
||||
}
|
||||
|
||||
void AddEmptyGroups (Dictionary<string, Dictionary<string, BuildItemGroup>> buckets)
|
||||
{
|
||||
foreach (Dictionary<string, BuildItemGroup> bucket in buckets.Values) {
|
||||
foreach (string name in batchedItemsByName.Keys) {
|
||||
BuildItemGroup group;
|
||||
if (!bucket.TryGetValue (name, out group))
|
||||
bucket [name] = new BuildItemGroup ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -59,8 +59,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
IDictionary targetOutputs)
|
||||
{
|
||||
if (String.IsNullOrEmpty (projectFileName)) {
|
||||
return engine.BuildProject (project, targetNames, targetOutputs,
|
||||
BuildSettings.DoNotResetPreviouslyBuiltTargets);
|
||||
return engine.BuildProject (project, targetNames, targetOutputs);
|
||||
} else {
|
||||
BuildPropertyGroup bpg = new BuildPropertyGroup ();
|
||||
if (globalProperties != null)
|
||||
@@ -69,7 +68,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
(string) de.Key, (string) de.Value,
|
||||
PropertyType.Global));
|
||||
return engine.BuildProjectFile (projectFileName,
|
||||
targetNames, bpg, targetOutputs, BuildSettings.DoNotResetPreviouslyBuiltTargets);
|
||||
targetNames, bpg, targetOutputs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ using Mono.XBuild.Utilities;
|
||||
namespace Microsoft.Build.BuildEngine {
|
||||
public class BuildItem {
|
||||
|
||||
List<BuildItem> child_items;
|
||||
BuildItemGroup child_items;
|
||||
XmlElement itemElement;
|
||||
string finalItemSpec;
|
||||
bool isImported;
|
||||
@@ -82,10 +82,10 @@ namespace Microsoft.Build.BuildEngine {
|
||||
unevaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
|
||||
evaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
|
||||
}
|
||||
|
||||
|
||||
internal BuildItem (XmlElement itemElement, BuildItemGroup parentItemGroup)
|
||||
{
|
||||
child_items = new List<BuildItem> ();
|
||||
child_items = new BuildItemGroup ();
|
||||
isImported = parentItemGroup.IsImported;
|
||||
unevaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
|
||||
evaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
|
||||
@@ -102,7 +102,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
isImported = parent.isImported;
|
||||
name = parent.Name;
|
||||
parent_item = parent;
|
||||
parent_item.child_items.Add (this);
|
||||
parent_item.child_items.AddItem (this);
|
||||
parent_item_group = parent.parent_item_group;
|
||||
unevaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable (parent.unevaluatedMetadata);
|
||||
evaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable (parent.evaluatedMetadata);
|
||||
@@ -169,7 +169,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
XmlNode node = itemElement [metadataName];
|
||||
itemElement.RemoveChild (node);
|
||||
}
|
||||
} else if (HasParentItem) {
|
||||
} else if (HasParent) {
|
||||
if (parent_item.child_items.Count > 1)
|
||||
SplitParentItem ();
|
||||
parent_item.RemoveMetadata (metadataName);
|
||||
@@ -198,7 +198,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
throw new ArgumentException (String.Format ("\"{0}\" is a reserved item meta-data, and cannot be modified or deleted.",
|
||||
metadataName));
|
||||
|
||||
if (treatMetadataValueAsLiteral && !HasParentItem)
|
||||
if (treatMetadataValueAsLiteral && !HasParent)
|
||||
metadataValue = Utilities.Escape (metadataValue);
|
||||
|
||||
if (FromXml) {
|
||||
@@ -209,12 +209,12 @@ namespace Microsoft.Build.BuildEngine {
|
||||
itemElement.AppendChild (element);
|
||||
} else
|
||||
element.InnerText = metadataValue;
|
||||
} else if (HasParentItem) {
|
||||
} else if (HasParent) {
|
||||
if (parent_item.child_items.Count > 1)
|
||||
SplitParentItem ();
|
||||
parent_item.SetMetadata (metadataName, metadataValue, treatMetadataValueAsLiteral);
|
||||
}
|
||||
if (FromXml || HasParentItem) {
|
||||
if (FromXml || HasParent) {
|
||||
parent_item_group.ParentProject.MarkProjectAsDirty ();
|
||||
parent_item_group.ParentProject.NeedToReevaluate ();
|
||||
}
|
||||
@@ -330,7 +330,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
{
|
||||
if (FromXml)
|
||||
itemElement.ParentNode.RemoveChild (itemElement);
|
||||
else if (HasParentItem) {
|
||||
else if (HasParent) {
|
||||
if (parent_item.child_items.Count > 1)
|
||||
SplitParentItem ();
|
||||
parent_item.Detach ();
|
||||
@@ -388,7 +388,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
parent.itemElement.ParentNode.InsertAfter (newElement, insertAfter);
|
||||
|
||||
newParent = new BuildItem (newElement, parent.parent_item_group);
|
||||
newParent.child_items.Add (child);
|
||||
newParent.child_items.AddItem (child);
|
||||
child.parent_item = newParent;
|
||||
|
||||
return newParent;
|
||||
@@ -404,7 +404,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
set {
|
||||
if (FromXml)
|
||||
itemElement.SetAttribute ("Condition", value);
|
||||
else if (!HasParentItem)
|
||||
else if (!HasParent)
|
||||
throw new InvalidOperationException ("Cannot set a condition on an object not represented by an XML element in the project file.");
|
||||
}
|
||||
}
|
||||
@@ -432,7 +432,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
get {
|
||||
if (FromXml)
|
||||
return itemElement.GetAttribute ("Include");
|
||||
else if (HasParentItem)
|
||||
else if (HasParent)
|
||||
return parent_item.Include;
|
||||
else
|
||||
return itemInclude;
|
||||
@@ -440,7 +440,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
set {
|
||||
if (FromXml)
|
||||
itemElement.SetAttribute ("Include", value);
|
||||
else if (HasParentItem) {
|
||||
else if (HasParent) {
|
||||
if (parent_item.child_items.Count > 1)
|
||||
SplitParentItem ();
|
||||
parent_item.Include = value;
|
||||
@@ -457,7 +457,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
get {
|
||||
if (FromXml)
|
||||
return itemElement.Name;
|
||||
else if (HasParentItem)
|
||||
else if (HasParent)
|
||||
return parent_item.Name;
|
||||
else
|
||||
return name;
|
||||
@@ -471,7 +471,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
newElement.AppendChild (xe.Clone ());
|
||||
itemElement.ParentNode.ReplaceChild (newElement, itemElement);
|
||||
itemElement = newElement;
|
||||
} else if (HasParentItem) {
|
||||
} else if (HasParent) {
|
||||
if (parent_item.child_items.Count > 1)
|
||||
SplitParentItem ();
|
||||
parent_item.Name = value;
|
||||
@@ -484,7 +484,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
get { return itemElement != null; }
|
||||
}
|
||||
|
||||
internal bool HasParentItem {
|
||||
internal bool HasParent {
|
||||
get { return parent_item != null; }
|
||||
}
|
||||
|
||||
@@ -494,7 +494,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
internal BuildItemGroup ParentItemGroup {
|
||||
get { return parent_item_group; }
|
||||
set { parent_item_group = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,12 +49,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
: this (null, null, null, false)
|
||||
{
|
||||
}
|
||||
|
||||
internal BuildItemGroup (Project project)
|
||||
: this (null, project, null, false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
internal BuildItemGroup (XmlElement xmlElement, Project project, ImportedProject importedProject, bool readOnly)
|
||||
{
|
||||
this.buildItems = new List <BuildItem> ();
|
||||
@@ -100,7 +95,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
item = new BuildItem (element, this);
|
||||
} else {
|
||||
item = new BuildItem (itemName, itemInclude);
|
||||
item.ParentItemGroup = this;
|
||||
}
|
||||
|
||||
item.Evaluate (null, true);
|
||||
@@ -181,7 +175,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
{
|
||||
BuildItem buildItem;
|
||||
buildItem = new BuildItem (name, taskItem);
|
||||
buildItem.ParentItemGroup = this;
|
||||
buildItems.Add (buildItem);
|
||||
}
|
||||
|
||||
@@ -276,11 +269,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
internal Project ParentProject {
|
||||
get { return parentProject; }
|
||||
set {
|
||||
if (parentProject != null)
|
||||
throw new InvalidOperationException ("parentProject is already set");
|
||||
parentProject = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool FromXml {
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
this.propertyType = PropertyType.Normal;
|
||||
this.parentProject = parentProject;
|
||||
this.name = propertyElement.Name;
|
||||
this.value = propertyElement.InnerXml;
|
||||
this.value = propertyElement.InnerText;
|
||||
this.isImported = false;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
set {
|
||||
this.@value = value;
|
||||
if (FromXml) {
|
||||
propertyElement.InnerXml = value;
|
||||
propertyElement.InnerText = value;
|
||||
} else {
|
||||
finalValue = value;
|
||||
}
|
||||
|
||||
@@ -1,52 +1,3 @@
|
||||
2009-02-12 Jonathan Chambers <[email protected]>
|
||||
|
||||
* BuildProperty.cs: Value corresponds to XmlElement.InnerXml
|
||||
no XmlElement.InnerText. This allows properties to be additional
|
||||
xml elements.
|
||||
|
||||
2009-02-01 Ankit Jain <[email protected]>
|
||||
|
||||
* BuildEngine.cs (BuildProjectFile): Use
|
||||
BuildSettings.DoNotResetPreviouslyBuiltTargets for building projects.
|
||||
* Engine.cs (BuiltTargetsOutputByName): New. Table of targets already
|
||||
built. Move logging of project start/finish to ..
|
||||
* Project.cs: .. here. Build a target only if hasn't been built already.
|
||||
Keep track of target outputs, and return those even if an already built
|
||||
target has been invoked again.
|
||||
Honor BuildSettings.None and DoNotResetPreviouslyBuiltTargets .
|
||||
|
||||
2009-01-31 Ankit Jain <[email protected]>
|
||||
|
||||
* BatchingImpl.cs: Split into ..
|
||||
* BatchingImplBase.cs: .. this,
|
||||
* TaskBatchingImpl.cs: .. this ..
|
||||
* TargetBatchingImpl.cs: .. and this. Implement target batching here.
|
||||
|
||||
* Target.cs (DoBuild): Use TargetBatchingImpl for building.
|
||||
(Log*): Move to TargetBatchingImpl .
|
||||
(BuildTasks): New.
|
||||
(Engine): New.
|
||||
|
||||
2009-01-30 Ankit Jain <[email protected]>
|
||||
|
||||
* TaskEngine.cs (GetObjectFromString): Empty value is allowed only for
|
||||
arrays.
|
||||
|
||||
2009-01-29 Ankit Jain <[email protected]>
|
||||
|
||||
* BuildItem.cs (child_items): Change type from BuildItemGroup to
|
||||
List<BuildItem>.
|
||||
(HasParent): Rename to ..
|
||||
(HasParentItem): .. this.
|
||||
(ParentItemGroup): Add setter.
|
||||
|
||||
* BuildItemGroup.cs (.ctor): Add overload with @project param.
|
||||
(AddNewItem):
|
||||
(AddItem): Correctly set the ParentItemGroup for new build items.
|
||||
(ParentProject): Add setter.
|
||||
* Project.cs: Set the project for new BuildItemGroup instances.
|
||||
* TaskEngine.cs (PublishItemGroup): Likewise.
|
||||
|
||||
2009-01-06 Ankit Jain <[email protected]>
|
||||
|
||||
* Project.cs (Build): Honor InitialTargets list.
|
||||
|
||||
@@ -49,7 +49,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
List <ILogger> loggers;
|
||||
//bool onlyLogCriticalEvents;
|
||||
Dictionary <string, Project> projects;
|
||||
Dictionary <string, ITaskItem[]> builtTargetsOutputByName;
|
||||
|
||||
static Engine globalEngine;
|
||||
static Version version;
|
||||
@@ -75,7 +74,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
this.loggers = new List <ILogger> ();
|
||||
this.buildStarted = false;
|
||||
this.globalProperties = new BuildPropertyGroup ();
|
||||
this.builtTargetsOutputByName = new Dictionary<string, ITaskItem[]> ();
|
||||
|
||||
RegisterDefaultTasks ();
|
||||
}
|
||||
@@ -119,13 +117,21 @@ namespace Microsoft.Build.BuildEngine {
|
||||
IDictionary targetOutputs,
|
||||
BuildSettings buildFlags)
|
||||
{
|
||||
bool result;
|
||||
if (project == null)
|
||||
throw new ArgumentException ("project");
|
||||
if (targetNames == null)
|
||||
return false;
|
||||
|
||||
StartBuild ();
|
||||
return project.Build (targetNames, targetOutputs, buildFlags);
|
||||
|
||||
LogProjectStarted (project, targetNames);
|
||||
|
||||
result = project.Build (targetNames, targetOutputs);
|
||||
|
||||
LogProjectFinished (project, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
@@ -172,18 +178,25 @@ namespace Microsoft.Build.BuildEngine {
|
||||
IDictionary targetOutputs,
|
||||
BuildSettings buildFlags)
|
||||
{
|
||||
bool result;
|
||||
Project project;
|
||||
|
||||
StartBuild ();
|
||||
|
||||
if (projects.ContainsKey (projectFile)) {
|
||||
project = (Project) projects [projectFile];
|
||||
LogProjectStarted (project, targetNames);
|
||||
result = project.Build (targetNames, targetOutputs);
|
||||
} else {
|
||||
project = CreateNewProject ();
|
||||
project.Load (projectFile);
|
||||
LogProjectStarted (project, targetNames);
|
||||
result = project.Build (targetNames, targetOutputs);
|
||||
}
|
||||
|
||||
return project.Build (targetNames, targetOutputs, buildFlags);
|
||||
LogProjectFinished (project, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void CheckBinPath ()
|
||||
@@ -275,6 +288,28 @@ namespace Microsoft.Build.BuildEngine {
|
||||
}
|
||||
}
|
||||
|
||||
void LogProjectStarted (Project project, string [] targetNames)
|
||||
{
|
||||
ProjectStartedEventArgs psea;
|
||||
if (targetNames == null || targetNames.Length == 0) {
|
||||
if (project.DefaultTargets != String.Empty)
|
||||
psea = new ProjectStartedEventArgs ("Project started.", null, project.FullFileName,
|
||||
project.DefaultTargets, null, null);
|
||||
else
|
||||
psea = new ProjectStartedEventArgs ("Project started.", null, project.FullFileName, "default", null, null);
|
||||
} else
|
||||
psea = new ProjectStartedEventArgs ("Project started.", null, project.FullFileName, String.Join (";",
|
||||
targetNames), null, null);
|
||||
eventSource.FireProjectStarted (this, psea);
|
||||
}
|
||||
|
||||
void LogProjectFinished (Project project, bool succeeded)
|
||||
{
|
||||
ProjectFinishedEventArgs pfea;
|
||||
pfea = new ProjectFinishedEventArgs ("Project started.", null, project.FullFileName, succeeded);
|
||||
eventSource.FireProjectFinished (this, pfea);
|
||||
}
|
||||
|
||||
void LogBuildStarted ()
|
||||
{
|
||||
BuildStartedEventArgs bsea;
|
||||
@@ -350,10 +385,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
internal TaskDatabase DefaultTasks {
|
||||
get { return defaultTasks; }
|
||||
}
|
||||
|
||||
internal Dictionary<string, ITaskItem[]> BuiltTargetsOutputByName {
|
||||
get { return builtTargetsOutputByName; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
XmlDocument xmlDocument;
|
||||
bool unloaded;
|
||||
bool initialTargetsBuilt;
|
||||
List<string> builtTargetKeys;
|
||||
|
||||
static XmlNamespaceManager manager;
|
||||
static string ns = "http://schemas.microsoft.com/developer/msbuild/2003";
|
||||
@@ -252,26 +251,10 @@ namespace Microsoft.Build.BuildEngine {
|
||||
IDictionary targetOutputs,
|
||||
BuildSettings buildFlags)
|
||||
|
||||
{
|
||||
bool result = false;
|
||||
LogProjectStarted (targetNames);
|
||||
try {
|
||||
result = BuildInternal (targetNames, targetOutputs, buildFlags);
|
||||
} finally {
|
||||
LogProjectFinished (result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool BuildInternal (string [] targetNames,
|
||||
IDictionary targetOutputs,
|
||||
BuildSettings buildFlags)
|
||||
{
|
||||
CheckUnloaded ();
|
||||
ParentEngine.StartBuild ();
|
||||
if (buildFlags == BuildSettings.None)
|
||||
Reevaluate ();
|
||||
NeedToReevaluate ();
|
||||
|
||||
if (targetNames == null || targetNames.Length == 0) {
|
||||
if (defaultTargets != null && defaultTargets.Length != 0)
|
||||
@@ -308,20 +291,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
return false;
|
||||
}
|
||||
|
||||
string key = fullFileName + ":" + target;
|
||||
ITaskItem[] outputs;
|
||||
if (ParentEngine.BuiltTargetsOutputByName.TryGetValue (key, out outputs)) {
|
||||
if (targetOutputs != null)
|
||||
targetOutputs.Add (target, outputs);
|
||||
LogTargetSkipped ();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!targets [target].Build ())
|
||||
return false;
|
||||
|
||||
ParentEngine.BuiltTargetsOutputByName [key] = (ITaskItem[]) targets [target].Outputs.Clone ();
|
||||
builtTargetKeys.Add (key);
|
||||
if (targetOutputs != null)
|
||||
targetOutputs.Add (target, targets [target].Outputs);
|
||||
|
||||
@@ -347,7 +319,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (evaluatedItemsByName.ContainsKey (itemName))
|
||||
return evaluatedItemsByName [itemName];
|
||||
else
|
||||
return new BuildItemGroup (this);
|
||||
return new BuildItemGroup ();
|
||||
}
|
||||
|
||||
public BuildItemGroup GetEvaluatedItemsByNameIgnoringCondition (string itemName)
|
||||
@@ -360,7 +332,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (evaluatedItemsByNameIgnoringCondition.ContainsKey (itemName))
|
||||
return evaluatedItemsByNameIgnoringCondition [itemName];
|
||||
else
|
||||
return new BuildItemGroup (this);
|
||||
return new BuildItemGroup ();
|
||||
}
|
||||
|
||||
public string GetEvaluatedProperty (string propertyName)
|
||||
@@ -454,7 +426,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (itemToRemove == null)
|
||||
throw new ArgumentNullException ("itemToRemove");
|
||||
|
||||
if (!itemToRemove.FromXml && !itemToRemove.HasParentItem)
|
||||
if (!itemToRemove.FromXml && !itemToRemove.HasParent)
|
||||
throw new InvalidOperationException ("The object passed in is not part of the project.");
|
||||
|
||||
BuildItemGroup big = itemToRemove.ParentItemGroup;
|
||||
@@ -522,7 +494,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
[MonoTODO]
|
||||
public void ResetBuildStatus ()
|
||||
{
|
||||
Reevaluate ();
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void Save (string projectFileName)
|
||||
@@ -790,7 +762,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
evaluatedItemsByName = new Dictionary <string, BuildItemGroup> (StringComparer.InvariantCultureIgnoreCase);
|
||||
evaluatedItemsByNameIgnoringCondition = new Dictionary <string, BuildItemGroup> (StringComparer.InvariantCultureIgnoreCase);
|
||||
evaluatedProperties = new BuildPropertyGroup (null, null, null, true);
|
||||
RemoveBuiltTargets ();
|
||||
|
||||
InitializeProperties ();
|
||||
|
||||
@@ -801,16 +772,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
usingTask.Evaluate ();
|
||||
}
|
||||
|
||||
// Removes entries of all earlier built targets for this project
|
||||
void RemoveBuiltTargets ()
|
||||
{
|
||||
if (builtTargetKeys != null)
|
||||
foreach (string key in builtTargetKeys)
|
||||
ParentEngine.BuiltTargetsOutputByName.Remove (key);
|
||||
|
||||
builtTargetKeys = new List<string> ();
|
||||
}
|
||||
|
||||
void InitializeProperties ()
|
||||
{
|
||||
BuildProperty bp;
|
||||
@@ -1034,15 +995,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
return default (T);
|
||||
}
|
||||
|
||||
void LogTargetSkipped ()
|
||||
{
|
||||
BuildMessageEventArgs bmea;
|
||||
bmea = new BuildMessageEventArgs ("Target {0} skipped, as it has already been built.",
|
||||
null, null, MessageImportance.Low);
|
||||
|
||||
ParentEngine.EventSource.FireMessageRaised (this, bmea);
|
||||
}
|
||||
|
||||
public BuildPropertyGroup EvaluatedProperties {
|
||||
get {
|
||||
if (needToReevaluate) {
|
||||
@@ -1155,29 +1107,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
internal static string XmlNamespace {
|
||||
get { return ns; }
|
||||
}
|
||||
|
||||
void LogProjectStarted (string [] targetNames)
|
||||
{
|
||||
ProjectStartedEventArgs psea;
|
||||
if (targetNames == null || targetNames.Length == 0) {
|
||||
if (DefaultTargets != String.Empty)
|
||||
psea = new ProjectStartedEventArgs ("Project started.", null, FullFileName,
|
||||
DefaultTargets, null, null);
|
||||
else
|
||||
psea = new ProjectStartedEventArgs ("Project started.", null, FullFileName, "default", null, null);
|
||||
} else
|
||||
psea = new ProjectStartedEventArgs ("Project started.", null, FullFileName, String.Join (";",
|
||||
targetNames), null, null);
|
||||
ParentEngine.EventSource.FireProjectStarted (this, psea);
|
||||
}
|
||||
|
||||
void LogProjectFinished (bool succeeded)
|
||||
{
|
||||
ProjectFinishedEventArgs pfea;
|
||||
pfea = new ProjectFinishedEventArgs ("Project started.", null, FullFileName, succeeded);
|
||||
ParentEngine.EventSource.FireProjectFinished (this, pfea);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ using Microsoft.Build.Utilities;
|
||||
namespace Microsoft.Build.BuildEngine {
|
||||
public class Target : IEnumerable {
|
||||
|
||||
TargetBatchingImpl batchingImpl;
|
||||
BatchingImpl batchingImpl;
|
||||
BuildState buildState;
|
||||
Engine engine;
|
||||
ImportedProject importedProject;
|
||||
@@ -64,7 +64,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
this.onErrorElements = new List <XmlElement> ();
|
||||
this.buildState = BuildState.NotStarted;
|
||||
this.buildTasks = new List <BuildTask> ();
|
||||
this.batchingImpl = new TargetBatchingImpl (project, this.targetElement);
|
||||
this.batchingImpl = new BatchingImpl (project, this.targetElement);
|
||||
|
||||
bool onErrorFound = false;
|
||||
foreach (XmlNode xn in targetElement.ChildNodes) {
|
||||
@@ -171,16 +171,26 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
bool DoBuild ()
|
||||
{
|
||||
bool executeOnErrors;
|
||||
bool executeOnErrors = false;
|
||||
bool result = true;
|
||||
|
||||
try {
|
||||
result = batchingImpl.Build (this, out executeOnErrors);
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine (e.ToString ());
|
||||
throw;
|
||||
LogTargetStarted ();
|
||||
|
||||
if (batchingImpl.BuildNeeded ()) {
|
||||
foreach (BuildTask bt in buildTasks) {
|
||||
result = batchingImpl.BatchBuildTask (bt);
|
||||
|
||||
if (!result && !bt.ContinueOnError) {
|
||||
executeOnErrors = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LogTargetSkipped ();
|
||||
}
|
||||
|
||||
LogTargetFinished (result);
|
||||
|
||||
if (executeOnErrors == true)
|
||||
ExecuteOnErrors ();
|
||||
|
||||
@@ -199,6 +209,29 @@ namespace Microsoft.Build.BuildEngine {
|
||||
}
|
||||
}
|
||||
|
||||
void LogTargetSkipped ()
|
||||
{
|
||||
BuildMessageEventArgs bmea;
|
||||
bmea = new BuildMessageEventArgs (String.Format ("Skipping target \"{0}\" because its outputs are up-to-date.",
|
||||
name), null, "MSBuild", MessageImportance.Normal);
|
||||
engine.EventSource.FireMessageRaised (this, bmea);
|
||||
}
|
||||
|
||||
void LogTargetStarted ()
|
||||
{
|
||||
TargetStartedEventArgs tsea;
|
||||
string projectFile = project.FullFileName;
|
||||
tsea = new TargetStartedEventArgs (String.Format ("Target {0} started.", name), null, name, projectFile, null);
|
||||
engine.EventSource.FireTargetStarted (this, tsea);
|
||||
}
|
||||
|
||||
void LogTargetFinished (bool succeeded)
|
||||
{
|
||||
TargetFinishedEventArgs tfea;
|
||||
string projectFile = project.FullFileName;
|
||||
tfea = new TargetFinishedEventArgs (String.Format ("Target {0} finished.", name), null, name, projectFile, null, succeeded);
|
||||
engine.EventSource.FireTargetFinished (this, tfea);
|
||||
}
|
||||
|
||||
public string Condition {
|
||||
get { return targetElement.GetAttribute ("Condition"); }
|
||||
@@ -221,14 +254,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
internal Project Project {
|
||||
get { return project; }
|
||||
}
|
||||
|
||||
internal List<BuildTask> BuildTasks {
|
||||
get { return buildTasks; }
|
||||
}
|
||||
|
||||
internal Engine Engine {
|
||||
get { return engine; }
|
||||
}
|
||||
|
||||
internal BuildState BuildState {
|
||||
get { return buildState; }
|
||||
|
||||
@@ -1,262 +0,0 @@
|
||||
//
|
||||
// TargetBatchingImpl.cs: Class that implements Target Batching Algorithm from the wiki.
|
||||
//
|
||||
// Author:
|
||||
// Marek Sieradzki ([email protected])
|
||||
// Ankit Jain ([email protected])
|
||||
//
|
||||
// (C) 2005 Marek Sieradzki
|
||||
// Copyright 2008 Novell, Inc (http://www.novell.com)
|
||||
// Copyright 2009 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.
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
|
||||
using Microsoft.Build.Framework;
|
||||
|
||||
namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
internal class TargetBatchingImpl : BatchingImplBase
|
||||
{
|
||||
string inputs;
|
||||
string outputs;
|
||||
|
||||
public TargetBatchingImpl (Project project, XmlElement targetElement)
|
||||
: base (project)
|
||||
{
|
||||
if (targetElement == null)
|
||||
throw new ArgumentNullException ("targetElement");
|
||||
|
||||
inputs = targetElement.GetAttribute ("Inputs");
|
||||
outputs = targetElement.GetAttribute ("Outputs");
|
||||
}
|
||||
|
||||
public bool Build (Target target, out bool executeOnErrors)
|
||||
{
|
||||
executeOnErrors = false;
|
||||
try {
|
||||
if (!BuildTargetNeeded ()) {
|
||||
LogTargetStarted (target);
|
||||
LogTargetSkipped (target);
|
||||
LogTargetFinished (target, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
Init ();
|
||||
|
||||
ParseTargetAttributes (target);
|
||||
BatchAndPrepareBuckets ();
|
||||
return Run (target, out executeOnErrors);
|
||||
} finally {
|
||||
consumedItemsByName = null;
|
||||
consumedMetadataReferences = null;
|
||||
consumedQMetadataReferences = null;
|
||||
consumedUQMetadataReferences = null;
|
||||
batchedItemsByName = null;
|
||||
commonItemsByName = null;
|
||||
}
|
||||
}
|
||||
|
||||
bool Run (Target target, out bool executeOnErrors)
|
||||
{
|
||||
executeOnErrors = false;
|
||||
if (buckets.Count > 0)
|
||||
return RunBatched (target, out executeOnErrors);
|
||||
else
|
||||
return RunUnbatched (target, out executeOnErrors);
|
||||
}
|
||||
|
||||
bool RunBatched (Target target, out bool executeOnErrors)
|
||||
{
|
||||
bool result = true;
|
||||
executeOnErrors = false;
|
||||
foreach (Dictionary<string, BuildItemGroup> bucket in buckets) {
|
||||
LogTargetStarted (target);
|
||||
try {
|
||||
project.SetBatchedItems (bucket, commonItemsByName);
|
||||
if (!BuildTargetNeeded ()) {
|
||||
LogTargetSkipped (target);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int i = 0; i < target.BuildTasks.Count; i ++) {
|
||||
//required setting here, as batchtask.Run resets
|
||||
//these to null before returning!
|
||||
project.SetBatchedItems (bucket, commonItemsByName);
|
||||
|
||||
//FIXME: parsing attributes repeatedly
|
||||
BuildTask task = target.BuildTasks [i];
|
||||
result = new TaskBatchingImpl (project).Build (task, out executeOnErrors);
|
||||
if (!result && !task.ContinueOnError) {
|
||||
executeOnErrors = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
LogTargetFinished (target, result);
|
||||
}
|
||||
}
|
||||
project.SetBatchedItems (null, null);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool RunUnbatched (Target target, out bool executeOnErrors)
|
||||
{
|
||||
bool result = true;
|
||||
executeOnErrors = false;
|
||||
LogTargetStarted (target);
|
||||
try {
|
||||
if (!BuildTargetNeeded ()) {
|
||||
LogTargetSkipped (target);
|
||||
LogTargetFinished (target, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (BuildTask bt in target.BuildTasks) {
|
||||
TaskBatchingImpl batchingImpl = new TaskBatchingImpl (project);
|
||||
result = batchingImpl.Build (bt, out executeOnErrors);
|
||||
|
||||
if (!result && !bt.ContinueOnError) {
|
||||
executeOnErrors = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
LogTargetFinished (target, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Parse target's Input and Output attributes to get list of referenced
|
||||
// metadata and items to determine batching
|
||||
void ParseTargetAttributes (Target target)
|
||||
{
|
||||
if (!String.IsNullOrEmpty (inputs))
|
||||
ParseAttribute (inputs);
|
||||
|
||||
if (!String.IsNullOrEmpty (outputs))
|
||||
ParseAttribute (outputs);
|
||||
}
|
||||
|
||||
bool BuildTargetNeeded ()
|
||||
{
|
||||
ITaskItem [] inputFiles;
|
||||
ITaskItem [] outputFiles;
|
||||
DateTime oldestInput, youngestOutput;
|
||||
|
||||
if (String.IsNullOrEmpty (inputs.Trim ()))
|
||||
return true;
|
||||
|
||||
if (String.IsNullOrEmpty (outputs.Trim ()))
|
||||
return true;
|
||||
|
||||
Expression e = new Expression ();
|
||||
e.Parse (inputs, true);
|
||||
inputFiles = (ITaskItem[]) e.ConvertTo (project, typeof (ITaskItem[]));
|
||||
|
||||
e = new Expression ();
|
||||
e.Parse (outputs, true);
|
||||
outputFiles = (ITaskItem[]) e.ConvertTo (project, typeof (ITaskItem[]));
|
||||
|
||||
if (inputFiles == null || inputFiles.Length == 0)
|
||||
return false;
|
||||
|
||||
//FIXME: if input specified, then output must also
|
||||
// be there, add tests and confirm
|
||||
if (outputFiles == null || outputFiles.Length == 0)
|
||||
return false;
|
||||
|
||||
if (File.Exists (inputFiles [0].ItemSpec))
|
||||
oldestInput = File.GetLastWriteTime (inputFiles [0].ItemSpec);
|
||||
else
|
||||
return true;
|
||||
|
||||
if (File.Exists (outputFiles [0].ItemSpec))
|
||||
youngestOutput = File.GetLastWriteTime (outputFiles [0].ItemSpec);
|
||||
else
|
||||
return true;
|
||||
|
||||
foreach (ITaskItem item in inputFiles) {
|
||||
string file = item.ItemSpec;
|
||||
if (file.Trim () == String.Empty)
|
||||
continue;
|
||||
|
||||
if (File.Exists (file.Trim ())) {
|
||||
if (File.GetLastWriteTime (file.Trim ()) > oldestInput)
|
||||
oldestInput = File.GetLastWriteTime (file.Trim ());
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ITaskItem item in outputFiles) {
|
||||
string file = item.ItemSpec;
|
||||
if (file.Trim () == String.Empty)
|
||||
continue;
|
||||
|
||||
if (File.Exists (file.Trim ())) {
|
||||
if (File.GetLastWriteTime (file.Trim ()) < youngestOutput)
|
||||
youngestOutput = File.GetLastWriteTime (file.Trim ());
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
if (oldestInput > youngestOutput)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void LogTargetSkipped (Target target)
|
||||
{
|
||||
BuildMessageEventArgs bmea;
|
||||
bmea = new BuildMessageEventArgs (String.Format ("Skipping target \"{0}\" because its outputs are up-to-date.",
|
||||
target.Name), null, "MSBuild", MessageImportance.Normal);
|
||||
target.Engine.EventSource.FireMessageRaised (this, bmea);
|
||||
}
|
||||
|
||||
void LogTargetStarted (Target target)
|
||||
{
|
||||
TargetStartedEventArgs tsea;
|
||||
string projectFile = project.FullFileName;
|
||||
tsea = new TargetStartedEventArgs (String.Format ("Target {0} started.", target.Name), null, target.Name, projectFile, null);
|
||||
target.Engine.EventSource.FireTargetStarted (this, tsea);
|
||||
}
|
||||
|
||||
void LogTargetFinished (Target target, bool succeeded)
|
||||
{
|
||||
TargetFinishedEventArgs tfea;
|
||||
string projectFile = project.FullFileName;
|
||||
tfea = new TargetFinishedEventArgs (String.Format ("Target {0} finished.", target.Name), null, target.Name, projectFile, null, succeeded);
|
||||
target.Engine.EventSource.FireTargetFinished (this, tfea);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,104 +0,0 @@
|
||||
//
|
||||
// TaskBatchingImpl.cs: Class that implements Task Batching Algorithm from the wiki.
|
||||
//
|
||||
// Author:
|
||||
// Marek Sieradzki ([email protected])
|
||||
// Ankit Jain ([email protected])
|
||||
//
|
||||
// (C) 2005 Marek Sieradzki
|
||||
// Copyright 2008 Novell, Inc (http://www.novell.com)
|
||||
// Copyright 2009 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.
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
|
||||
namespace Microsoft.Build.BuildEngine {
|
||||
internal class TaskBatchingImpl : BatchingImplBase
|
||||
{
|
||||
public TaskBatchingImpl (Project project)
|
||||
: base (project)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Build (BuildTask buildTask, out bool executeOnErrors)
|
||||
{
|
||||
executeOnErrors = false;
|
||||
try {
|
||||
Init ();
|
||||
|
||||
// populate list of referenced items and metadata
|
||||
ParseTaskAttributes (buildTask);
|
||||
if (consumedMetadataReferences.Count == 0) {
|
||||
// No batching required
|
||||
if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project))
|
||||
return buildTask.Execute ();
|
||||
else // skipped, it should be logged
|
||||
return true;
|
||||
}
|
||||
|
||||
BatchAndPrepareBuckets ();
|
||||
return Run (buildTask, out executeOnErrors);
|
||||
} finally {
|
||||
consumedItemsByName = null;
|
||||
consumedMetadataReferences = null;
|
||||
consumedQMetadataReferences = null;
|
||||
consumedUQMetadataReferences = null;
|
||||
batchedItemsByName = null;
|
||||
commonItemsByName = null;
|
||||
}
|
||||
}
|
||||
|
||||
bool Run (BuildTask buildTask, out bool executeOnErrors)
|
||||
{
|
||||
executeOnErrors = false;
|
||||
|
||||
// Run the task in batches
|
||||
bool retval = true;
|
||||
foreach (Dictionary<string, BuildItemGroup> bucket in buckets) {
|
||||
project.SetBatchedItems (bucket, commonItemsByName);
|
||||
if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project)) {
|
||||
if (! (retval = buildTask.Execute ()))
|
||||
break;
|
||||
}
|
||||
}
|
||||
project.SetBatchedItems (null, null);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
// Parse task attributes to get list of referenced metadata and items
|
||||
// to determine batching
|
||||
//
|
||||
void ParseTaskAttributes (BuildTask buildTask)
|
||||
{
|
||||
foreach (XmlAttribute attrib in buildTask.TaskElement.Attributes)
|
||||
ParseAttribute (attrib.Value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -162,7 +162,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
string itemName)
|
||||
{
|
||||
BuildItemGroup newItems = ChangeType.ToBuildItemGroup (o, propertyInfo.PropertyType, itemName);
|
||||
newItems.ParentProject = parentProject;
|
||||
|
||||
if (parentProject.EvaluatedItemsByName.ContainsKey (itemName)) {
|
||||
BuildItemGroup big = parentProject.EvaluatedItemsByName [itemName];
|
||||
@@ -182,11 +181,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
e = new Expression ();
|
||||
e.Parse (raw, true);
|
||||
|
||||
// Empty contents allowed only for arrays
|
||||
// See TestRequiredTask_*
|
||||
if (!type.IsArray &&
|
||||
(string) e.ConvertTo (parentProject, typeof (string)) == String.Empty)
|
||||
|
||||
if ((string) e.ConvertTo (parentProject, typeof (string)) == String.Empty)
|
||||
return null;
|
||||
|
||||
result = e.ConvertTo (parentProject, type);
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
Assembly/AssemblyInfo.cs
|
||||
../Microsoft.Build.Framework/Mono.XBuild.Framework/AssemblyLoadInfo.cs
|
||||
../Microsoft.Build.Utilities/Mono.XBuild.Utilities/ReservedNameUtils.cs
|
||||
Microsoft.Build.BuildEngine/BatchingImplBase.cs
|
||||
Microsoft.Build.BuildEngine/TargetBatchingImpl.cs
|
||||
Microsoft.Build.BuildEngine/TaskBatchingImpl.cs
|
||||
Microsoft.Build.BuildEngine/BatchingImpl.cs
|
||||
Microsoft.Build.BuildEngine/BuildChoose.cs
|
||||
Microsoft.Build.BuildEngine/BuildEngine.cs
|
||||
Microsoft.Build.BuildEngine/BuildItem.cs
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
Microsoft.Build.BuildEngine/BuildChooseTest.cs
|
||||
Microsoft.Build.BuildEngine/BuildItemGroupCollectionTest.cs
|
||||
Microsoft.Build.BuildEngine/BuildItemGroupTest.cs
|
||||
Microsoft.Build.BuildEngine/BuildItemTest.cs
|
||||
|
||||
@@ -1,287 +0,0 @@
|
||||
//
|
||||
// BuildChoose.cs
|
||||
//
|
||||
// Author:
|
||||
// Jonathan Chambers ([email protected])
|
||||
//
|
||||
// (C) 2009 Jonathan Chambers
|
||||
//
|
||||
// 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;
|
||||
using Microsoft.Build.BuildEngine;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
[TestFixture]
|
||||
public class BuildChooseTest {
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void TestEmptyWhen () {
|
||||
Engine engine;
|
||||
Project project;
|
||||
BuildItemGroup[] groups = new BuildItemGroup[1];
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Choose>
|
||||
<When Condition=""'$(Configuration)' == ''"">
|
||||
<ItemGroup>
|
||||
<A Include='a' />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
Assert.AreEqual (1, project.ItemGroups.Count, "A1");
|
||||
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
|
||||
Assert.AreEqual (1, project.EvaluatedItems.Count, "A3");
|
||||
Assert.AreEqual (1, project.EvaluatedItemsIgnoringCondition.Count, "A4");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void TestFalseWhen () {
|
||||
Engine engine;
|
||||
Project project;
|
||||
BuildItemGroup[] groups = new BuildItemGroup[1];
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Choose>
|
||||
<When Condition=""'$(Configuration)' == 'False'"">
|
||||
<ItemGroup>
|
||||
<A Include='a' />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
Assert.AreEqual (1, project.ItemGroups.Count, "A1");
|
||||
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
|
||||
Assert.AreEqual (0, project.EvaluatedItems.Count, "A3");
|
||||
Assert.AreEqual (0, project.EvaluatedItemsIgnoringCondition.Count, "A4");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void TestMultipleTrueWhen () {
|
||||
Engine engine;
|
||||
Project project;
|
||||
BuildItemGroup[] groups = new BuildItemGroup[1];
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Choose>
|
||||
<When Condition=""'$(Configuration)' == ''"">
|
||||
<ItemGroup>
|
||||
<A Include='a' />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition=""'$(Configuration)' == ''"">
|
||||
<ItemGroup>
|
||||
<B Include='a' />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
|
||||
Assert.AreEqual (2, project.ItemGroups.Count, "A1");
|
||||
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
|
||||
Assert.AreEqual (1, project.EvaluatedItems.Count, "A3");
|
||||
Assert.AreEqual ("A", project.EvaluatedItems[0].Name, "A4");
|
||||
Assert.AreEqual (1, project.EvaluatedItemsIgnoringCondition.Count, "A5");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void TestMultipleFalseWhen () {
|
||||
Engine engine;
|
||||
Project project;
|
||||
BuildItemGroup[] groups = new BuildItemGroup[1];
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Choose>
|
||||
<When Condition=""'$(Configuration)' == 'False'"">
|
||||
<ItemGroup>
|
||||
<A Include='a' />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition=""'$(Configuration)' == 'False'"">
|
||||
<ItemGroup>
|
||||
<B Include='a' />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
Assert.AreEqual (2, project.ItemGroups.Count, "A1");
|
||||
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
|
||||
Assert.AreEqual (0, project.EvaluatedItems.Count, "A3");
|
||||
Assert.AreEqual (0, project.EvaluatedItemsIgnoringCondition.Count, "A4");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
[ExpectedException (typeof (InvalidProjectFileException))]
|
||||
public void TestMissingWhen () {
|
||||
Engine engine;
|
||||
Project project;
|
||||
BuildItemGroup[] groups = new BuildItemGroup[1];
|
||||
|
||||
// a <Choose> requires at least one <When>
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Choose>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<A Include='a' />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
[ExpectedException (typeof (InvalidProjectFileException))]
|
||||
public void TestMissingConditionWhen () {
|
||||
Engine engine;
|
||||
Project project;
|
||||
BuildItemGroup[] groups = new BuildItemGroup[1];
|
||||
|
||||
// a <When> requires a Condition
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Choose>
|
||||
<When>
|
||||
<ItemGroup>
|
||||
<A Include='a' />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void TestWhenOtherwise1 () {
|
||||
Engine engine;
|
||||
Project project;
|
||||
BuildItemGroup[] groups = new BuildItemGroup[1];
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Choose>
|
||||
<When Condition=""'$(Configuration)' == ''"">
|
||||
<ItemGroup>
|
||||
<A Include='a' />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<B Include='a' />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
Assert.AreEqual (2, project.ItemGroups.Count, "A1");
|
||||
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
|
||||
Assert.AreEqual (1, project.EvaluatedItems.Count, "A3");
|
||||
Assert.AreEqual ("A", project.EvaluatedItems[0].Name, "A4");
|
||||
Assert.AreEqual (1, project.EvaluatedItemsIgnoringCondition.Count, "A5");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void TestWhenOtherwise2 () {
|
||||
Engine engine;
|
||||
Project project;
|
||||
BuildItemGroup[] groups = new BuildItemGroup[1];
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Choose>
|
||||
<When Condition=""'$(Configuration)' == 'False'"">
|
||||
<ItemGroup>
|
||||
<A Include='a' />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<B Include='a' />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
Assert.AreEqual (2, project.ItemGroups.Count, "A1");
|
||||
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
|
||||
Assert.AreEqual (1, project.EvaluatedItems.Count, "A3");
|
||||
Assert.AreEqual ("B", project.EvaluatedItems[0].Name, "A4");
|
||||
Assert.AreEqual (1, project.EvaluatedItemsIgnoringCondition.Count, "A5");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -802,50 +802,5 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
project.ItemGroups.CopyTo (groups, 0);
|
||||
Assert.AreEqual (1, groups [0].Count, "A3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBuildItemTransform ()
|
||||
{
|
||||
string projectText = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<UsingTask TaskName='BatchingTestTask' AssemblyFile='Test\resources\TestTasks.dll' />
|
||||
|
||||
<ItemGroup>
|
||||
<Foo Include='abc'/>
|
||||
<Foo Include='def'/>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<FooProp>PropValue/</FooProp>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name=""main"">
|
||||
<CreateItem Include=""@(Foo)"">
|
||||
<Output TaskParameter =""Include"" ItemName=""SyntheticFoo""/>
|
||||
</CreateItem>
|
||||
|
||||
<BatchingTestTask
|
||||
TaskItemsOutput=""@(SyntheticFoo->'$(FooProp)%(Identity).txt')"">
|
||||
<Output TaskParameter='TaskItemsOutput' ItemName='I0' />
|
||||
</BatchingTestTask>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
Project project = engine.CreateNewProject ();
|
||||
project.LoadXml (projectText);
|
||||
|
||||
bool result = project.Build ("main");
|
||||
if (!result) {
|
||||
logger.DumpMessages ();
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
|
||||
BuildItemGroup grp = project.GetEvaluatedItemsByName ("I0");
|
||||
Assert.AreEqual (2, grp.Count, "A1");
|
||||
Assert.AreEqual ("PropValue/abc.txt", grp [0].FinalItemSpec, "A2");
|
||||
Assert.AreEqual ("PropValue/def.txt", grp [1].FinalItemSpec, "A3");
|
||||
}
|
||||
}
|
||||
}
|
||||
-32
@@ -347,37 +347,5 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
node = xd.SelectSingleNode ("tns:Project/tns:PropertyGroup/tns:Name", TestNamespaceManager.NamespaceManager);
|
||||
Assert.AreEqual ("AnotherValue", node.InnerText, "A1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestValueXml ()
|
||||
{
|
||||
BuildPropertyGroup [] bpgs = new BuildPropertyGroup [1];
|
||||
BuildProperty [] props;
|
||||
XmlDocument xd;
|
||||
XmlNode node;
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<PropertyGroup>
|
||||
<Name>Value</Name>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
project.PropertyGroups.CopyTo (bpgs, 0);
|
||||
bpgs[0].AddNewProperty("XmlProp", "<XmlStuff></XmlStuff>");
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,3 @@
|
||||
2009-02-15 Jonathan Chambers <[email protected]>
|
||||
|
||||
* BuildChooseTest.cs (TestValueXml): Add tests for Choose.
|
||||
Currently not working.
|
||||
|
||||
2009-02-12 Jonathan Chambers <[email protected]>
|
||||
|
||||
* BuildPropertyTest.cs (TestValueXml): New.
|
||||
|
||||
2009-02-01 Ankit Jain <[email protected]>
|
||||
|
||||
* ProjectTest.cs (TestBuild[23]): Check number of task started/finished
|
||||
events.
|
||||
(TestResetBuildStat): Remove "NotWorking".
|
||||
(TestBuild4): Likewise. Check number of task started/finished events.
|
||||
|
||||
* TargetTest.cs (TestTargetOutputs1): New.
|
||||
|
||||
2009-01-30 Ankit Jain <[email protected]>
|
||||
|
||||
* ProjectTest.cs (TestRequiredTask_*): New.
|
||||
(TestBatchedMetadataRef5): New.
|
||||
|
||||
2009-01-29 Ankit Jain <[email protected]>
|
||||
|
||||
* BuildItemTest.cs (TestBuildItemTransform): New.
|
||||
|
||||
2009-01-06 Ankit Jain <[email protected]>
|
||||
|
||||
* ProjectTest.cs (TestInitialTargets): New.
|
||||
|
||||
@@ -36,8 +36,6 @@ using Microsoft.Build.Utilities;
|
||||
using NUnit.Framework;
|
||||
using System.Text;
|
||||
|
||||
using MBT = MonoTests.Microsoft.Build.Tasks;
|
||||
|
||||
namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
|
||||
class TestLogger : Logger {
|
||||
@@ -373,14 +371,14 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Target Name='T'>
|
||||
<Target Name='T' Inputs='Test\resources\TestTasks.cs' Outputs='Test\resources\TestTasks.dll'>
|
||||
<Message Text='text' />
|
||||
</Target>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
MBT.TestMessageLogger tl = new MBT.TestMessageLogger();
|
||||
TestLogger tl = new TestLogger ();
|
||||
engine.RegisterLogger (tl);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
@@ -388,10 +386,8 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
project.Build ("T");
|
||||
project.Build ("T");
|
||||
|
||||
Assert.AreEqual (2, tl.TargetStarted, "A1");
|
||||
Assert.AreEqual (2, tl.TargetFinished, "A2");
|
||||
Assert.AreEqual (2, tl.TaskStarted, "A3");
|
||||
Assert.AreEqual (2, tl.TaskFinished, "A4");
|
||||
Assert.AreEqual (2, tl.TargetStartedEvents, "A1");
|
||||
Assert.AreEqual (2, tl.TargetFinishedEvents, "A2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -402,14 +398,14 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Target Name='T'>
|
||||
<Target Name='T' Inputs='Test\resources\TestTasks.cs' Outputs='Test\resources\TestTasks.dll'>
|
||||
<Message Text='text' />
|
||||
</Target>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
MBT.TestMessageLogger tl = new MBT.TestMessageLogger ();
|
||||
TestLogger tl = new TestLogger ();
|
||||
engine.RegisterLogger (tl);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
@@ -417,13 +413,12 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
project.Build (new string [1] { "T" }, null, BuildSettings.None);
|
||||
project.Build (new string [1] { "T" }, null, BuildSettings.None);
|
||||
|
||||
Assert.AreEqual (2, tl.TargetStarted, "A1");
|
||||
Assert.AreEqual (2, tl.TargetFinished, "A2");
|
||||
Assert.AreEqual (2, tl.TaskStarted, "A3");
|
||||
Assert.AreEqual (2, tl.TaskFinished, "A4");
|
||||
Assert.AreEqual (2, tl.TargetStartedEvents, "A1");
|
||||
Assert.AreEqual (2, tl.TargetFinishedEvents, "A2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void TestBuild4 ()
|
||||
{
|
||||
Engine engine;
|
||||
@@ -431,14 +426,14 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Target Name='T'>
|
||||
<Target Name='T' Inputs='Test\resources\TestTasks.cs' Outputs='Test\resources\TestTasks.dll'>
|
||||
<Message Text='text' />
|
||||
</Target>
|
||||
</Project>
|
||||
";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
MBT.TestMessageLogger tl = new MBT.TestMessageLogger ();
|
||||
TestLogger tl = new TestLogger ();
|
||||
engine.RegisterLogger (tl);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
@@ -446,10 +441,8 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
project.Build (new string [1] { "T" }, null, BuildSettings.DoNotResetPreviouslyBuiltTargets);
|
||||
project.Build (new string [1] { "T" }, null, BuildSettings.DoNotResetPreviouslyBuiltTargets);
|
||||
|
||||
Assert.AreEqual (1, tl.TargetStarted, "A1");
|
||||
Assert.AreEqual (1, tl.TargetFinished, "A2");
|
||||
Assert.AreEqual (1, tl.TaskStarted, "A3");
|
||||
Assert.AreEqual (1, tl.TaskFinished, "A4");
|
||||
Assert.AreEqual (1, tl.TargetStartedEvents, "A1");
|
||||
Assert.AreEqual (1, tl.TargetFinishedEvents, "A2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1044,6 +1037,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void TestResetBuildStatus ()
|
||||
{
|
||||
Engine engine;
|
||||
@@ -1450,42 +1444,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
Assert.AreEqual (0, include.Count, "A2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBatchedMetadataRef5 ()
|
||||
{
|
||||
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<UsingTask TaskName=""BatchingTestTask"" AssemblyFile=""Test/resources/TestTasks.dll"" />
|
||||
<ItemGroup>
|
||||
<Coll1 Include=""A1""><Name>Abc</Name></Coll1>
|
||||
<Coll1 Include=""A2""><Name>Def</Name></Coll1>
|
||||
<Coll1 Include=""A3""><Name>Xyz</Name></Coll1>
|
||||
<Coll2 Include=""B1""><Name>Bar</Name></Coll2>
|
||||
</ItemGroup>
|
||||
<Target Name=""ShowMessage"">
|
||||
<Message Text=""Coll1: @(Coll1->'Foo%(Name)Bar')"" />
|
||||
<BatchingTestTask Sources=""@(Coll1->'Foo%(Name)Bar')"" >
|
||||
<Output TaskParameter=""Output"" ItemName=""FinalList"" />
|
||||
</BatchingTestTask>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
project.LoadXml (projectString);
|
||||
bool result = project.Build ("ShowMessage");
|
||||
if (!result) {
|
||||
logger.DumpMessages ();
|
||||
Assert.Fail ("A1: Build failed");
|
||||
}
|
||||
logger.DumpMessages ();
|
||||
BuildItemGroup include = project.GetEvaluatedItemsByName ("FinalList");
|
||||
Assert.AreEqual (3, include.Count, "A2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInitialTargets ()
|
||||
{
|
||||
@@ -1517,94 +1475,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequiredTask_String1 ()
|
||||
{
|
||||
CheckProjectForRequiredTests ("RequiredTestTask_String", "@(NonExistant)",
|
||||
false, "Should've failed: No value specified for required field - 'Property' of RequiredTestTask_String");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequiredTask_String2 ()
|
||||
{
|
||||
CheckProjectForRequiredTests ("RequiredTestTask_String", "$(NonExistant)",
|
||||
false, "Should've failed: No value specified for required field - 'Property' of RequiredTestTask_String");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequiredTask_TaskItem1 ()
|
||||
{
|
||||
Project p = CheckProjectForRequiredTests ("RequiredTestTask_TaskItem", "@(NonExistant)",
|
||||
false, "Should've failed: No value specified for required field - 'Property' of RequiredTestTask_TaskItem");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequiredTask_TaskItem2 ()
|
||||
{
|
||||
Project p = CheckProjectForRequiredTests ("RequiredTestTask_TaskItem", "$(NonExistant)",
|
||||
false, "Should've failed: No value specified for required field - 'Property' of RequiredTestTask_TaskItem");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequiredTask_TaskItemArray1 ()
|
||||
{
|
||||
Project p = CheckProjectForRequiredTests ("RequiredTestTask_TaskItems", "@(NonExistant)",
|
||||
true, "Build failed");
|
||||
|
||||
BuildItemGroup group = p.GetEvaluatedItemsByName ("OutItem");
|
||||
Assert.AreEqual (1, group.Count, "A2");
|
||||
Assert.AreEqual ("count: 0", group [0].FinalItemSpec, "A3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequiredTask_TaskItemArray2 ()
|
||||
{
|
||||
Project p = CheckProjectForRequiredTests ("RequiredTestTask_TaskItems", "$(NonExistant)",
|
||||
true, "Build failed");
|
||||
|
||||
BuildItemGroup group = p.GetEvaluatedItemsByName ("OutItem");
|
||||
Assert.AreEqual (1, group.Count, "A2");
|
||||
Assert.AreEqual ("count: 0", group [0].FinalItemSpec, "A3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequiredTask_TaskItemArray3 ()
|
||||
{
|
||||
Project p = CheckProjectForRequiredTests ("RequiredTestTask_IntArray", "$(NonExistant)",
|
||||
true, "Build failed");
|
||||
|
||||
BuildItemGroup group = p.GetEvaluatedItemsByName ("OutItem");
|
||||
Assert.AreEqual (1, group.Count, "A2");
|
||||
Assert.AreEqual ("count: 0", group [0].FinalItemSpec, "A3");
|
||||
}
|
||||
|
||||
|
||||
Project CheckProjectForRequiredTests (string taskname, string property_arg, bool expected_result, string error_msg)
|
||||
{
|
||||
string projectString = String.Format (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<UsingTask TaskName=""{0}"" AssemblyFile=""Test/resources/TestTasks.dll"" />
|
||||
<Target Name=""foo"">
|
||||
<{0} Property=""{1}"">
|
||||
<Output TaskParameter=""Output"" ItemName=""OutItem""/>
|
||||
</{0}>
|
||||
</Target>
|
||||
</Project>", taskname, property_arg);
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
Project project = engine.CreateNewProject ();
|
||||
project.LoadXml (projectString);
|
||||
|
||||
try {
|
||||
Assert.AreEqual (expected_result, project.Build (), error_msg);
|
||||
} finally {
|
||||
logger.DumpMessages ();
|
||||
}
|
||||
return project;
|
||||
}
|
||||
|
||||
static void CheckBuildItem (BuildItem item, string name, string [,] metadata, string finalItemSpec, string prefix)
|
||||
{
|
||||
Assert.AreEqual (name, item.Name, prefix + "#1");
|
||||
|
||||
@@ -234,81 +234,5 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
project.Targets.CopyTo (t, 0);
|
||||
t [0].RemoveTask (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTargetOutputs1 ()
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
string documentString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<ItemGroup>
|
||||
<fruit Include=""apple""/>
|
||||
<fruit Include=""rhubarb""/>
|
||||
<fruit Include=""apricot""/>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name=""Main"">
|
||||
<CallTarget Targets=""foo"">
|
||||
<Output TaskParameter=""TargetOutputs"" ItemName=""AllOut""/>
|
||||
</CallTarget>
|
||||
|
||||
<CallTarget Targets=""foo"">
|
||||
<Output TaskParameter=""TargetOutputs"" ItemName=""AllOut""/>
|
||||
</CallTarget>
|
||||
<Message Text=""AllOut: @(AllOut)""/>
|
||||
</Target>
|
||||
|
||||
<Target Name=""foo"" Outputs=""@(FooItem)"">
|
||||
<Message Text=""foo called""/>
|
||||
<CreateItem Include=""%(fruit.Identity)"">
|
||||
<Output TaskParameter=""Include"" ItemName=""FooItem""/>
|
||||
</CreateItem>
|
||||
<Message Text=""FooItem: @(FooItem)""/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
bool result = project.Build ("Main");
|
||||
if (!result) {
|
||||
logger.DumpMessages ();
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
|
||||
try {
|
||||
Assert.AreEqual (3, logger.NormalMessageCount, "Expected number of messages");
|
||||
CheckLoggedMessageHead (logger, "foo called", "A1");
|
||||
CheckLoggedMessageHead (logger, "FooItem: apple;rhubarb;apricot", "A2");
|
||||
CheckLoggedMessageHead (logger, "AllOut: apple;rhubarb;apricot;apple;rhubarb;apricot", "A3");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Extra messages found");
|
||||
|
||||
Assert.AreEqual (2, logger.TargetStarted, "TargetStarted count");
|
||||
Assert.AreEqual (2, logger.TargetFinished, "TargetFinished count");
|
||||
Assert.AreEqual (8, logger.TaskStarted, "TaskStarted count");
|
||||
Assert.AreEqual (8, logger.TaskFinished, "TaskFinished count");
|
||||
|
||||
} catch (AssertionException) {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckLoggedMessageHead (MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger, string expected, string id)
|
||||
{
|
||||
string actual;
|
||||
int result = logger.CheckHead (expected, MessageImportance.Normal, out actual);
|
||||
if (result == 1)
|
||||
Assert.Fail ("{0}: Expected message '{1}' was not emitted.", id, expected);
|
||||
if (result == 2)
|
||||
Assert.AreEqual (expected, actual, id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,3 @@
|
||||
2009-01-30 Ankit Jain <[email protected]>
|
||||
|
||||
* TestTasks.cs (RequiredTestTask): Rename to ..
|
||||
(RequiredTestTask_TaskItems): .. this.
|
||||
(RequiredTestTask_*): New types.
|
||||
|
||||
2009-01-29 Ankit Jain <[email protected]>
|
||||
|
||||
* TestTasks.cs (BatchingTestTask.TaskItemsOutput): New.
|
||||
|
||||
2008-12-30 Ankit Jain <[email protected]>
|
||||
|
||||
* TestTasks.cs (BatchingTestTask): Add specific properties
|
||||
|
||||
@@ -41,94 +41,18 @@ public class OutputTestTask : Task {
|
||||
}
|
||||
}
|
||||
|
||||
public class RequiredTestTask_TaskItems : Task {
|
||||
string output;
|
||||
public class RequiredTestTask : Task {
|
||||
public override bool Execute ()
|
||||
{
|
||||
output = items == null ? "null" : "count: " + items.Length.ToString ();
|
||||
return true;
|
||||
}
|
||||
|
||||
ITaskItem [] items;
|
||||
[Required]
|
||||
public ITaskItem[] Property {
|
||||
set { items = value; }
|
||||
}
|
||||
|
||||
[Output]
|
||||
public string Output
|
||||
{
|
||||
get { return output; }
|
||||
}
|
||||
}
|
||||
|
||||
public class RequiredTestTask_TaskItem : Task
|
||||
{
|
||||
string output;
|
||||
public override bool Execute ()
|
||||
{
|
||||
output = item == null ? "null" : "not null: " + item.ItemSpec;
|
||||
return true;
|
||||
}
|
||||
|
||||
ITaskItem item;
|
||||
[Required]
|
||||
public ITaskItem Property
|
||||
{
|
||||
set { item = value; }
|
||||
}
|
||||
|
||||
[Output]
|
||||
public string Output
|
||||
{
|
||||
get { return output; }
|
||||
}
|
||||
}
|
||||
|
||||
public class RequiredTestTask_String : Task
|
||||
{
|
||||
string output;
|
||||
public override bool Execute ()
|
||||
{
|
||||
output = property == null ? "null" : property.Length.ToString ();
|
||||
return true;
|
||||
}
|
||||
|
||||
string property;
|
||||
|
||||
[Required]
|
||||
public string Property
|
||||
{
|
||||
public string Property {
|
||||
set { property = value; }
|
||||
}
|
||||
|
||||
[Output]
|
||||
public string Output
|
||||
{
|
||||
get { return output; }
|
||||
}
|
||||
}
|
||||
|
||||
public class RequiredTestTask_IntArray: Task
|
||||
{
|
||||
string output;
|
||||
public override bool Execute ()
|
||||
{
|
||||
output = items == null ? "null" : "count: " + items.Length.ToString ();
|
||||
return true;
|
||||
}
|
||||
|
||||
int[] items;
|
||||
[Required]
|
||||
public int[] Property
|
||||
{
|
||||
set { items = value; }
|
||||
}
|
||||
|
||||
[Output]
|
||||
public string Output
|
||||
{
|
||||
get { return output; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -269,13 +193,5 @@ public class BatchingTestTask : Task
|
||||
{
|
||||
get { return strings; }
|
||||
}
|
||||
|
||||
[Output]
|
||||
public ITaskItem [] TaskItemsOutput
|
||||
{
|
||||
get { return sources; }
|
||||
set { sources = value; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
//
|
||||
// Author:
|
||||
// Marek Sieradzki ([email protected])
|
||||
// Ankit Jain ([email protected])
|
||||
//
|
||||
// (C) 2006 Marek Sieradzki
|
||||
// Copyright 2009 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
|
||||
@@ -41,14 +39,12 @@ namespace Microsoft.Build.Tasks {
|
||||
internal class AssemblyResolver {
|
||||
|
||||
// name -> (version -> assemblypath)
|
||||
Dictionary<string, TargetFrameworkAssemblies> target_framework_cache;
|
||||
Dictionary<string, Dictionary<Version, string>> gac;
|
||||
Dictionary <string, Dictionary <Version, string>> gac;
|
||||
TaskLoggingHelper log;
|
||||
|
||||
public AssemblyResolver ()
|
||||
{
|
||||
gac = new Dictionary<string, Dictionary<Version, string>> ();
|
||||
target_framework_cache = new Dictionary <string, TargetFrameworkAssemblies> ();
|
||||
gac = new Dictionary <string, Dictionary <Version, string>> ();
|
||||
|
||||
GatherGacAssemblies ();
|
||||
}
|
||||
@@ -92,98 +88,71 @@ namespace Microsoft.Build.Tasks {
|
||||
}
|
||||
}
|
||||
|
||||
public string FindInTargetFramework (ITaskItem reference, string framework_dir)
|
||||
public string ResolveAssemblyReference (ITaskItem reference)
|
||||
{
|
||||
AssemblyName key_aname = new AssemblyName (reference.ItemSpec);
|
||||
TargetFrameworkAssemblies gac_asm;
|
||||
if (!target_framework_cache.TryGetValue (framework_dir, out gac_asm)) {
|
||||
// fill gac_asm
|
||||
gac_asm = target_framework_cache [framework_dir] = PopulateTargetFrameworkAssemblies (framework_dir);
|
||||
}
|
||||
AssemblyName name = null;
|
||||
string resolved = null;
|
||||
|
||||
KeyValuePair<AssemblyName, string> pair;
|
||||
if (gac_asm.NameToAssemblyNameCache.TryGetValue (key_aname.Name, out pair)) {
|
||||
if (AssemblyNamesCompatible (key_aname, pair.Key, false))
|
||||
return pair.Value;
|
||||
name = new AssemblyName (reference.ItemSpec);
|
||||
|
||||
if (reference.GetMetadata ("HintPath") != String.Empty) {
|
||||
|
||||
bool specificVersion;
|
||||
|
||||
if (reference.GetMetadata ("SpecificVersion") != String.Empty) {
|
||||
specificVersion = Boolean.Parse (reference.GetMetadata ("SpecificVersion"));
|
||||
} else {
|
||||
specificVersion = IsStrongNamed (name);
|
||||
}
|
||||
|
||||
resolved = ResolveHintPathReference (name, reference.GetMetadata ("HintPath"), specificVersion);
|
||||
}
|
||||
return null;
|
||||
|
||||
if (resolved == null)
|
||||
resolved = ResolveGacReference (name, gac);
|
||||
|
||||
return resolved;
|
||||
}
|
||||
|
||||
public string FindInDirectory (ITaskItem reference, string directory)
|
||||
{
|
||||
AssemblyName key_aname = new AssemblyName (reference.ItemSpec);
|
||||
foreach (string file in Directory.GetFiles (directory, "*.dll")) {
|
||||
AssemblyName found = AssemblyName.GetAssemblyName (file);
|
||||
if (AssemblyNamesCompatible (key_aname, found, false))
|
||||
return file;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
TargetFrameworkAssemblies PopulateTargetFrameworkAssemblies (string directory)
|
||||
{
|
||||
TargetFrameworkAssemblies gac_asm = new TargetFrameworkAssemblies (directory);
|
||||
foreach (string file in Directory.GetFiles (directory, "*.dll")) {
|
||||
AssemblyName aname = AssemblyName.GetAssemblyName (file);
|
||||
gac_asm.NameToAssemblyNameCache [aname.Name] =
|
||||
new KeyValuePair<AssemblyName, string> (aname, file);
|
||||
}
|
||||
|
||||
return gac_asm;
|
||||
}
|
||||
|
||||
public string ResolveGacReference (ITaskItem reference)
|
||||
string ResolveGacReference (AssemblyName name, Dictionary <string, Dictionary <Version, string>> dic)
|
||||
{
|
||||
// FIXME: deal with SpecificVersion=False
|
||||
AssemblyName name = new AssemblyName (reference.ItemSpec);
|
||||
if (!gac.ContainsKey (name.Name))
|
||||
|
||||
if (!dic.ContainsKey (name.Name))
|
||||
return null;
|
||||
|
||||
if (name.Version != null) {
|
||||
if (!gac [name.Name].ContainsKey (name.Version))
|
||||
if (!dic [name.Name].ContainsKey (name.Version))
|
||||
return null;
|
||||
else
|
||||
return gac [name.Name] [name.Version];
|
||||
return dic [name.Name] [name.Version];
|
||||
}
|
||||
|
||||
Version [] versions = new Version [gac [name.Name].Keys.Count];
|
||||
gac [name.Name].Keys.CopyTo (versions, 0);
|
||||
Version [] versions = new Version [dic [name.Name].Keys.Count];
|
||||
dic [name.Name].Keys.CopyTo (versions, 0);
|
||||
Array.Sort (versions, (IComparer <Version>) null);
|
||||
Version highest = versions [versions.Length - 1];
|
||||
return gac [name.Name] [highest];
|
||||
return dic [name.Name] [highest];
|
||||
}
|
||||
|
||||
public string ResolveHintPathReference (ITaskItem reference)
|
||||
string ResolveHintPathReference (AssemblyName name, string hintpath, bool specificVersion)
|
||||
{
|
||||
AssemblyName name = new AssemblyName (reference.ItemSpec);
|
||||
string resolved = null;
|
||||
AssemblyName found;
|
||||
string ret = null;
|
||||
|
||||
string hintpath = reference.GetMetadata ("HintPath");
|
||||
if (String.IsNullOrEmpty (hintpath))
|
||||
return null;
|
||||
|
||||
bool specificVersion;
|
||||
if (!String.IsNullOrEmpty (reference.GetMetadata ("SpecificVersion")))
|
||||
specificVersion = Boolean.Parse (reference.GetMetadata ("SpecificVersion"));
|
||||
else
|
||||
specificVersion = IsStrongNamed (name);
|
||||
|
||||
if (!File.Exists (hintpath)) {
|
||||
if (!File.Exists (hintpath))
|
||||
log.LogMessage (MessageImportance.Low, "HintPath {0} does not exist.", hintpath);
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
AssemblyName found = AssemblyName.GetAssemblyName (hintpath);
|
||||
found = AssemblyName.GetAssemblyName (hintpath);
|
||||
if (AssemblyNamesCompatible (name, found, specificVersion))
|
||||
resolved = hintpath;
|
||||
ret = hintpath;
|
||||
else
|
||||
log.LogMessage (MessageImportance.Low, "Assembly names are not compatible.");
|
||||
} catch {
|
||||
}
|
||||
|
||||
return resolved;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool AssemblyNamesCompatible (AssemblyName a, AssemblyName b, bool specificVersion)
|
||||
@@ -191,7 +160,7 @@ namespace Microsoft.Build.Tasks {
|
||||
if (a.Name != b.Name)
|
||||
return false;
|
||||
|
||||
if (a.CultureInfo != null && !a.CultureInfo.Equals (b.CultureInfo))
|
||||
if (a.CultureInfo != null && a.CultureInfo != b.CultureInfo)
|
||||
return false;
|
||||
|
||||
if (specificVersion && a.Version != null && a.Version > b.Version)
|
||||
@@ -223,19 +192,6 @@ namespace Microsoft.Build.Tasks {
|
||||
set { log = value; }
|
||||
}
|
||||
}
|
||||
|
||||
class TargetFrameworkAssemblies {
|
||||
public string Path;
|
||||
|
||||
// assembly (simple) name -> (AssemblyName, file path)
|
||||
public Dictionary <string, KeyValuePair<AssemblyName, string>> NameToAssemblyNameCache;
|
||||
|
||||
public TargetFrameworkAssemblies (string path)
|
||||
{
|
||||
this.Path = path;
|
||||
NameToAssemblyNameCache = new Dictionary<string, KeyValuePair<AssemblyName, string>> ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.Build.Framework;
|
||||
|
||||
@@ -37,26 +36,27 @@ namespace Microsoft.Build.Tasks {
|
||||
public class CallTarget : TaskExtension {
|
||||
|
||||
bool runEachTargetSeparately;
|
||||
List<ITaskItem> targetOutputs_list;
|
||||
ITaskItem[] targetOutputs_array;
|
||||
ITaskItem[] targetOutputs;
|
||||
string[] targets;
|
||||
|
||||
public CallTarget ()
|
||||
{
|
||||
targetOutputs_list = new List<ITaskItem> ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override bool Execute ()
|
||||
{
|
||||
Hashtable targets_table = new Hashtable ();
|
||||
targetOutputs = new ITaskItem [targets.Length];
|
||||
|
||||
if (!RunEachTargetSeparately) {
|
||||
bool ret = BuildEngine.BuildProjectFile (BuildEngine.ProjectFileOfTaskNode,
|
||||
targets, null, targets_table);
|
||||
int i = 0;
|
||||
foreach (ITaskItem[] items in targets_table.Values) {
|
||||
if (items != null)
|
||||
targetOutputs_list.AddRange (items);
|
||||
//FIXME: can a target return multiple taskitems?
|
||||
if (items != null && items.Length > 0)
|
||||
targetOutputs [i ++] = items [0];
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -76,8 +76,9 @@ namespace Microsoft.Build.Tasks {
|
||||
continue;
|
||||
|
||||
ITaskItem [] items = (ITaskItem[]) targets_table [target];
|
||||
if (items != null)
|
||||
targetOutputs_list.AddRange (items);
|
||||
if (items != null && items.Length > 0)
|
||||
//FIXME:
|
||||
targetOutputs [i] = items [0];
|
||||
}
|
||||
|
||||
return allPassed;
|
||||
@@ -90,11 +91,7 @@ namespace Microsoft.Build.Tasks {
|
||||
|
||||
[Output]
|
||||
public ITaskItem[] TargetOutputs {
|
||||
get {
|
||||
if (targetOutputs_array == null)
|
||||
targetOutputs_array = targetOutputs_list.ToArray ();
|
||||
return targetOutputs_array;
|
||||
}
|
||||
get { return targetOutputs; }
|
||||
}
|
||||
|
||||
public string[] Targets {
|
||||
|
||||
@@ -1,38 +1,3 @@
|
||||
2009-02-11 Leszek Ciesielski <[email protected]>
|
||||
|
||||
* ResolveAssemblyReference.cs : AllowedRelatedFileExtensions stub
|
||||
|
||||
2009-02-02 Ankit Jain <[email protected]>
|
||||
|
||||
* MSBuild.cs (Execute): Disable incorrect 'rebaseOutputs' behavior.
|
||||
|
||||
2009-02-02 Ankit Jain <[email protected]>
|
||||
|
||||
* ResolveAssemblyReference.cs: Honor SearchPaths and the special
|
||||
items like '{HintPathFromItem}', '{TargetFrameworkDirectory}' etc.
|
||||
* AssemblyResolver.cs: Add api for more specific search, like search
|
||||
in a directory, target frameworks, gac etc.
|
||||
|
||||
2009-02-01 Ankit Jain <[email protected]>
|
||||
|
||||
* CallTarget.cs: Copy all items from target to TargetOutputs.
|
||||
|
||||
2009-02-01 Ankit Jain <[email protected]>
|
||||
|
||||
* Csc.cs (AddResponseFileCommands):
|
||||
* ManagedCompiler.cs (AddResponseFileCommands): 'AddModules' and
|
||||
'AdditionalLibPaths' can be empty.
|
||||
|
||||
2009-01-30 Ankit Jain <[email protected]>
|
||||
|
||||
* Copy.cs (Execute): Use for loop instead of enumerators.
|
||||
sourceFiles and destinationFiles can be null, handle that.
|
||||
Create new directory if required.
|
||||
|
||||
2009-01-27 Ankit Jain <[email protected]>
|
||||
|
||||
* Delete.cs (Execute): Skip non-existant files.
|
||||
|
||||
2009-01-06 Ankit Jain <[email protected]>
|
||||
|
||||
* CreateManifestResourceName.cs (Execute): Use full path, also helps
|
||||
|
||||
@@ -52,15 +52,18 @@ namespace Microsoft.Build.Tasks {
|
||||
try {
|
||||
List <ITaskItem> temporaryCopiedFiles = new List <ITaskItem> ();
|
||||
|
||||
if (sourceFiles != null && destinationFiles != null &&
|
||||
sourceFiles.Length != destinationFiles.Length)
|
||||
if (sourceFiles.Length != destinationFiles.Length)
|
||||
throw new Exception ("Number of source files is different than number of destination files.");
|
||||
if (destinationFiles != null && destinationFolder != null)
|
||||
throw new Exception ("You must specify only one attribute from DestinationFiles and DestinationFolder");
|
||||
if (destinationFiles != null) {
|
||||
for (int i = 0; i < sourceFiles.Length; i ++) {
|
||||
ITaskItem sourceItem = sourceFiles [i];
|
||||
ITaskItem destinationItem = destinationFiles [i];
|
||||
IEnumerator <ITaskItem> source, destination;
|
||||
source = ((IEnumerable <ITaskItem>) sourceFiles).GetEnumerator ();
|
||||
destination = ((IEnumerable <ITaskItem>) destinationFiles).GetEnumerator ();
|
||||
while (source.MoveNext ()) {
|
||||
destination.MoveNext ();
|
||||
ITaskItem sourceItem = source.Current;
|
||||
ITaskItem destinationItem = destination.Current;
|
||||
string sourceFile = sourceItem.GetMetadata ("FullPath");
|
||||
string destinationFile = destinationItem.GetMetadata ("FullPath");
|
||||
|
||||
@@ -71,27 +74,23 @@ namespace Microsoft.Build.Tasks {
|
||||
File.GetLastWriteTime (destinationFile))
|
||||
continue;
|
||||
}
|
||||
|
||||
string dest_dir = Path.GetDirectoryName (destinationFile);
|
||||
if (!Directory.Exists (dest_dir)) {
|
||||
Log.LogMessage ("Creating directory '{0}'", dest_dir);
|
||||
Directory.CreateDirectory (dest_dir);
|
||||
}
|
||||
Log.LogMessage ("Copying file from '{0}' to '{1}'", sourceFile, destinationFile);
|
||||
File.Copy (sourceFile, destinationFile, true);
|
||||
temporaryCopiedFiles.Add (sourceItem);
|
||||
temporaryCopiedFiles.Add (source.Current);
|
||||
}
|
||||
|
||||
} else if (destinationFolder != null) {
|
||||
bool directoryCreated = false;
|
||||
string destinationDirectory = destinationFolder.GetMetadata ("FullPath");
|
||||
if (Directory.Exists (destinationDirectory) == false) {
|
||||
Log.LogMessage ("Creating directory '{0}'", destinationDirectory);
|
||||
Directory.CreateDirectory (destinationDirectory);
|
||||
directoryCreated = true;
|
||||
}
|
||||
|
||||
foreach (ITaskItem sourceItem in sourceFiles) {
|
||||
IEnumerator <ITaskItem> source;
|
||||
source = (IEnumerator <ITaskItem>) sourceFiles.GetEnumerator ();
|
||||
while (source.MoveNext ()) {
|
||||
ITaskItem sourceItem = source.Current;
|
||||
string sourceFile = sourceItem.GetMetadata ("FullPath");
|
||||
string filename = sourceItem.GetMetadata ("Filename") + sourceItem.GetMetadata ("Extension");
|
||||
string destinationFile = Path.Combine (destinationDirectory,filename);
|
||||
@@ -105,7 +104,7 @@ namespace Microsoft.Build.Tasks {
|
||||
}
|
||||
Log.LogMessage ("Copying file from '{0}' to '{1}'", sourceFile, destinationFile);
|
||||
File.Copy (sourceFile, destinationFile, true);
|
||||
temporaryCopiedFiles.Add (sourceItem);
|
||||
temporaryCopiedFiles.Add (source.Current);
|
||||
}
|
||||
} else {
|
||||
throw new Exception ("You must specify DestinationFolder or DestinationFiles attribute.");
|
||||
|
||||
@@ -44,8 +44,7 @@ namespace Microsoft.Build.Tasks {
|
||||
{
|
||||
base.AddResponseFileCommands (commandLine);
|
||||
|
||||
if (AdditionalLibPaths != null && AdditionalLibPaths.Length > 0)
|
||||
commandLine.AppendSwitchIfNotNull ("/lib:", AdditionalLibPaths, ",");
|
||||
commandLine.AppendSwitchIfNotNull ("/lib:", AdditionalLibPaths, ",");
|
||||
|
||||
if (Bag ["AllowUnsafeBlocks"] != null)
|
||||
if (AllowUnsafeBlocks)
|
||||
|
||||
@@ -50,15 +50,13 @@ namespace Microsoft.Build.Tasks {
|
||||
List <ITaskItem> temporaryDeletedFiles = new List <ITaskItem> ();
|
||||
|
||||
foreach (ITaskItem file in files) {
|
||||
string path = file.GetMetadata ("FullPath");
|
||||
if (path == null || !File.Exists (path))
|
||||
//skip
|
||||
continue;
|
||||
|
||||
try {
|
||||
File.Delete (path);
|
||||
File.Delete (file.GetMetadata ("FullPath"));
|
||||
temporaryDeletedFiles.Add (file);
|
||||
}
|
||||
catch (ArgumentNullException ex) {
|
||||
LogException (ex);
|
||||
}
|
||||
catch (ArgumentException ex) {
|
||||
LogException (ex);
|
||||
}
|
||||
|
||||
@@ -74,10 +74,8 @@ namespace Microsoft.Build.Tasks {
|
||||
ITaskItem [] array = (ITaskItem []) de.Value;
|
||||
foreach (ITaskItem item in array) {
|
||||
outputItems.Add (item);
|
||||
//FIXME: Correctly rebase output paths to be relative to the
|
||||
// calling project
|
||||
//if (rebaseOutputs)
|
||||
// File.Copy (item.ItemSpec, Path.Combine (currentDirectory, item.ItemSpec), true);
|
||||
if (rebaseOutputs)
|
||||
File.Copy (item.ItemSpec, Path.Combine (currentDirectory, item.ItemSpec), true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -54,8 +54,7 @@ namespace Microsoft.Build.Tasks {
|
||||
protected internal override void AddResponseFileCommands (
|
||||
CommandLineBuilderExtension commandLine)
|
||||
{
|
||||
if (AddModules != null && AddModules.Length > 0)
|
||||
commandLine.AppendSwitchIfNotNull ("/addmodule:", AddModules, ",");
|
||||
commandLine.AppendSwitchIfNotNull ("/addmodule:", AddModules, ",");
|
||||
if (Bag ["CodePage"] != null)
|
||||
commandLine.AppendSwitchIfNotNull ("/codepage:", CodePage.ToString ());
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ namespace Microsoft.Build.Tasks {
|
||||
ITaskItem[] assemblies;
|
||||
string appConfigFile;
|
||||
string[] allowedAssemblyExtensions;
|
||||
string[] allowedRelatedFileExtensions;
|
||||
string[] candidateAssemblyFiles;
|
||||
ITaskItem[] copyLocalFiles;
|
||||
ITaskItem[] filesWritten;
|
||||
@@ -77,28 +76,7 @@ namespace Microsoft.Build.Tasks {
|
||||
List <ITaskItem> tempResolvedFiles = new List <ITaskItem> ();
|
||||
|
||||
foreach (ITaskItem item in assemblies) {
|
||||
//FIXME: Copy local
|
||||
string resolved = null;
|
||||
foreach (string spath in searchPaths) {
|
||||
if (String.Compare (spath, "{HintPathFromItem}") == 0) {
|
||||
resolved = assembly_resolver.ResolveHintPathReference (item);
|
||||
} else if (String.Compare (spath, "{TargetFrameworkDirectory}") == 0) {
|
||||
foreach (string fpath in targetFrameworkDirectories) {
|
||||
resolved = assembly_resolver.FindInTargetFramework (item, fpath);
|
||||
if (resolved != null)
|
||||
break;
|
||||
}
|
||||
} else if (String.Compare (spath, "{GAC}") == 0) {
|
||||
resolved = assembly_resolver.ResolveGacReference (item);
|
||||
} else if (String.Compare (spath, "{RawFileName}") == 0) {
|
||||
resolved = item.ItemSpec;
|
||||
} else {
|
||||
resolved = assembly_resolver.FindInDirectory (item, spath);
|
||||
}
|
||||
|
||||
if (resolved != null)
|
||||
break;
|
||||
}
|
||||
string resolved = assembly_resolver.ResolveAssemblyReference (item);
|
||||
|
||||
if (resolved == null) {
|
||||
Log.LogWarning ("Reference {0} not resolved", item.ItemSpec);
|
||||
@@ -137,11 +115,6 @@ namespace Microsoft.Build.Tasks {
|
||||
get { return allowedAssemblyExtensions; }
|
||||
set { allowedAssemblyExtensions = value; }
|
||||
}
|
||||
|
||||
public string[] AllowedRelatedFileExtensions {
|
||||
get { return allowedRelatedFileExtensions; }
|
||||
set { allowedRelatedFileExtensions = value; }
|
||||
}
|
||||
|
||||
public string[] CandidateAssemblyFiles {
|
||||
get { return candidateAssemblyFiles; }
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
2009-01-31 Ankit Jain <[email protected]>
|
||||
|
||||
* TaskBatchingTest.cs (*): Add tests for target/task events.
|
||||
(TestTargetBatching*): New tests for target batching.
|
||||
* TestMessageLogger.cs: Add counts for target/task started/finished
|
||||
events.
|
||||
(NormalMessageCount): New.
|
||||
|
||||
2008-12-22 Ankit Jain <[email protected]>
|
||||
|
||||
* TestMessageLogger.cs: Emit debug messages to stderr.
|
||||
|
||||
@@ -83,8 +83,6 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
CheckMessage (testLogger, "en", "Item3", "A3");
|
||||
CheckMessage (testLogger, "gb", "Item4", "A4");
|
||||
CheckMessage (testLogger, "it", "Item6", "A5");
|
||||
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 4, 4);
|
||||
}
|
||||
|
||||
// Test1 with unqualified %(Culture)
|
||||
@@ -132,8 +130,6 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
CheckMessage (testLogger, "en", "Item3", "A3");
|
||||
CheckMessage (testLogger, "gb", "Item4", "A4");
|
||||
CheckMessage (testLogger, "it", "Item6", "A5");
|
||||
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 4, 4);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -166,11 +162,7 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
|
||||
//Fails as Culture is being referenced unqualified, and no Culture is
|
||||
//specified for "Item5"
|
||||
bool result = project.Build ("ShowMessage");
|
||||
if (result)
|
||||
Assert.Fail ("A1: Build should have failed");
|
||||
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 0, 0);
|
||||
Assert.IsFalse (project.Build ("ShowMessage"), "A1: Build should have failed");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -208,7 +200,6 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
CheckMessage (testLogger, "fr", "Item1", "A2");
|
||||
CheckMessage (testLogger, "", "Item5", "A3");
|
||||
CheckMessage (testLogger, "it", "Item6", "A3");
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 3, 3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -262,7 +253,6 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
CheckMessage2 (testLogger, "en", "Item3", "Item8;Item9", "A3");
|
||||
CheckMessage2 (testLogger, "gb", "Item4", string.Empty, "A4");
|
||||
CheckMessage2 (testLogger, "it", "Item6", "Item7", "A6");
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 4, 4);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -314,7 +304,6 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
Assert.IsTrue (project.Build ("ShowMessage"), "A1: Build failed");
|
||||
|
||||
CheckLoggedMessageHead (testLogger, "ResXFiles: Item1;Item2 NonResXFiles: ", "A2");
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 1, 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -363,7 +352,6 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
CheckLoggedMessageAny (testLogger, "Number: 3 Color: Green-- Items in ExampColl: ExampColl2: Item6", "A4");
|
||||
CheckLoggedMessageAny (testLogger, "Number: 2 Color: -- Items in ExampColl: Item2 ExampColl2: ", "A5");
|
||||
Assert.AreEqual (0, testLogger.Count, "A6");
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 4, 4);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -398,7 +386,6 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
TestMessageLogger testLogger = new TestMessageLogger ();
|
||||
engine.RegisterLogger (testLogger);
|
||||
|
||||
project.LoadXml (projectString);
|
||||
Assert.IsTrue (project.Build ("Build"), "A1: Build failed");
|
||||
@@ -415,8 +402,6 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
additional_metadata = new string [,] { { "Identity", "file3.txt" } };
|
||||
CreateItemTest.CheckBuildItem (include [2], "GroupC", additional_metadata, "file3.txt", "A5");
|
||||
CreateItemTest.CheckBuildItem (include [3], "GroupC", additional_metadata, "file3.txt", "A6");
|
||||
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 5, 5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -453,7 +438,6 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
CheckLoggedMessageAny (testLogger, "Identity: Item5 -- Items in ExampColl: Item5", "A6");
|
||||
CheckLoggedMessageAny (testLogger, "Identity: Item6 -- Items in ExampColl: Item6", "A7");
|
||||
Assert.AreEqual (0, testLogger.Count, "A8");
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 6, 6);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -504,361 +488,8 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
|
||||
additional_metadata = new string [,] { { "Identity", "apricot" } };
|
||||
CreateItemTest.CheckBuildItem (include [2], "Final", additional_metadata, "apricot", "A5");
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 2, 2);
|
||||
}
|
||||
|
||||
//Target batching
|
||||
|
||||
[Test]
|
||||
public void TestTargetBatching1 ()
|
||||
{
|
||||
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<ItemGroup>
|
||||
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
|
||||
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
|
||||
|
||||
<List2 Include=""fr_x.txt""><Culture>fr</Culture></List2>
|
||||
<List2 Include=""gb_z.txt""><Culture>gb</Culture></List2>
|
||||
|
||||
<Foo Include=""1_a1""><Md>1</Md></Foo>
|
||||
<Foo Include=""2_b1""><Md>2</Md></Foo>
|
||||
<Foo Include=""1_c1""><Md>1</Md></Foo>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name=""foo"" >
|
||||
<Message Text=""TargetStarted""/>
|
||||
<Message Text=""List1: @(List1): %(Culture)""/>
|
||||
<Message Text=""Foo: @(Foo): %(Md)""/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
TestMessageLogger testLogger = new TestMessageLogger ();
|
||||
engine.RegisterLogger (testLogger);
|
||||
|
||||
project.LoadXml (projectString);
|
||||
bool res = project.Build ("foo");
|
||||
if (!res) {
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("A1: Build failed");
|
||||
}
|
||||
|
||||
CheckLoggedMessagesInOrder (testLogger, new string [] {
|
||||
"TargetStarted", "List1: fr_a.txt;fr_c.txt: fr",
|
||||
"List1: en_b.txt: en", "List1: gb_d.txt: gb",
|
||||
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2"
|
||||
}, "A2");
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 6, 6);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTargetBatching2 ()
|
||||
{
|
||||
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<ItemGroup>
|
||||
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
|
||||
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
|
||||
|
||||
<List2 Include=""fr_x.txt""><Culture>fr</Culture></List2>
|
||||
<List2 Include=""gb_z.txt""><Culture>gb</Culture></List2>
|
||||
|
||||
<Foo Include=""1_a1""><Md>1</Md></Foo>
|
||||
<Foo Include=""2_b1""><Md>2</Md></Foo>
|
||||
<Foo Include=""1_c1""><Md>1</Md></Foo>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name=""foo"" Inputs=""@(List1)"" Outputs=""%(Culture).foo"">
|
||||
<Message Text=""TargetStarted""/>
|
||||
<Message Text=""List1: @(List1): %(Culture)""/>
|
||||
<Message Text=""Foo: @(Foo): %(Md)""/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
TestMessageLogger testLogger = new TestMessageLogger ();
|
||||
engine.RegisterLogger (testLogger);
|
||||
|
||||
project.LoadXml (projectString);
|
||||
bool res = project.Build ("foo");
|
||||
if (!res) {
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("A1: Build failed");
|
||||
}
|
||||
|
||||
CheckLoggedMessagesInOrder (testLogger, new string [] {
|
||||
"TargetStarted", "List1: fr_a.txt;fr_c.txt: fr",
|
||||
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2",
|
||||
|
||||
"TargetStarted", "List1: en_b.txt: en",
|
||||
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2",
|
||||
|
||||
"TargetStarted", "List1: gb_d.txt: gb",
|
||||
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2"
|
||||
}, "A2");
|
||||
CheckEngineEventCounts (testLogger, 3, 3, 12, 12);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTargetBatching3 ()
|
||||
{
|
||||
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<ItemGroup>
|
||||
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
|
||||
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
|
||||
|
||||
<List2 Include=""fr_x.txt""><Culture>fr</Culture></List2>
|
||||
<List2 Include=""gb_z.txt""><Culture>gb</Culture></List2>
|
||||
|
||||
<Foo Include=""1_a1""><Md>1</Md></Foo>
|
||||
<Foo Include=""2_b1""><Md>2</Md></Foo>
|
||||
<Foo Include=""1_c1""><Md>1</Md></Foo>
|
||||
</ItemGroup>
|
||||
<Target Name=""foo"" Inputs=""@(Foo)"" Outputs=""%(Md).foo"">
|
||||
<Message Text=""TargetStarted""/>
|
||||
<Message Text=""List1: @(List1): %(Culture)""/>
|
||||
<Message Text=""Foo: @(Foo): %(Md)""/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
TestMessageLogger testLogger = new TestMessageLogger ();
|
||||
engine.RegisterLogger (testLogger);
|
||||
|
||||
project.LoadXml (projectString);
|
||||
bool res = project.Build ("foo");
|
||||
if (!res) {
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("A1: Build failed");
|
||||
}
|
||||
|
||||
CheckLoggedMessagesInOrder (testLogger, new string [] {
|
||||
"TargetStarted", "List1: fr_a.txt;fr_c.txt: fr",
|
||||
"List1: en_b.txt: en", "List1: gb_d.txt: gb",
|
||||
"Foo: 1_a1;1_c1: 1",
|
||||
"TargetStarted", "List1: fr_a.txt;fr_c.txt: fr",
|
||||
"List1: en_b.txt: en", "List1: gb_d.txt: gb",
|
||||
"Foo: 2_b1: 2"
|
||||
}, "A2");
|
||||
CheckEngineEventCounts (testLogger, 2, 2, 10, 10);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTargetBatching4 ()
|
||||
{
|
||||
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<ItemGroup>
|
||||
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
|
||||
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
|
||||
|
||||
<List2 Include=""fr_x.txt""><Culture>fr</Culture></List2>
|
||||
<List2 Include=""gb_z.txt""><Culture>gb</Culture></List2>
|
||||
|
||||
<Foo Include=""1_a1""><Md>1</Md></Foo>
|
||||
<Foo Include=""2_b1""><Md>2</Md></Foo>
|
||||
<Foo Include=""1_c1""><Md>1</Md></Foo>
|
||||
</ItemGroup>
|
||||
<Target Name=""foo"" Inputs=""@(List1)"" Outputs=""%(Culture).foo"">
|
||||
<Message Text=""TargetStarted""/>
|
||||
<Message Text=""List1: @(List1): %(Culture)""/>
|
||||
<Message Text=""List2: @(List2): %(Culture)""/>
|
||||
<Message Text=""Foo: @(Foo): %(Md)""/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
TestMessageLogger testLogger = new TestMessageLogger ();
|
||||
engine.RegisterLogger (testLogger);
|
||||
|
||||
project.LoadXml (projectString);
|
||||
bool res = project.Build ("foo");
|
||||
if (!res) {
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("A1: Build failed");
|
||||
}
|
||||
|
||||
CheckLoggedMessagesInOrder (testLogger, new string [] {
|
||||
"TargetStarted", "List1: fr_a.txt;fr_c.txt: fr",
|
||||
"List2: fr_x.txt: fr", "List2: gb_z.txt: gb",
|
||||
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2",
|
||||
|
||||
"TargetStarted", "List1: en_b.txt: en",
|
||||
"List2: fr_x.txt: fr", "List2: gb_z.txt: gb",
|
||||
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2",
|
||||
|
||||
"TargetStarted", "List1: gb_d.txt: gb",
|
||||
"List2: fr_x.txt: fr", "List2: gb_z.txt: gb",
|
||||
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2"
|
||||
}, "A2");
|
||||
CheckEngineEventCounts (testLogger, 3, 3, 18, 18);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTargetBatching5 ()
|
||||
{
|
||||
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<Target Name=""foo"" Inputs=""@(List1)"" Outputs=""%(Culture).foo"">
|
||||
<Message Text=""TargetStarted""/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
TestMessageLogger testLogger = new TestMessageLogger ();
|
||||
engine.RegisterLogger (testLogger);
|
||||
|
||||
project.LoadXml (projectString);
|
||||
bool res = project.Build ("foo");
|
||||
if (!res) {
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("A1: Build failed");
|
||||
}
|
||||
Assert.AreEqual (1, testLogger.CheckAny ("TargetStarted", MessageImportance.Normal),
|
||||
"A2: Target should've been skipped because of no inputs");
|
||||
CheckEngineEventCounts (testLogger, 1, 1, 0, 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTargetBatching6 ()
|
||||
{
|
||||
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<ItemGroup>
|
||||
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
|
||||
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
|
||||
|
||||
<List3 Include=""fr_x.txt""><Culture>fr</Culture></List3>
|
||||
<List3 Include=""gb_z.txt""><Culture>gb</Culture></List3>
|
||||
|
||||
<Foo Include=""1_a1""><Md>1</Md></Foo>
|
||||
<Foo Include=""2_b1""><Md>2</Md></Foo>
|
||||
<Foo Include=""1_c1""><Md>1</Md></Foo>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name=""foo"" Inputs=""@(List1);@(List2)"" Outputs=""%(Culture).foo"">
|
||||
<Message Text=""TargetStarted"" />
|
||||
<Message Text=""List1: %(List1.Culture), List2: %(List2.Culture)"" />
|
||||
<Message Text=""List2: @(List2), Culture: %(Culture)"" />
|
||||
<Message Text=""List3: @(List3), Culture: %(Culture)"" />
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
TestMessageLogger testLogger = new TestMessageLogger ();
|
||||
engine.RegisterLogger (testLogger);
|
||||
|
||||
project.LoadXml (projectString);
|
||||
bool res = project.Build ("foo");
|
||||
if (!res) {
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("A1: Build failed");
|
||||
}
|
||||
|
||||
CheckLoggedMessagesInOrder (testLogger, new string [] {
|
||||
"TargetStarted",
|
||||
"List1: fr, List2: ",
|
||||
"List2: , Culture: ",
|
||||
"List3: fr_x.txt, Culture: fr",
|
||||
"List3: gb_z.txt, Culture: gb",
|
||||
|
||||
"TargetStarted",
|
||||
"List1: en, List2: ",
|
||||
"List2: , Culture: ",
|
||||
"List3: fr_x.txt, Culture: fr",
|
||||
"List3: gb_z.txt, Culture: gb",
|
||||
|
||||
"TargetStarted",
|
||||
"List1: gb, List2: ",
|
||||
"List2: , Culture: ",
|
||||
"List3: fr_x.txt, Culture: fr",
|
||||
"List3: gb_z.txt, Culture: gb"
|
||||
}, "A2");
|
||||
CheckEngineEventCounts (testLogger, 3, 3, 15, 15);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTargetBatching7 ()
|
||||
{
|
||||
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<ItemGroup>
|
||||
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
|
||||
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
|
||||
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
|
||||
|
||||
<List2 Include=""fr_x.txt""><Culture>fr</Culture></List2>
|
||||
<List2 Include=""gb_z.txt""><Culture>gb</Culture></List2>
|
||||
|
||||
<Foo Include=""1_a1""><Md>1</Md></Foo>
|
||||
<Foo Include=""2_b1""><Md>2</Md></Foo>
|
||||
<Foo Include=""1_c1""><Md>1</Md></Foo>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name=""foo"" Inputs=""@(List1);@(List2)"" Outputs=""%(Culture).foo"">
|
||||
<Message Text=""TargetStarted"" />
|
||||
<Message Text=""List1: @(List1), List2: @(List2)""/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
TestMessageLogger testLogger = new TestMessageLogger ();
|
||||
engine.RegisterLogger (testLogger);
|
||||
|
||||
project.LoadXml (projectString);
|
||||
bool res = project.Build ("foo");
|
||||
if (!res) {
|
||||
testLogger.DumpMessages ();
|
||||
Assert.Fail ("A1: Build failed");
|
||||
}
|
||||
|
||||
CheckLoggedMessagesInOrder (testLogger, new string [] {
|
||||
"TargetStarted",
|
||||
"List1: fr_a.txt;fr_c.txt, List2: fr_x.txt",
|
||||
|
||||
"TargetStarted",
|
||||
"List1: en_b.txt, List2: ",
|
||||
|
||||
"TargetStarted",
|
||||
"List1: gb_d.txt, List2: gb_z.txt"
|
||||
}, "A2");
|
||||
CheckEngineEventCounts (testLogger, 3, 3, 6, 6);
|
||||
}
|
||||
|
||||
void CheckLoggedMessagesInOrder (TestMessageLogger logger, string [] values, string prefix)
|
||||
{
|
||||
try {
|
||||
for (int i = 0; i < values.Length; i++) {
|
||||
CheckLoggedMessageHead (logger, values [i], prefix + "#" + i);
|
||||
}
|
||||
if (logger.NormalMessageCount > 0)
|
||||
Assert.Fail ("{0}: Expected {1} messages, but found {2}",
|
||||
prefix, values.Length, values.Length + logger.NormalMessageCount);
|
||||
} catch (NUnit.Framework.AssertionException) {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckMessage (TestMessageLogger logger, string culture, string items, string id)
|
||||
{
|
||||
@@ -885,13 +516,5 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
if (logger.CheckAny (expected, MessageImportance.Normal) == 1)
|
||||
Assert.Fail ("{0}: Expected message '{1}' was not emitted.", id, expected);
|
||||
}
|
||||
|
||||
void CheckEngineEventCounts (TestMessageLogger logger, int target_start, int target_finish, int task_start, int task_finish)
|
||||
{
|
||||
Assert.AreEqual (target_start, logger.TargetStarted, "TargetStarted event count doesn't match");
|
||||
Assert.AreEqual (target_finish, logger.TargetFinished, "TargetFinished event count doesn't match");
|
||||
Assert.AreEqual (task_start, logger.TaskStarted, "TaskStarted event count doesn't match");
|
||||
Assert.AreEqual (task_finish, logger.TaskFinished, "TaskFinished event count doesn't match");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,38 +8,12 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
internal class TestMessageLogger : ILogger
|
||||
{
|
||||
List<BuildMessageEventArgs> messages;
|
||||
List<BuildEventArgs> all_messages;
|
||||
int target_started, target_finished;
|
||||
int task_started, task_finished;
|
||||
List<BuildEventArgs> errorsAndWarnings;
|
||||
|
||||
public TestMessageLogger ()
|
||||
{
|
||||
messages = new List<BuildMessageEventArgs> ();
|
||||
all_messages = new List<BuildEventArgs> ();
|
||||
}
|
||||
|
||||
public int TargetFinished
|
||||
{
|
||||
get { return target_finished; }
|
||||
set { target_finished = value; }
|
||||
}
|
||||
|
||||
public int TargetStarted
|
||||
{
|
||||
get { return target_started; }
|
||||
set { target_started = value; }
|
||||
}
|
||||
|
||||
public int TaskStarted
|
||||
{
|
||||
get { return task_started; }
|
||||
set { task_started = value; }
|
||||
}
|
||||
|
||||
public int TaskFinished
|
||||
{
|
||||
get { return task_finished; }
|
||||
set { task_finished = value; }
|
||||
errorsAndWarnings = new List<BuildEventArgs> ();
|
||||
}
|
||||
|
||||
public int Count
|
||||
@@ -54,12 +28,8 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
public void Initialize (IEventSource eventSource)
|
||||
{
|
||||
eventSource.MessageRaised += new BuildMessageEventHandler (MessageHandler);
|
||||
eventSource.ErrorRaised += new BuildErrorEventHandler (AllMessagesHandler);
|
||||
eventSource.WarningRaised += new BuildWarningEventHandler(AllMessagesHandler);
|
||||
eventSource.TargetStarted += delegate { target_started++; };
|
||||
eventSource.TargetFinished += delegate { target_finished++; };
|
||||
eventSource.TaskStarted += delegate { task_started++; };
|
||||
eventSource.TaskFinished += delegate { task_finished++; };
|
||||
eventSource.ErrorRaised += new BuildErrorEventHandler (ErrorHandler);
|
||||
eventSource.WarningRaised += new BuildWarningEventHandler (WarningHandler);
|
||||
}
|
||||
|
||||
public void Shutdown ()
|
||||
@@ -70,23 +40,16 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
{
|
||||
if (args.Message.StartsWith ("Using") == false)
|
||||
messages.Add (args);
|
||||
all_messages.Add (args);
|
||||
}
|
||||
|
||||
private void AllMessagesHandler (object sender, BuildEventArgs args)
|
||||
private void ErrorHandler (object sender, BuildEventArgs args)
|
||||
{
|
||||
all_messages.Add (args);
|
||||
errorsAndWarnings.Add (args);
|
||||
}
|
||||
|
||||
public int NormalMessageCount {
|
||||
get
|
||||
{
|
||||
int count = 0, i = 0;
|
||||
while (i ++ < messages.Count)
|
||||
if (messages [i - 1].Importance == MessageImportance.Normal)
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
private void WarningHandler (object sender, BuildEventArgs args)
|
||||
{
|
||||
errorsAndWarnings.Add (args);
|
||||
}
|
||||
|
||||
public int CheckHead (string text, MessageImportance importance)
|
||||
@@ -101,13 +64,8 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
actual_msg = String.Empty;
|
||||
|
||||
if (messages.Count > 0) {
|
||||
//find first @importance level message
|
||||
int i = 0;
|
||||
while (messages [i].Importance != importance && i < messages.Count)
|
||||
i++;
|
||||
|
||||
actual = messages [i];
|
||||
messages.RemoveAt (i);
|
||||
actual = messages [0];
|
||||
messages.RemoveAt (0);
|
||||
} else
|
||||
return 1;
|
||||
|
||||
@@ -144,7 +102,10 @@ namespace MonoTests.Microsoft.Build.Tasks
|
||||
|
||||
public void DumpMessages ()
|
||||
{
|
||||
foreach (BuildEventArgs arg in all_messages)
|
||||
foreach (BuildEventArgs arg in errorsAndWarnings)
|
||||
Console.WriteLine ("{0} {1}", (arg is BuildErrorEventArgs) ? "Err:" : "Warn:", arg.Message);
|
||||
|
||||
foreach (BuildMessageEventArgs arg in messages)
|
||||
Console.WriteLine ("Msg: {0}", arg.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,3 @@
|
||||
2009-02-12 Jordi Mas i Hernandez <[email protected]>
|
||||
|
||||
* Mono.Cairo/ScaledFont.cs: Fixes Dispose signature
|
||||
* Mono.Cairo/FontFace.cs: Fixes Dispose signature
|
||||
* Mono.Cairo/Surface.cs: Fixes Dispose signature
|
||||
* Mono.Cairo/Path.cs: Fixes Dispose signature
|
||||
* Mono.Cairo/Pattern.cs: Fixes Dispose signature
|
||||
|
||||
2009-02-07 Jordi Mas i Hernandez <[email protected]>
|
||||
|
||||
* Mono.Cairo/NativeMethods.cs: class should be internal not public
|
||||
|
||||
2008-11-30 Jordi Mas i Hernandez <[email protected]>
|
||||
|
||||
* Mono.Cairo/ImageSurface.cs: Fixes ImageSurface constructor signature.
|
||||
|
||||
@@ -51,13 +51,13 @@ namespace Cairo
|
||||
~FontFace ()
|
||||
{
|
||||
// Since Cairo is not thread safe, we can not unref the
|
||||
// font_face here, the programmer must do this with Dispose
|
||||
// font_face here, the programmer must do this with IDisposable.Dispose
|
||||
|
||||
Console.Error.WriteLine ("Programmer forgot to call Dispose on the FontFace");
|
||||
Dispose (false);
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
void IDisposable.Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Cairo
|
||||
// sort these so it is easier to find what is missing
|
||||
// http://www.cairographics.org/manual/ix01.html
|
||||
|
||||
internal static class NativeMethods
|
||||
public static class NativeMethods
|
||||
{
|
||||
const string cairo = "libcairo-2.dll";
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Cairo {
|
||||
}
|
||||
|
||||
|
||||
public void Dispose ()
|
||||
void IDisposable.Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
GC.SuppressFinalize (this);
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Cairo {
|
||||
NativeMethods.cairo_pattern_reference (pattern);
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
void IDisposable.Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Cairo {
|
||||
get { return NativeMethods.cairo_scaled_font_status (handle); }
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
void IDisposable.Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
GC.SuppressFinalize (this);
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Cairo {
|
||||
NativeMethods.cairo_paint (gr.Handle);
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
void IDisposable.Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
GC.SuppressFinalize (this);
|
||||
|
||||
Loaded 100 of 1472 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user