[libpeas/msvc: 8/9] NMake Makefiles: Build the tests



commit 52175746969efec2441459af3b9ae818ec5ae6fb
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Oct 17 00:48:22 2018 +0800

    NMake Makefiles: Build the tests
    
    This builds the test programs, and prepares the file layout in order to
    run the tests within the tree.

 win32/Makefile.am                 |   3 +-
 win32/Makefile.vc                 |   3 +-
 win32/build-rules-msvc.mak        | 340 +++++++++++++++++++++++++++++++++++++-
 win32/config-msvc.mak             |  66 +++++++-
 win32/create-lists-msvc.mak       | 109 ++++++++++++
 win32/generate-msvc.mak           |  21 ++-
 win32/peas-introspection-msvc.mak |  41 ++++-
 win32/replace.py                  | 115 +++++++++++++
 8 files changed, 682 insertions(+), 16 deletions(-)
---
diff --git a/win32/Makefile.am b/win32/Makefile.am
index de2830d..bb6b495 100644
--- a/win32/Makefile.am
+++ b/win32/Makefile.am
@@ -12,4 +12,5 @@ EXTRA_DIST =  \
        luaconfig.mak   \
        Makefile.vc     \
        pythonconfig.mak        \
-       peas-introspection-msvc.mak
+       peas-introspection-msvc.mak     \
+       replace.py
diff --git a/win32/Makefile.vc b/win32/Makefile.vc
index 8408ca0..da32945 100644
--- a/win32/Makefile.vc
+++ b/win32/Makefile.vc
@@ -18,6 +18,7 @@
 !include ..\peas-demo\peas-demo-srcs.mak
 !include ..\peas-demo\plugins\helloworld\demo-helloworld-srcs.mak
 !include ..\peas-demo\plugins\secondtime\demo-secondtime-srcs.mak
+!include ..\tests\libpeas\introspection\test-introspection-srcs.mak
 
 # Include the Makefile portion that enables features based on user input
 !include config-msvc.mak
@@ -40,8 +41,6 @@ INTROSPECTION_ITEMS =
 
 all: $(PEAS_LIBS) $(PEAS_LOADERS) $(INTROSPECTION_ITEMS) $(PEAS_DEMOS) all-build-info
 
-tests: all $(HB_TESTS)
-
 !include peas-introspection-msvc.mak
 
 # Include the build rules for sources, DLLs and executables
diff --git a/win32/build-rules-msvc.mak b/win32/build-rules-msvc.mak
index 6ac4ec3..2ab4068 100644
--- a/win32/build-rules-msvc.mak
+++ b/win32/build-rules-msvc.mak
@@ -81,6 +81,87 @@ $<
 $<
 <<
 
+# Inference rules for the various test sources
+
+{..\tests\testing-util\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_CFLAGS) $(PEAS_LIB_DEFINES) $(TEST_UTIL_CFLAGS) $(TEST_UTIL_DEFINES) 
/Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+{..\tests\libpeas\testing\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_CFLAGS) $(PEAS_LIB_DEFINES) $(TEST_UTIL_CFLAGS) $(TEST_UTIL_DEFINES) 
/I..\tests\libpeas\introspection /Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+{..\tests\libpeas\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_CFLAGS) $(PEAS_LIB_DEFINES) $(TEST_UTIL_CFLAGS) /Fo$(CFG)\$(PLAT)\peas-test\ 
/c @<<
+$<
+<<
+
+{..\tests\libpeas-gtk\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_GTK_CFLAGS) $(PEAS_LIB_DEFINES) $(TEST_GTK_UTIL_CFLAGS) 
/Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+{..\tests\libpeas\introspection\}.c{$(CFG)\$(PLAT)\peas-test-introspection\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_CFLAGS) $(PEAS_LIB_DEFINES) /Fo$(CFG)\$(PLAT)\peas-test-introspection\ /c @<<
+$<
+<<
+
+{..\tests\libpeas\plugins\embedded\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_CFLAGS) $(PEAS_LIB_DEFINES) /Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+{..\tests\libpeas\plugins\extension-c\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_CFLAGS) $(PEAS_LIB_DEFINES) /I..\tests\libpeas\introspection 
/Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+{..\tests\plugins\builtin\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_CFLAGS) $(PEAS_LIB_DEFINES) /Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+{..\tests\plugins\has-dep\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_CFLAGS) $(PEAS_LIB_DEFINES) /Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+{..\tests\plugins\loadable\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_CFLAGS) $(PEAS_LIB_DEFINES) /Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+{..\tests\plugins\self-dep\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_CFLAGS) $(PEAS_LIB_DEFINES) /Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+{..\tests\libpeas-gtk\plugins\builtin-configurable\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_GTK_CFLAGS) $(PEAS_LIB_DEFINES) /Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+{..\tests\libpeas-gtk\plugins\configurable\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_GTK_CFLAGS) $(PEAS_LIB_DEFINES) /Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+{$(CFG)\$(PLAT)\peas-test\}.c{$(CFG)\$(PLAT)\peas-test\}.obj::
+       $(CC) $(CFLAGS) $(PEAS_CFLAGS) $(PEAS_LIB_DEFINES) /Fo$(CFG)\$(PLAT)\peas-test\ /c @<<
+$<
+<<
+
+$(CFG)\$(PLAT)\peas-test\extension-python.obj: ..\tests\libpeas\extension-py.c
+       $(CC) $(CFLAGS) $(PEAS_DEFINES) $(TEST_UTIL_CFLAGS) $(PYTHON_EXT_TEST_CFLAG) /Fo$@ $** /c
+
+$(CFG)\$(PLAT)\peas-test\extension-python3.obj: ..\tests\libpeas\extension-py.c
+       $(CC) $(CFLAGS) $(PEAS_DEFINES) $(TEST_UTIL_CFLAGS) $(PYTHON3_EXT_TEST_CFLAG) /Fo$@ $** /c
+
+$(CFG)\$(PLAT)\peas-test\testing-gtk.obj: ..\tests\libpeas-gtk\testing\testing.c
+       $(CC) $(CFLAGS) $(PEAS_GTK_CFLAGS) $(PEAS_DEFINES) $(TEST_UTIL_DEFINES) $(TEST_GTK_UTIL_CFLAGS) /Fo$@ 
$** /c
+
 # Inference rules for building the test programs
 # Used for programs with a single source file.
 # Format is as follows
