Skip to content

objectionary/ineo-maven-plugin

Repository files navigation

logo

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

Maven Central Javadoc License Hits-of-Code Lines of code codecov

INEO (stands for EO Inliner) is the tool to inline EO objects in order to get a faster and lighter EO code.

How to use

To run the plugin you need at least Maven 3.1.+ and Java 8+. The plugin provides two optimizations:

FUSE

The optimization scans the directory and checks if there's any.xmir file where the next code occurs:

<o base=".new">
  <o base="B"/>
  <o base=".new">
    <o base="A"/>
    <o base="int" data="bytes">
      <!-- BYTES HERE -->
    </o>
  </o>
</o>

The plugin adds new fused BA.xmir file into the directory and replaces the xmir above with the next one:

<o base=".new">
  <o base="BA"/>
  <o base="int" data="bytes">
    <!-- BYTES HERE -->
  </o>
</o>

STATICIZE

The optimization scans the directory and checks if there's any.xmir file where the next code occurs:

<o base=".get">
  <o base=".new">
    <o base="A"/>
    <o base="int" data="bytes">
      <!-- BYTES HERE -->
    </o>
  </o>
</o>

The plugin adds new staticized StaticizedA.xmir file into the directory and replaces the xmir above with the next one:

<o base=".get">
  <o base=".new">
    <o base="StaticizedA"/>
    <o base="int" data="bytes">
      <!-- BYTES HERE -->
    </o>
  </o>
</o>

Meantime StaticizedA will use static method instead of instance one.

Objects A and B must be from the same package and have the same prefix.

FACTORIALIZE

The optimization scans the directory and

  1. replaces org/eolang/benchmark/Main.xmir with this Main.xmir
  2. puts Factorialized.xmir near Main.xmir

Here you may find a working example that uses the plugin with other optimization tools, like JEO and OPEO

Invoke the plugin from the Maven lifecycle

You can run the plugin from the Maven lifecycle by adding the following configuration to your pom.xml file:

<build>
  <plugins>
    <plugin>
      <groupId>org.eolang</groupId>
      <artifactId>ineo-maven-plugin</artifactId>
      <version>0.2.0</version>
      <executions>
        <execution>
          <id>fuse</id>
          <phase>generate-sources</phase>
          <goals>
            <goal>fuse</goal>
          </goals>
        </execution>
        <execution>
          <id>staticize</id>
          <phase>generate-sources</phase>
          <goals>
            <goal>fuse</goal>
          </goals>
        </execution>
        <execution>
          <id>factorialize</id>
          <phase>generate-sources</phase>
          <goals>
            <goal>factorialize</goal>
          </goals>
          <configuration>
            <sourcesDir>SOURCES DIRECTORY</sourcesDir>
            <outputDir>OUTPUT DIRECTORY</outputDir>
            <main>PATH TO Main.xmir</main>
            <factorial>PATH TO Factorial.xmir</factorial>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

More details about plugin usage you can find in our Maven site.

How to Contribute

Fork repository, make changes, then send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full Maven build:

$ mvn clean install -Pqulice

You will need Maven 3.3+ and Java 8+ installed.