Commit e9c7f604 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Make generated Java folder names match package names. (#10537)

parent 7d713263
......@@ -84,20 +84,20 @@ class Template {
return null;
relativeDestinationPath = relativeDestinationPath.replaceAll('$platform-$language.tmpl', platform);
}
final String organization = context['organization'];
final String projectName = context['projectName'];
final String androidIdentifier = context['androidIdentifier'];
final String pluginClass = context['pluginClass'];
final String destinationDirPath = destination.absolute.path;
final String pathSeparator = fs.path.separator;
String finalDestinationPath = fs.path
.join(destinationDirPath, relativeDestinationPath)
.replaceAll(_kCopyTemplateExtension, '')
.replaceAll(_kTemplateExtension, '')
.replaceAll(
'${pathSeparator}organization$pathSeparator',
'$pathSeparator${organization.replaceAll('.', pathSeparator)}$pathSeparator',
);
.replaceAll(_kTemplateExtension, '');
if (androidIdentifier != null) {
finalDestinationPath = finalDestinationPath
.replaceAll('androidIdentifier', androidIdentifier.replaceAll('.', pathSeparator));
}
if (projectName != null)
finalDestinationPath = finalDestinationPath.replaceAll('projectName', projectName);
if (pluginClass != null)
......
......@@ -40,7 +40,7 @@ void main() {
projectDir,
<String>[],
<String>[
'android/app/src/main/java/com/yourcompany/flutter_project/MainActivity.java',
'android/app/src/main/java/com/yourcompany/flutterproject/MainActivity.java',
'ios/Runner/AppDelegate.h',
'ios/Runner/AppDelegate.m',
'ios/Runner/main.m',
......@@ -54,13 +54,13 @@ void main() {
projectDir,
<String>['--android-language', 'kotlin', '-i', 'swift'],
<String>[
'android/app/src/main/kotlin/com/yourcompany/flutter_project/MainActivity.kt',
'android/app/src/main/kotlin/com/yourcompany/flutterproject/MainActivity.kt',
'ios/Runner/AppDelegate.swift',
'ios/Runner/Runner-Bridging-Header.h',
'lib/main.dart',
],
<String>[
'android/app/src/main/java/com/yourcompany/flutter_project/MainActivity.java',
'android/app/src/main/java/com/yourcompany/flutterproject/MainActivity.java',
'ios/Runner/AppDelegate.h',
'ios/Runner/AppDelegate.m',
'ios/Runner/main.m',
......@@ -73,11 +73,11 @@ void main() {
projectDir,
<String>['--plugin'],
<String>[
'android/src/main/java/com/yourcompany/flutter_project/FlutterProjectPlugin.java',
'android/src/main/java/com/yourcompany/flutterproject/FlutterProjectPlugin.java',
'ios/Classes/FlutterProjectPlugin.h',
'ios/Classes/FlutterProjectPlugin.m',
'lib/flutter_project.dart',
'example/android/app/src/main/java/com/yourcompany/flutter_project_example/MainActivity.java',
'example/android/app/src/main/java/com/yourcompany/flutterprojectexample/MainActivity.java',
'example/ios/Runner/AppDelegate.h',
'example/ios/Runner/AppDelegate.m',
'example/ios/Runner/main.m',
......@@ -91,19 +91,19 @@ void main() {
projectDir,
<String>['--plugin', '-a', 'kotlin', '--ios-language', 'swift'],
<String>[
'android/src/main/kotlin/com/yourcompany/flutter_project/FlutterProjectPlugin.kt',
'android/src/main/kotlin/com/yourcompany/flutterproject/FlutterProjectPlugin.kt',
'ios/Classes/FlutterProjectPlugin.h',
'ios/Classes/FlutterProjectPlugin.m',
'ios/Classes/SwiftFlutterProjectPlugin.swift',
'lib/flutter_project.dart',
'example/android/app/src/main/kotlin/com/yourcompany/flutter_project_example/MainActivity.kt',
'example/android/app/src/main/kotlin/com/yourcompany/flutterprojectexample/MainActivity.kt',
'example/ios/Runner/AppDelegate.swift',
'example/ios/Runner/Runner-Bridging-Header.h',
'example/lib/main.dart',
],
<String>[
'android/src/main/java/com/yourcompany/flutter_project/FlutterProjectPlugin.java',
'example/android/app/src/main/java/com/yourcompany/flutter_project_example/MainActivity.java',
'android/src/main/java/com/yourcompany/flutterproject/FlutterProjectPlugin.java',
'example/android/app/src/main/java/com/yourcompany/flutterprojectexample/MainActivity.java',
'example/ios/Runner/AppDelegate.h',
'example/ios/Runner/AppDelegate.m',
'example/ios/Runner/main.m',
......@@ -116,12 +116,12 @@ void main() {
projectDir,
<String>['--plugin', '--org', 'com.bar.foo'],
<String>[
'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',
'android/src/main/java/com/bar/foo/flutterproject/FlutterProjectPlugin.java',
'example/android/app/src/main/java/com/bar/foo/flutterprojectexample/MainActivity.java',
],
<String>[
'android/src/main/java/com/yourcompany/flutter_project/FlutterProjectPlugin.java',
'example/android/app/src/main/java/com/yourcompany/flutter_project_example/MainActivity.java',
'android/src/main/java/com/yourcompany/flutterproject/FlutterProjectPlugin.java',
'example/android/app/src/main/java/com/yourcompany/flutterprojectexample/MainActivity.java',
],
);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment