[Libreoffice-commits] .: 6 commits - binaryurp/source desktop/unx idlc/source solenv/gbuild unoil/CustomTarget_javamaker.mk unotest/source

Michael Stahl mst at kemper.freedesktop.org
Sat Apr 14 12:09:30 PDT 2012


 binaryurp/source/unmarshal.cxx                                |    6 +
 desktop/unx/source/start.c                                    |   16 ++++
 idlc/source/idlc.cxx                                          |   18 ++++
 solenv/gbuild/JavaClassSet.mk                                 |    6 +
 unoil/CustomTarget_javamaker.mk                               |    1 
 unotest/source/java/org/openoffice/test/OfficeConnection.java |   39 ++++++----
 6 files changed, 67 insertions(+), 19 deletions(-)

New commits:
commit 5b3a8606767929e349fd4034fbf8e2243c34cfc5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Apr 14 20:38:38 2012 +0200

    JavaClassSet.mk: remove the output directory before calling javac
    
    When removing a source file, the outdated class file would still end up
    in the jar otherwise.

diff --git a/solenv/gbuild/JavaClassSet.mk b/solenv/gbuild/JavaClassSet.mk
index 7e0954a..1830d01 100644
--- a/solenv/gbuild/JavaClassSet.mk
+++ b/solenv/gbuild/JavaClassSet.mk
@@ -31,7 +31,7 @@ gb_JavaClassSet_JAVACDEBUG :=
 
 # Enforces correct dependency order for possibly generated stuff:
 # generated sources, jars/classdirs etc.
-gb_JavaClassSet_get_preparation_target = $(WORKDIR)/JavaClassSet/$(1)/prepared
+gb_JavaClassSet_get_preparation_target = $(WORKDIR)/JavaClassSet/$(1).prepared
 
 ifneq ($(gb_DEBUGLEVEL),0)
 gb_JavaClassSet_JAVACDEBUG := -g
