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
c469b1fe
Unverified
Commit
c469b1fe
authored
Jul 25, 2019
by
Emmanuel Garcia
Committed by
GitHub
Jul 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add annotation dependency to plugins (#36886)
Fixes #36817
parent
76d05816
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
143 additions
and
10 deletions
+143
-10
test.dart
dev/bots/test.dart
+1
-0
gradle_plugins_without_annotations_test.dart
...ab/bin/tasks/gradle_plugins_without_annotations_test.dart
+138
-0
aar_init_script.gradle
packages/flutter_tools/gradle/aar_init_script.gradle
+4
-10
No files found.
dev/bots/test.dart
View file @
c469b1fe
...
...
@@ -962,6 +962,7 @@ Future<void> _androidGradleTests(String subShard) async {
await
_runDevicelabTest
(
'gradle_plugin_light_apk_test'
,
env:
env
);
await
_runDevicelabTest
(
'gradle_plugin_fat_apk_test'
,
env:
env
);
await
_runDevicelabTest
(
'gradle_jetifier_test'
,
env:
env
);
await
_runDevicelabTest
(
'gradle_plugins_without_annotations_test'
,
env:
env
);
await
_runDevicelabTest
(
'gradle_plugin_dependencies_test'
,
env:
env
);
await
_runDevicelabTest
(
'gradle_migrate_settings_test'
,
env:
env
);
}
...
...
dev/devicelab/bin/tasks/gradle_plugins_without_annotations_test.dart
0 → 100644
View file @
c469b1fe
// Copyright (c) 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
;
import
'package:flutter_devicelab/framework/apk_utils.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/utils.dart'
;
import
'package:path/path.dart'
as
path
;
final
String
gradlew
=
Platform
.
isWindows
?
'gradlew.bat'
:
'gradlew'
;
final
String
gradlewExecutable
=
Platform
.
isWindows
?
gradlew
:
'./
$gradlew
'
;
/// Tests that plugins that don't define a `androidx.annotation:annotation:+` or
/// `com.android.support:support-annotations:+` dependency can be built as AAR.
/// aar_init_script.gradle adds these dependencies manually.
Future
<
void
>
main
()
async
{
await
task
(()
async
{
section
(
'Find Java'
);
final
String
javaHome
=
await
findJavaHome
();
if
(
javaHome
==
null
)
{
return
TaskResult
.
failure
(
'Could not find Java'
);
}
print
(
'
\n
Using JAVA_HOME=
$javaHome
'
);
section
(
'Create Flutter app project'
);
final
Directory
tempDir
=
Directory
.
systemTemp
.
createTempSync
(
'flutter_module_test.'
);
final
Directory
projectDir
=
Directory
(
path
.
join
(
tempDir
.
path
,
'hello'
));
try
{
await
inDirectory
(
tempDir
,
()
async
{
await
flutter
(
'create'
,
options:
<
String
>[
'--org'
,
'io.flutter.devicelab'
,
'hello'
,
],
);
});
section
(
'Add firebase_auth: 0.11.1+12 since it uses AndroidX annotations'
);
// firebase_auth: 0.11.1+12 uses `androidx.annotation.NonNull` without having a
// dependency on `androidx.annotation:annotation:+`
final
File
pubspec
=
File
(
path
.
join
(
projectDir
.
path
,
'pubspec.yaml'
));
String
content
=
pubspec
.
readAsStringSync
();
content
=
content
.
replaceFirst
(
'
\n
dependencies:
\n
'
,
'
\n
dependencies:
\n
firebase_auth: 0.11.1+12
\n
'
,
);
pubspec
.
writeAsStringSync
(
content
,
flush:
true
);
await
inDirectory
(
projectDir
,
()
async
{
await
flutter
(
'packages'
,
options:
<
String
>[
'get'
],
);
});
section
(
'Build release APK'
);
await
inDirectory
(
projectDir
,
()
async
{
await
flutter
(
'build'
,
options:
<
String
>[
'apk'
,
'--target-platform'
,
'android-arm'
,
'--verbose'
,
],
);
});
final
File
releaseApk
=
File
(
path
.
join
(
projectDir
.
path
,
'build'
,
'app'
,
'outputs'
,
'apk'
,
'release'
,
'app-release.apk'
,
));
if
(!
exists
(
releaseApk
))
{
return
TaskResult
.
failure
(
'Failed to build release APK.'
);
}
checkApkContainsClasses
(
releaseApk
,
<
String
>[
// The plugin class defined by `firebase_auth`.
'io.flutter.plugins.firebaseauth.FirebaseAuthPlugin'
,
// Used by `firebase_auth`.
'com.google.firebase.FirebaseApp'
,
]);
section
(
'Build debug APK'
);
await
inDirectory
(
projectDir
,
()
async
{
await
flutter
(
'build'
,
options:
<
String
>[
'apk'
,
'--target-platform'
,
'android-arm'
,
'--debug'
,
'--verbose'
,
],
);
});
final
File
debugApk
=
File
(
path
.
join
(
projectDir
.
path
,
'build'
,
'app'
,
'outputs'
,
'apk'
,
'debug'
,
'app-debug.apk'
,
));
if
(!
exists
(
debugApk
))
{
return
TaskResult
.
failure
(
'Failed to build debug APK.'
);
}
checkApkContainsClasses
(
debugApk
,
<
String
>[
// The plugin class defined by `firebase_auth`.
'io.flutter.plugins.firebaseauth.FirebaseAuthPlugin'
,
// Used by `firebase_auth`.
'com.google.firebase.FirebaseApp'
,
]);
return
TaskResult
.
success
(
null
);
}
catch
(
e
)
{
return
TaskResult
.
failure
(
e
.
toString
());
}
finally
{
rmTree
(
tempDir
);
}
});
}
packages/flutter_tools/gradle/aar_init_script.gradle
View file @
c469b1fe
...
...
@@ -42,17 +42,11 @@ void configureProject(Project project, File outputDir) {
// Check if the project uses the Flutter plugin (defined in flutter.gradle).
Boolean
usesFlutterPlugin
=
project
.
plugins
.
find
{
it
.
class
.
name
==
"FlutterPlugin"
}
!=
null
if
(!
usesFlutterPlugin
)
{
// Plugins don't include their dependencies under the assumption that the parent project adds them.
if
(
project
.
properties
[
'android.useAndroidX'
])
{
project
.
dependencies
{
compileOnly
"androidx.annotation:annotation:+"
}
}
else
{
project
.
dependencies
{
compileOnly
"com.android.support:support-annotations:+"
}
}
project
.
dependencies
{
// Some plugins don't include `annotations` and they don't set
// `android.useAndroidX=true` in `gradle.properties`.
compileOnly
"androidx.annotation:annotation:+"
compileOnly
"com.android.support:support-annotations:+"
// The Flutter plugin already adds `flutter.jar`.
compileOnly
project
.
files
(
"${getFlutterRoot(project)}/bin/cache/artifacts/engine/android-arm-release/flutter.jar"
)
}
...
...
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