@@ -98,6 +179,7 @@ $<
 #      @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
 $(CFG)\$(PLAT)\peas-$(APIVERSION).lib: $(PEAS_DLL)
 $(CFG)\$(PLAT)\peas-gtk-$(APIVERSION).lib: $(PEAS_GTK_DLL)
+$(CFG)\$(PLAT)\introspection.lib: $(CFG)\$(PLAT)\introspection.dll
 
 $(PEAS_DLL): config.h $(CFG)\$(PLAT)\peas $(PEAS_MARSHAL_SRCS) $(peas_OBJS)
        link /DLL $(PEAS_LDFLAGS) $(PEAS_DEP_LIBS) -out:$@ -implib:$(CFG)\$(PLAT)\peas-$(APIVERSION).lib @<<
@@ -166,6 +248,107 @@ $(peas_demo_secondtime_OBJS)
        @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
        @-if exist $@.manifest del $@.manifest
 
+$(CFG)\$(PLAT)\introspection.dll:      \
+$(PEAS_LIBS)   \
+$(CFG)\$(PLAT)\peas-test-introspection \
+$(peas_test_introspection_OBJS)
+       link /DLL $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(peas_test_introspection_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\libembedded.dll:        \
+$(PEAS_LIBS)   \
+$(CFG)\$(PLAT)\peas-test       \
+$(peas_test_embedded_OBJS)
+       link /DLL $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(peas_test_embedded_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\libloadable.dll:        \
+$(PEAS_LIBS)   \
+$(CFG)\$(PLAT)\peas-test       \
+$(peas_test_loadable_OBJS)
+       link /DLL $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(peas_test_loadable_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\libbuiltin.dll: \
+$(PEAS_LIBS)   \
+$(CFG)\$(PLAT)\peas-test       \
+$(peas_test_builtin_OBJS)
+       link /DLL $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(peas_test_builtin_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\libhas-dep.dll: \
+$(PEAS_LIBS)   \
+$(CFG)\$(PLAT)\peas-test       \
+$(peas_test_has_dep_OBJS)
+       link /DLL $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(peas_test_has_dep_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\libself-dep.dll:        \
+$(PEAS_LIBS)   \
+$(CFG)\$(PLAT)\peas-test       \
+$(peas_test_self_dep_OBJS)
+       link /DLL $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(peas_test_self_dep_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\libextension-c.dll:     \
+$(PEAS_LIBS)   \
+$(CFG)\$(PLAT)\peas-test       \
+$(CFG)\$(PLAT)\Introspection-1.0.typelib       \
+$(peas_test_extension_c_mod_OBJS)
+       link /DLL $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) $(CFG)\$(PLAT)\introspection.lib -out:$@ @<<
+$(peas_test_extension_c_mod_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\libextension-c-missing-symbol.dll:      \
+$(PEAS_LIBS)   \
+$(CFG)\$(PLAT)\peas-test       \
+$(peas_test_extension_c_missing_symbol_mod_OBJS)
+       link /DLL $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(peas_test_extension_c_missing_symbol_mod_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\libbuiltin-configurable.dll:    \
+$(PEAS_LIBS)   \
+$(CFG)\$(PLAT)\peas-test       \
+$(peas_test_gtk_builtin_configurable_OBJS)
+       link /DLL $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_GTK_LIBS) -out:$@ @<<
+$(peas_test_gtk_builtin_configurable_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\libconfigurable.dll:    \
+$(PEAS_LIBS)   \
+$(CFG)\$(PLAT)\peas-test       \
+$(peas_test_gtk_configurable_OBJS)
+       link /DLL $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_GTK_LIBS) -out:$@ @<<
+$(peas_test_gtk_configurable_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+       @-if exist $@.manifest del $@.manifest
+
 # Rules for linking EXEs
 # Format is as follows (the mt command is needed for MSVC 2005/2008 builds):
 # $(exe_name_with_path): $(dependent_libs_files_objects_and_items)
@@ -180,7 +363,135 @@ $(peas_demo_OBJS)
        @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
        @-if exist $@.manifest del $@.manifest
 
+$(CFG)\$(PLAT)\engine.exe:     \
+$(CFG)\$(PLAT)\peas-test       \
+$(CFG)\$(PLAT)\Introspection-1.0.typelib       \
+$(TESTS_DLLS)  \
+$(TESTING_UTIL_OBJS)   \
+$(CFG)\$(PLAT)\peas-test\engine.obj
+       link $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(CFG)\$(PLAT)\peas-test\engine.obj $(TESTING_UTIL_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\extension-c.exe:        \
+$(CFG)\$(PLAT)\peas-test       \
+$(CFG)\$(PLAT)\Introspection-1.0.typelib       \
+$(TESTS_DLLS)  \
+$(TESTING_EXT_UTIL_OBJS)       \
+$(CFG)\$(PLAT)\libembedded.dll \
+$(CFG)\$(PLAT)\peas-test\extension-c.obj
+       link $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) $(CFG)\$(PLAT)\introspection.lib -out:$@ @<<
+$(CFG)\$(PLAT)\peas-test\extension-c.obj $(TESTING_EXT_UTIL_OBJS) 
$(CFG)\$(PLAT)\peas-test\embedded-resources.obj $(CFG)\$(PLAT)\libembedded.lib
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\extension-lua.exe:      \
+$(CFG)\$(PLAT)\peas-test       \
+$(CFG)\$(PLAT)\liblua51loader.dll      \
+$(TESTS_DLLS)  \
+$(TESTING_EXT_UTIL_OBJS)       \
+$(CFG)\$(PLAT)\peas-test\extension-lua.obj
+       link $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) $(CFG)\$(PLAT)\introspection.lib -out:$@ @<<
+$(CFG)\$(PLAT)\peas-test\extension-lua.obj $(TESTING_EXT_UTIL_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\extension-python.exe:   \
+$(CFG)\$(PLAT)\peas-test       \
+$(CFG)\$(PLAT)\libpythonloader.dll     \
+$(TESTS_DLLS)  \
+$(TESTING_EXT_UTIL_OBJS)       \
+$(CFG)\$(PLAT)\peas-test\extension-python.obj
+       link $(PYTHON_LOADER_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) $(CFG)\$(PLAT)\introspection.lib -out:$@ 
@<<
+$(CFG)\$(PLAT)\peas-test\extension-python.obj $(TESTING_EXT_UTIL_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\extension-python3.exe:  \
+$(CFG)\$(PLAT)\peas-test       \
+$(CFG)\$(PLAT)\libpython3loader.dll    \
+$(TESTS_DLLS)  \
+$(TESTING_EXT_UTIL_OBJS)       \
+$(CFG)\$(PLAT)\peas-test\extension-python3.obj
+       link $(PYTHON3_LOADER_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) $(CFG)\$(PLAT)\introspection.lib -out:$@ 
@<<
+$(CFG)\$(PLAT)\peas-test\extension-python3.obj $(TESTING_EXT_UTIL_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\extension-set.exe:      \
+$(CFG)\$(PLAT)\peas-test       \
+$(TESTS_DLLS)  \
+$(TESTING_UTIL_OBJS)   \
+$(CFG)\$(PLAT)\peas-test\extension-set.obj
+       link $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(CFG)\$(PLAT)\peas-test\extension-set.obj $(TESTING_UTIL_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\plugin-info.exe:        \
+$(CFG)\$(PLAT)\peas-test       \
+$(TESTS_DLLS)  \
+$(TESTING_UTIL_OBJS)   \
+$(CFG)\$(PLAT)\peas-test\plugin-info.obj
+       link $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(CFG)\$(PLAT)\peas-test\plugin-info.obj $(TESTING_UTIL_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\plugin-manager.exe:     \
+$(CFG)\$(PLAT)\peas-test       \
+$(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).typelib   \
+$(TESTS_DLLS)  \
+$(TESTING_GTK_UTIL_OBJS)       \
+$(CFG)\$(PLAT)\peas-test\plugin-manager.obj
+       link $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_GTK_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(CFG)\$(PLAT)\peas-test\plugin-manager.obj $(TESTING_GTK_UTIL_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\plugin-manager-store.exe:       \
+$(CFG)\$(PLAT)\peas-test       \
+$(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).typelib   \
+$(TESTS_DLLS)  \
+$(TESTING_GTK_UTIL_OBJS)       \
+$(CFG)\$(PLAT)\peas-test\plugin-manager-store.obj
+       link $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_GTK_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(CFG)\$(PLAT)\peas-test\plugin-manager-store.obj $(TESTING_GTK_UTIL_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+       @-if exist $@.manifest del $@.manifest
+
+$(CFG)\$(PLAT)\plugin-manager-view.exe:        \
+$(CFG)\$(PLAT)\peas-test       \
+$(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).typelib   \
+$(TESTS_DLLS)  \
+$(TESTING_GTK_UTIL_OBJS)       \
+$(CFG)\$(PLAT)\peas-test\plugin-manager-view.obj
+       link $(PEAS_LDFLAGS) $(PEAS_LIBS) $(PEAS_GTK_LIBS) $(PEAS_DEP_LIBS) -out:$@ @<<
+$(CFG)\$(PLAT)\peas-test\plugin-manager-view.obj $(TESTING_GTK_UTIL_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+       @-if exist $@.manifest del $@.manifest
+
 clean:
+       @for %%d in (builtin has-dep loadable self-dep) do @(for %%x in (dll pdb) do @if exist 
..\tests\plugins\%%d\lib%%d.%%x del /f /q ..\tests\plugins\%%d\lib%%d.%%x)
+       @for %%d in (embedded extension-c) do @(for %%x in (dll pdb) do @if exist 
..\tests\libpeas\plugins\%%d\lib%%d.%%x del /f /q ..\tests\libpeas\plugins\%%d\lib%%d.%%x)
+       @for %%x in (dll pdb) do @if exist 
..\tests\libpeas\plugins\extension-c\libextension-c-missing-symbol.%%x del /f /q 
..\tests\libpeas\plugins\extension-c\libextension-c-missing-symbol.%%x
+       @for %%d in (builtin-configurable configurable) do @(for %%x in (dll pdb) do @if exist 
..\tests\libpeas-gtk\plugins\%%d\lib%%d.%%x del /f /q ..\tests\libpeas-gtk\plugins\%%d\lib%%d.%%x)
+       @for %%x in (gschema.xml plugin py) do @del /f /q ..\tests\libpeas\plugins\extension-python\*.%%x
+       @for %%t in (c lua python) do @if exist ..\tests\libpeas\plugins\extension-%%t\gschema.compiled del 
/f /q ..\tests\libpeas\plugins\extension-%%t\gschema.compiled
+       @if exist ..\tests\libpeas\introspection\Introspection-1.0.typelib del /f /q 
..\tests\libpeas\introspection\Introspection-1.0.typelib
+       @if exist ..\libpeas-gtk\PeasGtk-$(APIVERSION).typelib del /f /q 
..\libpeas-gtk\PeasGtk-$(APIVERSION).typelib
+       @if exist ..\libpeas\Peas-$(APIVERSION).typelib del /f /q ..\libpeas\Peas-$(APIVERSION).typelib
        @for %%x in (dll pdb) do @if exist ..\loaders\python3\libpython3loader.%%x del /f /q 
..\loaders\python3\libpython3loader.%%x
        @for %%x in (dll pdb) do @if exist ..\loaders\lua5.1\liblua51loader.%%x del /f /q  
..\loaders\lua5.1\liblua51loader.%%x
        @for %%x in (dll pdb) do @if exist ..\peas-demo\plugins\helloworld\libhelloworld.%%x del /f /q 
..\peas-demo\plugins\helloworld\libhelloworld.%%x
@@ -188,6 +499,8 @@ clean:
        @for %%x in (dll pdb) do @if exist ..\peas-demo\$(PEAS_DLL_NAME).%%x del /f /q 
..\peas-demo\$(PEAS_DLL_NAME).%%x
        @for %%x in (dll pdb) do @if exist ..\peas-demo\$(PEAS_GTK_DLL_NAME).%%x del /f /q 
..\peas-demo\$(PEAS_GTK_DLL_NAME).%%x
        @for %%x in (exe pdb) do @if exist ..\peas-demo\peas-demo.%%x del /f /q ..\peas-demo\peas-demo.%%x
+       @if exist $(CFG)\$(PLAT)\Introspection-1.0.typelib del $(CFG)\$(PLAT)\Introspection-1.0.typelib
+       @if exist $(CFG)\$(PLAT)\Introspection-1.0.gir del $(CFG)\$(PLAT)\Introspection-1.0.gir
        @if exist $(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).typelib del 
$(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).typelib
        @if exist $(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).gir del $(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).gir
        @if exist $(CFG)\$(PLAT)\Peas-$(APIVERSION).typelib del $(CFG)\$(PLAT)\Peas-$(APIVERSION).typelib
@@ -199,6 +512,9 @@ clean:
        @-del /f /q $(CFG)\$(PLAT)\*.lib
        @-del /f /q $(CFG)\$(PLAT)\*.exp
        @for %%f in ($(CFG)\$(PLAT)\*.ilk) do @del /f /q $(CFG)\$(PLAT)\%%f
+       @if exist $(CFG)\$(PLAT)\peas-test-introspection\ del /f /q 
$(CFG)\$(PLAT)\peas-test-introspection\*.obj
+       @if exist $(CFG)\$(PLAT)\peas-test\ del /f /q $(CFG)\$(PLAT)\peas-test\*.obj
+       @for %%x in (c h) do @(if exist $(CFG)\$(PLAT)\peas-test\embedded-resources.%%x del /f /q 
$(CFG)\$(PLAT)\peas-test\embedded-resources.%%x)
        @if exist $(CFG)\$(PLAT)\peas-demo-secondtime\ del /f /q $(CFG)\$(PLAT)\peas-demo-secondtime\*.obj
        @if exist $(CFG)\$(PLAT)\peas-demo-helloworld\ del /f /q $(CFG)\$(PLAT)\peas-demo-helloworld\*.obj
        @if exist $(CFG)\$(PLAT)\peas-demo\ del /f /q $(CFG)\$(PLAT)\peas-demo\*.obj
@@ -211,6 +527,8 @@ clean:
        @if exist $(CFG)\$(PLAT)\peas-gtk\ del /f /q $(CFG)\$(PLAT)\peas-gtk\*.obj
        @-del /f /q $(CFG)\$(PLAT)\peas\*.obj
        @-del /f /q $(PEAS_MARSHAL_SRCS)
+       @if exist $(CFG)\$(PLAT)\peas-test-introspection\ rmdir /s /q $(CFG)\$(PLAT)\peas-test-introspection
+       @if exist $(CFG)\$(PLAT)\peas-test\ rmdir /s /q $(CFG)\$(PLAT)\peas-test
        @if exist $(CFG)\$(PLAT)\peas-demo-secondtime\ rmdir /s /q $(CFG)\$(PLAT)\peas-demo-secondtime
        @if exist $(CFG)\$(PLAT)\peas-demo-helloworld\ rmdir /s /q $(CFG)\$(PLAT)\peas-demo-helloworld
        @if exist $(CFG)\$(PLAT)\peas-demo\ rmdir /s /q $(CFG)\$(PLAT)\peas-demo
@@ -242,15 +560,31 @@ install:
        @if exist $(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).gir (copy /y $(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).gir 
$(PREFIX)\share\gir-1.0\)
        @if exist $(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).typelib (copy /y 
$(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).typelib $(PREFIX)\lib\girepository-1.0\)
 
-prep-run-demo:
+copy-loaders:
+       @for %%x in (dll pdb) do @if exist $(CFG)\$(PLAT)\libpythonloader.%%x copy /b /y 
$(CFG)\$(PLAT)\libpythonloader.%%x ..\loaders\python
+       @for %%x in (dll pdb) do @if exist $(CFG)\$(PLAT)\libpython3loader.%%x copy /b /y 
$(CFG)\$(PLAT)\libpython3loader.%%x ..\loaders\python3
+       @for %%x in (dll pdb) do @if exist $(CFG)\$(PLAT)\liblua51loader.%%x copy /b /y 
$(CFG)\$(PLAT)\liblua51loader.%%x ..\loaders\lua5.1
+
+tests: $(TEST_PROGS) copy-loaders
+       @copy /b $(CFG)\$(PLAT)\Peas-$(APIVERSION).typelib ..\libpeas
+       @if exist $(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).typelib copy /b 
$(CFG)\$(PLAT)\PeasGtk-$(APIVERSION).typelib ..\libpeas-gtk
+       @copy /b $(CFG)\$(PLAT)\Introspection-1.0.typelib ..\tests\libpeas\introspection
+       @for %%d in (builtin has-dep loadable self-dep) do @(for %%x in (dll pdb) do @copy /b 
$(CFG)\$(PLAT)\lib%%d.%%x ..\tests\plugins\%%d\)
+       @for %%d in (embedded extension-c) do @(for %%x in (dll pdb) do @copy /b $(CFG)\$(PLAT)\lib%d.%x 
..\tests\libpeas\plugins\%d\)
+       @for %%x in (dll pdb) do @if exist $(CFG)\$(PLAT)\libextension-c-missing-symbol.%%x copy 
$(CFG)\$(PLAT)\libextension-c-missing-symbol.%%x ..\tests\libpeas\plugins\extension-c
+       @for %%d in (builtin-configurable configurable) do @(for %%x in (dll pdb) do @copy /b 
$(CFG)\$(PLAT)\lib%%d.%%x ..\tests\libpeas-gtk\plugins\%%d\)
+       @for %%x in (gschema.xml plugin) do @if "$(BUILD_PY2_LOADER)" == "1" $(PYTHON) replace.py 
-a=replace-str -i=..\tests\libpeas\plugins\extension-python\extension-py.%%x.in 
-o=..\tests\libpeas\plugins\extension-python\extension-python.%%x --instring=PY_LOADER --outstring=python
+       @for %%x in (gschema.xml plugin) do @if "$(BUILD_PY3_LOADER)" == "1" $(PYTHON) replace.py 
-a=replace-str -i=..\tests\libpeas\plugins\extension-python\extension-py.%%x.in 
-o=..\tests\libpeas\plugins\extension-python\extension-python3.%%x --instring=PY_LOADER --outstring=python3
+       @if "$(BUILD_PY2_LOADER)" == "1" copy ..\tests\libpeas\plugins\extension-python\extension-py.py.in 
..\tests\libpeas\plugins\extension-python\extension-python.py
+       @if "$(BUILD_PY3_LOADER)" == "1" copy ..\tests\libpeas\plugins\extension-python\extension-py.py.in 
..\tests\libpeas\plugins\extension-python\extension-python3.py
+
+prep-run-demo: copy-loaders
        @if not exist $(CFG)\$(PLAT)\peas-demo.exe (echo peas-demo is not built yet!) & (goto :eof)
        @for %%x in (exe pdb) do @copy /b /y $(CFG)\$(PLAT)\peas-demo.%%x ..\peas-demo
        @for %%x in (dll pdb) do @copy /b /y $(CFG)\$(PLAT)\$(PEAS_GTK_DLL_NAME).%%x ..\peas-demo
        @for %%x in (dll pdb) do @copy /b /y $(CFG)\$(PLAT)\$(PEAS_DLL_NAME).%%x ..\peas-demo
        @for %%x in (dll pdb) do @copy /b /y $(CFG)\$(PLAT)\libhelloworld.%%x ..\peas-demo\plugins\helloworld
        @for %%x in (dll pdb) do @copy /b /y $(CFG)\$(PLAT)\libsecondtime.%%x ..\peas-demo\plugins\secondtime
-       @for %%x in (dll pdb) do @if exist $(CFG)\$(PLAT)\libpython3loader.%%x copy /b /y 
$(CFG)\$(PLAT)\libpython3loader.%%x ..\loaders\python3
-       @for %%x in (dll pdb) do @if exist $(CFG)\$(PLAT)\liblua51loader.%%x copy /b /y 
$(CFG)\$(PLAT)\liblua51loader.%%x ..\loaders\lua5.1
        @echo Please set the environment variables as follows to run the peas-demo program
        @echo directly from the build:
        @echo set GI_TYPELIB_PATH=%%CD%%\$(CFG)\$(PLAT)
diff --git a/win32/config-msvc.mak b/win32/config-msvc.mak
index 97b4b45..bcb96d0 100644
--- a/win32/config-msvc.mak
+++ b/win32/config-msvc.mak
@@ -132,10 +132,11 @@ PEAS_LOADERS = $(CFG)\$(PLAT)\libpythonloader.dll $(PEAS_LOADERS)
 PEAS_LOADERS_BUILT = python2 $(PEAS_LOADERS_BUILT)
 !endif
 !if "$(BUILD_PY3_LOADER)" == "1"
-PEAS_LOADERS = $(CFG)\$(PLAT)\libpython3loader.dll $(PEAS_LOADERS)
+PEAS_LOADERS = $(CFG)\$(PLAT)\libpythonloader3.dll $(PEAS_LOADERS)
 PEAS_LOADERS_BUILT = python3 $(PEAS_LOADERS_BUILT)
 !endif
 
+
 !if "$(LGI_ERR)" == "0"
 PEAS_LOADERS = $(CFG)\$(PLAT)\liblua51loader.dll $(PEAS_LOADERS)
 PEAS_LOADERS_BUILT = lua $(PEAS_LOADERS_BUILT)
@@ -144,4 +145,65 @@ LUA_CFLAGS = $(PEAS_DEFINES) $(PEAS_CFLAGS)
 !if "$(LUA_EXTRA_CFLAGS)" != ""
 LUA_CFLAGS = $(LUA_EXTRA_CFLAGS) $(LUA_CFLAGS)
 !endif
-!endif
\ No newline at end of file
+!endif
+
+TESTS_DLLS =   \
+       $(CFG)\$(PLAT)\libbuiltin.dll   \
+       $(CFG)\$(PLAT)\libembedded.dll  \
+       $(CFG)\$(PLAT)\libloadable.dll  \
+       $(CFG)\$(PLAT)\libhas-dep.dll   \
+       $(CFG)\$(PLAT)\libself-dep.dll  \
+       $(CFG)\$(PLAT)\libextension-c.dll       \
+       $(CFG)\$(PLAT)\libextension-c-missing-symbol.dll
+
+TEST_PROGS =   \
+       $(CFG)\$(PLAT)\engine.exe       \
+       $(CFG)\$(PLAT)\extension-c.exe  \
+       $(CFG)\$(PLAT)\extension-set.exe        \
+       $(CFG)\$(PLAT)\plugin-info.exe
+
+!if "$(PEAS_NO_GTK)" == ""
+TESTS_DLLS =   \
+       $(TESTS_DLLS)   \
+       $(CFG)\$(PLAT)\libbuiltin-configurable.dll      \
+       $(CFG)\$(PLAT)\libconfigurable.dll
+
+TEST_PROGS =   \
+       $(TEST_PROGS)   \
+       $(CFG)\$(PLAT)\plugin-manager.exe       \
+       $(CFG)\$(PLAT)\plugin-manager-store.exe \
+       $(CFG)\$(PLAT)\plugin-manager-view.exe
+
+!endif
+
+!if "$(LGI_ERR)" == "0"
+TEST_PROGS = $(TEST_PROGS) $(CFG)\$(PLAT)\extension-lua.exe
+!endif
+
+!if "$(BUILD_PY2_LOADER)" == "1"
+TEST_PROGS = $(TEST_PROGS) $(CFG)\$(PLAT)\extension-python.exe
+PYTHON_EXT_TEST_CFLAG = $(PYTHON_EXT_TEST_CFLAG) /DENABLE_PYTHON2=1 $(PYTHON_LOADER_CFLAGS)
+!endif
+!if "$(BUILD_PY3_LOADER)" == "1"
+TEST_PROGS = $(TEST_PROGS) $(CFG)\$(PLAT)\extension-python3.exe
+PYTHON3_EXT_TEST_CFLAG = $(PYTHON_EXT_TEST_CFLAG) /DENABLE_PYTHON3=1 $(PYTHON3_LOADER_CFLAGS)
+!endif
+
+BASE_TESTING_UTIL_OBJS = $(CFG)\$(PLAT)\peas-test\testing-util.obj
+
+TESTING_UTIL_OBJS =    \
+       $(BASE_TESTING_UTIL_OBJS)       \
+       $(CFG)\$(PLAT)\peas-test\testing.obj
+
+TESTING_GTK_UTIL_OBJS =        \
+       $(BASE_TESTING_UTIL_OBJS)       \
+       $(CFG)\$(PLAT)\peas-test\testing-gtk.obj
+
+TESTING_EXT_UTIL_OBJS =        \
+       $(TESTING_UTIL_OBJS)    \
+       $(CFG)\$(PLAT)\peas-test\testing-extension.obj
+
+TEST_UTIL_DEFINES = /DSRCDIR=\"$(PEAS_BUILDDIR)\" /DBUILDDIR=\"$(PEAS_BUILDDIR)\"
+BASE_TEST_UTIL_CLFAGS = /I..\tests\testing-util
+TEST_UTIL_CFLAGS = $(BASE_TEST_UTIL_CLFAGS) /I..\tests\libpeas\testing
+TEST_GTK_UTIL_CFLAGS = $(BASE_TEST_UTIL_CLFAGS) /I..\tests\libpeas-gtk\testing
diff --git a/win32/create-lists-msvc.mak b/win32/create-lists-msvc.mak
index b0a80b8..3b915a5 100644
--- a/win32/create-lists-msvc.mak
+++ b/win32/create-lists-msvc.mak
@@ -135,6 +135,115 @@ NULL=
 !if [call create-lists.bat footer peas_objs.mak]
 !endif
 
+# For introspection test
+!if [call create-lists.bat header peas_objs.mak peas_test_introspection_OBJS]
+!endif
+
+!if [for %c in ($(PEAS_TEST_INTROSPECTION_SRCS)) do @if "%~xc" == ".c" @call create-lists.bat file 
peas_objs.mak ^$(CFG)\^$(PLAT)\peas-test-introspection\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
+!if [call create-lists.bat header peas_objs.mak peas_test_introspection_sources]
+!endif
+
+!if [for %c in ($(PEAS_TEST_INTROSPECTION_SRCS)) do @call create-lists.bat file peas_objs.mak 
..\tests\libpeas\introspection\%c]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
+!if [call create-lists.bat header peas_objs.mak embedded_plugins]
+!endif
+
+!if [for %p in (..\tests\libpeas\plugins\embedded\*.plugin) do @call create-lists.bat file peas_objs.mak %p]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
+!if [call create-lists.bat header peas_objs.mak peas_test_embedded_OBJS]
+!endif
+
+!if [for %c in (embedded-plugin.c embedded-resources.c) do @call create-lists.bat file peas_objs.mak 
^$(CFG)\^$(PLAT)\peas-test\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
+!if [call create-lists.bat header peas_objs.mak peas_test_loadable_OBJS]
+!endif
+
+!if [for %c in (..\tests\plugins\loadable\*.c) do @call create-lists.bat file peas_objs.mak 
^$(CFG)\^$(PLAT)\peas-test\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
+!if [call create-lists.bat header peas_objs.mak peas_test_builtin_OBJS]
+!endif
+
+!if [for %c in (..\tests\plugins\builtin\*.c) do @call create-lists.bat file peas_objs.mak 
^$(CFG)\^$(PLAT)\peas-test\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
+!if [call create-lists.bat header peas_objs.mak peas_test_has_dep_OBJS]
+!endif
+
+!if [for %c in (..\tests\plugins\has-dep\*.c) do @call create-lists.bat file peas_objs.mak 
^$(CFG)\^$(PLAT)\peas-test\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
+!if [call create-lists.bat header peas_objs.mak peas_test_self_dep_OBJS]
+!endif
+
+!if [for %c in (..\tests\plugins\self-dep\*.c) do @call create-lists.bat file peas_objs.mak 
^$(CFG)\^$(PLAT)\peas-test\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
+!if [call create-lists.bat header peas_objs.mak peas_test_extension_c_mod_OBJS]
+!endif
+
+!if [for %c in (..\tests\libpeas\plugins\extension-c\*.c) do @if not "%~nc" == 
"extension-c-missing-symbol-plugin" call create-lists.bat file peas_objs.mak 
^$(CFG)\^$(PLAT)\peas-test\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
+!if [call create-lists.bat header peas_objs.mak peas_test_extension_c_missing_symbol_mod_OBJS]
+!endif
+
+!if [for %c in (..\tests\libpeas\plugins\extension-c\*.c) do @if "%~nc" == 
"extension-c-missing-symbol-plugin" call create-lists.bat file peas_objs.mak 
^$(CFG)\^$(PLAT)\peas-test\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
+!if [call create-lists.bat header peas_objs.mak peas_test_gtk_configurable_OBJS]
+!endif
+
+!if [for %c in (..\tests\libpeas-gtk\plugins\configurable\*.c) do @if not "%~nc" == 
"extension-c-missing-symbol-plugin" call create-lists.bat file peas_objs.mak 
^$(CFG)\^$(PLAT)\peas-test\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
+!if [call create-lists.bat header peas_objs.mak peas_test_gtk_builtin_configurable_OBJS]
+!endif
+
+!if [for %c in (..\tests\libpeas-gtk\plugins\builtin-configurable\*.c) do @if not "%~nc" == 
"extension-c-missing-symbol-plugin" call create-lists.bat file peas_objs.mak 
^$(CFG)\^$(PLAT)\peas-test\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer peas_objs.mak]
+!endif
+
 !include peas_objs.mak
 
 !if [del /f /q peas_objs.mak]
diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak
index 1641005..f62ec12 100644
--- a/win32/generate-msvc.mak
+++ b/win32/generate-msvc.mak
@@ -47,6 +47,23 @@ $(CFG)\$(PLAT)\loaders-lua\peas-lua-resources.c:     \
        --internal                      \
        $**
 
+..\tests\libpeas\plugins\embedded\embedded.gresource.xml: $(embedded_plugins)
+
+embedded_resource_sources =    \
+       $(CFG)\$(PLAT)\peas-test\embedded-resources.h   \
+       $(CFG)\$(PLAT)\peas-test\embedded-resources.c
+
+$(CFG)\$(PLAT)\peas-test\embedded-resources.h  \
+$(CFG)\$(PLAT)\peas-test\embedded-resources.c: ..\tests\libpeas\plugins\embedded\embedded.gresource.xml
+       $(PREFIX)\bin\glib-compile-resources.exe        \
+       --target=$@                     \
+       --sourcedir=$(**D)      \
+       --generate      \
+       --c-name="embedded"     \
+       --manual-register       \
+       --internal                      \
+       $**
+
 # Create the build directories
 
 $(CFG)\$(PLAT)\peas    \
@@ -56,5 +73,7 @@ $(CFG)\$(PLAT)\loaders-py3    \
 $(CFG)\$(PLAT)\loaders-lua     \
 $(CFG)\$(PLAT)\peas-demo       \
 $(CFG)\$(PLAT)\peas-demo-helloworld    \
-$(CFG)\$(PLAT)\peas-demo-secondtime:
+$(CFG)\$(PLAT)\peas-demo-secondtime    \
+$(CFG)\$(PLAT)\peas-test-introspection \
+$(CFG)\$(PLAT)\peas-test:
        @-mkdir $@
\ No newline at end of file
diff --git a/win32/peas-introspection-msvc.mak b/win32/peas-introspection-msvc.mak
index 5f9cd4c..62477aa 100644
--- a/win32/peas-introspection-msvc.mak
+++ b/win32/peas-introspection-msvc.mak
@@ -38,13 +38,6 @@ $(CFG)/$(PLAT)/Peas-$(APIVERSION).gir: $(peas_introspection_sources) $(PEAS_DLL)
        -L $(CFG)\$(PLAT)       \
        -o $@
 
-$(CFG)/$(PLAT)/Peas-$(APIVERSION).typelib: $(CFG)/$(PLAT)/Peas-$(APIVERSION).gir
-       @-echo Compiling $@...
-       $(G_IR_COMPILER)        \
-       --includedir=$(CFG)/$(PLAT)/Peas-$(APIVERSION).gir --debug --verbose    \
-       $**     \
-       -o $@
-
 $(CFG)/$(PLAT)/PeasGtk-$(APIVERSION).gir: $(peas_introspection_sources) $(PEAS_DLL) 
$(CFG)/$(PLAT)/Peas-$(APIVERSION).gir
        @-echo Generating $@...
        $(PYTHON) $(G_IR_SCANNER)       \
@@ -65,6 +58,33 @@ $(CFG)/$(PLAT)/PeasGtk-$(APIVERSION).gir: $(peas_introspection_sources) $(PEAS_D
        -L $(CFG)\$(PLAT)       \
        -o $@
 
+$(CFG)/$(PLAT)/Introspection-1.0.gir: $(peas_test_introspection_sources) $(CFG)/$(PLAT)/introspection.lib 
$(CFG)/$(PLAT)/Peas-$(APIVERSION).gir
+       @-echo Generating $@...
+       $(PYTHON) $(G_IR_SCANNER)       \
+       --verbose -no-libtool   \
+       --namespace=Introspection       \
+       --nsversion=1.0 \
+               \
+       --library=introspection --library=peas-1.0      \
+               \
+       --add-include-path=$(G_IR_INCLUDEDIR)   \
+       --include=GObject-2.0   \
+       --pkg-export=libpeas-1.0        \
+       --cflags-begin  \
+       $(PEAS_CFLAGS)  \
+       --cflags-end    \
+       --warn-all      \
+       $(peas_test_introspection_sources)      \
+       -L $(CFG)\$(PLAT)       \
+       -o $@
+
+$(CFG)/$(PLAT)/Peas-$(APIVERSION).typelib: $(CFG)/$(PLAT)/Peas-$(APIVERSION).gir
+       @-echo Compiling $@...
+       $(G_IR_COMPILER)        \
+       --debug --verbose       \
+       $**     \
+       -o $@
+
 $(CFG)/$(PLAT)/PeasGtk-$(APIVERSION).typelib: $(CFG)/$(PLAT)/PeasGtk-$(APIVERSION).gir 
$(CFG)/$(PLAT)/Peas-$(APIVERSION).typelib
        @-echo Compiling $@...
        $(G_IR_COMPILER)        \
@@ -72,6 +92,13 @@ $(CFG)/$(PLAT)/PeasGtk-$(APIVERSION).typelib: $(CFG)/$(PLAT)/PeasGtk-$(APIVERSIO
        $**     \
        -o $@
 
+$(CFG)/$(PLAT)/Introspection-1.0.typelib: $(CFG)/$(PLAT)/Introspection-1.0.gir 
$(CFG)/$(PLAT)/Peas-$(APIVERSION).typelib
+       @-echo Compiling $@...
+       $(G_IR_COMPILER)        \
+       --includedir=$(CFG)/$(PLAT) --debug --verbose   \
+       $**     \
+       -o $@
+
 !else
 all:
        @-echo $(ERROR_MSG)
diff --git a/win32/replace.py b/win32/replace.py
new file mode 100644
index 0000000..f215cce
--- /dev/null
+++ b/win32/replace.py
@@ -0,0 +1,115 @@
+#!/usr/bin/python
+#
+# Simple utility script to manipulate
+# certain types of strings in a file
+
+# This can be used in various projects where
+# there is the need to replace strings in files,
+# and is copied from GLib's $(srcroot)/build/win32
+
+# Author: Fan, Chun-wei
+# Date: September 03, 2014
+
+import os
+import sys
+import re
+import string
+import argparse
+
+valid_actions = ['remove-prefix',
+                 'replace-var',
+                 'replace-str',
+                 'remove-str']
+
+def open_file(filename, mode):
+    if sys.version_info[0] < 3:
+        return open(filename, mode=mode)
+    else:
+        return open(filename, mode=mode, encoding='utf-8')
+
+def replace_multi(src, dest, replace_items):
+    with open_file(src, 'r') as s:
+        with open_file(dest, 'w') as d:
+            for line in s:
+                replace_dict = dict((re.escape(key), value) \
+                               for key, value in replace_items.items())
+                replace_pattern = re.compile("|".join(replace_dict.keys()))
+                d.write(replace_pattern.sub(lambda m: \
+                        replace_dict[re.escape(m.group(0))], line))
+
+def replace(src, dest, instring, outstring):
+    replace_item = {instring: outstring}
+    replace_multi(src, dest, replace_item)
+
+def check_required_args(args, params):
+    for param in params:
+        if getattr(args, param, None) is None:
+            raise SystemExit('%s: error: --%s argument is required' % (__file__, param))
+
+def warn_ignored_args(args, params):
+    for param in params:
+        if getattr(args, param, None) is not None:
+            print('%s: warning: --%s argument is ignored' % (__file__, param))
+
+def main(argv):
+
+    parser = argparse.ArgumentParser(description='Process strings in a file.')
+    parser.add_argument('-a',
+                        '--action',
+                        help='Action to carry out.  Can be one of:\n'
+                             'remove-prefix\n'
+                             'replace-var\n'
+                             'replace-str\n'
+                             'remove-str',
+                        choices=valid_actions)
+    parser.add_argument('-i', '--input', help='Input file')
+    parser.add_argument('-o', '--output', help='Output file')
+    parser.add_argument('--instring', help='String to replace or remove')
+    parser.add_argument('--var', help='Autotools variable name to replace')
+    parser.add_argument('--outstring',
+                        help='New String to replace specified string or variable')
+    parser.add_argument('--removeprefix', help='Prefix of string to remove')
+
+    args = parser.parse_args()
+
+    input_string = ''
+    output_string = ''
+
+    # We must have action, input, output for all operations
+    check_required_args(args, ['action','input','output'])
+
+    # Build the arguments by the operation that is to be done,
+    # to be fed into replace()
+
+    # Get rid of prefixes from a string
+    if args.action == 'remove-prefix':
+        check_required_args(args, ['instring','removeprefix'])
+        warn_ignored_args(args, ['outstring','var'])
+        input_string = args.removeprefix + args.instring
+        output_string = args.instring
+
+    # Replace an m4-style variable (those surrounded by @...@)
+    if args.action == 'replace-var':
+        check_required_args(args, ['var','outstring'])
+        warn_ignored_args(args, ['instring','removeprefix'])
+        input_string = '@' + args.var + '@'
+        output_string = args.outstring
+
+    # Replace a string
+    if args.action == 'replace-str':
+        check_required_args(args, ['instring','outstring'])
+        warn_ignored_args(args, ['var','removeprefix'])
+        input_string = args.instring
+        output_string = args.outstring
+
+    # Remove a string
+    if args.action == 'remove-str':
+        check_required_args(args, ['instring'])
+        warn_ignored_args(args, ['var','outstring','removeprefix'])
+        input_string = args.instring
+        output_string = ''
+
+    replace(args.input, args.output, input_string, output_string)
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]