-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add setting to allow disabling of auto-inclusion of Jandex index in J…
…AR (#1)
- Loading branch information
1 parent
8491acb
commit fd1b1db
Showing
9 changed files
with
107 additions
and
29 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
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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name := "jandex-cdi" | ||
scalaVersion := "2.13.10" | ||
|
||
libraryDependencies += "jakarta.enterprise" % "jakarta.enterprise.cdi-api" % "4.0.1" % Provided | ||
|
||
jandexIncludeInPackage := false | ||
|
||
val verifyJarNoIndex = taskKey[Unit]("check Jandex index is not in JAR") | ||
|
||
verifyJarNoIndex := { | ||
import scala.util.Using | ||
import java.util.jar.JarFile | ||
|
||
val projectJar = (Compile / packageBin).value | ||
|
||
val jarFile = new JarFile(projectJar) | ||
val indexEntry = jarFile.getEntry("META-INF/jandex.idx") | ||
|
||
if (indexEntry != null) { | ||
sys.error("jandex.idx found in JAR") | ||
} | ||
} |
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,7 @@ | ||
{ | ||
val pluginVersion = System.getProperty("plugin.version") | ||
if (pluginVersion == null) | ||
throw new RuntimeException("""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) | ||
else addSbtPlugin("software.purpledragon" % "sbt-jandex" % pluginVersion) | ||
} |
10 changes: 10 additions & 0 deletions
10
src/sbt-test/jandex/no-include/src/main/scala/com/example/Greeter.scala
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,10 @@ | ||
package com.example | ||
|
||
import jakarta.enterprise.context.ApplicationScoped | ||
|
||
@ApplicationScoped | ||
class Greeter { | ||
def greet(name: String): String = { | ||
s"Hello, $name!" | ||
} | ||
} |
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,6 @@ | ||
# check index file is generated | ||
> jandex | ||
$ exists target/scala-2.13/jandex/jandex.idx | ||
|
||
# check that index file is included in JAR | ||
> verifyJarNoIndex |