Skip to content

Commit 24e1aa8

Browse files
author
Stewart Miles
committedSep 27, 2019
Only run the Asset Store Uploader test if Python 3 is installed.
The Asset Store Uploader requires Python 3 which isn't installed by default on many machines. This commit modifies build.gradle to only run the test if Python 3 is installed. Change-Id: I8d17d93dcf89095088cce11786f0795d9c2ee541
1 parent 045354d commit 24e1aa8

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed
 

‎build.gradle

+17-1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ project.ext {
157157
cacheProperties.store(projectPropertiesFile.newWriter(), null)
158158
}
159159

160+
// Get the installed python version.
161+
def pythonOutput = new ByteArrayOutputStream()
162+
pythonVersion = ""
163+
if (project.exec {
164+
commandLine "python", "-V"
165+
standardOutput = pythonOutput
166+
errorOutput = pythonOutput
167+
}.exitValue == 0) {
168+
pythonVersion = pythonOutput.toString().trim().tokenize()[1]
169+
}
170+
160171
// UnityAssetUploader required environment variables.
161172
unityUsername = findProperty("UNITY_USERNAME")
162173
unityPassword = findProperty("UNITY_PASSWORD")
@@ -1019,13 +1030,18 @@ task testDownloadArtifacts(type: GradleBuild) {
10191030
buildFile "source/PlayServicesResolver/scripts/download_artifacts_test.gradle"
10201031
}
10211032

1022-
task testPackageUploaderTests(type: Exec) {
1033+
task testPackageUploader(type: Exec) {
1034+
if (project.ext.pythonVersion &&
1035+
project.ext.pythonVersion.tokenize(".")[0].toInteger() >= 3) {
10231036
def outputDir = buildDir
10241037
def script = "source/UnityAssetUploader/unity_asset_uploader_test.py"
10251038
inputs.file script
10261039
outputs.dir outputDir
10271040
commandLine "python", script
10281041
workingDir = projectDir
1042+
} else {
1043+
commandLine "echo", "Skipping testPackageUploaderTests, requires Python 3."
1044+
}
10291045
}
10301046

10311047
task updateEmbeddedGradleWrapper(type: Zip) {

0 commit comments

Comments
 (0)
Please sign in to comment.