Project

General

Profile

Feature #6253

add file-set processing into p2j.cfg.xml

Added by Greg Shah about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD

Related issues

Related to Conversion Tools - Bug #5135: replace -s, -f and -x options of ConversionDriver with a single combined mode Closed
Related to Conversion Tools - Feature #7169: drive conversion order using user-specified dependencies New

History

#1 Updated by Greg Shah about 2 years ago

  • Related to Bug #5135: replace -s, -f and -x options of ConversionDriver with a single combined mode added

#2 Updated by Greg Shah about 2 years ago

  • Assignee set to Constantin Asofiei

The global section of the p2j.cfg.xml should allow the definition of a file-set element which will allow the explicit configuration of files to be processed in a project. There will be 2 mutually exclusive approaches provided:

1. External configuration mode. This references the same -Zinput_file used for #5135.

<file-set input-file="an_awesome_cfg_file.lst" />

2. Inline configuration mode. This is an XML form of the same syntax used in #5135.

<file-set>
   <directory recursive="true" path="./abl/some/path/" spec="(*.[pPwW]|*.cls)" />      <!-- directive "D" -->
   <filename path="./abl/some/path/file.p" />                                          <!-- directive "F" -->
   <directory recursive="false" path="./abl/some/other/path/again/" spec="*.[tT]" />   <!-- directive "N" -->
   <filename path="./abl/some/other/path/file.p" />                                    <!-- directive "F" -->
   <exclude filter="./abl/possenet/*" />                                               <!-- directive "X" -->
   <include filter="./abl/possenet/src/adecomm/as-utils.w" />                          <!-- directive "I" -->
   <include filter="./abl/possenet/src/adecomm/get-user.p" />                          <!-- directive "I" -->
...
</file-set>

By default, if this is present, the ConversionDriver should use -Z mode and honor any file-set as its input.

#3 Updated by Constantin Asofiei about 2 years ago

  • Status changed from New to WIP

#4 Updated by Constantin Asofiei about 2 years ago

I've used <file-set filename="file-set.txt" /> (filename instead of input-file) because of the dash in input-file and to be more consistent with other naming.

#5 Updated by Constantin Asofiei about 2 years ago

A command like this:

java -server -Xmx16G -XX:-OmitStackTraceInFastThrow -DP2J_HOME=. -classpath deploy/lib/app.jar:deploy/lib/p2j.jar com.goldencode.p2j.convert.ConversionDriver -LId2 f2+m0+cb

will use the file-set configuration from the cfg/p2j.cfg.xml (will assume the 'Z' mode). Here I use L for the 'dry-run'.

#6 Updated by Greg Shah about 2 years ago

I've used <file-set filename="file-set.txt" /> (filename instead of input-file) because of the dash in input-file and to be more consistent with other naming.

No objection.

#7 Updated by Greg Shah about 2 years ago

Constantin Asofiei wrote:

A command like this:
[...]
will use the file-set configuration from the cfg/p2j.cfg.xml (will assume the 'Z' mode). Here I use L for the 'dry-run'.

Yes, I like the idea. If there are no other inputs and no explicit mode AND the file-set exists outside of the profiles, then use -Z by default.

#8 Updated by Constantin Asofiei about 2 years ago

The file-set in p2j.cfg.xml will look like this:

<!-- P2J main configuration -->
<cfg>

   <global>
...
      <!-- explicit file
      <file-set filename="file-set.txt" />

or

      -->
      <file-set>
        <directory recursive="true" path="./abl/possenet/src" spec="(*.[pPwW]|*.cls)" />
        <directory recursive="true" path="./abl/src/" spec="(*.[pPwW]|*.cls)" />
        <filename path="./abl/fwd-embedded-driver.p" />
        <exclude filter="./abl/possenet/src/*" />
        <include filter="./abl/possenet/src/adecomm/as-utils.w" />
        <include filter="./abl/possenet/src/adecomm/get-user.p" />
        <include filter="./abl/possenet/src/adeuib/_uibmode.p" />
        <include filter="./abl/possenet/src/adm2/containr.p" />
        <include filter="./abl/possenet/src/adm2/dyndata.w" />
        <include filter="./abl/possenet/src/adm2/fetchdata.p" />
        <include filter="./abl/possenet/src/adm2/fetchrows.p" />
        <include filter="./abl/possenet/src/adm2/query.p" />
        <exclude filter="./abl/src/config/*" />
        <exclude filter="./abl/src/db/*" />
        <exclude filter="./abl/src/dev/*" />
      </file-set>
   </global>

...

#9 Updated by Greg Shah about 2 years ago

It looks good.

Should we make the following common cases the default?

  • recursive="true"
  • spec="(*.[pPwW]|*.cls)"

I'm less convinced about the spec because there is some value to making it explicit. On the other hand, reducing the configuration is a great benefit because it reduces errors and maintenance.

#10 Updated by Constantin Asofiei about 2 years ago

  • % Done changed from 0 to 100
  • Status changed from WIP to Review

The changes are in 3821c/13778 for both this task and #5135.

#11 Updated by Constantin Asofiei about 2 years ago

Greg Shah wrote:

Should we make the following common cases the default?

  • recursive="true"
  • spec="(*.[pPwW]|*.cls)"

I'm less convinced about the spec because there is some value to making it explicit. On the other hand, reducing the configuration is a great benefit because it reduces errors and maintenance.

I don't really like to hide the attributes behind the defaults... but recursive makes sense for it to default to 'true'.

#12 Updated by Greg Shah about 2 years ago

Code Review Task Branch 3821c Revision 13778

The changes are good.

1. An "include file" has a special meaning in this project. For that reason, I think the IncludeFile and ExcludeFile should be named IncludeFilter and ExcludeFilter.

2. StringHelper.readQuotedString() needs javadoc.

#13 Updated by Greg Shah about 2 years ago

but recursive makes sense for it to default to 'true'.

Let's do it.

#14 Updated by Constantin Asofiei about 2 years ago

The changes are in 3821c/13788.

#15 Updated by Greg Shah about 2 years ago

  • Status changed from Review to Closed

Code Review Task Branch 3821c Revision 13788

It is good.

#16 Updated by Greg Shah about 2 years ago

A command like this:
[...]
will use the file-set configuration from the cfg/p2j.cfg.xml (will assume the 'Z' mode). Here I use L for the 'dry-run'.

Yes, I like the idea. If there are no other inputs and no explicit mode AND the file-set exists outside of the profiles, then use -Z by default.

This is not quite working properly. It turns out that you must put an option on the command line, which means it is not optional. :)

Given proper file-set configuration in p2j.cfg.xml, this fails:

java -classpath p2j/build/lib/p2j.jar com.goldencode.p2j.convert.ConversionDriver F2

But this works:

java -classpath p2j/build/lib/p2j.jar com.goldencode.p2j.convert.ConversionDriver -D2 F2

#17 Updated by Constantin Asofiei about 2 years ago

Please check 3821c/13794.

#18 Updated by Greg Shah about 1 year ago

  • Related to Feature #7169: drive conversion order using user-specified dependencies added

Also available in: Atom PDF