Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ec3653f4
Unverified
Commit
ec3653f4
authored
Mar 25, 2020
by
Jenn Magder
Committed by
GitHub
Mar 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove XcodeValidator from context (#53213)
parent
31175eb0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
48 deletions
+38
-48
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+0
-2
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+1
-1
xcode_validator.dart
packages/flutter_tools/lib/src/macos/xcode_validator.dart
+24
-18
xcode_validator_test.dart
..._tools/test/general.shard/macos/xcode_validator_test.dart
+13
-27
No files found.
packages/flutter_tools/lib/src/context_runner.dart
View file @
ec3653f4
...
...
@@ -42,7 +42,6 @@ import 'macos/cocoapods.dart';
import
'macos/cocoapods_validator.dart'
;
import
'macos/macos_workflow.dart'
;
import
'macos/xcode.dart'
;
import
'macos/xcode_validator.dart'
;
import
'mdns_discovery.dart'
;
import
'persistent_tool_state.dart'
;
import
'reporting/reporting.dart'
;
...
...
@@ -226,7 +225,6 @@ Future<T> runInContext<T>(
fileSystem:
globals
.
fs
,
terminal:
globals
.
terminal
,
),
XcodeValidator:
()
=>
const
XcodeValidator
(),
},
);
}
packages/flutter_tools/lib/src/doctor.dart
View file @
ec3653f4
...
...
@@ -81,7 +81,7 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
if
(
androidWorkflow
.
appliesToHostPlatform
)
GroupedValidator
(<
DoctorValidator
>[
androidValidator
,
androidLicenseValidator
]),
if
(
globals
.
iosWorkflow
.
appliesToHostPlatform
||
macOSWorkflow
.
appliesToHostPlatform
)
GroupedValidator
(<
DoctorValidator
>[
xcodeValidator
,
cocoapodsValidator
]),
GroupedValidator
(<
DoctorValidator
>[
XcodeValidator
(
xcode:
globals
.
xcode
,
userMessages:
userMessages
)
,
cocoapodsValidator
]),
if
(
webWorkflow
.
appliesToHostPlatform
)
WebValidator
(
chromeLauncher:
globals
.
chromeLauncher
,
...
...
packages/flutter_tools/lib/src/macos/xcode_validator.dart
View file @
ec3653f4
...
...
@@ -2,16 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'../base/context.dart'
;
import
'package:meta/meta.dart'
;
import
'../base/user_messages.dart'
;
import
'../doctor.dart'
;
import
'../globals.dart'
as
globals
;
import
'xcode.dart'
;
XcodeValidator
get
xcodeValidator
=>
context
.
get
<
XcodeValidator
>();
class
XcodeValidator
extends
DoctorValidator
{
const
XcodeValidator
()
:
super
(
'Xcode - develop for iOS and macOS'
);
XcodeValidator
({
@required
Xcode
xcode
,
@required
UserMessages
userMessages
,
})
:
_xcode
=
xcode
,
_userMessages
=
userMessages
,
super
(
'Xcode - develop for iOS and macOS'
);
final
Xcode
_xcode
;
final
UserMessages
_userMessages
;
@override
Future
<
ValidationResult
>
validate
()
async
{
...
...
@@ -19,39 +25,39 @@ class XcodeValidator extends DoctorValidator {
ValidationType
xcodeStatus
=
ValidationType
.
missing
;
String
xcodeVersionInfo
;
if
(
globals
.
xcode
.
isInstalled
)
{
if
(
_
xcode
.
isInstalled
)
{
xcodeStatus
=
ValidationType
.
installed
;
messages
.
add
(
ValidationMessage
(
userMessages
.
xcodeLocation
(
globals
.
xcode
.
xcodeSelectPath
)));
messages
.
add
(
ValidationMessage
(
_userMessages
.
xcodeLocation
(
_
xcode
.
xcodeSelectPath
)));
xcodeVersionInfo
=
globals
.
xcode
.
versionText
;
xcodeVersionInfo
=
_
xcode
.
versionText
;
if
(
xcodeVersionInfo
.
contains
(
','
))
{
xcodeVersionInfo
=
xcodeVersionInfo
.
substring
(
0
,
xcodeVersionInfo
.
indexOf
(
','
));
}
messages
.
add
(
ValidationMessage
(
globals
.
xcode
.
versionText
));
messages
.
add
(
ValidationMessage
(
_
xcode
.
versionText
));
if
(!
globals
.
xcode
.
isInstalledAndMeetsVersionCheck
)
{
if
(!
_
xcode
.
isInstalledAndMeetsVersionCheck
)
{
xcodeStatus
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
xcodeOutdated
(
kXcodeRequiredVersionMajor
,
kXcodeRequiredVersionMinor
)
_
userMessages
.
xcodeOutdated
(
kXcodeRequiredVersionMajor
,
kXcodeRequiredVersionMinor
)
));
}
if
(!
globals
.
xcode
.
eulaSigned
)
{
if
(!
_
xcode
.
eulaSigned
)
{
xcodeStatus
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
xcodeEula
));
messages
.
add
(
ValidationMessage
.
error
(
_
userMessages
.
xcodeEula
));
}
if
(!
globals
.
xcode
.
isSimctlInstalled
)
{
if
(!
_
xcode
.
isSimctlInstalled
)
{
xcodeStatus
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
xcodeMissingSimct
));
messages
.
add
(
ValidationMessage
.
error
(
_
userMessages
.
xcodeMissingSimct
));
}
}
else
{
xcodeStatus
=
ValidationType
.
missing
;
if
(
globals
.
xcode
.
xcodeSelectPath
==
null
||
globals
.
xcode
.
xcodeSelectPath
.
isEmpty
)
{
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
xcodeMissing
));
if
(
_xcode
.
xcodeSelectPath
==
null
||
_
xcode
.
xcodeSelectPath
.
isEmpty
)
{
messages
.
add
(
ValidationMessage
.
error
(
_
userMessages
.
xcodeMissing
));
}
else
{
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
xcodeIncomplete
));
messages
.
add
(
ValidationMessage
.
error
(
_
userMessages
.
xcodeIncomplete
));
}
}
...
...
packages/flutter_tools/test/general.shard/macos/xcode_validator_test.dart
View file @
ec3653f4
...
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_tools/src/base/user_messages.dart'
;
import
'package:flutter_tools/src/doctor.dart'
;
import
'package:flutter_tools/src/macos/xcode.dart'
;
import
'package:flutter_tools/src/macos/xcode_validator.dart'
;
...
...
@@ -17,89 +18,74 @@ class MockXcode extends Mock implements Xcode {}
void
main
(
)
{
group
(
'Xcode validation'
,
()
{
MockXcode
xcode
;
MockProcessManager
processManager
;
setUp
(()
{
xcode
=
MockXcode
();
processManager
=
MockProcessManager
();
});
test
Using
Context
(
'Emits missing status when Xcode is not installed'
,
()
async
{
test
Without
Context
(
'Emits missing status when Xcode is not installed'
,
()
async
{
when
(
xcode
.
isInstalled
).
thenReturn
(
false
);
when
(
xcode
.
xcodeSelectPath
).
thenReturn
(
null
);
const
XcodeValidator
validator
=
XcodeValidator
(
);
final
XcodeValidator
validator
=
XcodeValidator
(
xcode:
xcode
,
userMessages:
UserMessages
()
);
final
ValidationResult
result
=
await
validator
.
validate
();
expect
(
result
.
type
,
ValidationType
.
missing
);
},
overrides:
<
Type
,
Generator
>{
Xcode:
()
=>
xcode
,
});
test
Using
Context
(
'Emits missing status when Xcode installation is incomplete'
,
()
async
{
test
Without
Context
(
'Emits missing status when Xcode installation is incomplete'
,
()
async
{
when
(
xcode
.
isInstalled
).
thenReturn
(
false
);
when
(
xcode
.
xcodeSelectPath
).
thenReturn
(
'/Library/Developer/CommandLineTools'
);
const
XcodeValidator
validator
=
XcodeValidator
(
);
final
XcodeValidator
validator
=
XcodeValidator
(
xcode:
xcode
,
userMessages:
UserMessages
()
);
final
ValidationResult
result
=
await
validator
.
validate
();
expect
(
result
.
type
,
ValidationType
.
missing
);
},
overrides:
<
Type
,
Generator
>{
Xcode:
()
=>
xcode
,
});
test
Using
Context
(
'Emits partial status when Xcode version too low'
,
()
async
{
test
Without
Context
(
'Emits partial status when Xcode version too low'
,
()
async
{
when
(
xcode
.
isInstalled
).
thenReturn
(
true
);
when
(
xcode
.
versionText
)
.
thenReturn
(
'Xcode 7.0.1
\n
Build version 7C1002
\n
'
);
when
(
xcode
.
isInstalledAndMeetsVersionCheck
).
thenReturn
(
false
);
when
(
xcode
.
eulaSigned
).
thenReturn
(
true
);
when
(
xcode
.
isSimctlInstalled
).
thenReturn
(
true
);
const
XcodeValidator
validator
=
XcodeValidator
(
);
final
XcodeValidator
validator
=
XcodeValidator
(
xcode:
xcode
,
userMessages:
UserMessages
()
);
final
ValidationResult
result
=
await
validator
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
Xcode:
()
=>
xcode
,
});
test
Using
Context
(
'Emits partial status when Xcode EULA not signed'
,
()
async
{
test
Without
Context
(
'Emits partial status when Xcode EULA not signed'
,
()
async
{
when
(
xcode
.
isInstalled
).
thenReturn
(
true
);
when
(
xcode
.
versionText
)
.
thenReturn
(
'Xcode 8.2.1
\n
Build version 8C1002
\n
'
);
when
(
xcode
.
isInstalledAndMeetsVersionCheck
).
thenReturn
(
true
);
when
(
xcode
.
eulaSigned
).
thenReturn
(
false
);
when
(
xcode
.
isSimctlInstalled
).
thenReturn
(
true
);
const
XcodeValidator
validator
=
XcodeValidator
(
);
final
XcodeValidator
validator
=
XcodeValidator
(
xcode:
xcode
,
userMessages:
UserMessages
()
);
final
ValidationResult
result
=
await
validator
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
Xcode:
()
=>
xcode
,
});
test
Using
Context
(
'Emits partial status when simctl is not installed'
,
()
async
{
test
Without
Context
(
'Emits partial status when simctl is not installed'
,
()
async
{
when
(
xcode
.
isInstalled
).
thenReturn
(
true
);
when
(
xcode
.
versionText
)
.
thenReturn
(
'Xcode 8.2.1
\n
Build version 8C1002
\n
'
);
when
(
xcode
.
isInstalledAndMeetsVersionCheck
).
thenReturn
(
true
);
when
(
xcode
.
eulaSigned
).
thenReturn
(
true
);
when
(
xcode
.
isSimctlInstalled
).
thenReturn
(
false
);
const
XcodeValidator
validator
=
XcodeValidator
(
);
final
XcodeValidator
validator
=
XcodeValidator
(
xcode:
xcode
,
userMessages:
UserMessages
()
);
final
ValidationResult
result
=
await
validator
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
Xcode:
()
=>
xcode
,
});
test
Using
Context
(
'Succeeds when all checks pass'
,
()
async
{
test
Without
Context
(
'Succeeds when all checks pass'
,
()
async
{
when
(
xcode
.
isInstalled
).
thenReturn
(
true
);
when
(
xcode
.
versionText
)
.
thenReturn
(
'Xcode 8.2.1
\n
Build version 8C1002
\n
'
);
when
(
xcode
.
isInstalledAndMeetsVersionCheck
).
thenReturn
(
true
);
when
(
xcode
.
eulaSigned
).
thenReturn
(
true
);
when
(
xcode
.
isSimctlInstalled
).
thenReturn
(
true
);
const
XcodeValidator
validator
=
XcodeValidator
(
);
final
XcodeValidator
validator
=
XcodeValidator
(
xcode:
xcode
,
userMessages:
UserMessages
()
);
final
ValidationResult
result
=
await
validator
.
validate
();
expect
(
result
.
type
,
ValidationType
.
installed
);
},
overrides:
<
Type
,
Generator
>{
Xcode:
()
=>
xcode
,
ProcessManager:
()
=>
processManager
,
});
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment