mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
create intellij metadata from flutter create (#6429)
This commit is contained in:
parent
e72e174461
commit
f1d70fcdd3
@ -168,8 +168,11 @@ Your main program file is lib/main.dart in the $relativePath directory.
|
||||
templateContext['withDriverTest'] = renderDriverTest;
|
||||
|
||||
Template createTemplate = new Template.fromName('create');
|
||||
fileCount += createTemplate.render(new Directory(dirPath), templateContext,
|
||||
overwriteExisting: false);
|
||||
fileCount += createTemplate.render(
|
||||
new Directory(dirPath),
|
||||
templateContext, overwriteExisting: false,
|
||||
projectName: projectName
|
||||
);
|
||||
|
||||
if (renderDriverTest) {
|
||||
Template driverTemplate = new Template.fromName('driver');
|
||||
|
@ -60,8 +60,12 @@ class Template {
|
||||
|
||||
Map<String /* relative */, String /* absolute source */> _templateFilePaths;
|
||||
|
||||
int render(Directory destination, Map<String, dynamic> context,
|
||||
{ bool overwriteExisting: true }) {
|
||||
int render(
|
||||
Directory destination,
|
||||
Map<String, dynamic> context, {
|
||||
bool overwriteExisting: true,
|
||||
String projectName
|
||||
}) {
|
||||
destination.createSync(recursive: true);
|
||||
int fileCount = 0;
|
||||
|
||||
@ -72,6 +76,8 @@ class Template {
|
||||
.join(destinationDirPath, relativeDestPath)
|
||||
.replaceAll(_kCopyTemplateExtension, '')
|
||||
.replaceAll(_kTemplateExtension, '');
|
||||
if (projectName != null)
|
||||
finalDestinationPath = finalDestinationPath.replaceAll('projectName', projectName);
|
||||
File finalDestinationFile = new File(finalDestinationPath);
|
||||
String relativePathForLogging = path.relative(finalDestinationFile.path);
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/{{projectName}}.iml" filepath="$PROJECT_DIR$/{{projectName}}.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
|
||||
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
12
packages/flutter_tools/templates/create/projectName.iml.tmpl
Normal file
12
packages/flutter_tools/templates/create/projectName.iml.tmpl
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="FLUTTER_MODULE_TYPE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/packages" />
|
||||
</content>
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Dart SDK" level="application" />
|
||||
<orderEntry type="library" name="Dart Packages" level="project" />
|
||||
</component>
|
||||
</module>
|
Loading…
Reference in New Issue
Block a user