Add --dart-define option support to build aar command (#71829)

This commit is contained in:
hy 2020-12-15 02:21:01 +08:00 committed by GitHub
parent cd452286ab
commit cd294666bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -40,6 +40,7 @@ class BuildAarCommand extends BuildSubCommand {
usesPubOption(); usesPubOption();
addSplitDebugInfoOption(); addSplitDebugInfoOption();
addDartObfuscationOption(); addDartObfuscationOption();
usesDartDefineOption();
usesTrackWidgetCreation(verboseHelp: false); usesTrackWidgetCreation(verboseHelp: false);
addNullSafetyModeOptions(hide: !verboseHelp); addNullSafetyModeOptions(hide: !verboseHelp);
addEnableExperimentation(hide: !verboseHelp); addEnableExperimentation(hide: !verboseHelp);

View File

@ -176,6 +176,7 @@ void main() {
'--split-debug-info', '--split-debug-info',
'/project-name/v1.2.3/', '/project-name/v1.2.3/',
'--obfuscate', '--obfuscate',
'--dart-define=foo=bar'
], ],
); );
@ -196,6 +197,7 @@ void main() {
expect(buildInfo.flavor, 'free'); expect(buildInfo.flavor, 'free');
expect(buildInfo.splitDebugInfoPath, '/project-name/v1.2.3/'); expect(buildInfo.splitDebugInfoPath, '/project-name/v1.2.3/');
expect(buildInfo.dartObfuscation, isTrue); expect(buildInfo.dartObfuscation, isTrue);
expect(buildInfo.dartDefines.contains('foo=bar'), isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
AndroidBuilder: () => mockAndroidBuilder, AndroidBuilder: () => mockAndroidBuilder,
}); });