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
392e25c8
Unverified
Commit
392e25c8
authored
Jul 29, 2020
by
Robert Ancell
Committed by
GitHub
Jul 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set the application-id in the Linux shell (#60053)
parent
6139708e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
3 deletions
+28
-3
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+6
-1
project.dart
packages/flutter_tools/lib/src/project.dart
+6
-0
CMakeLists.txt.tmpl
...lutter_tools/templates/app/linux.tmpl/CMakeLists.txt.tmpl
+3
-0
my_application.cc.tmpl
...ter_tools/templates/app/linux.tmpl/my_application.cc.tmpl
+3
-1
create_test.dart
...tter_tools/test/commands.shard/permeable/create_test.dart
+10
-1
No files found.
packages/flutter_tools/lib/src/commands/create.dart
View file @
392e25c8
...
...
@@ -747,13 +747,18 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl
final
String
pluginClassSnakeCase
=
snakeCase
(
pluginClass
);
final
String
pluginClassCapitalSnakeCase
=
pluginClassSnakeCase
.
toUpperCase
();
final
String
appleIdentifier
=
_createUTIIdentifier
(
organization
,
projectName
);
final
String
androidIdentifier
=
_createAndroidIdentifier
(
organization
,
projectName
);
// Linux uses the same scheme as the Android identifier.
// https://developer.gnome.org/gio/stable/GApplication.html#g-application-id-is-valid
final
String
linuxIdentifier
=
androidIdentifier
;
return
<
String
,
dynamic
>{
'organization'
:
organization
,
'projectName'
:
projectName
,
'androidIdentifier'
:
_createAndroidIdentifier
(
organization
,
projectName
)
,
'androidIdentifier'
:
androidIdentifier
,
'iosIdentifier'
:
appleIdentifier
,
'macosIdentifier'
:
appleIdentifier
,
'linuxIdentifier'
:
linuxIdentifier
,
'description'
:
projectDescription
,
'dartSdk'
:
'
$flutterRoot
/bin/cache/dart-sdk'
,
'androidMinApiLevel'
:
android_common
.
minApiLevel
,
...
...
packages/flutter_tools/lib/src/project.dart
View file @
392e25c8
...
...
@@ -1039,6 +1039,8 @@ class LinuxProject extends FlutterProjectPlatform implements CmakeBasedProject {
@override
String
get
pluginConfigKey
=>
LinuxPlugin
.
kConfigKey
;
static
final
RegExp
_applicationIdPattern
=
RegExp
(
r''
'^
\
s*set
\
s*
\
(
\
s*APPLICATION_ID
\
s*"(.*)"
\
s*
\
)
\
s*
$
'''
);
Directory
get
_editableDirectory
=>
parent
.
directory
.
childDirectory
(
'linux'
);
/// The directory in the project that is managed by Flutter. As much as
...
...
@@ -1067,6 +1069,10 @@ class LinuxProject extends FlutterProjectPlatform implements CmakeBasedProject {
Directory
get
pluginSymlinkDirectory
=>
ephemeralDirectory
.
childDirectory
(
'.plugin_symlinks'
);
Future
<
void
>
ensureReadyForPlatformSpecificTooling
()
async
{}
String
get
applicationId
{
return
_firstMatchInFile
(
cmakeFile
,
_applicationIdPattern
)?.
group
(
1
);
}
}
/// The Fuchsia sub project
...
...
packages/flutter_tools/templates/app/linux.tmpl/CMakeLists.txt.tmpl
View file @
392e25c8
...
...
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.10)
project(runner LANGUAGES CXX)
set(BINARY_NAME "{{projectName}}")
set(APPLICATION_ID "{{linuxIdentifier}}")
cmake_policy(SET CMP0063 NEW)
...
...
@@ -32,6 +33,8 @@ add_subdirectory(${FLUTTER_MANAGED_DIR})
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
# Application build
add_executable(${BINARY_NAME}
"main.cc"
...
...
packages/flutter_tools/templates/app/linux.tmpl/my_application.cc.tmpl
View file @
392e25c8
...
...
@@ -40,5 +40,7 @@ static void my_application_class_init(MyApplicationClass* klass) {
static void my_application_init(MyApplication* self) {}
MyApplication* my_application_new() {
return MY_APPLICATION(g_object_new(my_application_get_type(), nullptr));
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID,
nullptr));
}
packages/flutter_tools/test/commands.shard/permeable/create_test.dart
View file @
392e25c8
...
...
@@ -1037,7 +1037,7 @@ void main() {
Platform:
_kNoColorTerminalPlatform
,
});
testUsingContext
(
'has correct application id for android
and bundle id for ios
'
,
()
async
{
testUsingContext
(
'has correct application id for android
, bundle id for ios and application id for Linux
'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
when
(
mockFlutterVersion
.
frameworkRevision
).
thenReturn
(
frameworkRevision
);
when
(
mockFlutterVersion
.
channel
).
thenReturn
(
frameworkChannel
);
...
...
@@ -1068,6 +1068,10 @@ void main() {
project
.
android
.
applicationId
,
'com.example.hello_flutter'
,
);
expect
(
project
.
linux
.
applicationId
,
'com.example.hello_flutter'
,
);
tmpProjectDir
=
globals
.
fs
.
path
.
join
(
tempDir
.
path
,
'test_abc'
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=app'
,
'--no-pub'
,
'--org'
,
'abc^*.1#@'
,
tmpProjectDir
]);
...
...
@@ -1092,9 +1096,14 @@ void main() {
project
.
android
.
applicationId
,
'flutter_project.untitled'
,
);
expect
(
project
.
linux
.
applicationId
,
'flutter_project.untitled'
,
);
},
overrides:
<
Type
,
Generator
>{
FlutterVersion:
()
=>
mockFlutterVersion
,
Platform:
_kNoColorTerminalPlatform
,
FeatureFlags:
()
=>
TestFeatureFlags
(
isLinuxEnabled:
true
),
});
testUsingContext
(
'can re-gen default template over existing project'
,
()
async
{
...
...
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