Kaydet (Commit) 0ef8beed authored tarafından Michael Stahl's avatar Michael Stahl

gbuild: refactor gb_Library_set_componentfile:

Reverse the dependency: now the component target depends (order-only) on the
library, which should ensure that gb_CppunitTest_add_component can set up
dependencies such that the unit test does not run concurrently with
a library loaded via UNO being overwritten.

Unfortunately this requires introducing another phony dummy library
target, on which the module can depend (because we don't want to register
the component target as a module target).
üst 268cfdf2
...@@ -58,7 +58,8 @@ $(call gb_ComponentTarget_get_outdir_target,%) : ...@@ -58,7 +58,8 @@ $(call gb_ComponentTarget_get_outdir_target,%) :
define gb_ComponentTarget_ComponentTarget define gb_ComponentTarget_ComponentTarget
$(call gb_ComponentTarget_get_target,$(1)) : COMPONENTPREFIX := $(2) $(call gb_ComponentTarget_get_target,$(1)) : COMPONENTPREFIX := $(2)
$(call gb_ComponentTarget_get_target,$(1)) : LIBFILENAME := $(3) $(call gb_ComponentTarget_get_target,$(1)) : LIBFILENAME := $(3)
$(call gb_ComponentTarget_get_outdir_target,$(1)) : $(call gb_ComponentTarget_get_target,$(1)) $(call gb_ComponentTarget_get_outdir_target,$(1)) : \
$(call gb_ComponentTarget_get_target,$(1))
$(call gb_Deliver_add_deliverable,$(call gb_ComponentTarget_get_outdir_target,$(1)),$(call gb_ComponentTarget_get_target,$(1)),$(1)) $(call gb_Deliver_add_deliverable,$(call gb_ComponentTarget_get_outdir_target,$(1)),$(call gb_ComponentTarget_get_target,$(1)),$(1))
endef endef
......
...@@ -153,9 +153,9 @@ endef ...@@ -153,9 +153,9 @@ endef
define gb_CppunitTest_add_component define gb_CppunitTest_add_component
$(call gb_CppunitTest_get_target,$(1)) : \ $(call gb_CppunitTest_get_target,$(1)) : \
$(call gb_ComponentTarget_get_target,$(2)) $(call gb_ComponentTarget_get_outdir_target,$(2))
$(call gb_CppunitTest_get_target,$(1)) : \ $(call gb_CppunitTest_get_target,$(1)) : \
UNO_SERVICES += $(call gb_ComponentTarget_get_target,$(2)) UNO_SERVICES += $(call gb_ComponentTarget_get_outdir_target,$(2))
endef endef
......
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
# gb_Library_Library_platform # gb_Library_Library_platform
# gb_Library_TARGETS # gb_Library_TARGETS
# doesn't do anything, just used for hooking up component target
.PHONY: $(call gb_Library__get_final_target,%)
# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows # EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
.PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT) .PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT)
...@@ -69,10 +71,11 @@ $(call gb_LinkTarget_set_targettype,$(2),Library) ...@@ -69,10 +71,11 @@ $(call gb_LinkTarget_set_targettype,$(2),Library)
$(call gb_LinkTarget_add_defs,$(2),\ $(call gb_LinkTarget_add_defs,$(2),\
$(gb_Library_DEFS) \ $(gb_Library_DEFS) \
) )
$(call gb_Library__get_final_target,$(1)) : $(call gb_Library_get_target,$(1))
$(call gb_Library_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2)) $(call gb_Library_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
$(call gb_Library_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2)) $(call gb_Library_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
$(call gb_Library_Library_platform,$(1),$(2),$(gb_Library_DLLDIR)/$(call gb_Library_get_dllname,$(1))) $(call gb_Library_Library_platform,$(1),$(2),$(gb_Library_DLLDIR)/$(call gb_Library_get_dllname,$(1)))
$$(eval $$(call gb_Module_register_target,$(call gb_Library_get_target,$(1)),$(call gb_Library_get_clean_target,$(1)))) $$(eval $$(call gb_Module_register_target,$(call gb_Library__get_final_target,$(1)),$(call gb_Library_get_clean_target,$(1))))
$(call gb_Deliver_add_deliverable,$(call gb_Library_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)),$(1)) $(call gb_Deliver_add_deliverable,$(call gb_Library_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)),$(1))
endef endef
...@@ -97,13 +100,18 @@ $(if $(3),,$(call gb_Output_error,gb_Library_set_soversion_script: no script)) ...@@ -97,13 +100,18 @@ $(if $(3),,$(call gb_Output_error,gb_Library_set_soversion_script: no script))
$(call gb_Library__set_soversion_script_platform,$(1),$(2),$(3)) $(call gb_Library__set_soversion_script_platform,$(1),$(2),$(3))
endef endef
# The dependency from workdir component target to outdir library should ensure
# that gb_CppunitTest_add_component can transitively depend on the library.
# But the component target also must be delivered, so a new phony target
# gb_Library__get_final_target has been invented for that purpose...
define gb_Library_set_componentfile define gb_Library_set_componentfile
$(call gb_ComponentTarget_ComponentTarget,$(2),$(call gb_Library__get_componentprefix,$(1)),\ $(call gb_ComponentTarget_ComponentTarget,$(2),$(call gb_Library__get_componentprefix,$(1)),\
$(call gb_Library_get_runtime_filename,$(if $(MERGELIBS),$(if $(filter $(gb_MERGED_LIBS),$(1)),merged,$(1)),$(1)))) $(call gb_Library_get_runtime_filename,$(if $(MERGELIBS),$(if $(filter $(gb_MERGED_LIBS),$(1)),merged,$(1)),$(1))))
$(call gb_LinkTarget_get_target,$(call gb_Library_get_linktargetname,$(1))) : \ $(call gb_Library__get_final_target,$(1)) : \
$(call gb_ComponentTarget_get_outdir_target,$(2)) $(call gb_ComponentTarget_get_outdir_target,$(2))
$(call gb_Library_get_clean_target,$(1)) : $(call gb_ComponentTarget_get_clean_target,$(or $(strip $(3)),$(strip $(2)))) $(call gb_ComponentTarget_get_target,$(2)) :| $(call gb_Library_get_target,$(1))
$(call gb_Library_get_clean_target,$(1)) : \
$(call gb_ComponentTarget_get_clean_target,$(2))
endef endef
gb_Library__get_componentprefix = \ gb_Library__get_componentprefix = \
......
...@@ -133,6 +133,8 @@ gb_XcuResTarget_get_target = $(WORKDIR)/XcuResTarget/$(1) ...@@ -133,6 +133,8 @@ gb_XcuResTarget_get_target = $(WORKDIR)/XcuResTarget/$(1)
gb_Zip_get_target = $(WORKDIR)/Zip/$(1).zip gb_Zip_get_target = $(WORKDIR)/Zip/$(1).zip
gb_Zip_get_final_target = $(WORKDIR)/Zip/$(1).done gb_Zip_get_final_target = $(WORKDIR)/Zip/$(1).done
gb_Library__get_final_target = $(WORKDIR)/Dummy/$(1)
define gb_Library_get_external_headers_target define gb_Library_get_external_headers_target
$(patsubst $(1):%,$(WORKDIR)/ExternalHeaders/Library/%,$(filter $(1):%,$(gb_Library_FILENAMES))) $(patsubst $(1):%,$(WORKDIR)/ExternalHeaders/Library/%,$(filter $(1):%,$(gb_Library_FILENAMES)))
endef endef
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment