Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Commit 6847d9f

Browse files
committedJul 16, 2021·
Add log error handling to Unity task when the Unity process execution fails
1 parent 52a64c6 commit 6847d9f

File tree

8 files changed

+417
-52
lines changed

8 files changed

+417
-52
lines changed
 

‎src/integrationTest/groovy/wooga/gradle/unity/UnityPluginIntegrationSpec.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package wooga.gradle.unity
2020
import com.wooga.spock.extensions.unity.UnityPathResolution
2121
import com.wooga.spock.extensions.unity.UnityPluginTestOptions
2222
import spock.lang.Unroll
23-
import wooga.gradle.unity.models.BuildTarget
2423
import wooga.gradle.unity.models.UnityCommandLineOption
2524
import wooga.gradle.unity.tasks.Test
2625
import wooga.gradle.unity.utils.ProjectSettingsFile

‎src/integrationTest/groovy/wooga/gradle/unity/UnityTaskIntegrationSpec.groovy

+19
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package wooga.gradle.unity
1919

2020

2121
import org.gradle.api.logging.LogLevel
22+
import spock.lang.Ignore
2223
import spock.lang.IgnoreIf
2324
import spock.lang.Unroll
2425
import spock.util.environment.RestoreSystemProperties
@@ -405,4 +406,22 @@ abstract class UnityTaskIntegrationSpec<T extends UnityTask> extends UnityIntegr
405406
logFile.text.contains(mockUnityStartupMessage)
406407
}
407408

409+
@Ignore
410+
// TODO: How to make the task fail/throw within the exec block?
411+
def "task action does not invoke post execute if process didn't run"() {
412+
given: "a task that is definitely gonna fail"
413+
appendToSubjectTask("""
414+
environment = null
415+
""".stripIndent())
416+
417+
when:
418+
def result = runTasks(subjectUnderTestName)
419+
420+
then:
421+
!result.success
422+
outputContains(result, "${subjectUnderTestName}.preExecute")
423+
outputContains(result, "${subjectUnderTestName}.execute")
424+
!outputContains(result, "${subjectUnderTestName}.postExecute")
425+
}
426+
408427
}

‎src/main/groovy/wooga/gradle/unity/UnityPlugin.groovy

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@ import org.gradle.language.base.plugins.LifecycleBasePlugin
3131
import wooga.gradle.unity.models.APICompatibilityLevel
3232
import wooga.gradle.unity.models.DefaultUnityAuthentication
3333
import wooga.gradle.unity.internal.DefaultUnityPluginExtension
34-
import wooga.gradle.unity.models.BuildTarget
3534
import wooga.gradle.unity.models.TestPlatform
3635
import wooga.gradle.unity.tasks.Activate
3736

3837
import wooga.gradle.unity.tasks.ReturnLicense
3938
import wooga.gradle.unity.tasks.SetAPICompatibilityLevel
4039
import wooga.gradle.unity.tasks.Test
4140
import wooga.gradle.unity.utils.ProjectSettingsFile
42-
import wooga.gradle.unity.utils.UnityTestTaskReport
43-
import wooga.gradle.unity.utils.UnityTestTaskReportsImpl
41+
import wooga.gradle.unity.utils.UnityLogErrorParse
42+
import wooga.gradle.unity.utils.UnityLogErrorReader
4443

