Skip to content

Commit

Permalink
** Initial work on a dev goal.
Browse files Browse the repository at this point in the history
Signed-off-by: James R. Perkins <jperkins@redhat.com>
  • Loading branch information
jamezp committed Mar 7, 2023
1 parent 11f1680 commit 5fbb884
Show file tree
Hide file tree
Showing 12 changed files with 1,914 additions and 0 deletions.
907 changes: 907 additions & 0 deletions docs/dev-mojo.html

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docs/lib/popperjs/core/dist/umd/popper.min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
</dependency>

<dependency>
<groupId>org.twdata.maven</groupId>
<artifactId>mojo-executor</artifactId>
<version>${version.org.twdata.maven}</version>
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-controller-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ public static String getJavaCommand(final Path javaHome) {
return exe;
}

/**
* Determines if this is a Windows environment.
*
* @return {@code true} if this is a Windows environment, otherwise {@code false}
*/
public static boolean isWindows() {
return WINDOWS;
}

private static Path findJavaHome() {
String path = WildFlySecurityManager.getPropertyPrivileged("java.home", null);
if (path != null) {
Expand Down
25 changes: 25 additions & 0 deletions plugin/src/main/java/org/wildfly/plugin/common/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@

package org.wildfly.plugin.common;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
Expand All @@ -33,6 +36,8 @@
public class Utils {
private static final Pattern EMPTY_STRING = Pattern.compile("^$|\\s+");

private static final Pattern WHITESPACE_IF_NOT_QUOTED = Pattern.compile("(\\S+\"[^\"]+\")|\\S+");

public static final String WILDFLY_DEFAULT_DIR= "server";
/**
* Tests if the character sequence is not {@code null} and not empty.
Expand Down Expand Up @@ -75,4 +80,24 @@ public static String toString(final Iterable<?> iterable, final CharSequence del
}
return result.toString();
}

/**
* Splits the arguments into a list. The arguments are split based on whitespace while ignoring whitespace that is
* within quotes.
*
* @param arguments the arguments to split
*
* @return the list of the arguments
*/
public static List<String> splitArguments(final CharSequence arguments) {
final List<String> args = new ArrayList<>();
final Matcher m = WHITESPACE_IF_NOT_QUOTED.matcher(arguments);
while (m.find()) {
final String value = m.group();
if (!value.isEmpty()) {
args.add(value);
}
}
return args;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* JBoss, Home of Professional Open Source.
*
* Copyright 2023 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.wildfly.plugin.dev;

import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.WatchEvent;

import org.apache.maven.plugin.MojoExecutionException;

/**
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
class CompiledSourceHandler implements WatchHandler {

@Override
public Result handle(final WatchContext context, final WatchEvent<Path> event, final Path file) throws IOException, MojoExecutionException {
return new Result() {
@Override
public boolean requiresRecompile() {
return true;
}

@Override
public boolean requiresRedeploy() {
return true;
}

@Override
public boolean requiresRepackage() {
return true;
}
};
}
}
Loading

0 comments on commit 5fbb884

Please sign in to comment.