Hi Zhe Liu,

On Fri, Dec 16, 2011 at 10:43:47AM +0800, Zhe Liu wrote:
> Hi All,
> I always break because of the error when build on Windows XP. I
> mentioned before, nobody responsed on it.  I did a little search and
> found someone also encountered the problem.  I still have no clue how
> to resolve it.
> 
> JunitTest_framework_unoapi.mk:28: *** Malformed target-specific
> variable definition.  Stop.
> 
> To continue my build, I have to remove the lines related to Junitest.
> There are several module with the same error. It's annoying to
> workaround them all.   Could anybody help me?

there are different ways to work around this:

1. comment the part in Module_XXX.mk where the tests are included
2. surround this part with a condition, checking for OOO_JUNIT_JAR
3. disable the code in solenv/gbuild/JunitTest.mk with the check for
   OOO_JUNIT_JAR
4. disable gb_Module_add_subsequentcheck_targets with a similar check


I first tried (3), then (4). I'm not sure yet, I'll need to test this
further, but you can give it a try. The patch is a dirty mix of (3) and
(4).

The problem is not solved disabling junit in configure, because the issue
is not with compiling the unit tests, but with parsing the Makefiles
JunitTest_xxx_xxx.mk , so we have to find a way not to parse those files
(until we find the real bug here - my guess, a gmake one).

Testing the patch with 
]$ make -dsr --print-data-base --warn-undefined-variables 
shows that at least the Makefiles are not even parsed.

You should first unset OOO_JUNIT_JAR before compiling: 

]$ unset OOO_JUNIT_JAR


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina
diff --git a/solenv/gbuild/JunitTest.mk b/solenv/gbuild/JunitTest.mk
index 31af844..21e5b8e 100644
--- a/solenv/gbuild/JunitTest.mk
+++ b/solenv/gbuild/JunitTest.mk
@@ -39,6 +39,8 @@ $(call gb_JunitTest_get_clean_target,%) : $(call 
gb_JavaClassSet_get_clean_targe
        $(call gb_Helper_abbreviate_dirs,\
                rm -f $@ [email protected])
 
+ifneq ($(strip $(OOO_JUNIT_JAR)),)
+
 .PHONY : $(call gb_JunitTest_get_target,$(1))
 $(call gb_JunitTest_get_target,%) :
        $(call gb_Output_announce,$*,$(true),JUT,2)
@@ -100,4 +102,31 @@ define gb_JunitTest_add_jars
 $(foreach jar,$(2),$(call gb_JunitTest_add_jar,$(1),$(jar)))
 
 endef
+
+else
+
+gb_JunitTest_JAVACOMMAND :=
+DBGSV_ERROR_OUT := 
+export DBGSV_ERROR_OUT
+
+.PHONY : $(call gb_JunitTest_get_target,$(1))
+$(call gb_JunitTest_get_target,%) :
+       $(call gb_Output_announce,JunitTests disabled,$(true),JUT,2)
+
+define gb_JunitTest_JunitTest
+# only register the clean target
+$(eval $(call gb_Module_register_target,$(call 
gb_JunitTest_get_target,$(1)),$(call gb_JunitTest_get_clean_target,$(1))))
+endef
+
+gb_JunitTest_set_defs :=
+gb_JunitTest_add_classes :=
+gb_JunitTest_add_class :=
+gb_JunitTest_add_sourcefile :=
+gb_JunitTest_add_sourcefiles :=
+gb_JunitTest_set_classpath :=
+gb_JunitTest_add_jar :=
+gb_JunitTest_add_jars :=
+
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/Module.mk b/solenv/gbuild/Module.mk
index 9556a13..29b920a 100644
--- a/solenv/gbuild/Module.mk
+++ b/solenv/gbuild/Module.mk
@@ -173,10 +173,16 @@ $(foreach target,$(2),$(call 
gb_Module_add_check_target,$(1),$(target)))
 
 endef
 
+ifneq ($(strip $(OOO_JUNIT_JAR)),)
 define gb_Module_add_subsequentcheck_targets
 $(foreach target,$(2),$(call 
gb_Module_add_subsequentcheck_target,$(1),$(target)))
 
 endef
+else
+define gb_Module_add_subsequentcheck_targets
+$(call gb_Output_announce,JunitTests disabled,$(true),JUT,2)
+endef
+endif
 
 define gb_Module_add_moduledirs
 $(foreach target,$(2),$(call gb_Module_add_moduledir,$(1),$(target)))

Attachment: pgphG3AkQ957m.pgp
Description: PGP signature

Reply via email to