-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from Ladicek/maven-plugin-single-index
Make the Maven plugin generate a single index per execution
- Loading branch information
Showing
11 changed files
with
173 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
import org.jboss.jandex.IndexReader | ||
|
||
def jandexFile = new File(basedir, 'target/classes/META-INF/jandex.idx') | ||
assert !jandexFile.exists() : "File ${jandexFile} does exist" | ||
|
||
// --- | ||
|
||
// this assumes that each fileSet gets its own index, which is current behavior | ||
// not sure this is _correct_ behavior though! | ||
|
||
jandexFile = new File(basedir, 'target/dependency/META-INF/jandex.idx') | ||
// index dir explicitly configured | ||
def jandexFile = new File(basedir, 'target/dependency/jandex.idx') | ||
assert jandexFile.exists() : "File ${jandexFile} does not exist" | ||
assert jandexFile.length() > 0 : "File ${jandexFile} is empty" | ||
|
||
index = new IndexReader(jandexFile.newInputStream()).read() | ||
assert index.getKnownClasses().size() == 1 : "Index ${jandexFile} doesn't contain exactly 1 class" | ||
assert index.getKnownClasses().size() == 1 : "Index ${jandexFile} does not contain exactly 1 class" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,9 @@ | ||
import org.jboss.jandex.IndexReader | ||
|
||
// 2 file sets in 1 index | ||
def jandexFile = new File(basedir, 'target/classes/META-INF/jandex.idx') | ||
assert jandexFile.exists() : "File ${jandexFile} does not exist" | ||
assert jandexFile.length() > 0 : "File ${jandexFile} is empty" | ||
|
||
def index = new IndexReader(jandexFile.newInputStream()).read() | ||
assert index.getKnownClasses().size() == 1 : "Index ${jandexFile} doesn't contain exactly 1 class" | ||
|
||
// --- | ||
|
||
// this assumes that each fileSet gets its own index, which is current behavior | ||
// not sure this is _correct_ behavior though! | ||
|
||
jandexFile = new File(basedir, 'target/dependency/META-INF/jandex.idx') | ||
assert jandexFile.exists() : "File ${jandexFile} does not exist" | ||
assert jandexFile.length() > 0 : "File ${jandexFile} is empty" | ||
|
||
index = new IndexReader(jandexFile.newInputStream()).read() | ||
assert index.getKnownClasses().size() == 1 : "Index ${jandexFile} doesn't contain exactly 1 class" | ||
assert index.getKnownClasses().size() == 2 : "Index ${jandexFile} does not contain exactly 2 classes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.smallrye</groupId> | ||
<artifactId>smallrye-build-parent</artifactId> | ||
<version>31</version> | ||
</parent> | ||
|
||
<groupId>org.jboss.jandex</groupId> | ||
<artifactId>jandex-maven-plugin-multipleIndices</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<version>3.2.0</version> | ||
<executions> | ||
<execution> | ||
<id>unpack-dependency</id> | ||
<phase>generate-resources</phase> | ||
<goals> | ||
<goal>unpack</goal> | ||
</goals> | ||
<configuration> | ||
<artifactItems> | ||
<artifactItem> | ||
<groupId>org.jboss</groupId> | ||
<artifactId>jandex</artifactId> | ||
<version>2.4.0.Final</version> | ||
<overWrite>true</overWrite> | ||
<outputDirectory>${project.build.directory}/dependency</outputDirectory> | ||
</artifactItem> | ||
</artifactItems> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<id>make-index</id> | ||
<goals> | ||
<goal>jandex</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>make-second-index</id> | ||
<goals> | ||
<goal>jandex</goal> | ||
</goals> | ||
<configuration> | ||
<indexDir>${project.build.directory}/dependency</indexDir> | ||
<processDefaultFileSet>false</processDefaultFileSet> | ||
<fileSets> | ||
<fileSet> | ||
<directory>${project.build.directory}/dependency</directory> | ||
<includes> | ||
<include>org/jboss/jandex/MethodParameter*.class</include> | ||
</includes> | ||
<excludes> | ||
<exclude>org/jboss/jandex/MethodParameterTypeTarget.class</exclude> | ||
</excludes> | ||
</fileSet> | ||
</fileSets> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
5 changes: 5 additions & 0 deletions
5
...rc/it/multipleIndices/src/main/java/org/jboss/jandex/maven/multipleIndices/SomeClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.jboss.jandex.maven.multipleIndices; | ||
|
||
public class SomeClass { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import org.jboss.jandex.IndexReader | ||
|
||
// 1st execution | ||
def jandexFile = new File(basedir, 'target/classes/META-INF/jandex.idx') | ||
assert jandexFile.exists() : "File ${jandexFile} does not exist" | ||
assert jandexFile.length() > 0 : "File ${jandexFile} is empty" | ||
|
||
def index = new IndexReader(jandexFile.newInputStream()).read() | ||
assert index.getKnownClasses().size() == 1 : "Index ${jandexFile} does not contain exactly 1 class" | ||
|
||
// 2nd execution | ||
jandexFile = new File(basedir, 'target/dependency/jandex.idx') | ||
assert jandexFile.exists() : "File ${jandexFile} does not exist" | ||
assert jandexFile.length() > 0 : "File ${jandexFile} is empty" | ||
|
||
index = new IndexReader(jandexFile.newInputStream()).read() | ||
assert index.getKnownClasses().size() == 1 : "Index ${jandexFile} does not contain exactly 1 class" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
import org.jboss.jandex.IndexReader | ||
|
||
def jandexFile = new File(basedir, 'target/classes/META-INF/jandex.idx') | ||
assert !jandexFile.exists() : "File ${jandexFile} does exist" | ||
assert jandexFile.exists() : "File ${jandexFile} does not exist" | ||
assert jandexFile.length() > 0 : "File ${jandexFile} is empty" | ||
|
||
def index = new IndexReader(jandexFile.newInputStream()).read() | ||
assert index.getKnownClasses().isEmpty() : "Index ${jandexFile} is not empty" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.