1
votes

In my apps package filter.xml i have give as below:

<filter root="/apps/site">
    <include pattern="/apps/site/components"/>
    <include pattern="/apps/site/config"/>
    <include pattern="/apps/site/config(.*)?"/>
    <include pattern="/apps/site/install"/>
    <include pattern="/apps/site/pages"/>
    <include pattern="/apps/site/templates"/>    
</filter>

With the above code, when I am deploying my package, any new folders/files created are getting updated in crxde any existing html file changes are getting updated in crxde but changes to component dialog.xml are not getting updated in crxde (to explain, I make changes directly in one of the component dialog in crxde and then i deploy my package. The changes I did are not getting udpated from my codebase is the problem)

So then I add the below pattern as well to the filter.xml and it works.

<include pattern="/apps/site/components(/.*)"/>

Can someone help me if we need to include both the below patterns in filter if this need to work or do we have an alternative approach?

<include pattern="/apps/site/components"/>
<include pattern="/apps/site/components(/.*)"/>
2

2 Answers

1
votes

The behaviour you are observing is due to backward compatibility. When there was no merge mode yet then the behaviour was like this: Install nodes matching filters using replace mode, everything else using merge mode (add new content only).

So for the filter like this:

<filter root="/apps/site">
     <include pattern="/apps/site/components"/>
</filter>

Everything from the package below /apps/site/components is installed using merge mode because there is no wildcard at the end.

If you change the filter to:

<filter root="/apps/site">
      <include pattern="/apps/site/components"/>
      <include pattern="/apps/site/components(/.*)"/>
</filter>

Then it match also nodes below, so package installer is using replace mode.

0
votes

To make it simple you can have components, install, config etc as filter roots, i.e.

<filter root="/apps/site/components">
<filter root="/apps/site/config">
<filter root="/apps/site/install">

and so on.

That way the tree starting with /apps/site/components is replaced every time you install the package and there's no need for include statements.

Update: The include and exclude patterns are a good practice when your package will install stuff in parts of the tree that don't fully own; in your case, if there's another package that also installs stuff in /apps/site.