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
62d89692
Unverified
Commit
62d89692
authored
Feb 19, 2021
by
Jenn Magder
Committed by
GitHub
Feb 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adopt Artifacts.test(localEngine:) in a few tests (#76354)
parent
6fec8b36
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
95 deletions
+66
-95
assemble_test.dart
...ter_tools/test/commands.shard/hermetic/assemble_test.dart
+1
-3
gradle_test.dart
...flutter_tools/test/general.shard/android/gradle_test.dart
+4
-16
xcodeproj_test.dart
.../flutter_tools/test/general.shard/ios/xcodeproj_test.dart
+61
-76
No files found.
packages/flutter_tools/test/commands.shard/hermetic/assemble_test.dart
View file @
62d89692
...
...
@@ -135,7 +135,6 @@ void main() {
testbed
.
test
(
'flutter assemble does not inject engine revision with local-engine'
,
()
async
{
Environment
environment
;
when
(
globals
.
artifacts
.
isLocalEngine
).
thenReturn
(
true
);
when
(
globals
.
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
environment
=
invocation
.
positionalArguments
[
1
]
as
Environment
;
...
...
@@ -146,7 +145,7 @@ void main() {
expect
(
environment
.
engineVersion
,
isNull
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
MockLocalEngineArtifacts
()
Artifacts:
()
=>
Artifacts
.
test
(
localEngine:
'out/host_release'
),
});
testbed
.
test
(
'flutter assemble only writes input and output files when the values change'
,
()
async
{
...
...
@@ -239,4 +238,3 @@ void main() {
}
class
MockBuildSystem
extends
Mock
implements
BuildSystem
{}
class
MockLocalEngineArtifacts
extends
Mock
implements
LocalEngineArtifacts
{}
packages/flutter_tools/test/general.shard/android/gradle_test.dart
View file @
62d89692
...
...
@@ -315,24 +315,22 @@ include ':app'
});
group
(
'Gradle local.properties'
,
()
{
MockLocalEngineArtifacts
mockArtifacts
;
MockProcessManager
mockProcessManager
;
Artifacts
localEngineArtifacts
;
FakePlatform
android
;
FileSystem
fs
;
setUp
(()
{
fs
=
MemoryFileSystem
.
test
();
mockArtifacts
=
MockLocalEngineArtifacts
();
mockProcessManager
=
MockProcessManager
();
localEngineArtifacts
=
Artifacts
.
test
(
localEngine:
'out/android_arm'
);
android
=
fakePlatform
(
'android'
);
});
void
testUsingAndroidContext
(
String
description
,
dynamic
testMethod
())
{
testUsingContext
(
description
,
testMethod
,
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mock
Artifacts
,
Artifacts:
()
=>
localEngine
Artifacts
,
Platform:
()
=>
android
,
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
FakeProcessManager
.
any
()
,
});
}
...
...
@@ -349,14 +347,6 @@ include ':app'
String
expectedBuildName
,
String
expectedBuildNumber
,
})
async
{
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
android_arm
,
mode:
anyNamed
(
'mode'
),
environmentType:
anyNamed
(
'environmentType'
),
)).
thenReturn
(
'engine'
);
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
globals
.
fs
.
path
.
join
(
'out'
,
'android_arm'
));
final
File
manifestFile
=
globals
.
fs
.
file
(
'path/to/project/pubspec.yaml'
);
manifestFile
.
createSync
(
recursive:
true
);
manifestFile
.
writeAsStringSync
(
manifest
);
...
...
@@ -1042,5 +1032,3 @@ class FakeGradleUtils extends GradleUtils {
class
MockAndroidSdk
extends
Mock
implements
AndroidSdk
{}
class
MockAndroidProject
extends
Mock
implements
AndroidProject
{}
class
MockFlutterProject
extends
Mock
implements
FlutterProject
{}
class
MockLocalEngineArtifacts
extends
Mock
implements
LocalEngineArtifacts
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart
View file @
62d89692
...
...
@@ -638,20 +638,20 @@ Information about project "Runner":
});
group
(
'updateGeneratedXcodeProperties'
,
()
{
MockLocalEngineArtifacts
mock
Artifacts
;
Artifacts
local
Artifacts
;
FakePlatform
macOS
;
FileSystem
fs
;
setUp
(()
{
fs
=
MemoryFileSystem
.
test
();
mockArtifacts
=
MockLocalEngineArtifacts
(
);
localArtifacts
=
Artifacts
.
test
(
localEngine:
'out/ios_profile_arm'
);
macOS
=
FakePlatform
(
operatingSystem:
'macos'
);
fs
.
file
(
xcodebuild
).
createSync
(
recursive:
true
);
});
void
testUsingOsxContext
(
String
description
,
dynamic
testMethod
())
{
testUsingContext
(
description
,
testMethod
,
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mock
Artifacts
,
Artifacts:
()
=>
local
Artifacts
,
Platform:
()
=>
macOS
,
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
...
...
@@ -659,13 +659,6 @@ Information about project "Runner":
}
testUsingOsxContext
(
'sets ARCHS=armv7 when armv7 local engine is set'
,
()
async
{
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
anyNamed
(
'mode'
),
environmentType:
anyNamed
(
'environmentType'
)))
.
thenReturn
(
'engine'
);
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
const
BuildInfo
buildInfo
=
BuildInfo
.
debug
;
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fs
.
directory
(
'path/to/project'
));
await
updateGeneratedXcodeProperties
(
...
...
@@ -686,41 +679,7 @@ Information about project "Runner":
expect
(
buildPhaseScriptContents
.
contains
(
'ARCHS=armv7'
),
isTrue
);
});
testUsingOsxContext
(
'sets ARCHS=x86_64 when sim local engine is set'
,
()
async
{
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
anyNamed
(
'mode'
),
environmentType:
anyNamed
(
'environmentType'
)))
.
thenReturn
(
'engine'
);
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_debug_sim_unopt'
));
const
BuildInfo
buildInfo
=
BuildInfo
.
debug
;
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fs
.
directory
(
'path/to/project'
));
await
updateGeneratedXcodeProperties
(
project:
project
,
buildInfo:
buildInfo
,
);
final
File
config
=
fs
.
file
(
'path/to/project/ios/Flutter/Generated.xcconfig'
);
expect
(
config
.
existsSync
(),
isTrue
);
final
String
contents
=
config
.
readAsStringSync
();
expect
(
contents
.
contains
(
'ARCHS=x86_64'
),
isTrue
);
final
File
buildPhaseScript
=
fs
.
file
(
'path/to/project/ios/Flutter/flutter_export_environment.sh'
);
expect
(
buildPhaseScript
.
existsSync
(),
isTrue
);
final
String
buildPhaseScriptContents
=
buildPhaseScript
.
readAsStringSync
();
expect
(
buildPhaseScriptContents
.
contains
(
'ARCHS=x86_64'
),
isTrue
);
});
testUsingOsxContext
(
'sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true'
,
()
async
{
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
anyNamed
(
'mode'
),
environmentType:
anyNamed
(
'environmentType'
)))
.
thenReturn
(
'engine'
);
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
debug
,
null
,
trackWidgetCreation:
true
,
treeShakeIcons:
false
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fs
.
directory
(
'path/to/project'
));
await
updateGeneratedXcodeProperties
(
...
...
@@ -742,12 +701,6 @@ Information about project "Runner":
});
testUsingOsxContext
(
'does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false'
,
()
async
{
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
anyNamed
(
'mode'
),
environmentType:
anyNamed
(
'environmentType'
)))
.
thenReturn
(
'engine'
);
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
const
BuildInfo
buildInfo
=
BuildInfo
.
debug
;
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fs
.
directory
(
'path/to/project'
));
await
updateGeneratedXcodeProperties
(
...
...
@@ -768,26 +721,67 @@ Information about project "Runner":
expect
(
buildPhaseScriptContents
.
contains
(
'TRACK_WIDGET_CREATION=true'
),
isFalse
);
});
testUsingOsxContext
(
'sets ARCHS=armv7 when armv7 local engine is set'
,
()
async
{
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
anyNamed
(
'mode'
),
environmentType:
anyNamed
(
'environmentType'
)))
.
thenReturn
(
'engine'
);
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile'
));
const
BuildInfo
buildInfo
=
BuildInfo
.
debug
;
group
(
'sim local engine'
,
()
{
Artifacts
localArtifacts
;
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fs
.
directory
(
'path/to/project'
));
await
updateGeneratedXcodeProperties
(
project:
project
,
buildInfo:
buildInfo
,
);
setUp
(()
{
localArtifacts
=
Artifacts
.
test
(
localEngine:
'out/ios_debug_sim_unopt'
);
});
final
File
config
=
fs
.
file
(
'path/to/project/ios/Flutter/Generated.xcconfig'
);
expect
(
config
.
existsSync
(),
isTrue
);
testUsingContext
(
'sets ARCHS=x86_64 when sim local engine is set'
,
()
async
{
const
BuildInfo
buildInfo
=
BuildInfo
.
debug
;
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fs
.
directory
(
'path/to/project'
));
await
updateGeneratedXcodeProperties
(
project:
project
,
buildInfo:
buildInfo
,
);
final
String
contents
=
config
.
readAsStringSync
();
expect
(
contents
.
contains
(
'ARCHS=arm64'
),
isTrue
);
final
File
config
=
fs
.
file
(
'path/to/project/ios/Flutter/Generated.xcconfig'
);
expect
(
config
.
existsSync
(),
isTrue
);
final
String
contents
=
config
.
readAsStringSync
();
expect
(
contents
.
contains
(
'ARCHS=x86_64'
),
isTrue
);
final
File
buildPhaseScript
=
fs
.
file
(
'path/to/project/ios/Flutter/flutter_export_environment.sh'
);
expect
(
buildPhaseScript
.
existsSync
(),
isTrue
);
final
String
buildPhaseScriptContents
=
buildPhaseScript
.
readAsStringSync
();
expect
(
buildPhaseScriptContents
.
contains
(
'ARCHS=x86_64'
),
isTrue
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
localArtifacts
,
Platform:
()
=>
macOS
,
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
group
(
'armv7 local engine'
,
()
{
Artifacts
localArtifacts
;
setUp
(()
{
localArtifacts
=
Artifacts
.
test
(
localEngine:
'out/ios_profile'
);
});
testUsingContext
(
'sets ARCHS=armv7 when armv7 local engine is set'
,
()
async
{
const
BuildInfo
buildInfo
=
BuildInfo
.
debug
;
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fs
.
directory
(
'path/to/project'
));
await
updateGeneratedXcodeProperties
(
project:
project
,
buildInfo:
buildInfo
,
);
final
File
config
=
fs
.
file
(
'path/to/project/ios/Flutter/Generated.xcconfig'
);
expect
(
config
.
existsSync
(),
isTrue
);
final
String
contents
=
config
.
readAsStringSync
();
expect
(
contents
.
contains
(
'ARCHS=arm64'
),
isTrue
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
localArtifacts
,
Platform:
()
=>
macOS
,
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
String
propertyFor
(
String
key
,
File
file
)
{
...
...
@@ -805,13 +799,6 @@ Information about project "Runner":
String
expectedBuildName
,
String
expectedBuildNumber
,
})
async
{
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
anyNamed
(
'mode'
),
environmentType:
anyNamed
(
'environmentType'
)))
.
thenReturn
(
'engine'
);
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios'
));
final
File
manifestFile
=
fs
.
file
(
'path/to/project/pubspec.yaml'
);
manifestFile
.
createSync
(
recursive:
true
);
manifestFile
.
writeAsStringSync
(
manifestString
);
...
...
@@ -989,5 +976,3 @@ flutter:
});
});
}
class
MockLocalEngineArtifacts
extends
Mock
implements
LocalEngineArtifacts
{}
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