Skip to content

Commit

Permalink
fix: Fix entrypoint file name (#1782)
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelpasterz authored Apr 7, 2021
1 parent 536f3f6 commit d2ce59b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test_runner/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ tasks.withType<KotlinCompile>().configureEach {

application {
// unfortunately shadowJar task seems not to be working correctly with new property based approach
mainClassName = "ftl.MainKt"
mainClassName = "ftl.Main"
}

repositories {
Expand Down
1 change: 1 addition & 0 deletions test_runner/src/main/kotlin/ftl/Main.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@file:JvmName("Main")
package ftl

import ftl.presentation.cli.MainCommand
Expand Down
24 changes: 24 additions & 0 deletions test_runner/src/test/kotlin/ftl/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import com.google.common.truth.Truth.assertThat
import flank.common.normalizeLineEnding
import ftl.presentation.cli.MainCommand
import ftl.test.util.FlankTestRunner
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
import org.junit.contrib.java.lang.system.ExpectedSystemExit
import org.junit.contrib.java.lang.system.SystemErrRule
import org.junit.contrib.java.lang.system.SystemOutRule
import org.junit.rules.TemporaryFolder
import org.junit.runner.RunWith
import picocli.CommandLine

Expand All @@ -24,6 +26,9 @@ class MainTest {
@get:Rule
val systemExit: ExpectedSystemExit = ExpectedSystemExit.none()

@get:Rule
val root = TemporaryFolder()

private fun assertMainHelpStrings(output: String) {
assertThat(output.normalizeLineEnding()).contains(
"flank.jar\n" +
Expand Down Expand Up @@ -100,4 +105,23 @@ class MainTest {
)
)
}

@Test
fun `flank entrypoint should be ftl_Main`() {
// For reference: https://github.com/Flank/flank/issues/1780

val logFile = root.newFile()
val result = ProcessBuilder(
"java",
"-cp",
System.getProperty("java.class.path"),
"ftl.Main"
)
.redirectOutput(logFile)
.redirectError(ProcessBuilder.Redirect.INHERIT)
.start().waitFor()

assertEquals("Process did not finish with exit code 0, check entrypoint", 0, result)
assertMainHelpStrings(logFile.readText())
}
}

0 comments on commit d2ce59b

Please sign in to comment.