Skip to content

Commit

Permalink
Release v0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
twasyl committed Oct 16, 2013
1 parent 211a45f commit 9bb21b9
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 9 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ can be displayed live in a window.
Each build is launched inside the repository folder. In order to determine if the build is a success
or not, the application checks the result of the mvn command.

## Configuration

In the **Tools** menu and then **Configuration**, you can define the configuration of the software. You will need to
enter the full path of the **mvn** command.
You will also be able to define custom maven options. For example if you often use an option like **-DskipTests=true**
and you don't want to enter this option each time you add/edit a repository, you can define it here. Then when adding/editing
a repository you will get it in the help window of the maven options.


## Workspaces

A workspace allows you to have multiple repositories available in ***CompilerFX***, grouped
Expand Down Expand Up @@ -39,7 +48,8 @@ is executed before ***install***. Custom goals will be available in a next versi

## Maven options

Maven option can be added when adding/editing a repository using the **Options** field.
Maven option can be added when adding/editing a repository using the **Options** field. Using the help button, maven options
are listed, default ones as well as custom ones. Double clicking on an option will add it automatically to the field.

## Post build commands

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/twasyl/compilerfx/app/CompilerFXApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

public class CompilerFXApp extends Application {

public static String version = "0.3.0";
public static String version = "0.3.1";
private static final ReadOnlyObjectProperty<CompilerFXApp> current = new SimpleObjectProperty<>();
private final ReadOnlyObjectProperty<Stage> currentStage = new SimpleObjectProperty<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public class CompilerFXController implements Initializable {
@FXML private void showAbout(ActionEvent event) {
final StringBuilder changeLog = new StringBuilder();
changeLog.append("Change logs:\n\n");
changeLog.append("version 0.3.1:\n\n");
changeLog.append(" - Fix commands execution on Windows platforms\n");
changeLog.append(" - Edit button in edition screen for a repository is renamed to Save");
changeLog.append("\n\n");
changeLog.append("version 0.3.0:\n\n");
changeLog.append(" - Abort feature for the current workspace and for all\n");
changeLog.append(" - Feature for creating custom maven options\n");
Expand Down
28 changes: 22 additions & 6 deletions src/main/java/com/twasyl/compilerfx/utils/MavenExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import javafx.collections.ObservableList;

import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand All @@ -22,7 +23,10 @@
public class MavenExecutor {

public static List<MavenRepository.MavenOption> getMavenOptions() {
final String[] command = new String[] {Configuration.getInstance().getMavenCommand(), "--help"};

final String[] command = OSUtils.isWindows() ?
new String[] {"cmd.exe", "/C", Configuration.getInstance().getMavenCommand(), "--help"} :
new String[] {Configuration.getInstance().getMavenCommand(), "--help"};
final List<MavenRepository.MavenOption> options = new ArrayList<>();

for(MavenRepository.MavenOption option : Configuration.getInstance().getCustomMavenOptions()) {
Expand All @@ -35,7 +39,6 @@ public static List<MavenRepository.MavenOption> getMavenOptions() {

try {
final Process process = builder.start();
process.waitFor();

reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
Expand Down Expand Up @@ -80,7 +83,6 @@ public static List<MavenRepository.MavenOption> getMavenOptions() {
}
}
} catch (IOException e) {
} catch (InterruptedException e) {
} finally {
if(reader != null) {
try {
Expand Down Expand Up @@ -139,6 +141,7 @@ public void run() {

Process process = null;
File repositoryDirectory = null;
final boolean isWindows = OSUtils.isWindows();

for (final MavenRepository repository : repositories) {

Expand All @@ -154,6 +157,11 @@ public void run() {
Configuration.getInstance().currentBuildsProperty().add(repository);

command.clear();
if(isWindows) {
command.add("cmd.exe");
command.add("/C");
}

command.add(Configuration.getInstance().getMavenCommand());

if(repository.getOptions() != null && !repository.getOptions().trim().isEmpty()) {
Expand Down Expand Up @@ -255,8 +263,9 @@ public static void executePostBuildCommands(final ObservableList<MavenRepository
Runnable run = new Runnable() {
@Override
public void run() {

final boolean isWindows = OSUtils.isWindows();
final ProcessBuilder processBuilder = new ProcessBuilder();
List<String> command = new ArrayList<>();

Process process = null;
File repositoryDirectory = null;
Expand Down Expand Up @@ -284,7 +293,15 @@ public void run() {

while (groupIndex <= matcher.groupCount()) {
processBuilder.directory(new File(repository.getPath()));
processBuilder.command(Arrays.asList(matcher.group(groupIndex).split(" ")));
command.clear();

if(isWindows) {
command.add("cmd.exe");
command.add("/C");
}

command.addAll(Arrays.asList(matcher.group(groupIndex).split(" ")));
processBuilder.command(command);

process = processBuilder.start();
repository.setActiveProcess(process);
Expand Down Expand Up @@ -363,7 +380,6 @@ public void run() {

try {
while((line = in.readLine()) != null) {

try {
repository.setLastExecutionStack(
(repository.getLastExecutionStack() == null ? "" : repository.getLastExecutionStack())
Expand Down
35 changes: 35 additions & 0 deletions src/main/java/com/twasyl/compilerfx/utils/OSUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.twasyl.compilerfx.utils;

public class OSUtils {
private static String OS = System.getProperty("os.name").toLowerCase();

public enum OperatingSystem {
WINDOWS, UNIX, MAC
}

public static boolean isWindows() {
return (OS.indexOf("win") >= 0);
}

public static boolean isMac() {
return (OS.indexOf("mac") >= 0);
}

public static boolean isUnix() {
return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0);
}

public static OperatingSystem getOperatingSystem() {
OperatingSystem os = null;

if (isWindows()) {
os = OperatingSystem.WINDOWS;
} else if(isUnix()) {
os = OperatingSystem.UNIX;
} else if(isMac()) {
os = OperatingSystem.MAC;
}

return os;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</HBox>
<HBox spacing="10">
<Button text="Cancel" onAction="#cancel" />
<Button text="Edit" onAction="#edit" />
<Button text="Save" onAction="#edit" />
</HBox>
</children>
</VBox>

0 comments on commit 9bb21b9

Please sign in to comment.