Skip to content

Commit ab4dcfe

Browse files
claywilkinsonGerrit Code Review
authored andcommitted
Merge "Adding locating nunit-console so tests can be run."
2 parents 75a5840 + fd82812 commit ab4dcfe

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

build.gradle

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ project.ext {
100100
logger.info("Unity NUnity framework found in $unity_nunit_dll_path")
101101
}
102102

103-
104103
// xbuild is used to build the dlls.
105104
xbuild_exe = findUnityPath("XBUILD_EXE", false,
106105
os_windows ?
@@ -115,6 +114,20 @@ project.ext {
115114
logger.info("xbuild found at $xbuild_exe")
116115
}
117116

117+
// nunit-console is used to run tests.
118+
nunit_console_exe = findUnityPath("NUNIT_CONSOLE_EXE", false,
119+
os_windows ?
120+
fileTree(dir: unity_root).matching { include '**/Mono/bin/nunit-console2.bat'}
121+
:
122+
fileTree(dir: unity_root).matching { include '**/Mono/bin/nunit-console2'}
123+
)
124+
if (nunit_console_exe == null || !nunit_console_exe.exists()) {
125+
logger.warn("nunit_console command not found, compilation may fail.")
126+
nunit_console_exe = null
127+
} else {
128+
logger.info("nunit_console found at $nunit_console_exe")
129+
}
130+
118131
pluginSrc = file('plugin').absolutePath
119132
pluginProj = file('build/PluginSrc').absolutePath
120133
buildPath = file('build').absolutePath
@@ -138,7 +151,7 @@ task compile_resolverTests(type: Exec) {
138151
task test_resolverLib(type: Exec, dependsOn: compile_resolverTests) {
139152
description 'Runs the tests.'
140153
workingDir 'source'
141-
commandLine "nunit-console",
154+
commandLine "$nunit_console_exe",
142155
"JarResolverTests/bin/Debug/JarResolverTests.dll"
143156
ext.remoteTaskPhase = 'build'
144157
}
@@ -352,6 +365,8 @@ task export_package(dependsOn: 'generate_manifest') {
352365
}
353366
}
354367
ext.remoteTaskPhase = 'build'
368+
369+
dependsOn test_resolverLib
355370
}
356371

357372
task copy_plugin() {

0 commit comments

Comments
 (0)