Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
70 changed files
with
3,675 additions
and
25 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
34 changes: 34 additions & 0 deletions
34
core/runtime/src/main/java/io/quarkus/runtime/BuildAnalyticsConfig.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,34 @@ | ||
package io.quarkus.runtime; | ||
|
||
import java.util.Optional; | ||
|
||
import io.quarkus.runtime.annotations.ConfigItem; | ||
import io.quarkus.runtime.annotations.ConfigPhase; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
|
||
/** | ||
* Build time analytics configuration. | ||
* This is a dummy config class to hide the warnings on the comment line. | ||
* All properties in here are actually used in the build tools. | ||
*/ | ||
@ConfigRoot(name = "analytics", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) | ||
public class BuildAnalyticsConfig { | ||
|
||
/** | ||
* If Build time analytics are disabled. | ||
*/ | ||
@ConfigItem | ||
public Optional<Boolean> disabled; | ||
|
||
/** | ||
* The Segment base URI. | ||
*/ | ||
@ConfigItem | ||
public Optional<String> uriBase; | ||
|
||
/** | ||
* The Timeout to send the build time analytics to segment. | ||
*/ | ||
@ConfigItem(defaultValue = "3000") | ||
public Optional<Integer> timeout; | ||
} |
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
85 changes: 85 additions & 0 deletions
85
devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/Prompter.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,85 @@ | ||
package io.quarkus.gradle; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
import java.util.function.Consumer; | ||
|
||
import org.aesh.readline.Readline; | ||
import org.aesh.readline.ReadlineBuilder; | ||
import org.aesh.readline.tty.terminal.TerminalConnection; | ||
import org.aesh.terminal.tty.Signal; | ||
|
||
/** | ||
* Prompt implementation. | ||
* | ||
* @author <a href="http://escoffier.me">Clement Escoffier</a> | ||
*/ | ||
public class Prompter { | ||
|
||
private static class Prompt { | ||
private final String prompt; | ||
private final String defaultValue; | ||
private final Consumer<String> inputConsumer; | ||
|
||
public Prompt(String prompt, String defaultValue, Consumer<String> inputConsumer) { | ||
this.prompt = prompt; | ||
this.defaultValue = defaultValue; | ||
this.inputConsumer = inputConsumer; | ||
} | ||
} | ||
|
||
private final List<Prompt> prompts = new ArrayList<>(); | ||
|
||
public Prompter() throws IOException { | ||
} | ||
|
||
public Prompter addPrompt(String prompt, Consumer<String> inputConsumer) { | ||
prompts.add(new Prompt(prompt, null, inputConsumer)); | ||
return this; | ||
} | ||
|
||
public Prompter addPrompt(String prompt, String defaultValue, Consumer<String> inputConsumer) { | ||
prompts.add(new Prompt(prompt, defaultValue, inputConsumer)); | ||
return this; | ||
} | ||
|
||
public void collectInput() throws IOException { | ||
if (prompts.isEmpty()) { | ||
return; | ||
} | ||
final TerminalConnection connection = new TerminalConnection(); | ||
connection.setSignalHandler(interruptionSignalHandler()); | ||
try { | ||
read(connection, ReadlineBuilder.builder().enableHistory(false).build(), prompts.iterator()); | ||
connection.openBlocking(); | ||
} finally { | ||
connection.close(); | ||
} | ||
} | ||
|
||
private static void read(TerminalConnection connection, Readline readline, Iterator<Prompt> prompts) { | ||
final Prompt prompt = prompts.next(); | ||
readline.readline(connection, prompt.prompt, input -> { | ||
prompt.inputConsumer.accept( | ||
(input == null || input.isBlank()) && prompt.defaultValue != null ? prompt.defaultValue : input); | ||
if (!prompts.hasNext()) { | ||
connection.close(); | ||
} else { | ||
read(connection, readline, prompts); | ||
} | ||
}); | ||
} | ||
|
||
private Consumer<Signal> interruptionSignalHandler() { | ||
return new Consumer<Signal>() { | ||
@Override | ||
public void accept(Signal signal) { | ||
if (signal == Signal.INT) { | ||
throw new RuntimeException("Process interrupted"); | ||
} | ||
} | ||
}; | ||
} | ||
} |
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
Oops, something went wrong.