Skip to content

Commit

Permalink
Upgrade Gradle to 4.3
Browse files Browse the repository at this point in the history
This should help in building a Java 9 version of FitNesse.
  • Loading branch information
amolenaar committed Dec 27, 2017
1 parent 92801a0 commit 97149a8
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 35 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sourceSets {
main {
java.srcDir 'src'
resources.srcDir 'src'
output.resourcesDir output.classesDir
output.resourcesDir java.outputDir
}
test {
java.srcDir 'test'
Expand Down Expand Up @@ -198,7 +198,7 @@ task standaloneJar(type: Jar, dependsOn: jar) {

task acceptanceTest(type: JavaExec) {
mustRunAfter test
onlyIf { dependsOnTaskDidWork() }
onlyIf { test.didWork }
classpath = standaloneJar.outputs.files
main "fitnesseMain.FitNesseMain"
args "-o", "-c", "FitNesse.SuiteAcceptanceTests?suite&format=text"
Expand Down Expand Up @@ -309,7 +309,7 @@ bintray {
}

wrapper {
gradleVersion = '3.1'
gradleVersion = '4.3.1'
}


Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Nov 05 11:17:19 CET 2016
#Sun Nov 19 14:54:04 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip
26 changes: 17 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

##############################################################################
##
Expand Down Expand Up @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand Down Expand Up @@ -154,11 +154,19 @@ if $cygwin ; then
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
6 changes: 0 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ goto fail
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
Expand All @@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
Expand Down
3 changes: 2 additions & 1 deletion test/fit/FitServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.junit.Before;
import org.junit.Test;
import util.FileUtil;
import util.GradleSupport;
import util.StreamReader;

public class FitServerTest {
Expand Down Expand Up @@ -327,7 +328,7 @@ private String readWholeResponse() throws Exception {
}

protected String command() {
return "java -cp build/classes/main fit.FitServer";
return "java -cp " + GradleSupport.CLASSES_DIR + " fit.FitServer";
}

protected String simpleTable(String fixtureName) {
Expand Down
3 changes: 2 additions & 1 deletion test/fitnesse/testsystems/CommandRunnerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
import org.junit.Test;

import fitnesse.testutil.Echo;
import util.GradleSupport;

public class CommandRunnerTest {

private TestExecutionLogListener executionLogListener = new TestExecutionLogListener();

@Test
public void testBasics() throws Exception {
CommandRunner runner = new CommandRunner(new String[] { "java", "-cp", "build/classes/main", "fitnesse.testutil.Echo" }, null, executionLogListener);
CommandRunner runner = new CommandRunner(new String[] { "java", "-cp", GradleSupport.CLASSES_DIR, "fitnesse.testutil.Echo" }, null, executionLogListener);
runner.asynchronousStart();
runner.join();
assertHasRegexp(Echo.ECHO_THIS, executionLogListener.stdOut.toString());
Expand Down
3 changes: 2 additions & 1 deletion test/fitnesse/testsystems/fit/FitClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.junit.Before;
import org.junit.Test;
import fitnesse.util.TimeMeasurement;
import util.GradleSupport;

public class FitClientTest implements FitClientListener {
private List<String> outputs = new ArrayList<>();
Expand All @@ -27,7 +28,7 @@ public class FitClientTest implements FitClientListener {
public void setUp() throws Exception {
CommandRunningFitClient.TIMEOUT = 10000;
client = new CommandRunningFitClient(new CommandRunningFitClient.OutOfProcessCommandRunner(
new String[] { "java", "-cp", "build/classes/main", "fit.FitServer", "-v" }, null, new ConsoleExecutionLogListener()));
new String[] { "java", "-cp", GradleSupport.CLASSES_DIR, "fit.FitServer", "-v" }, null, new ConsoleExecutionLogListener()));
client.addFitClientListener(this);
}

Expand Down
3 changes: 2 additions & 1 deletion test/fitnesse/testsystems/slim/SslSlimClientBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import org.junit.Before;
import org.junit.Test;
import util.GradleSupport;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -53,7 +54,7 @@ public void executeAndCheck(String agentParameters, String clientParameters) thr
"!define slim.pool.size {1}\n" +
"!define wiki.protocol.ssl.parameter.class {"+ clientParameters + "}\n"
);
WikiPageDescriptor descriptor = new WikiPageDescriptor(testPage, false, false, "build/classes/test", "classes");
WikiPageDescriptor descriptor = new WikiPageDescriptor(testPage, false, false, GradleSupport.TEST_CLASSES_DIR, "classes");
descriptor.getExecutionLogListener().addExecutionLogListener(new ConsoleExecutionLogListener());
SlimClientBuilder clientBuilder = new SlimClientBuilder(descriptor);
String testSystemName = clientBuilder.getTestSystemName();
Expand Down
3 changes: 2 additions & 1 deletion test/fitnesse/updates/FileUpdateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import util.GradleSupport;

import java.io.File;

public class FileUpdateTest extends UpdateTestCase {
public final File testFile = new File("build/classes/test/testFile");
public final File testFile = new File(GradleSupport.TEST_CLASSES_DIR, "testFile");

@Override
protected Update makeUpdate() throws Exception {
Expand Down
3 changes: 2 additions & 1 deletion test/fitnesse/updates/ReplacingFileUpdateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertEquals;
import util.FileUtil;
import util.GradleSupport;

import java.io.File;
import java.io.FileOutputStream;

public class ReplacingFileUpdateTest extends UpdateTestCase {
public final File sourceFile = new File("build/classes/test", "testFile");
public final File sourceFile = new File(GradleSupport.TEST_CLASSES_DIR, "testFile");

public final String destDirName = "subDir";
public File destFile;
Expand Down
19 changes: 10 additions & 9 deletions test/fitnesse/updates/WikiContentUpdaterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.junit.Before;
import org.junit.Test;
import util.FileUtil;
import util.GradleSupport;

import static org.junit.Assert.*;
import static util.RegexTestCase.assertSubString;
Expand Down Expand Up @@ -52,16 +53,16 @@ private void setTheContext(String name) {
}

private void createFakeUpdateListFiles() throws IOException {
updateList = new File("build/classes/test/Resources/updateList");
updateDoNotCopyOver = new File("build/classes/test/Resources/updateDoNotCopyOverList");
updateList = new File(GradleSupport.TEST_CLASSES_DIR + "/Resources/updateList");
updateDoNotCopyOver = new File(GradleSupport.TEST_CLASSES_DIR +"/Resources/updateDoNotCopyOverList");
FileUtil.createFile(updateList, "FitNesseRoot/files/TestFile\nFitNesseRoot/files/BestFile\n");
FileUtil.createFile(updateDoNotCopyOver, "FitNesseRoot/SpecialFile");
}

private void createFakeJarFileResources() throws IOException {
FileUtil.createFile("build/classes/test/Resources/FitNesseRoot/files/TestFile","") ;
FileUtil.createFile("build/classes/test/Resources/FitNesseRoot/files/BestFile","") ;
FileUtil.createFile("build/classes/test/Resources/FitNesseRoot/SpecialFile","");
FileUtil.createFile(GradleSupport.TEST_CLASSES_DIR + "/Resources/FitNesseRoot/files/TestFile","") ;
FileUtil.createFile(GradleSupport.TEST_CLASSES_DIR + "/Resources/FitNesseRoot/files/BestFile","") ;
FileUtil.createFile(GradleSupport.TEST_CLASSES_DIR + "/Resources/FitNesseRoot/SpecialFile","");
}

@Test
Expand All @@ -76,8 +77,8 @@ public void shouldBeAbleToGetUpdateFilesAndMakeAlistFromThem() throws Exception

@Test
public void shouldBeAbleToGetThePathOfJustTheParent() throws Exception {
File filePath = updater.getCorrectPathForTheDestination("build/classes/test/files/moreFiles/TestFile");
assertSubString(portablePath("build/classes/test/files/moreFiles"), filePath.getPath());
File filePath = updater.getCorrectPathForTheDestination(GradleSupport.TEST_CLASSES_DIR + "/files/moreFiles/TestFile");
assertSubString(portablePath(GradleSupport.TEST_CLASSES_DIR + "/files/moreFiles"), filePath.getPath());
}

private String portablePath(String path) {
Expand Down Expand Up @@ -174,12 +175,12 @@ List<Update> makeAllUpdates() {
@Test(expected = RuntimeException.class)
public void shouldThrowExceptionInNoUpdateFileExists() throws Exception {
FileUtil.deleteFile(updateList);
updater.parseResource("build/classes/test/Resources/updateList");
updater.parseResource(GradleSupport.TEST_CLASSES_DIR + "/Resources/updateList");
}

@After
public void tearDown() throws IOException {
FileUtil.deleteFileSystemDirectory("build/classes/test/Resources");
FileUtil.deleteFileSystemDirectory(GradleSupport.TEST_CLASSES_DIR + "/Resources");
FileUtil.deleteFileSystemDirectory(testDir);
}

Expand Down
9 changes: 9 additions & 0 deletions test/util/GradleSupport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package util;

public final class GradleSupport {
public static final String CLASSES_DIR = "build/classes/java/main";
public static final String TEST_CLASSES_DIR = "build/classes/java/test";

private GradleSupport() {
}
}

0 comments on commit 97149a8

Please sign in to comment.