// Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . import 'package:mason/mason.dart'; void run(HookContext context) { final platforms = context.vars['platforms']; final enabled_platforms = { 'enable_android': platforms?.contains('android') ?? false, 'enable_ios': platforms?.contains('ios') ?? false, 'enable_web': platforms?.contains('web') ?? false, 'enable_macos': platforms?.contains('macos') ?? false, 'enable_windows': platforms?.contains('windows') ?? false, 'enable_linux': platforms?.contains('linux') ?? false, }; final features = context.vars['features']; final enabled_features = { 'enable_l10n': features?.contains('localization') ?? false, 'enable_analysis': features?.contains('analysis') ?? false, 'enable_freezed': features?.contains('freezed') ?? false, 'enable_http': features?.contains('http') ?? false, 'enable_router': features?.contains('router') ?? false, 'enable_auth': features?.contains('authentication') ?? false, 'enable_forms': features?.contains('forms') ?? false, }; context.vars = {...context.vars, ...enabled_platforms, ...enabled_features}; }