-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 #43329 from cdsap/kotlin_not_included_in_sourceset
Missing sourceSets for Kotlin in Project Descriptor
- Loading branch information
Showing
2 changed files
with
52 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
47 changes: 47 additions & 0 deletions
47
...ration-tests/gradle/src/test/java/io/quarkus/gradle/KotlinIsIncludedInQuarkusJarTest.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,47 @@ | ||
package io.quarkus.gradle; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.io.File; | ||
import java.nio.file.Path; | ||
import java.util.Enumeration; | ||
import java.util.jar.JarEntry; | ||
import java.util.jar.JarFile; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class KotlinIsIncludedInQuarkusJarTest extends QuarkusGradleWrapperTestBase { | ||
|
||
@Test | ||
public void testFastJarFormatWorks() throws Exception { | ||
|
||
final File projectDir = getProjectDir("basic-kotlin-application-project"); | ||
|
||
runGradleWrapper(projectDir, "clean", "build"); | ||
|
||
final Path quarkusApp = projectDir.toPath().resolve("build").resolve("quarkus-app").resolve("app"); | ||
assertThat(quarkusApp).exists(); | ||
Path jar = quarkusApp.resolve("code-with-quarkus-unspecified.jar"); | ||
assertThat(jar).exists(); | ||
try (JarFile jarFile = new JarFile(jar.toFile())) { | ||
assertJarContainsEntry(jarFile, "basic-kotlin-application-project/src/main/kotlin/org/acme/MyMainClass.class"); | ||
assertJarContainsEntry(jarFile, "org/acme/GreetingResource.class"); | ||
assertJarContainsEntry(jarFile, "META-INF/code-with-quarkus.kotlin_module"); | ||
} | ||
} | ||
|
||
private void assertJarContainsEntry(JarFile jarFile, String expectedEntry) { | ||
boolean entryFound = false; | ||
Enumeration<JarEntry> entries = jarFile.entries(); | ||
while (entries.hasMoreElements()) { | ||
JarEntry entry = entries.nextElement(); | ||
System.out.println(entry.getName()); | ||
if (entry.getName().equals(expectedEntry)) { | ||
entryFound = true; | ||
break; | ||
} | ||
} | ||
assertTrue(entryFound, "Expected entry " + expectedEntry + " not found in JAR file."); | ||
} | ||
} |