diff options
author | David Tardon <dtardon@redhat.com> | 2011-12-23 15:31:26 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2011-12-23 16:43:02 +0100 |
commit | 713e536fe987f4dbd901656fda19ec4908a0a2f1 (patch) | |
tree | d4d3f209cdcfa9db22a5687c03f9c0ee3d6e239a /solenv | |
parent | d3fec0e98b0dc5aca59ee43814f8a31bea96327b (diff) |
work around deficiency in jar
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gbuild/Jar.mk | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/solenv/gbuild/Jar.mk b/solenv/gbuild/Jar.mk index 36e5112b911d..295aa693e899 100644 --- a/solenv/gbuild/Jar.mk +++ b/solenv/gbuild/Jar.mk @@ -48,6 +48,12 @@ endef # creates the target folder of the jar file if it doesn't exist # creates the jar file # jar program does not remove the target in case of error, so rm it manually +# XXX: PACKAGEDIRS need special treatment, because sometimes we need to +# add into the jar another class hierarchy created outside of our class +# set (e.g., by javamaker). Because jar does not allow two same root dirs +# when creating the archive, we work around this deficiency by creating +# the archive with the main class hierarchy and then updating it from +# the other one(s), which seems to work .-) define gb_Jar__command $(call gb_Output_announce,$*,$(true),JAR,3) $(call gb_Helper_abbreviate_dirs_native,\ @@ -59,6 +65,7 @@ define gb_Jar__command mkdir -p $(dir $(2)) && cd $(call gb_Jar_get_workdir,$(1)) && \ $(gb_Jar_JARCOMMAND) cfm $(2) $(call gb_Jar_get_manifest_target,$(1)) \ META-INF $(PACKAGEROOTS) $(PACKAGEFILES) \ + $(foreach root,$(PACKAGEDIRS),&& $(gb_Jar_JARCOMMAND) uf $(2) -C $(dir $(root)) $(notdir $(root))) \ || (rm $(2); false) ) endef @@ -84,6 +91,7 @@ define gb_Jar_Jar $(call gb_Jar_get_target,$(1)) : MANIFEST := $(call gb_Jar_get_target,$(1)) : JARCLASSPATH := $(call gb_Jar_get_target,$(1)) : PACKAGEROOTS := +$(call gb_Jar_get_target,$(1)) : PACKAGEDIRS := $(call gb_Jar_get_target,$(1)) : PACKAGEFILES := $(call gb_JavaClassSet_JavaClassSet,$(call gb_Jar_get_classsetname,$(1))) $(call gb_JavaClassSet_set_classpath,$(call gb_Jar_get_classsetname,$(1)),$(value XCLASSPATH)) @@ -99,19 +107,31 @@ $(call gb_JavaClassSet_add_sourcefile,$(call gb_Jar_get_classsetname,$(1)),$(2)) endef -# PACKAGEROOTS is the list of all root folders to pack into the jar (without META-INF as this is added automatically) +# PACKAGEROOTS is the list of all root folders created by the JavaClassSet to pack into the jar (without META-INF as this is added automatically) define gb_Jar_set_packageroot $(call gb_Jar_get_target,$(1)) : PACKAGEROOTS := $(2) endef +# +# PACKAGEDIRS is the list of additional root directories to pack into the jar +define gb_Jar_add_packagedir +$(call gb_Jar_get_target,$(1)) : PACKAGEDIRS += $(2) + +endef + +define gb_Jar_add_packagedirs +$(foreach packagedir,$(2),$(call gb_Jar_add_packagedir,$(1),$(packagedir))) + +endef # PACKAGEFILES is the list of all root files to pack into the jar define gb_Jar_add_packagefile $(call gb_Jar_get_target,$(1)) : PACKAGEFILES += $(2) -$(call gb_Jar_get_target,$(1)) : $(call gb_Jar_get_workdir,$(1))/$(strip $(2)) -$(call gb_Jar_get_workdir,$(1))/$(strip $(2)) : $(3) $(call gb_JavaClassSet_get_target,$(call gb_Jar_get_classsetname,$(1))) - mkdir -p $$(dir $$@) - cp -rf $(3) $$@ + +endef + +define gb_Jar_add_packagefiles +$(foreach packagefile,$(2),$(call gb_Jar_add_packagefile,$(1),$(packagefile))) endef |