Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Using Regular Expressions (regex)

You can use regular expressions, regex, to define the build tools and processes you include in an ib_profile.xml file. The regex applies to the process filename.

When regex=true, the process filename is checked as a regular expression instead of an exact match. This way, you can add to an ib_profile.xml file tools and processes that has a dynamic name or whose name is not fully known.   

>To use regex, enter the following:

Code Block
<process filename="<partial_name+regex>" regex="true" type="<distribution_type>" />

Here are two examples for the use of regex in an ib_profile.xml file:

  1. The "$" regular expression is used in the process filename definition:

    Code Block
    <process filename=".bash$" regex="true" type="intercepted" />

    In this case, every process whose name ends with "bash", that is "<any_character>bash", will be handled as intercepted

  2. The "^" regular expression is used in the process filename definition:

    Code Block
    <process filename="^soong" regex="true" type="intercepted" />

    In this case, every process whose name starts with "soong", that is "soong<any_character>", will be handled as intercepted

Note: For more information about regular expressions, see:
https://www.guru99.com/linux-regular-expressions.html

Using Arguments (args)

The arguments, args, parameter enables you to filter the instances of the running process, and to automatically apply the defined distribution type only to instances that include or do not include certain arguments.

The args parameter is relevant for processes whose instances contain different arguments. In such a process, each running instance may need to be distributed in a different manner. For example, a process can run a compilation instance, which should be executed remotely, and a linker instance, which should be executed locally.

We can specify, for example, that all instances should be local_only, except for instances that have the -c (compilation without linking) argument. This means that the distribution type of the compilation instances will not be local_only but allow_remote, while all other instances will be local_only.

You can use the args parameter both in an exclusion and an inclusion approach. In both approaches, the args parameter specifies one or more arguments. If there is more than one argument in the args parameter, the arguments should be organized in a list, when each argument is separated by a colon.

>To use args, enter the following:

Code Block
<process filename="<process_name>"   type="<distribution_type>" exclude_args/include_args="<argument:argument:argument"/>

Note: Do not use partial names with regex as arguments. Enter into the ib_profile.xml file the full argument for an exact match. 

 

  • exclude_args:

If any of the arguments in the exclude_args list is met at the actual process execution, the specified distribution type will NOT be applied to the process instance.

For example:

Code Block
<process filename="clang.real"         type="local_only" exclude_args="-c:-S:-E"/>

In this example, it is specified that the clang.real process should run as local_only. However, if its instance contains one or more of the defined tokens (-c, -S, or -E), this distribution type will not be applied to it. This means that if the command that runs the clang.real process contains the -c, -S or -E tokens, the process will run as allow_remote instead of local_only.

  

  •  include_args:

Only if any of the arguments in the include_args list is met at the actual process execution, the specified distribution type will be applied to the process.

If there is more than one entry regarding the same process, the entry with the include_args parameter will take effect.

For example:

Code Block
<process filename="java"             type="allow_remote" />
<process filename="java"             type="intercepted" include_args="org.gradle.launcher.GradleMain:org.gradle.wrapper.GradleWrapperMain" />

In this example, java processes will usually run as allow_remote. However, if the actual command will contain org.gradle.launcher.GradleMain and/or org.gradle.wrapper.GradleWrapperMain, the java processes will be handled as intercepted.

...