4544
/**
4645
* A {@link org.gradle.api.Plugin} which provides tasks to run unity batch-mode commands.
@@ -111,6 +110,7 @@ class UnityPlugin implements Plugin<Project> {
111110
extension.pluginsDir.convention(extension.assetsDir.dir("Plugins"))
112111
extension.logsDir.convention(UnityPluginConventions.logDirectory.getDirectoryValueProvider(project))
113112

113+
extension.logErrorReader.convention(new UnityLogErrorReader())
114114
extension.logCategory.convention(UnityPluginConventions.logCategory.getStringValueProvider(project))
115115
final ReportingExtension reportingExtension = (ReportingExtension) project.extensions.getByName(ReportingExtension.NAME)
116116
extension.reportsDir.convention(project.layout.buildDirectory.dir(project.provider({ reportingExtension.file("unity").path })))
@@ -149,6 +149,7 @@ class UnityPlugin implements Plugin<Project> {
149149
t.projectDirectory.convention(extension.projectDirectory)
150150
t.projectSettings.convention(extension.projectSettings)
151151
t.logCategory.convention(extension.logCategory)
152+
t.logErrorReader.convention(extension.logErrorReader)
152153

153154
t.unityLogFile.convention(extension.logsDir.file(project.provider {
154155
t.logCategory.get().isEmpty() ? "${t.name}.log" : "${t.logCategory.get()}/${t.name}.log"

‎src/main/groovy/wooga/gradle/unity/UnityPluginExtension.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import org.gradle.api.file.DirectoryProperty
2424
import org.gradle.api.provider.Property
2525
import org.gradle.api.provider.Provider
2626
import org.gradle.api.tasks.Internal
27-
import wooga.gradle.unity.models.BuildTarget
2827
import wooga.gradle.unity.traits.APICompatibilityLevelSpec
2928
import wooga.gradle.unity.traits.UnityAuthenticationSpec
3029
import wooga.gradle.unity.traits.UnityLicenseSpec

‎src/main/groovy/wooga/gradle/unity/UnityTask.groovy

+38-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ import org.gradle.internal.io.LineBufferingOutputStream
2727
import org.gradle.internal.io.TextStream
2828
import org.gradle.process.ExecResult
2929
import org.gradle.process.ExecSpec
30-
import sun.reflect.misc.FieldUtil
3130
import wooga.gradle.unity.models.UnityCommandLineOption
3231
import wooga.gradle.unity.traits.ArgumentsSpec
3332
import wooga.gradle.unity.traits.UnityCommandLineSpec
3433
import wooga.gradle.unity.traits.UnitySpec
3534
import wooga.gradle.unity.utils.FileUtils
3635
import wooga.gradle.unity.utils.ForkTextStream
36+
import wooga.gradle.unity.utils.UnityLogErrorReader
3737
import wooga.gradle.unity.utils.UnityVersionManager
3838

3939
abstract class UnityTask extends DefaultTask
@@ -47,21 +47,24 @@ abstract class UnityTask extends DefaultTask
4747
// and also an additional one for our custom use
4848
wooga_gradle_unity_traits_ArgumentsSpec__arguments = project.provider({ getUnityCommandLineOptions() })
4949
wooga_gradle_unity_traits_ArgumentsSpec__additionalArguments = project.objects.listProperty(String)
50-
wooga_gradle_unity_traits_ArgumentsSpec__environment = project.objects.mapProperty(String, Object)
50+
wooga_gradle_unity_traits_ArgumentsSpec__environment = project.objects.mapProperty(String, Object)
5151
}
5252

5353
@TaskAction
5454
void exec() {
55+
// Invoked before the unity process
56+
logger.info("${name}.preExecute")
57+
preExecute()
58+
// Execute the unity process
59+
logger.info("${name}.execute")
5560
ExecResult execResult = project.exec(new Action<ExecSpec>() {
5661
@Override
5762
void execute(ExecSpec exec) {
5863

64+
// TODO: Should these be moved before preExecute?
5965
if (!unityPath.present) {
6066
throw new GradleException("Unity path is not set")
6167
}
62-
63-
preExecute()
64-
6568
def unityPath = unityPath.get().asFile.absolutePath
6669
def unityArgs = getAllArguments()
6770
def unityEnvironment = environment.get()
@@ -76,8 +79,11 @@ abstract class UnityTask extends DefaultTask
7679
}
7780
}
7881
})
79-
80-
execResult.assertNormalExitValue()
82+
if (execResult.exitValue != 0) {
83+
handleUnityProcessError(execResult)
84+
}
85+
// Invoked after the unity process (even if it failed)
86+
logger.info("${name}.postExecute")
8187
postExecute(execResult)
8288
}
8389

@@ -97,6 +103,31 @@ abstract class UnityTask extends DefaultTask
97103
protected void postExecute(ExecResult result) {
98104
}
99105

106+
/**
107+
* Invoked whenever the Unity process executed by the task exits with an error,
108+
* @param result The execution result of the Unity process
109+
*/
110+
protected void handleUnityProcessError(ExecResult result) {
111+
logger.error("Unity process failed with exit value ${result.exitValue}...")
112+
113+
// Look up the log
114+
if (!unityLogFile.isPresent()) {
115+
logger.warn("No log file was configured for the task ${this.name}")
116+
return
117+
}
118+
119+
File logFile = unityLogFile.get().asFile
120+
if (!logFile.exists()) {
121+
logger.warn("No log file was written for the task ${this.name}")
122+
return
123+
}
124+
125+
// TODO: Gracefully show the error here?
126+
UnityLogErrorReader reader = new UnityLogErrorReader()
127+
def errorParse = reader.parse(logFile)
128+
logger.error(errorParse.toString())
129+
}
130+
100131
@Internal
101132
protected ArtifactVersion getUnityVersion() {
102133
File file = unityPath.present ? unityPath.get().asFile : null

‎src/main/groovy/wooga/gradle/unity/traits/UnitySpec.groovy

+10-9
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,17 @@
1616

1717
package wooga.gradle.unity.traits
1818

19-
import org.gradle.api.model.ObjectFactory
2019
import org.gradle.api.file.Directory
2120
import org.gradle.api.file.DirectoryProperty
2221
import org.gradle.api.file.RegularFile
2322
import org.gradle.api.file.RegularFileProperty
2423
import org.gradle.api.provider.Property
2524
import org.gradle.api.provider.Provider
26-
import org.gradle.api.provider.ProviderFactory
27-
import org.gradle.api.tasks.Input
28-
import org.gradle.api.tasks.InputDirectory
2925
import org.gradle.api.tasks.InputFile
3026
import org.gradle.api.tasks.Internal
31-
import org.gradle.api.tasks.Optional
3227
import org.gradle.api.tasks.OutputFile
33-
import org.gradle.api.tasks.SkipWhenEmpty
34-
import org.gradle.internal.impldep.org.eclipse.jgit.errors.NotSupportedException
35-
import wooga.gradle.unity.UnityPluginConventions
36-
import wooga.gradle.unity.models.BuildTarget
3728
import wooga.gradle.unity.utils.ProjectSettingsFile
29+
import wooga.gradle.unity.utils.UnityLogErrorReader
3830

3931
import javax.inject.Inject
4032

@@ -115,5 +107,14 @@ trait UnitySpec extends UnityBaseSpec {
115107
logToStdout
116108
}
117109

110+
private final Property<UnityLogErrorReader> logErrorReader = objects.property(UnityLogErrorReader)
111+
/**
112+
* @return The reader used for parsing the Unity Editor log whenever the exits with a failure code
113+
*/
114+
@Internal
115+
Property<UnityLogErrorReader> getLogErrorReader(){
116+
logErrorReader
117+
}
118+
118119
}
119120