@@ -41,6 +41,7 @@ define gb_JavaClassSet__command
 $(call gb_Helper_abbreviate_dirs_native,\
 	mkdir -p $(dir $(1)) && \
 	$(if $(filter-out $(JARDEPS),$(4)), \
+		rm -rf $(call gb_JavaClassSet_get_classdir,$(2))/* && \
 		RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),500,\
 			$(call gb_Helper_native_path,\
 			$(filter-out $(JARDEPS),$(4)))) && \
@@ -61,7 +62,8 @@ $(call gb_JavaClassSet_get_target,%) :
 $(call gb_JavaClassSet_get_clean_target,%) :
 	$(call gb_Output_announce,$*,$(false),JCS,3)
 	$(call gb_Helper_abbreviate_dirs,\
-		rm -rf $(dir $(call gb_JavaClassSet_get_target,$*)))
+		rm -rf $(dir $(call gb_JavaClassSet_get_target,$*))) \
+			$(call gb_JavaClassSet_get_preparation_target,$*)
 
 $(call gb_JavaClassSet_get_preparation_target,%) :
 	mkdir -p $(dir $@) && touch $@
commit 946e7180be96178937e7be1b0bd7132902709a87
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Apr 14 18:17:00 2012 +0200

    oosplash: handle SIGTERM by killing soffice.bin

diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c
index 410c2fd..307cd88 100644
--- a/desktop/unx/source/start.c
+++ b/desktop/unx/source/start.c
@@ -765,6 +765,19 @@ exec_javaldx (Args *args)
 
 #endif
 
+// has to be a global :(
+oslProcess * g_pProcess = 0;
+
+void sigterm_handler(int ignored)
+{
+    (void) ignored;
+    if (g_pProcess)
+    {
+        // forward signal to soffice.bin
+        osl_terminateProcess(g_pProcess);
+    }
+}
+
 SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
 {
     int fd = 0;
@@ -777,6 +790,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
 
     /* turn SIGPIPE into an error */
     signal( SIGPIPE, SIG_IGN );
+    signal( SIGTERM, &sigterm_handler );
 
     args = args_parse ();
     args->pAppPath = get_app_path( argv[0] );
@@ -849,6 +863,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
             /* Periodically update the splash & the percent according
                to what status_fd says, poll quickly only while starting */
             info = child_spawn (args, bAllArgs, bShortWait);
+            g_pProcess = info->child;
             while (!child_exited_wait (info, bShortWait))
             {
                 ProgressStatus eResult;
@@ -874,6 +889,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
 #endif
 
             status = child_get_exit_code(info);
+            g_pProcess = 0; // reset
             switch (status) {
             case 79: // re-start with just -env: parameters
 #if OSL_DEBUG_LEVEL > 0
commit 228515e7783aecdb992258765554a530d6c831f3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Apr 14 18:11:11 2012 +0200

    OfficeConnection: kill soffice process when Java bridge is disposed
    
    In the rare case that the soffice process outlives the Java side UNO
    bridge, ensure that soffice.bin doesn't continue running.

diff --git a/unotest/source/java/org/openoffice/test/OfficeConnection.java b/unotest/source/java/org/openoffice/test/OfficeConnection.java
index 5eb3afa..2b7e34f 100644
--- a/unotest/source/java/org/openoffice/test/OfficeConnection.java
+++ b/unotest/source/java/org/openoffice/test/OfficeConnection.java
@@ -119,24 +119,33 @@ public final class OfficeConnection {
             boolean desktopTerminated = true;
             if (process != null) {
                 if (context != null) {
-                    XMultiComponentFactory factory = context.getServiceManager();
-                    assertNotNull(factory);
-                    XDesktop desktop = UnoRuntime.queryInterface(
-                        XDesktop.class,
-                        factory.createInstanceWithContext(
-                            "com.sun.star.frame.Desktop", context));
-                    context = null;
+                    XDesktop desktop = null;
                     try {
-                        desktopTerminated = desktop.terminate();
-                        if (!desktopTerminated) {
-                            // in case terminate() fails we would wait forever
-                            // for the process to die, so kill it
-                            process.destroy();
-                        }
-                        assertTrue(desktopTerminated);
-                    } catch (DisposedException e) {}
+                        XMultiComponentFactory factory =
+                            context.getServiceManager();
+                        assertNotNull(factory);
+                        desktop = UnoRuntime.queryInterface(XDesktop.class,
+                            factory.createInstanceWithContext(
+                                "com.sun.star.frame.Desktop", context));
+                    } catch (DisposedException e) {
+                        // it can happen that the Java bridge was disposed
+                        // already, we want to ensure soffice.bin is killed
+                        process.destroy();
+                    }
+                    context = null;
+                    if (desktop != null) {
+                        try {
+                            desktopTerminated = desktop.terminate();
+                            if (!desktopTerminated) {
+                                // in case terminate() fails we would wait
+                                // forever for the process to die, so kill it
+                                process.destroy();
+                            }
+                            assertTrue(desktopTerminated);
+                        } catch (DisposedException e) {}
                         // it appears that DisposedExceptions can already happen
                         // while receiving the response of the terminate call
+                    }
                     desktop = null;
                 } else {
                     process.destroy();
commit 40aaefeb25190b2c63212f1b5cc353abfc7b0def
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Apr 14 18:07:42 2012 +0200

    put the missing type into the exception message

diff --git a/binaryurp/source/unmarshal.cxx b/binaryurp/source/unmarshal.cxx
index a2ac6c3..f203b21 100644
--- a/binaryurp/source/unmarshal.cxx
+++ b/binaryurp/source/unmarshal.cxx
@@ -182,15 +182,17 @@ css::uno::TypeDescription Unmarshal::readType() {
                 }
                 return state_.typeCache[idx];
             } else {
-                css::uno::TypeDescription t(readString());
+                rtl::OUString const str(readString());
+                css::uno::TypeDescription t(str);
                 if (!t.is() ||
                     t.get()->eTypeClass != static_cast< typelib_TypeClass >(tc))
                 {
+
                     throw css::io::IOException(
                         rtl::OUString(
                             RTL_CONSTASCII_USTRINGPARAM(
                                 "binaryurp::Unmarshal: type with unknown"
-                                " name")),
+                                " name: ")) + str,
                         css::uno::Reference< css::uno::XInterface >());
                 }
                 for (css::uno::TypeDescription t2(t);
commit 0ff30829a607eb84669988f424b22df88db7c2de
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Apr 14 18:04:24 2012 +0200

    unoil: remove generated classes before calling javamaker
    
    Otherwise the class files for IDL files that were removed still end up
    in unoil.jar and may cause JunitTest to fail with
    "binaryurp::Unmarshal: type with unknown name: ".

diff --git a/unoil/CustomTarget_javamaker.mk b/unoil/CustomTarget_javamaker.mk
index 73fd436..943732a 100644
--- a/unoil/CustomTarget_javamaker.mk
+++ b/unoil/CustomTarget_javamaker.mk
@@ -35,6 +35,7 @@ $(UIJM)/done : $(OUTDIR)/bin/offapi.rdb $(OUTDIR)/bin/udkapi.rdb \
 		$(call gb_Executable_get_target_for_build,javamaker) | $(UIJM)/.dir
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),JVM,1)
 	$(call gb_Helper_abbreviate_dirs_native, \
+	rm -r $(UIJM) && \
 	$(call gb_Helper_execute,javamaker -BUCR -O$(UIJM) $(OUTDIR)/bin/offapi.rdb -X$(OUTDIR)/bin/udkapi.rdb) && \
 	touch $@)
 
commit 8c0a9bca425bffd87d12c3f18ec852f083c11bef
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Apr 13 18:55:37 2012 +0200

    idlc: make dependencies: handle removed include files:
    
    Write dummy targets for included files, so the incremental build does not
    break with "No rule to make target" if the included file is removed.

diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx
index 449de35..4d15b2f 100644
--- a/idlc/source/idlc.cxx
+++ b/idlc/source/idlc.cxx
@@ -313,6 +313,21 @@ struct WriteDep
     }
 };
 
+// write a dummy target for one included file, so the incremental build does
+// not break with "No rule to make target" if the included file is removed
+struct WriteDummy
+{
+    ::osl::File& m_rFile;
+    ::osl::FileBase::RC & m_rRC;
+    explicit WriteDummy(::osl::File & rFile, ::osl::FileBase::RC & rRC)
+        : m_rFile(rFile), m_rRC(rRC) { }
+    void operator() (::rtl::OString const& rEntry)
+    {
+        lcl_writeString(m_rFile, m_rRC, rEntry);
+        lcl_writeString(m_rFile, m_rRC, ":\n\n");
+    }
+};
+
 bool
 Idlc::dumpDeps(::rtl::OString const& rDepFile, ::rtl::OString const& rTarget)
 {
@@ -334,6 +349,9 @@ Idlc::dumpDeps(::rtl::OString const& rDepFile, ::rtl::OString const& rTarget)
     m_includes.erase(getRealFileName()); // eeek, that is a temp file...
     ::std::for_each(m_includes.begin(), m_includes.end(),
             WriteDep(depFile, rc));
+    lcl_writeString(depFile, rc, "\n\n");
+    ::std::for_each(m_includes.begin(), m_includes.end(),
+            WriteDummy(depFile, rc));
     if (::osl::FileBase::E_None != rc) {
         return false;
     }


More information about the Libreoffice-commits mailing list