-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dependency handling in JlinkPlugin (+ general improvements) (#1226)
* Fix missing dependency handling in JlinkPlugin * Switch to OpenJDK 12 for JLink test * Add comments/documentation following PR discussion
- Loading branch information
1 parent
b9228fd
commit 4702cc5
Showing
11 changed files
with
205 additions
and
7 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
3 changes: 3 additions & 0 deletions
3
src/sbt-test/jlink/test-jlink-missing-deps/bar/src/main/java/bar/Bar.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,3 @@ | ||
package bar; | ||
|
||
public class Bar {} |
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,21 @@ | ||
// Tests jlink behavior with missing dependencies. | ||
|
||
import scala.sys.process.Process | ||
import com.typesafe.sbt.packager.Compat._ | ||
|
||
|
||
// Exclude Scala to simplify the test | ||
autoScalaLibrary in ThisBuild := false | ||
|
||
// Simulate a missing dependency (foo -> bar) | ||
lazy val foo = project.dependsOn(bar % "provided") | ||
lazy val bar = project | ||
|
||
lazy val withoutIgnore = project.dependsOn(foo) | ||
.enablePlugins(JlinkPlugin) | ||
|
||
lazy val withIgnore = project.dependsOn(foo) | ||
.enablePlugins(JlinkPlugin) | ||
.settings( | ||
jlinkIgnoreMissingDependency := JlinkIgnore.only("foo" -> "bar") | ||
) |
7 changes: 7 additions & 0 deletions
7
src/sbt-test/jlink/test-jlink-missing-deps/foo/src/main/java/foo/Foo.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,7 @@ | ||
package foo; | ||
|
||
public class Foo { | ||
public Foo() { | ||
new bar.Bar(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/sbt-test/jlink/test-jlink-missing-deps/project/plugins.sbt
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,8 @@ | ||
{ | ||
val pluginVersion = sys.props("project.version") | ||
if (pluginVersion == null) | ||
throw new RuntimeException("""|The system property 'project.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) | ||
else | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version")) | ||
} |
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 @@ | ||
> compile | ||
# Should fail since we have a missing dependency. | ||
-> withoutIgnore/jlinkBuildImage | ||
# Should work OK since the issue is silenced | ||
> withIgnore/jlinkBuildImage |
5 changes: 5 additions & 0 deletions
5
src/sbt-test/jlink/test-jlink-missing-deps/withIgnore/src/main/java/WithIgnore.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 @@ | ||
class WithIgnore { | ||
public WithIgnore() { | ||
new foo.Foo(); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/sbt-test/jlink/test-jlink-missing-deps/withoutIgnore/src/main/java/WithoutIgnore.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 @@ | ||
class WithoutIgnore { | ||
public WithoutIgnore() { | ||
new foo.Foo(); | ||
} | ||
} |
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