-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flavors and generated code on top of base flutter app
- Loading branch information
1 parent
2c57475
commit f7b62a8
Showing
117 changed files
with
403 additions
and
4,075 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
/// Indicates the version of the package | ||
const rxBlocCliPackageVersion = '3.3.1'; | ||
const rxBlocCliPackageVersion = '3.4.0'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:mason/mason.dart'; | ||
|
||
import '../models/generator_arguments.dart'; | ||
import '../templates/rx_bloc_flavor_config_bundle.dart'; | ||
|
||
/// Utility class containing logic for flavor generation | ||
class FlavorGenerator { | ||
/// Generates flavor config and uses it to add flavors to project | ||
static Future<void> addFlavors( | ||
Future<MasonGenerator> Function(MasonBundle) generator, | ||
GeneratorArguments args, | ||
) async { | ||
await _generateFlavorConfig(generator, args); | ||
|
||
final addFlavorizr = await Process.run( | ||
'flutter', | ||
[ | ||
'pub', | ||
'add', | ||
'flutter_flavorizr', | ||
], | ||
workingDirectory: args.outputDirectory.path, | ||
); | ||
|
||
final dartGet = await Process.run( | ||
'dart', | ||
['pub', 'get'], | ||
workingDirectory: args.outputDirectory.path, | ||
); | ||
|
||
final runFlavorizr = await Process.run( | ||
'flutter', | ||
[ | ||
'pub', | ||
'run', | ||
'flutter_flavorizr', | ||
], | ||
workingDirectory: args.outputDirectory.path, | ||
); | ||
} | ||
|
||
///region Helper functions | ||
/// Generates config file used to define flavors | ||
static Future<void> _generateFlavorConfig( | ||
Future<MasonGenerator> Function(MasonBundle) generator, | ||
GeneratorArguments arguments, | ||
) async { | ||
final _bundle = await generator(rxBlocFlavorConfigBundle); | ||
var generatedFiles = await _bundle.generate( | ||
DirectoryGeneratorTarget(arguments.outputDirectory), | ||
vars: { | ||
'project_name': arguments.projectName, | ||
'domain_name': arguments.organisationDomain, | ||
'organization_name': arguments.organisationName, | ||
}, | ||
); | ||
} | ||
|
||
/// endregion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/.run/development.run.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/.run/production.run.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Production" type="FlutterRunConfigurationType" factoryName="Flutter"> | ||
<option name="buildFlavor" value="production" /> | ||
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" /> | ||
<option name="buildFlavor" value="prod" /> | ||
<option name="filePath" value="$PROJECT_DIR$/lib/main_prod.dart" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/android/.gitignore
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.