-
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
limitModules
configuration property
- Loading branch information
1 parent
d70e4c9
commit 5f32c97
Showing
5 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
package com.github.iherasymenko.jlink.test; | ||
|
||
import com.github.iherasymenko.jlink.test.fixtures.Text; | ||
import org.assertj.core.api.InstanceOfAssertFactories; | ||
import org.gradle.testkit.runner.BuildResult; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
@@ -141,6 +142,50 @@ implementation platform('org.slf4j:slf4j-bom:2.0.9') | |
assertThat(taskOutput[11]).isEqualTo("[email protected]"); | ||
} | ||
|
||
@Test | ||
void can_limit_module_universe() throws IOException { | ||
build.buildFile = """ | ||
plugins { | ||
id 'application' | ||
id 'com.github.iherasymenko.jlink' | ||
} | ||
group = 'com.example' | ||
version = '0.0.1-SNAPSHOT' | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(System.getenv().getOrDefault('TESTING_AGAINST_JDK', '21')) | ||
vendor = JvmVendorSpec.AZUL | ||
} | ||
} | ||
application { | ||
mainClass = 'com.example.demo.DemoApplication' | ||
mainModule = 'demo.main' | ||
} | ||
jlinkApplication { | ||
limitModules = ['com.zaxxer.hikari'] | ||
} | ||
dependencies { | ||
implementation platform('org.slf4j:slf4j-bom:2.0.9') | ||
implementation 'com.zaxxer:HikariCP:5.1.0' | ||
} | ||
"""; | ||
build.moduleInfo = """ | ||
module demo.main { | ||
requires com.zaxxer.hikari; | ||
} | ||
"""; | ||
BuildResult buildResult = build.runner("image") | ||
.buildAndFail(); | ||
assertThat(buildResult) | ||
.extracting(BuildResult::getOutput, InstanceOfAssertFactories.STRING) | ||
.containsPattern("Module (.*) not found, required by com\\.zaxxer\\.hikari"); | ||
} | ||
|
||
@Test | ||
void can_list_modules_in_an_image_with_third_party_modules() throws IOException { | ||
build.buildFile = """ | ||
|