‎src/main/groovy/wooga/gradle/unity/utils/UnityLogErrorReader.groovy

+155-20
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,172 @@
1717

1818
package wooga.gradle.unity.utils
1919

20+
import java.util.regex.Matcher
21+
22+
enum UnityLogErrorType {
23+
/**
24+
* No error was found
25+
*/
26+
None,
27+
/**
28+
* The error could not be parsed
29+
*/
30+
Unknown,
31+
/**
32+
* The Unity scripts have compiler errors
33+
*/
34+
ScriptCompilerError,
35+
/**
36+
* The build failed
37+
*/
38+
BuildFailure,
39+
/**
40+
* Tests failed
41+
*/
42+
TestFailure
43+
}
44+
45+
class UnityLogErrorParse {
46+
UnityLogErrorType type
47+
String message
48+
List<CSharpFileCompilationResult> compilerOutput
49+
50+
@Override
51+
String toString() {
52+
def result = "${type}:"
53+
switch (type) {
54+
case UnityLogErrorType.ScriptCompilerError:
55+
compilerOutput.forEach({ l ->
56+
result += "\n${l.text}"
57+
})
58+
break
59+
}
60+
result
61+
}
62+
}
63+
64+
class CSharpFileCompilationResult {
65+
String text
66+
String filePath
67+
Integer line
68+
Integer column
69+
String level
70+
String code
71+
String message
72+
73+
CSharpFileCompilationResult(String filePath, Integer line, Integer column, String level, String code, String message) {
74+
this.filePath = filePath
75+
this.line = line
76+
this.column = column
77+
this.level = level
78+
this.code = code
79+
this.message = message
80+
}
81+
82+
CSharpFileCompilationResult(String text, String filePath, Integer line, Integer column, String level, String code, String message) {
83+
this.text = text
84+
this.filePath = filePath
85+
this.line = line
86+
this.column = column
87+
this.level = level
88+
this.code = code
89+
this.message = message
90+
}
91+
92+
CSharpFileCompilationResult() {
93+
}
94+
95+
// e.g: "A/B.cs(9,7): warning CS0105: WRONG!"
96+
static String pattern = /(?<filePath>.+)\((?<line>\d+),(?<column>\d+)\):\s(?<level>.*?)\s(?<code>.+):\s(?<message>.*)/
97+
98+
static CSharpFileCompilationResult Parse(String text) {
99+
Matcher matcher = (text =~ pattern)
100+
if (matcher.count == 0) {
101+
return null
102+
}
103+
104+
def (all, filePath, line, column, level, code, message) = matcher[0]
105+
CSharpFileCompilationResult result = new CSharpFileCompilationResult()
106+
result.text = all
107+
result.filePath = filePath
108+
result.line = Integer.parseInt(line)
109+
result.column = Integer.parseInt(column)
110+
result.level = level
111+
result.code = code
112+
result.message = message
113+
result
114+
}
115+
}
116+
117+
// TODO: Perhaps named Parser?
118+
/**
119+
* Given a valid Unity Editor log file that was written to,
120+
* parses it for errors that can be viewed by an user
121+
* (by default, Editor.log)
122+
*/
20123
class UnityLogErrorReader {
21124

22-
static String DEFAULT_MESSAGE = "no error"
125+
static String compilerOutputStartMarker = "-----CompilerOutput:"
126+
static String compilerOutputEndMarker = "-----EndCompilerOutput"
127+
static String compilerErrorMarker = "Scripts have compiler errors."
128+
static String errorMarker = "Aborting batchmode due to failure:"
129+
static String dialogError = "Cancelling DisplayDialog:"
23130

24-
static String readErrorMessageFromLog(File logfile) {
25-
def message = DEFAULT_MESSAGE
26-
if(!logfile || !logfile.exists()) {
27-
return message
131+
UnityLogErrorParse parse(File logfile) {
132+
133+
UnityLogErrorParse parse = new UnityLogErrorParse()
134+
parse.type = UnityLogErrorType.None
135+
136+
if (!logfile || !logfile.exists()) {
137+
return parse
28138
}
29139

140+
boolean foundCompilerMarker = false
30141
boolean foundErrorMarker = false
31-
String errorMarker = "Aborting batchmode due to failure:"
32-
String dialogError = "Cancelling DisplayDialog:"
142+
parse.compilerOutput = []
33143
String line
144+
Integer lineNumber = 0
145+
146+
// Read through the log file
34147
logfile.withReader { reader ->
35-
while ((line = reader.readLine())!=null) {
36-
if(foundErrorMarker) {
37-
message = line
38-
break
39-
}
40-
if(line.startsWith(errorMarker)) {
41-
foundErrorMarker = true
42-
}
148+
while ((line = reader.readLine()) != null) {
149+
lineNumber++
43150

44-
if(line.startsWith(dialogError)) {
45-
message = line.replace(dialogError, "").trim()
46-
break
151+
// If inside a compiler marker, parse the compiler output
152+
if (foundCompilerMarker) {
153+
// Finished reading compiler output
154+
if (line.startsWith(compilerOutputEndMarker)) {
155+
foundCompilerMarker = false
156+
}
157+
// Record all warnings/errors
158+
else {
159+
CSharpFileCompilationResult fileCompilationResult = CSharpFileCompilationResult.Parse(line)
160+
if (fileCompilationResult != null) {
161+
parse.compilerOutput.add(fileCompilationResult)
162+
}
163+
}
164+
} else if (foundErrorMarker) {
165+
if (line.startsWith(compilerErrorMarker)) {
166+
parse.type = UnityLogErrorType.ScriptCompilerError
167+
break
168+
} else {
169+
parse.message = line
170+
}
171+
}
172+
// Look for markers
173+
else {
174+
// The error marker is found near the end of the log output
175+
if (line.startsWith(errorMarker)) {
176+
parse.type = UnityLogErrorType.Unknown
177+
foundErrorMarker = true
178+
}
179+
// Started reading through C# compiler output
180+
else if (line.startsWith(compilerOutputStartMarker)) {
181+
foundCompilerMarker = true
182+
}
47183
}
48184
}
49185
}
50-
51-
message
186+
parse
52187
}
53188
}

‎src/test/groovy/wooga/gradle/unity/utils/UnityErrorLogReaderTest.groovy

+191-11
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,19 @@
1818
package wooga.gradle.unity.utils
1919

2020
import spock.lang.Specification
21+
import spock.lang.Unroll
2122

2223
class UnityErrorLogReaderTest extends Specification {
2324

25+
UnityLogErrorReader reader
26+
27+
def setup(){
28+
reader = new UnityLogErrorReader()
29+
}
30+
2431
def "reads error message from logfile"() {
2532
given: "logfile with error message"
26-
def log = File.createTempFile("log","log")
33+
def log = File.createTempFile("log", "log")
2734
log << """
2835
Reloading assemblies after script compilation.
2936
Validating Project structure ... 0.005520 seconds.
@@ -45,16 +52,16 @@ class UnityErrorLogReaderTest extends Specification {
4552
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Threads/Posix/PlatformThread.cpp Line: 38)
4653
""".stripIndent()
4754

48-
when:"parsing error message"
49-
def message = UnityLogErrorReader.readErrorMessageFromLog(log)
55+
when: "parsing error message"
56+
def message = reader.parse(log)
5057

5158
then:
52-
message == "Scripts have compiler errors."
59+
message.type == UnityLogErrorType.ScriptCompilerError
5360
}
5461

5562
def "returns default message when error marker is not included"() {
5663
given: "logfile with no error message"
57-
def log = File.createTempFile("log","log")
64+
def log = File.createTempFile("log", "log")
5865
log << """
5966
Reloading assemblies after script compilation.
6067
Validating Project structure ... 0.005520 seconds.
@@ -72,21 +79,194 @@ class UnityErrorLogReaderTest extends Specification {
7279
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Threads/Posix/PlatformThread.cpp Line: 38)
7380
""".stripIndent()
7481

75-
when:"parsing error message"
76-
def message = UnityLogErrorReader.readErrorMessageFromLog(log)
82+
when: "parsing error message"
83+
def message = reader.parse(log)
7784

7885
then:
79-
message == UnityLogErrorReader.DEFAULT_MESSAGE
86+
message.type == UnityLogErrorType.None
8087
}
8188

8289
def "returns default message log file doesn't exist"() {
8390
given: "path to nonexisting logfile"
8491
def log = new File("test.log")
8592

86-
when:"parsing error message"
87-
def message = UnityLogErrorReader.readErrorMessageFromLog(log)
93+
when: "parsing error message"
94+
def message = reader.parse(log)
8895

8996
then:
90-
message == UnityLogErrorReader.DEFAULT_MESSAGE
97+
message.type == UnityLogErrorType.None
9198
}
99+
100+
def "finds script compiler errors"() {
101+
given: "logfile with compiler errors"
102+
def log = File.createTempFile("log", "log")
103+
log << """
104+
-----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-Editor.dll
105+
106+
Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
107+
108+
Copyright (C) Microsoft Corporation. All rights reserved.
109+
110+
Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/BuildStepTest.cs(9,7): warning CS0105: The using directive for 'Wooga.UnifiedBuildSystem.Editor' appeared previously in this namespace
111+
Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/GroupedBuildStepTest.cs(9,39): error CS0234: The type or namespace name 'Tests' does not exist in the namespace 'Wooga.UnifiedBuildSystem.Editor' (are you missing an assembly reference?)
112+
Assets/Wooga/UnifiedBuildSystem/Samples/Editor/BuildExamples.cs(13,45): warning CS0618: 'BuildStep.RunAfter' is obsolete: 'This ordering is planned to be deprecated. '
113+
Assets/Wooga/UnifiedBuildSystem/Samples/Editor/BuildExamples.cs(16,45): warning CS0618: 'BuildStep.RunBefore' is obsolete: 'This ordering is planned to be deprecated. '
114+
Assets/Wooga/UnifiedBuildSystem/Editor/AppConfig/AppConfig.ISerializationCallbackReceiver.cs(7,21): warning CS0114: 'AppConfig.OnBeforeSerialize()' hides inherited member 'BuildConfigScriptable.OnBeforeSerialize()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
115+
Assets/Wooga/UnifiedBuildSystem/Editor/AppConfig/AppConfig.ISerializationCallbackReceiver.cs(23,21): warning CS0114: 'AppConfig.OnAfterDeserialize()' hides inherited member 'BuildConfigScriptable.OnAfterDeserialize()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
116+
Assets/Wooga/UnifiedBuildSystem/Editor/Build/Build.ExportProject.cs(9,41): warning CS0618: 'BuildStep.RunBefore' is obsolete: 'This ordering is planned to be deprecated. '
117+
Assets/Wooga/UnifiedBuildSystem/Editor/Build/Build.PostBuildAndroid.cs(8,46): warning CS0618: 'BuildStep.RunAfter' is obsolete: 'This ordering is planned to be deprecated. '
118+
Assets/Wooga/UnifiedBuildSystem/Editor/Build/Build.PostBuildAndroid.cs(8,83): warning CS0618: 'BuildStep.RunBefore' is obsolete: 'This ordering is planned to be deprecated. '
119+
120+
-----CompilerOutput:-stderr----------
121+
122+
-----EndCompilerOutput---------------
123+
124+
- Finished script compilation in 7.715436 seconds
125+
126+
Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/BuildStepTest.cs(9,7): warning CS0105: The using directive for 'Wooga.UnifiedBuildSystem.Editor' appeared previously in this namespace
127+
Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/GroupedBuildStepTest.cs(9,39): error CS0234: The type or namespace name 'Tests' does not exist in the namespace 'Wooga.UnifiedBuildSystem.Editor' (are you missing an assembly reference?)
128+
Assets/Wooga/UnifiedBuildSystem/Samples/Editor/BuildExamples.cs(13,45): warning CS0618: 'BuildStep.RunAfter' is obsolete: 'This ordering is planned to be deprecated. '
129+
Assets/Wooga/UnifiedBuildSystem/Samples/Editor/BuildExamples.cs(16,45): warning CS0618: 'BuildStep.RunBefore' is obsolete: 'This ordering is planned to be deprecated. '
130+
Assets/Wooga/UnifiedBuildSystem/Editor/AppConfig/AppConfig.ISerializationCallbackReceiver.cs(7,21): warning CS0114: 'AppConfig.OnBeforeSerialize()' hides inherited member 'BuildConfigScriptable.OnBeforeSerialize()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
131+
Assets/Wooga/UnifiedBuildSystem/Editor/AppConfig/AppConfig.ISerializationCallbackReceiver.cs(23,21): warning CS0114: 'AppConfig.OnAfterDeserialize()' hides inherited member 'BuildConfigScriptable.OnAfterDeserialize()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
132+
Assets/Wooga/UnifiedBuildSystem/Editor/Build/Build.ExportProject.cs(9,41): warning CS0618: 'BuildStep.RunBefore' is obsolete: 'This ordering is planned to be deprecated. '
133+
Assets/Wooga/UnifiedBuildSystem/Editor/Build/Build.PostBuildAndroid.cs(8,46): warning CS0618: 'BuildStep.RunAfter' is obsolete: 'This ordering is planned to be deprecated. '
134+
Assets/Wooga/UnifiedBuildSystem/Editor/Build/Build.PostBuildAndroid.cs(8,83): warning CS0618: 'BuildStep.RunBefore' is obsolete: 'This ordering is planned to be deprecated. '
135+
136+
Unloading 1218 Unused Serialized files (Serialized files now loaded: 0)
137+
System memory in use before: 321.0 MB.
138+
System memory in use after: 321.2 MB.
139+
140+
...
141+
142+
Unloading 1798 Unused Serialized files (Serialized files now loaded: 0)
143+
System memory in use before: 348.5 MB.
144+
System memory in use after: 347.6 MB.
145+
146+
Unloading 1814 unused Assets to reduce memory usage. Loaded Objects now: 1668.
147+
Total: 7.968787 ms (FindLiveObjects: 0.574456 ms CreateObjectMapping: 0.243863 ms MarkObjects: 4.823242 ms DeleteObjects: 2.326409 ms)
148+
149+
Disconnect from CacheServer
150+
Refreshing native plugins compatible for Editor in 4.99 ms, found 0 plugins.
151+
Preloading 0 native plugins for Editor in 0.00 ms.
152+
Warming cache for 1797 main assets: 0.003021 seconds elapsed
153+
154+
Initializing Unity extensions:
155+
156+
'/Users/jenkins_agent/Applications/Unity/Hub/Editor/2019.4.19f1/Unity.app/Contents/UnityExtensions/Unity/UnityVR/Editor/UnityEditor.VR.dll' GUID: 4ba2329b63d54f0187bcaa12486b1b0f
157+
158+
Unloading 53 Unused Serialized files (Serialized files now loaded: 0)
159+
160+
System memory in use before: 309.1 MB.
161+
System memory in use after: 309.1 MB.
162+
Unloading 56 unused Assets to reduce memory usage. Loaded Objects now: 1678.
163+
Total: 5.620424 ms (FindLiveObjects: 0.363267 ms CreateObjectMapping: 0.103867 ms MarkObjects: 5.024895 ms DeleteObjects: 0.127224 ms)
164+
165+
166+
Scripts have compiler errors.
167+
(Filename: ./Runtime/Utilities/Argv.cpp Line: 376)
168+
169+
Aborting batchmode due to failure:
170+
Scripts have compiler errors.
171+
172+
[Package Manager] Server::Kill -- Server was shutdown
173+
174+
(lldb) command source -s 0 '/tmp/mono-gdb-commands.Fr24P1'
175+
176+
177+
> Task :Wooga.UnifiedBuildSystem:exportUnityPackage FAILED
178+
> Task :Wooga.UnifiedBuildSystem:returnUnityLicense SKIPPED
179+
> Task :Wooga.UnifiedBuildSystem:unsetAPICompatibilityLevel SKIPPED
180+
181+
FAILURE: Build failed with an exception.
182+
183+
* What went wrong:
184+
Execution failed for task ':Wooga.UnifiedBuildSystem:exportUnityPackage'.
185+
186+
> Unity batchmode finished with non-zero exit value 1 and error 'Scripts have compiler errors.'
187+
188+
* Try:
189+
190+
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
191+
192+
* Get more help at https://help.gradle.org
193+
194+
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
195+
Use '--warning-mode all' to show the individual deprecation warnings.
196+
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings
197+
198+
BUILD FAILED in 2m 24s
199+
10 actionable tasks: 9 executed, 1 up-to-date
200+
201+
"""
202+
when: "parsing error message"
203+
def message = reader.parse(log)
204+
205+
then:
206+
message.type == UnityLogErrorType.ScriptCompilerError
207+
message.compilerOutput.size() == 9
208+
message.compilerOutput[0].properties == new CSharpFileCompilationResult(
209+
"Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/BuildStepTest.cs(9,7): warning CS0105: The using directive for 'Wooga.UnifiedBuildSystem.Editor' appeared previously in this namespace",
210+
"Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/BuildStepTest.cs",
211+
9,
212+
7,
213+
"warning",
214+
"CS0105",
215+
"The using directive for 'Wooga.UnifiedBuildSystem.Editor' appeared previously in this namespace"
216+
).properties
217+
218+
}
219+
220+
@Unroll("parses #testCase[0]")
221+
def "parses csharp file compilation result"() {
222+
given:
223+
def input = testCase[0]
224+
def expected = testCase[1]
225+
226+
when:
227+
def result = CSharpFileCompilationResult.Parse(input)
228+
229+
then:
230+
result != null
231+
result.properties == expected.properties
232+
233+
where:
234+
testCase << [
235+
[
236+
"A/B.cs(9,7): warning CS0105: WRONG!",
237+
new CSharpFileCompilationResult(
238+
"A/B.cs(9,7): warning CS0105: WRONG!",
239+
"A/B.cs",
240+
9,
241+
7,
242+
"warning",
243+
"CS0105",
244+
"WRONG!")
245+
],
246+
[
247+
"Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/BuildStepTest.cs(9,7): warning CS0105: The using directive for 'Wooga.UnifiedBuildSystem.Editor' appeared previously in this namespace",
248+
new CSharpFileCompilationResult(
249+
"Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/BuildStepTest.cs(9,7): warning CS0105: The using directive for 'Wooga.UnifiedBuildSystem.Editor' appeared previously in this namespace",
250+
"Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/BuildStepTest.cs",
251+
9,
252+
7,
253+
"warning",
254+
"CS0105",
255+
"The using directive for 'Wooga.UnifiedBuildSystem.Editor' appeared previously in this namespace")
256+
],
257+
[
258+
"Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/GroupedBuildStepTest.cs(9,39): error CS0234: The type or namespace name 'Tests' does not exist in the namespace 'Wooga.UnifiedBuildSystem.Editor' (are you missing an assembly reference?)",
259+
new CSharpFileCompilationResult(
260+
"Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/GroupedBuildStepTest.cs(9,39): error CS0234: The type or namespace name 'Tests' does not exist in the namespace 'Wooga.UnifiedBuildSystem.Editor' (are you missing an assembly reference?)",
261+
"Assets/Wooga/UnifiedBuildSystem/Tests/Editor/BuildEngine/GroupedBuildStepTest.cs",
262+
9,
263+
39,
264+
"error",
265+
"CS0234",
266+
"The type or namespace name 'Tests' does not exist in the namespace 'Wooga.UnifiedBuildSystem.Editor' (are you missing an assembly reference?)")
267+
],
268+
]
269+
270+
}
271+
92272
}

0 commit comments

Comments
 (0)
This repository has been archived.