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
06fcf514
Unverified
Commit
06fcf514
authored
4 years ago
by
Jenn Magder
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inject logger and fs into printHowToConsumeAar, test without context (#56331)
parent
90233746
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
36 deletions
+40
-36
android_builder.dart
packages/flutter_tools/lib/src/android/android_builder.dart
+2
-0
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+9
-8
gradle_test.dart
...flutter_tools/test/general.shard/android/gradle_test.dart
+29
-28
No files found.
packages/flutter_tools/lib/src/android/android_builder.dart
View file @
06fcf514
...
...
@@ -84,6 +84,8 @@ class _AndroidBuilderImpl extends AndroidBuilder {
androidPackage:
project
.
manifest
.
androidPackage
,
repoDirectory:
getRepoDirectory
(
outputDirectory
),
buildNumber:
buildNumber
,
logger:
globals
.
logger
,
fileSystem:
globals
.
fs
,
);
}
finally
{
globals
.
androidSdk
?.
reinitialize
();
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/android/gradle.dart
View file @
06fcf514
...
...
@@ -634,6 +634,8 @@ void printHowToConsumeAar({
@required
Set
<
String
>
buildModes
,
@required
String
androidPackage
,
@required
Directory
repoDirectory
,
@required
Logger
logger
,
@required
FileSystem
fileSystem
,
String
buildNumber
,
})
{
assert
(
buildModes
!=
null
&&
buildModes
.
isNotEmpty
);
...
...
@@ -641,10 +643,9 @@ void printHowToConsumeAar({
assert
(
repoDirectory
!=
null
);
buildNumber
??=
'1.0'
;
globals
.
printStatus
(
'''
${globals.terminal.bolden('Consuming the Module')}
1. Open
${globals.fs.path.join('<host>', 'app', 'build.gradle')}
logger
.
printStatus
(
'
\n
Consuming the Module'
,
emphasis:
true
);
logger
.
printStatus
(
'''
1. Open
${fileSystem.path.join('<host>', 'app', 'build.gradle')}
2. Ensure you have the repositories configured, otherwise add them:
repositories {
...
...
@@ -661,16 +662,16 @@ ${globals.terminal.bolden('Consuming the Module')}
dependencies
{
''');
for (final String buildMode in buildModes) {
globals
.printStatus("""
logger
.printStatus("""
${buildMode}
Implementation '
$androidPackage
:
flutter_$buildMode
:
$buildNumber
'""");
}
globals
.printStatus('''
logger
.printStatus('''
}
''');
if (buildModes.contains('
profile
')) {
globals
.printStatus('''
logger
.printStatus('''
4
.
Add
the
`
profile
`
build
type:
...
...
@@ -684,7 +685,7 @@ ${globals.terminal.bolden('Consuming the Module')}
''');
}
globals
.printStatus('
To
learn
more
,
visit
https:
//flutter.dev/go/build-aar');
logger
.printStatus('
To
learn
more
,
visit
https:
//flutter.dev/go/build-aar');
}
String
_hex
(
List
<
int
>
bytes
)
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/android/gradle_test.dart
View file @
06fcf514
...
...
@@ -15,6 +15,7 @@ import 'package:flutter_tools/src/base/context.dart';
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/terminal.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
...
...
@@ -2349,16 +2350,26 @@ plugin1=${plugin1.path}
});
group
(
'printHowToConsumeAar'
,
()
{
testUsingContext
(
'stdout contains release, debug and profile'
,
()
async
{
BufferLogger
logger
;
FileSystem
fileSystem
;
setUp
(()
{
logger
=
BufferLogger
.
test
();
fileSystem
=
MemoryFileSystem
.
test
();
});
testWithoutContext
(
'stdout contains release, debug and profile'
,
()
async
{
printHowToConsumeAar
(
buildModes:
const
<
String
>{
'release'
,
'debug'
,
'profile'
},
androidPackage:
'com.mycompany'
,
repoDirectory:
globals
.
fs
.
directory
(
'build/'
),
repoDirectory:
fileSystem
.
directory
(
'build/'
),
buildNumber:
'2.2'
,
logger:
logger
,
fileSystem:
fileSystem
,
);
expect
(
testL
ogger
.
statusText
,
l
ogger
.
statusText
,
contains
(
'
\n
'
'Consuming the Module
\n
'
...
...
@@ -2396,21 +2407,19 @@ plugin1=${plugin1.path}
'To learn more, visit https://flutter.dev/go/build-aar
\n
'
)
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
Platform:
()
=>
fakePlatform
(
'android'
),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
test
Using
Context
(
'stdout contains release'
,
()
async
{
test
Without
Context
(
'stdout contains release'
,
()
async
{
printHowToConsumeAar
(
buildModes:
const
<
String
>{
'release'
},
androidPackage:
'com.mycompany'
,
repoDirectory:
globals
.
fs
.
directory
(
'build/'
),
repoDirectory:
fileSystem
.
directory
(
'build/'
),
logger:
logger
,
fileSystem:
fileSystem
,
);
expect
(
testL
ogger
.
statusText
,
l
ogger
.
statusText
,
contains
(
'
\n
'
'Consuming the Module
\n
'
...
...
@@ -2435,21 +2444,19 @@ plugin1=${plugin1.path}
'To learn more, visit https://flutter.dev/go/build-aar
\n
'
)
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
Platform:
()
=>
fakePlatform
(
'android'
),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
test
Using
Context
(
'stdout contains debug'
,
()
async
{
test
Without
Context
(
'stdout contains debug'
,
()
async
{
printHowToConsumeAar
(
buildModes:
const
<
String
>{
'debug'
},
androidPackage:
'com.mycompany'
,
repoDirectory:
globals
.
fs
.
directory
(
'build/'
),
repoDirectory:
fileSystem
.
directory
(
'build/'
),
logger:
logger
,
fileSystem:
fileSystem
,
);
expect
(
testL
ogger
.
statusText
,
l
ogger
.
statusText
,
contains
(
'
\n
'
'Consuming the Module
\n
'
...
...
@@ -2474,22 +2481,20 @@ plugin1=${plugin1.path}
'To learn more, visit https://flutter.dev/go/build-aar
\n
'
)
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
Platform:
()
=>
fakePlatform
(
'android'
),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
test
Using
Context
(
'stdout contains profile'
,
()
async
{
test
Without
Context
(
'stdout contains profile'
,
()
async
{
printHowToConsumeAar
(
buildModes:
const
<
String
>{
'profile'
},
androidPackage:
'com.mycompany'
,
repoDirectory:
globals
.
fs
.
directory
(
'build/'
),
repoDirectory:
fileSystem
.
directory
(
'build/'
),
buildNumber:
'1.0'
,
logger:
logger
,
fileSystem:
fileSystem
,
);
expect
(
testL
ogger
.
statusText
,
l
ogger
.
statusText
,
contains
(
'
\n
'
'Consuming the Module
\n
'
...
...
@@ -2525,10 +2530,6 @@ plugin1=${plugin1.path}
'To learn more, visit https://flutter.dev/go/build-aar
\n
'
)
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
Platform:
()
=>
fakePlatform
(
'android'
),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
}
...
...
This diff is collapsed.
Click to expand it.
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