Hi Peter

On 25 September 2011 01:05, Peter Foley <pefol...@verizon.net> wrote:
> While working on converting xmerge to gbuild I found that the current
> gbuild Jar.mk doesn't support adding non java files to the jar.
> The xmerge jars need a component.xml file included in the jar.
> I tried to implement file adding but couldn't get it to work. Help with
> implementing this would be greatly appreciated.
> I've included my (non-working) attempt at implementing this and a
> usage example below.
>
Maybe you have already solved this but in case it could be helpful I'm
sending something that should more or less work.
See attached.

I think gd_Deliver is only for $(OUTDIR) so it can't be used in this case.
And maybe you want to use cp --foo, I'm not sure about proper parameters.

Main part:

+define gb_Jar_get_workdir
+$(call gb_JavaClassSet_get_classdir,$(call gb_Jar_get_classsetname,$(1)))
+endef
+
+define gb_Jar_add_file
+$(call gb_Jar_get_target,$(1)) : PACKAGEFILES += $(2)
+$(call gb_Jar_get_target,$(1)) : $(call gb_Jar_get_workdir,$(1))/$(2)
+$(call gb_Jar_get_workdir,$(1))/$(2) : $(3) $(call
gb_JavaClassSet_get_target,$(call gb_Jar_get_classsetname,$(1)))
+       cp $(3) $$@
+
+endef

HTH,

Matus
diff --git a/solenv/gbuild/Jar.mk b/solenv/gbuild/Jar.mk
index b30bd3a..af14a56 100644
--- a/solenv/gbuild/Jar.mk
+++ b/solenv/gbuild/Jar.mk
@@ -54,7 +54,7 @@ define gb_Jar__command
 	mkdir -p $(dir $(2)) && \
 	cd $(call gb_JavaClassSet_get_classdir,$(call gb_Jar_get_classsetname,$(1))) && \
 	$(gb_Jar_JARCOMMAND) cfm $(2) $(call gb_Jar_get_manifest_target,$(1)) \
-		META-INF $(PACKAGEROOTS) \
+		META-INF $(PACKAGEROOTS) $(PACKAGEFILES) \
 	|| (rm $(2); false) )
 endef
 
@@ -80,6 +80,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)) : PACKAGEFILES :=
 $(call gb_JavaClassSet_JavaClassSet,$(call gb_Jar_get_classsetname,$(1)),$(2))
 $(call gb_JavaClassSet_set_classpath,$(call gb_Jar_get_classsetname,$(1)),$(value XCLASSPATH))
 $(eval $(call gb_Module_register_target,$(call gb_Jar_get_outdir_target,$(1)),$(call gb_Jar_get_clean_target,$(1))))
@@ -98,6 +99,18 @@ define gb_Jar_set_packageroot
 $(call gb_Jar_get_target,$(1)) : PACKAGEROOTS := $(2)
 endef
 
+define gb_Jar_get_workdir
+$(call gb_JavaClassSet_get_classdir,$(call gb_Jar_get_classsetname,$(1)))
+endef
+
+define gb_Jar_add_file
+$(call gb_Jar_get_target,$(1)) : PACKAGEFILES += $(2)
+$(call gb_Jar_get_target,$(1)) : $(call gb_Jar_get_workdir,$(1))/$(2)
+$(call gb_Jar_get_workdir,$(1))/$(2) : $(3) $(call gb_JavaClassSet_get_target,$(call gb_Jar_get_classsetname,$(1)))
+	cp $(3) $$@
+
+endef
+
 define gb_Jar_add_sourcefiles
 $(foreach sourcefile,$(2),$(call gb_Jar_add_sourcefile,$(1),$(sourcefile)))
 endef
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to