generateWithFlavors function
void
generateWithFlavors(
- Arguments arguments, {
- bool isMonitoring = false,
})
Implementation
void generateWithFlavors(
Arguments arguments, {
bool isMonitoring = false,
}) {
assert(
Directory(join(arguments.assetsLocation, flavorDefault)).existsSync(),
'Flavored assets must have a default assets folder "all/"!',
);
Directory(arguments.assetsLocation)
.listSync()
.whereType<Directory>()
.forEach((flavorDir) {
final flavor = basename(flavorDir.unixPath);
Logger.verboseLog('Generating flavor $flavor...');
generateVectorResources(
input: join(arguments.assetsLocation, flavor, 'vectors'),
output: arguments.outputLocation,
package: arguments.package,
flavor: flavor,
);
generateImageResources(
input: join(arguments.assetsLocation, flavor, 'images'),
output: arguments.outputLocation,
package: arguments.package,
flavor: flavor,
);
generateFontResources(
input: join(arguments.assetsLocation, flavor, 'fonts'),
output: arguments.outputLocation,
package: arguments.package,
flavor: flavor,
);
generateScriptResources(
input: join(arguments.assetsLocation, flavor, 'scripts'),
output: arguments.outputLocation,
package: arguments.package,
flavor: flavor,
);
generateColorResources(
input: join(arguments.assetsLocation, flavor, 'colors'),
output: arguments.outputLocation,
flavor: flavor,
);
generateStringResources(
input: join(arguments.assetsLocation, flavor, 'translations'),
output: arguments.outputLocation,
flavor: flavor,
);
generateConfigResources(
input: join(arguments.assetsLocation, flavor, 'configs'),
output: arguments.outputLocation,
flavor: flavor,
);
generateValueResources(
input: join(arguments.assetsLocation, flavor, 'values'),
output: arguments.outputLocation,
flavor: flavor,
);
generateRawResources(
input: join(arguments.assetsLocation, flavor, 'raws'),
output: arguments.outputLocation,
flavor: flavor,
package: arguments.package,
);
generateRootResourcesWithFlavor(
output: arguments.outputLocation,
);
Logger.verboseLog('Flavor $flavor generated!');
});
if (!isMonitoring) {
declarePubspecAssets(
arguments.assetsLocation,
hasFlavors: true,
);
}
}