Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e24a27d3
Unverified
Commit
e24a27d3
authored
Aug 15, 2019
by
Zachary Anderson
Committed by
GitHub
Aug 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tool] Flip create language defaults to swift and kotlin (#38339)
parent
8d6dc620
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
21 deletions
+50
-21
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+2
-2
create_test.dart
...lutter_tools/test/general.shard/commands/create_test.dart
+42
-13
create_usage_test.dart
..._tools/test/general.shard/commands/create_usage_test.dart
+6
-6
No files found.
packages/flutter_tools/lib/src/commands/create.dart
View file @
e24a27d3
...
@@ -129,13 +129,13 @@ class CreateCommand extends FlutterCommand {
...
@@ -129,13 +129,13 @@ class CreateCommand extends FlutterCommand {
argParser
.
addOption
(
argParser
.
addOption
(
'ios-language'
,
'ios-language'
,
abbr:
'i'
,
abbr:
'i'
,
defaultsTo:
'
objc
'
,
defaultsTo:
'
swift
'
,
allowed:
<
String
>[
'objc'
,
'swift'
],
allowed:
<
String
>[
'objc'
,
'swift'
],
);
);
argParser
.
addOption
(
argParser
.
addOption
(
'android-language'
,
'android-language'
,
abbr:
'a'
,
abbr:
'a'
,
defaultsTo:
'
java
'
,
defaultsTo:
'
kotlin
'
,
allowed:
<
String
>[
'java'
,
'kotlin'
],
allowed:
<
String
>[
'java'
,
'kotlin'
],
);
);
argParser
.
addFlag
(
argParser
.
addFlag
(
...
...
packages/flutter_tools/test/general.shard/commands/create_test.dart
View file @
e24a27d3
...
@@ -63,7 +63,7 @@ void main() {
...
@@ -63,7 +63,7 @@ void main() {
testUsingContext
(
'can create a default project'
,
()
async
{
testUsingContext
(
'can create a default project'
,
()
async
{
await
_createAndAnalyzeProject
(
await
_createAndAnalyzeProject
(
projectDir
,
projectDir
,
<
String
>[],
<
String
>[
'-i'
,
'objc'
,
'-a'
,
'java'
],
<
String
>[
<
String
>[
'android/app/src/main/java/com/example/flutter_project/MainActivity.java'
,
'android/app/src/main/java/com/example/flutter_project/MainActivity.java'
,
'android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java'
,
'android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java'
,
...
@@ -81,7 +81,7 @@ void main() {
...
@@ -81,7 +81,7 @@ void main() {
await
projectDir
.
create
(
recursive:
true
);
await
projectDir
.
create
(
recursive:
true
);
await
_createAndAnalyzeProject
(
await
_createAndAnalyzeProject
(
projectDir
,
projectDir
,
<
String
>[],
<
String
>[
'-i'
,
'objc'
,
'-a'
,
'java'
],
<
String
>[
<
String
>[
'android/app/src/main/java/com/example/flutter_project/MainActivity.java'
,
'android/app/src/main/java/com/example/flutter_project/MainActivity.java'
,
'android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java'
,
'android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java'
,
...
@@ -129,7 +129,10 @@ void main() {
...
@@ -129,7 +129,10 @@ void main() {
testUsingContext
(
'Will create an app project if non-empty non-project directory exists without .metadata'
,
()
async
{
testUsingContext
(
'Will create an app project if non-empty non-project directory exists without .metadata'
,
()
async
{
await
projectDir
.
absolute
.
childDirectory
(
'blag'
).
create
(
recursive:
true
);
await
projectDir
.
absolute
.
childDirectory
(
'blag'
).
create
(
recursive:
true
);
await
projectDir
.
absolute
.
childDirectory
(
'.idea'
).
create
(
recursive:
true
);
await
projectDir
.
absolute
.
childDirectory
(
'.idea'
).
create
(
recursive:
true
);
await
_createAndAnalyzeProject
(
projectDir
,
<
String
>[],
<
String
>[
await
_createAndAnalyzeProject
(
projectDir
,
<
String
>[
'-i'
,
'objc'
,
'-a'
,
'java'
],
<
String
>[
'android/app/src/main/java/com/example/flutter_project/MainActivity.java'
,
'android/app/src/main/java/com/example/flutter_project/MainActivity.java'
,
'android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java'
,
'android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java'
,
'flutter_project.iml'
,
'flutter_project.iml'
,
...
@@ -145,7 +148,10 @@ void main() {
...
@@ -145,7 +148,10 @@ void main() {
testUsingContext
(
'detects and recreates an app project correctly'
,
()
async
{
testUsingContext
(
'detects and recreates an app project correctly'
,
()
async
{
await
projectDir
.
absolute
.
childDirectory
(
'lib'
).
create
(
recursive:
true
);
await
projectDir
.
absolute
.
childDirectory
(
'lib'
).
create
(
recursive:
true
);
await
projectDir
.
absolute
.
childDirectory
(
'ios'
).
create
(
recursive:
true
);
await
projectDir
.
absolute
.
childDirectory
(
'ios'
).
create
(
recursive:
true
);
await
_createAndAnalyzeProject
(
projectDir
,
<
String
>[],
<
String
>[
await
_createAndAnalyzeProject
(
projectDir
,
<
String
>[
'-i'
,
'objc'
,
'-a'
,
'java'
],
<
String
>[
'android/app/src/main/java/com/example/flutter_project/MainActivity.java'
,
'android/app/src/main/java/com/example/flutter_project/MainActivity.java'
,
'android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java'
,
'android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java'
,
'flutter_project.iml'
,
'flutter_project.iml'
,
...
@@ -163,8 +169,9 @@ void main() {
...
@@ -163,8 +169,9 @@ void main() {
await
projectDir
.
absolute
.
childFile
(
'.metadata'
).
writeAsString
(
'project_type: plugin
\n
'
);
await
projectDir
.
absolute
.
childFile
(
'.metadata'
).
writeAsString
(
'project_type: plugin
\n
'
);
return
_createAndAnalyzeProject
(
return
_createAndAnalyzeProject
(
projectDir
,
projectDir
,
<
String
>[],
<
String
>[
<
String
>[
'-i'
,
'objc'
,
'-a'
,
'java'
],
<
String
>[
'android/src/main/java/com/example/flutter_project/FlutterProjectPlugin.java'
,
'android/src/main/java/com/example/flutter_project/FlutterProjectPlugin.java'
,
'example/android/app/src/main/java/com/example/flutter_project_example/MainActivity.java'
,
'example/android/app/src/main/java/com/example/flutter_project_example/MainActivity.java'
,
'example/ios/Runner/AppDelegate.h'
,
'example/ios/Runner/AppDelegate.h'
,
...
@@ -259,7 +266,7 @@ void main() {
...
@@ -259,7 +266,7 @@ void main() {
testUsingContext
(
'can create a plugin project'
,
()
async
{
testUsingContext
(
'can create a plugin project'
,
()
async
{
await
_createAndAnalyzeProject
(
await
_createAndAnalyzeProject
(
projectDir
,
projectDir
,
<
String
>[
'--template=plugin'
],
<
String
>[
'--template=plugin'
,
'-i'
,
'objc'
,
'-a'
,
'java'
],
<
String
>[
<
String
>[
'android/src/main/java/com/example/flutter_project/FlutterProjectPlugin.java'
,
'android/src/main/java/com/example/flutter_project/FlutterProjectPlugin.java'
,
'example/android/app/src/main/java/com/example/flutter_project_example/MainActivity.java'
,
'example/android/app/src/main/java/com/example/flutter_project_example/MainActivity.java'
,
...
@@ -304,8 +311,13 @@ void main() {
...
@@ -304,8 +311,13 @@ void main() {
testUsingContext
(
'plugin project with custom org'
,
()
async
{
testUsingContext
(
'plugin project with custom org'
,
()
async
{
return
_createProject
(
return
_createProject
(
projectDir
,
projectDir
,
<
String
>[
'--no-pub'
,
'--template=plugin'
,
'--org'
,
'com.bar.foo'
],
<
String
>[
<
String
>[
'--no-pub'
,
'--template=plugin'
,
'--org'
,
'com.bar.foo'
,
'-i'
,
'objc'
,
'-a'
,
'java'
,
],
<
String
>[
'android/src/main/java/com/bar/foo/flutter_project/FlutterProjectPlugin.java'
,
'android/src/main/java/com/bar/foo/flutter_project/FlutterProjectPlugin.java'
,
'example/android/app/src/main/java/com/bar/foo/flutter_project_example/MainActivity.java'
,
'example/android/app/src/main/java/com/bar/foo/flutter_project_example/MainActivity.java'
,
],
],
...
@@ -319,8 +331,13 @@ void main() {
...
@@ -319,8 +331,13 @@ void main() {
testUsingContext
(
'plugin project with valid custom project name'
,
()
async
{
testUsingContext
(
'plugin project with valid custom project name'
,
()
async
{
return
_createProject
(
return
_createProject
(
projectDir
,
projectDir
,
<
String
>[
'--no-pub'
,
'--template=plugin'
,
'--project-name'
,
'xyz'
],
<
String
>[
<
String
>[
'--no-pub'
,
'--template=plugin'
,
'--project-name'
,
'xyz'
,
'-i'
,
'objc'
,
'-a'
,
'java'
,
],
<
String
>[
'android/src/main/java/com/example/xyz/XyzPlugin.java'
,
'android/src/main/java/com/example/xyz/XyzPlugin.java'
,
'example/android/app/src/main/java/com/example/xyz_example/MainActivity.java'
,
'example/android/app/src/main/java/com/example/xyz_example/MainActivity.java'
,
],
],
...
@@ -837,13 +854,19 @@ void main() {
...
@@ -837,13 +854,19 @@ void main() {
testUsingContext
(
'can re-gen app android/ folder, reusing custom org'
,
()
async
{
testUsingContext
(
'can re-gen app android/ folder, reusing custom org'
,
()
async
{
await
_createProject
(
await
_createProject
(
projectDir
,
projectDir
,
<
String
>[
'--no-pub'
,
'--template=app'
,
'--org'
,
'com.bar.foo'
],
<
String
>[
'--no-pub'
,
'--template=app'
,
'--org'
,
'com.bar.foo'
,
'-i'
,
'objc'
,
'-a'
,
'java'
],
<
String
>[],
<
String
>[],
);
);
projectDir
.
childDirectory
(
'android'
).
deleteSync
(
recursive:
true
);
projectDir
.
childDirectory
(
'android'
).
deleteSync
(
recursive:
true
);
return
_createProject
(
return
_createProject
(
projectDir
,
projectDir
,
<
String
>[
'--no-pub'
],
<
String
>[
'--no-pub'
,
'-i'
,
'objc'
,
'-a'
,
'java'
],
<
String
>[
<
String
>[
'android/app/src/main/java/com/bar/foo/flutter_project/MainActivity.java'
,
'android/app/src/main/java/com/bar/foo/flutter_project/MainActivity.java'
,
],
],
...
@@ -871,14 +894,20 @@ void main() {
...
@@ -871,14 +894,20 @@ void main() {
testUsingContext
(
'can re-gen plugin ios/ and example/ folders, reusing custom org'
,
()
async
{
testUsingContext
(
'can re-gen plugin ios/ and example/ folders, reusing custom org'
,
()
async
{
await
_createProject
(
await
_createProject
(
projectDir
,
projectDir
,
<
String
>[
'--no-pub'
,
'--template=plugin'
,
'--org'
,
'com.bar.foo'
],
<
String
>[
'--no-pub'
,
'--template=plugin'
,
'--org'
,
'com.bar.foo'
,
'-i'
,
'objc'
,
'-a'
,
'java'
,
],
<
String
>[],
<
String
>[],
);
);
projectDir
.
childDirectory
(
'example'
).
deleteSync
(
recursive:
true
);
projectDir
.
childDirectory
(
'example'
).
deleteSync
(
recursive:
true
);
projectDir
.
childDirectory
(
'ios'
).
deleteSync
(
recursive:
true
);
projectDir
.
childDirectory
(
'ios'
).
deleteSync
(
recursive:
true
);
await
_createProject
(
await
_createProject
(
projectDir
,
projectDir
,
<
String
>[
'--no-pub'
,
'--template=plugin'
],
<
String
>[
'--no-pub'
,
'--template=plugin'
,
'-i'
,
'objc'
,
'-a'
,
'java'
],
<
String
>[
<
String
>[
'example/android/app/src/main/java/com/bar/foo/flutter_project_example/MainActivity.java'
,
'example/android/app/src/main/java/com/bar/foo/flutter_project_example/MainActivity.java'
,
'ios/Classes/FlutterProjectPlugin.h'
,
'ios/Classes/FlutterProjectPlugin.h'
,
...
@@ -964,7 +993,7 @@ void main() {
...
@@ -964,7 +993,7 @@ void main() {
existingFile
.
createSync
(
recursive:
true
);
existingFile
.
createSync
(
recursive:
true
);
await
_createProject
(
await
_createProject
(
fs
.
directory
(
existingDirectory
.
path
),
fs
.
directory
(
existingDirectory
.
path
),
<
String
>[
'--overwrite'
],
<
String
>[
'--overwrite'
,
'-i'
,
'objc'
,
'-a'
,
'java'
],
<
String
>[
<
String
>[
'android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java'
,
'android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java'
,
'lib/main.dart'
,
'lib/main.dart'
,
...
...
packages/flutter_tools/test/general.shard/commands/create_usage_test.dart
View file @
e24a27d3
...
@@ -71,18 +71,18 @@ void main() {
...
@@ -71,18 +71,18 @@ void main() {
await
runner
.
run
(<
String
>[
await
runner
.
run
(<
String
>[
'create'
,
'--flutter-root=flutter'
,
'--no-pub'
,
'--template=app'
,
'testy'
]);
'create'
,
'--flutter-root=flutter'
,
'--no-pub'
,
'--template=app'
,
'testy'
]);
expect
(
await
command
.
usageValues
,
expect
(
await
command
.
usageValues
,
containsPair
(
CustomDimensions
.
commandCreateIosLanguage
,
'
objc
'
));
containsPair
(
CustomDimensions
.
commandCreateIosLanguage
,
'
swift
'
));
await
runner
.
run
(<
String
>[
await
runner
.
run
(<
String
>[
'create'
,
'create'
,
'--flutter-root=flutter'
,
'--flutter-root=flutter'
,
'--no-pub'
,
'--no-pub'
,
'--template=app'
,
'--template=app'
,
'--ios-language=
swift
'
,
'--ios-language=
objc
'
,
'testy'
,
'testy'
,
]);
]);
expect
(
await
command
.
usageValues
,
expect
(
await
command
.
usageValues
,
containsPair
(
CustomDimensions
.
commandCreateIosLanguage
,
'
swift
'
));
containsPair
(
CustomDimensions
.
commandCreateIosLanguage
,
'
objc
'
));
}));
}));
...
@@ -92,18 +92,18 @@ void main() {
...
@@ -92,18 +92,18 @@ void main() {
await
runner
.
run
(<
String
>[
'create'
,
'--flutter-root=flutter'
,
'--no-pub'
,
'--template=app'
,
'testy'
]);
await
runner
.
run
(<
String
>[
'create'
,
'--flutter-root=flutter'
,
'--no-pub'
,
'--template=app'
,
'testy'
]);
expect
(
await
command
.
usageValues
,
expect
(
await
command
.
usageValues
,
containsPair
(
CustomDimensions
.
commandCreateAndroidLanguage
,
'
java
'
));
containsPair
(
CustomDimensions
.
commandCreateAndroidLanguage
,
'
kotlin
'
));
await
runner
.
run
(<
String
>[
await
runner
.
run
(<
String
>[
'create'
,
'create'
,
'--flutter-root=flutter'
,
'--flutter-root=flutter'
,
'--no-pub'
,
'--no-pub'
,
'--template=app'
,
'--template=app'
,
'--android-language=
kotlin
'
,
'--android-language=
java
'
,
'testy'
,
'testy'
,
]);
]);
expect
(
await
command
.
usageValues
,
expect
(
await
command
.
usageValues
,
containsPair
(
CustomDimensions
.
commandCreateAndroidLanguage
,
'
kotlin
'
));
containsPair
(
CustomDimensions
.
commandCreateAndroidLanguage
,
'
java
'
));
}));
}));
});
});
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment