Hello Severin,

To get the conditional running of either MergeProperties or copy, I would do something like this:

$$($1_TARGET): $$($1_DEPS)
        $$(call MakeTargetDir)
ifneq ($$($1_NUM_INPUT_FILES),1) $$(call LogInfo, Merging $$(words $$($1_INPUT_FILES)) properties files into a single properties file for jdk.jlink)
$(TOOL_MERGE_PROPERTIES) \
$(GENERATED_JLINK_RESOURCES_DIR)/$$($1_PROP).properties \
$$($1_INPUT_FILES)
        else
          $$(call LogInfo, Copying $$(patsubst $(OUTPUTDIR)/%,%,$$@)))
          $$(call install-file)
        endif

  $1 := $$($1_TARGET)

Note that the make conditional lines need to be indented with space while the recipe lines (including the $$(call )) needs to be tabbed. We still like them to align though, assuming 8 spaces tabs.

Down in the call loop, the first argument to SetupPropertiesMerge must be unique. This can be achieved with MERGE_JLINK_PROPS_$(prop). Then add a line like this last in the loop:

$(eval TARGETS += $(MERGE_JLINK_PROPS_$(prop)))

To find all the src dirs for the jlink module, there are helper macros in make/common/Modules.gmk.

JLINK_RESOURCE_DIRS := $(addsuffix /jdk/tools/jlink/resources, $(call FindModuleSrcDirs, jdk.jlink))

In the loop I would recommend reusing the already built list of all properties files instead of calling find again. Also, if all properties files in the resource dir are in the same directory with no sub directories, then please consider using $(wildcard ) to find them as that's much less taxing on Windows.

Hope this helps!

/Erik

On 2019-01-25 07:27, Severin Gehwolf wrote:
Hi,

I'm working on an enhancement for jlink. In particular a platform
specific plugin. I.e. It would only get built on unix/linux platforms.
My trouble is getting some resouce properties set up properly. In my
example there is two versions of plugins.properties: one in
shared/classes one in unix/classes. These, need to get merged into one
via the MergeProperties build tool class. So far so good. But for the
cases where there is only one resource property it should just get
copied to support/gensrc and that source root be used for compiling
those properties into actual ListResourceBundle Java classes.

The copying from the src tree to the gensrc tree doesn't seem to work.
I've tried using $(CP) and SetupCopyFiles to no avail. Would anybody
willing to help?

WIP webrev is:
http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8214796-wip/01/webrev/

I thought I'd do the copying in an else branch in SetupPropertiesMerge,
where I've put in a FIXME comment. Am I on the wrong track?

Thanks,
Severin

Reply via email to