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
bfcb43d2
Unverified
Commit
bfcb43d2
authored
Feb 18, 2021
by
Jonah Williams
Committed by
GitHub
Feb 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove local engine from globals in gradle (#76277)
parent
7233d963
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
165 additions
and
149 deletions
+165
-149
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+8
-15
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+35
-4
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+1
-0
android_gradle_builder_test.dart
...st/general.shard/android/android_gradle_builder_test.dart
+115
-129
gradle_test.dart
...flutter_tools/test/general.shard/android/gradle_test.dart
+6
-1
No files found.
packages/flutter_tools/lib/src/android/gradle.dart
View file @
bfcb43d2
...
...
@@ -22,7 +22,7 @@ import '../build_info.dart';
import
'../cache.dart'
;
import
'../convert.dart'
;
import
'../flutter_manifest.dart'
;
import
'../globals.dart'
as
globals
hide
logger
,
printStatus
,
printTrace
,
printError
,
processManager
,
processUtils
,
fs
;
import
'../globals.dart'
as
globals
hide
logger
,
printStatus
,
printTrace
,
printError
,
processManager
,
processUtils
,
fs
,
artifacts
;
import
'../project.dart'
;
import
'../reporting/reporting.dart'
;
import
'android_builder.dart'
;
...
...
@@ -216,13 +216,16 @@ class AndroidGradleBuilder implements AndroidBuilder {
@required
Logger
logger
,
@required
ProcessManager
processManager
,
@required
FileSystem
fileSystem
,
@required
Artifacts
artifacts
,
})
:
_logger
=
logger
,
_fileSystem
=
fileSystem
,
_artifacts
=
artifacts
,
_processUtils
=
ProcessUtils
(
logger:
logger
,
processManager:
processManager
);
final
Logger
_logger
;
final
ProcessUtils
_processUtils
;
final
FileSystem
_fileSystem
;
final
Artifacts
_artifacts
;
/// Builds the AAR and POM files for the current Flutter module or plugin.
@override
...
...
@@ -387,8 +390,8 @@ class AndroidGradleBuilder implements AndroidBuilder {
if
(!
buildInfo
.
androidGradleDaemon
)
{
command
.
add
(
'--no-daemon'
);
}
if
(
globals
.
artifacts
is
LocalEngineArtifacts
)
{
final
LocalEngineArtifacts
localEngineArtifacts
=
globals
.
artifacts
as
LocalEngineArtifacts
;
if
(
_
artifacts
is
LocalEngineArtifacts
)
{
final
LocalEngineArtifacts
localEngineArtifacts
=
_
artifacts
as
LocalEngineArtifacts
;
final
Directory
localEngineRepo
=
_getLocalEngineRepo
(
engineOutPath:
localEngineArtifacts
.
engineOutPath
,
androidBuildInfo:
androidBuildInfo
,
...
...
@@ -704,8 +707,8 @@ class AndroidGradleBuilder implements AndroidBuilder {
);
}
if
(
globals
.
artifacts
is
LocalEngineArtifacts
)
{
final
LocalEngineArtifacts
localEngineArtifacts
=
globals
.
artifacts
as
LocalEngineArtifacts
;
if
(
_
artifacts
is
LocalEngineArtifacts
)
{
final
LocalEngineArtifacts
localEngineArtifacts
=
_
artifacts
as
LocalEngineArtifacts
;
final
Directory
localEngineRepo
=
_getLocalEngineRepo
(
engineOutPath:
localEngineArtifacts
.
engineOutPath
,
androidBuildInfo:
androidBuildInfo
,
...
...
@@ -1137,16 +1140,6 @@ Directory _getLocalEngineRepo({
final
String
abi
=
_getAbiByLocalEnginePath
(
engineOutPath
);
final
Directory
localEngineRepo
=
fileSystem
.
systemTempDirectory
.
createTempSync
(
'flutter_tool_local_engine_repo.'
);
// Remove the local engine repo before the tool exits.
shutdownHooks
.
addShutdownHook
(()
{
if
(
localEngineRepo
.
existsSync
())
{
localEngineRepo
.
deleteSync
(
recursive:
true
);
}
},
ShutdownStage
.
CLEANUP
,
);
final
String
buildMode
=
androidBuildInfo
.
buildInfo
.
modeName
;
final
String
artifactVersion
=
_getLocalArtifactVersion
(
fileSystem
.
path
.
join
(
...
...
packages/flutter_tools/lib/src/artifacts.dart
View file @
bfcb43d2
...
...
@@ -209,8 +209,15 @@ class EngineBuildPaths {
abstract
class
Artifacts
{
/// A test-specific implementation of artifacts that returns stable paths for
/// all artifacts.
///
/// Creates a [LocalEngineArtifacts] if `localEngine` is non-null
@visibleForTesting
factory
Artifacts
.
test
()
=
_TestArtifacts
;
factory
Artifacts
.
test
({
String
localEngine
})
{
if
(
localEngine
!=
null
)
{
return
_TestLocalEngine
(
localEngine
);
}
return
_TestArtifacts
();
}
static
LocalEngineArtifacts
getLocalEngine
(
EngineBuildPaths
engineBuildPaths
)
{
return
LocalEngineArtifacts
(
...
...
@@ -569,9 +576,21 @@ String _getIosEngineArtifactPath(String engineDirectory,
.
path
;
}
abstract
class
LocalEngineArtifacts
implements
Artifacts
{
factory
LocalEngineArtifacts
(
String
engineOutPath
,
String
hostEngineOutPath
,
{
@required
FileSystem
fileSystem
,
@required
Cache
cache
,
@required
ProcessManager
processManager
,
@required
Platform
platform
,
@required
OperatingSystemUtils
operatingSystemUtils
,
})
=
CachedLocalEngineArtifacts
;
String
get
engineOutPath
;
}
/// Manages the artifacts of a locally built engine.
class
LocalEngineArtifacts
implements
Artifacts
{
LocalEngineArtifacts
(
class
CachedLocalEngineArtifacts
implements
LocalEngine
Artifacts
{
Cached
LocalEngineArtifacts
(
this
.
engineOutPath
,
this
.
_hostEngineOutPath
,
{
@required
FileSystem
fileSystem
,
...
...
@@ -585,7 +604,9 @@ class LocalEngineArtifacts implements Artifacts {
_platform
=
platform
,
_operatingSystemUtils
=
operatingSystemUtils
;
final
String
engineOutPath
;
// TODO(goderbauer): This should be private.
@override
final
String
engineOutPath
;
final
String
_hostEngineOutPath
;
final
FileSystem
_fileSystem
;
final
Cache
_cache
;
...
...
@@ -847,3 +868,13 @@ class _TestArtifacts implements Artifacts {
@override
bool
get
isLocalEngine
=>
false
;
}
class
_TestLocalEngine
extends
_TestArtifacts
implements
LocalEngineArtifacts
{
_TestLocalEngine
(
this
.
engineOutPath
);
@override
bool
get
isLocalEngine
=>
true
;
@override
final
String
engineOutPath
;
}
packages/flutter_tools/lib/src/context_runner.dart
View file @
bfcb43d2
...
...
@@ -83,6 +83,7 @@ Future<T> runInContext<T>(
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
fileSystem:
globals
.
fs
,
artifacts:
globals
.
artifacts
,
),
AndroidLicenseValidator:
()
=>
AndroidLicenseValidator
(
operatingSystemUtils:
globals
.
os
,
...
...
packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart
View file @
bfcb43d2
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/android/gradle_test.dart
View file @
bfcb43d2
...
...
@@ -860,7 +860,12 @@ flutter:
fakeProcessManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[]);
mockAndroidSdk
=
MockAndroidSdk
();
when
(
mockAndroidSdk
.
directory
).
thenReturn
(
fs
.
directory
(
'irrelevant'
));
builder
=
AndroidGradleBuilder
(
logger:
logger
,
processManager:
fakeProcessManager
,
fileSystem:
fs
);
builder
=
AndroidGradleBuilder
(
logger:
logger
,
processManager:
fakeProcessManager
,
fileSystem:
fs
,
artifacts:
Artifacts
.
test
(),
);
});
testUsingContext
(
'calls gradle'
,
()
async
{
...
...
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