Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve coding logic #450

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ public void runtimeInit(
@BuildStep(onlyIf = IsDevelopment.class)
List<HotDeploymentWatchedFileBuildItem> hotDeploymentWatchedFiles(QuinoaConfig quinoaConfig,
OutputTargetBuildItem outputTarget) {
final List<HotDeploymentWatchedFileBuildItem> watchedFiles = new ArrayList<>(PackageManagerType.values().length);
final List<HotDeploymentWatchedFileBuildItem> watchedFiles = new ArrayList<>(
PackageManagerType.values().length);
final ProjectDirs projectDirs = resolveProjectDirs(quinoaConfig, outputTarget);
if (projectDirs == null) {
// UI dir is misconfigured so just skip watching files
Expand Down Expand Up @@ -263,7 +264,8 @@ private QuinoaDirectoryBuildItem initDefaultConfig(PackageManager packageManager
buildDirectory = detectedFramework.getBuildDirectory();
LOG.infof("%s framework setting build directory: '%s'", framework, buildDirectory);
}
return new QuinoaDirectoryBuildItem(packageManager, detectedFramework.getDevServerCommand(), port, buildDirectory);
return new QuinoaDirectoryBuildItem(packageManager, detectedFramework.getDevServerCommand(), port,
buildDirectory);
}

private HashSet<BuiltResourcesBuildItem.BuiltResource> prepareBuiltResources(
Expand All @@ -277,7 +279,8 @@ private HashSet<BuiltResourcesBuildItem.BuiltResource> prepareBuiltResources(
for (Path file : files) {
final String name = "/" + targetDir.relativize(file).toString().replace('\\', '/');
LOG.infof("Quinoa generated resource: '%s'", name);
generatedResources.produce(new GeneratedResourceBuildItem(META_INF_WEB_UI + name, Files.readAllBytes(file), true));
generatedResources
.produce(new GeneratedResourceBuildItem(META_INF_WEB_UI + name, Files.readAllBytes(file), true));
if (nativeImageResources != null) {
nativeImageResources
.produce(new NativeImageResourceBuildItem(META_INF_WEB_UI + name));
Expand Down Expand Up @@ -337,9 +340,9 @@ static Path findProjectRoot(Path outputDirectory) {
}
if (currentPath.getParent() != null && Files.exists(currentPath.getParent())) {
currentPath = currentPath.getParent();
} else {
return null;
}
return null;

} while (true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public void install(boolean frozenLockfile) {
LOG.infof("Running Quinoa package manager install command: %s", install.commandWithArguments);
if (!exec(install)) {
throw new RuntimeException(
format("Error in Quinoa while running package manager install command: %s", install.commandWithArguments));
format("Error in Quinoa while running package manager install command: %s",
install.commandWithArguments));
}
}

Expand All @@ -59,7 +60,8 @@ public void build(LaunchMode mode) {
LOG.infof("Running Quinoa package manager build command: %s", build.commandWithArguments);
if (!exec(build)) {
throw new RuntimeException(
format("Error in Quinoa while running package manager build command: %s", build.commandWithArguments));
format("Error in Quinoa while running package manager build command: %s",
build.commandWithArguments));
}
}

Expand All @@ -68,7 +70,8 @@ public void test() {
LOG.infof("Running Quinoa package manager test command: %s", test.commandWithArguments);
if (!exec(test)) {
throw new RuntimeException(
format("Error in Quinoa while running package manager test command: %s", test.commandWithArguments));
format("Error in Quinoa while running package manager test command: %s",
test.commandWithArguments));
}
}

Expand Down Expand Up @@ -114,7 +117,8 @@ private static void killDescendants(ProcessHandle process, boolean force) {
});
}

public DevServer dev(String devServerCommand, String devServerHost, int devServerPort, String checkPath, int checkTimeout) {
public DevServer dev(String devServerCommand, String devServerHost, int devServerPort, String checkPath,
int checkTimeout) {
final Command dev = packageManagerCommands.dev(devServerCommand);
LOG.infof("Running Quinoa package manager live coding as a dev service: %s", dev.commandWithArguments);
Process p = process(dev);
Expand Down Expand Up @@ -228,9 +232,8 @@ private boolean exec(Command command) {
private String[] runner(Command command) {
if (isWindows()) {
return new String[] { "cmd.exe", "/c", command.commandWithArguments };
} else {
return new String[] { "sh", "-c", command.commandWithArguments };
}
return new String[] { "sh", "-c", command.commandWithArguments };
}

private static class HandleOutput implements Runnable {
Expand Down
Loading
Loading