Skip to content

Commit c2bd4fd

Browse files
Rebuild script for tfserving-flutter (#2307)
This adds a rebuild script for `tfserving-flutter`. In the process it extends the `codelab_rebuild` tooling to support running `protoc` to generate dart code from protobuf definitions. Oh, and upgrading the codelab to latest Dart and protobuf libraries. ## Pre-launch Checklist - [x] I read the [Effective Dart: Style] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-devrel channel on [Discord]. <!-- Links --> [Effective Dart: Style]: https://dart.dev/guides/language/effective-dart/style [CLA]: https://cla.developers.google.com/ [Discord]: https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
1 parent 7661a0c commit c2bd4fd

File tree

319 files changed

+19646
-14095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

319 files changed

+19646
-14095
lines changed

tfserving-flutter/codelab2/finished/.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
*.swp
66
.DS_Store
77
.atom/
8+
.build/
89
.buildlog/
910
.history
1011
.svn/
12+
.swiftpm/
13+
migrate_working_dir/
1114

1215
# IntelliJ related
1316
*.iml
@@ -26,14 +29,10 @@
2629
.dart_tool/
2730
.flutter-plugins
2831
.flutter-plugins-dependencies
29-
.packages
3032
.pub-cache/
3133
.pub/
3234
/build/
3335

34-
# Web related
35-
lib/generated_plugin_registrant.dart
36-
3736
# Symbolication related
3837
app.*.symbols
3938

tfserving-flutter/codelab2/finished/android/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ gradle-wrapper.jar
55
/gradlew.bat
66
/local.properties
77
GeneratedPluginRegistrant.java
8+
.cxx/
89

910
# Remember to never publicly share your keystore.
10-
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11+
# See https://flutter.dev/to/reference-keystore
1112
key.properties
1213
**/*.keystore
1314
**/*.jks

tfserving-flutter/codelab2/finished/android/app/build.gradle

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
plugins {
2+
id("com.android.application")
3+
id("kotlin-android")
4+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5+
id("dev.flutter.flutter-gradle-plugin")
6+
}
7+
8+
android {
9+
namespace = "com.example.tfserving_flutter"
10+
compileSdk = flutter.compileSdkVersion
11+
ndkVersion = flutter.ndkVersion
12+
13+
compileOptions {
14+
sourceCompatibility = JavaVersion.VERSION_11
15+
targetCompatibility = JavaVersion.VERSION_11
16+
}
17+
18+
kotlinOptions {
19+
jvmTarget = JavaVersion.VERSION_11.toString()
20+
}
21+
22+
defaultConfig {
23+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
24+
applicationId = "com.example.tfserving_flutter"
25+
// You can update the following values to match your application needs.
26+
// For more information, see: https://flutter.dev/to/review-gradle-config.
27+
minSdk = flutter.minSdkVersion
28+
targetSdk = flutter.targetSdkVersion
29+
versionCode = flutter.versionCode
30+
versionName = flutter.versionName
31+
}
32+
33+
buildTypes {
34+
release {
35+
// TODO: Add your own signing config for the release build.
36+
// Signing with the debug keys for now, so `flutter run --release` works.
37+
signingConfig = signingConfigs.getByName("debug")
38+
}
39+
}
40+
}
41+
42+
flutter {
43+
source = "../.."
44+
}

tfserving-flutter/codelab2/finished/android/app/src/debug/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.tfserving_flutter">
3-
<!-- Flutter needs it to communicate with the running application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<!-- The INTERNET permission is required for development. Specifically,
3+
the Flutter tool needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>

tfserving-flutter/codelab2/finished/android/app/src/main/AndroidManifest.xml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.tfserving_flutter">
3-
<application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<application
43
android:label="tfserving_flutter"
54
android:name="${applicationName}"
65
android:icon="@mipmap/ic_launcher">
76
<activity
87
android:name=".MainActivity"
98
android:exported="true"
109
android:launchMode="singleTop"
10+
android:taskAffinity=""
1111
android:theme="@style/LaunchTheme"
1212
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1313
android:hardwareAccelerated="true"
@@ -31,4 +31,15 @@
3131
android:name="flutterEmbedding"
3232
android:value="2" />
3333
</application>
34+
<!-- Required to query activities that can process text, see:
35+
https://developer.android.com/training/package-visibility and
36+
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
37+
38+
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
39+
<queries>
40+
<intent>
41+
<action android:name="android.intent.action.PROCESS_TEXT"/>
42+
<data android:mimeType="text/plain"/>
43+
</intent>
44+
</queries>
3445
</manifest>

tfserving-flutter/codelab2/finished/android/app/src/main/kotlin/com/example/tfserving_flutter/MainActivity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ package com.example.tfserving_flutter
22

33
import io.flutter.embedding.android.FlutterActivity
44

5-
class MainActivity: FlutterActivity() {
6-
}
5+
class MainActivity : FlutterActivity()

tfserving-flutter/codelab2/finished/android/app/src/main/res/values-night/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
44
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
55
<!-- Show a splash screen on the activity. Automatically removed when
6-
Flutter draws its first frame -->
6+
the Flutter engine draws its first frame -->
77
<item name="android:windowBackground">@drawable/launch_background</item>
88
</style>
99
<!-- Theme applied to the Android Window as soon as the process has started.

tfserving-flutter/codelab2/finished/android/app/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
44
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
55
<!-- Show a splash screen on the activity. Automatically removed when
6-
Flutter draws its first frame -->
6+
the Flutter engine draws its first frame -->
77
<item name="android:windowBackground">@drawable/launch_background</item>
88
</style>
99
<!-- Theme applied to the Android Window as soon as the process has started.

tfserving-flutter/codelab2/finished/android/app/src/profile/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.tfserving_flutter">
3-
<!-- Flutter needs it to communicate with the running application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<!-- The INTERNET permission is required for development. Specifically,
3+
the Flutter tool needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>

tfserving-flutter/codelab2/finished/android/build.gradle

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
allprojects {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
}
6+
}
7+
8+
val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
9+
rootProject.layout.buildDirectory.value(newBuildDir)
10+
11+
subprojects {
12+
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
13+
project.layout.buildDirectory.value(newSubprojectBuildDir)
14+
}
15+
subprojects {
16+
project.evaluationDependsOn(":app")
17+
}
18+
19+
tasks.register<Delete>("clean") {
20+
delete(rootProject.layout.buildDirectory)
21+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
org.gradle.jvmargs=-Xmx1536M
1+
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
22
android.useAndroidX=true
33
android.enableJetifier=true
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Fri Jun 23 08:50:38 CEST 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

tfserving-flutter/codelab2/finished/android/settings.gradle

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
pluginManagement {
2+
val flutterSdkPath = run {
3+
val properties = java.util.Properties()
4+
file("local.properties").inputStream().use { properties.load(it) }
5+
val flutterSdkPath = properties.getProperty("flutter.sdk")
6+
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
7+
flutterSdkPath
8+
}
9+
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11+
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
18+
19+
plugins {
20+
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
21+
id("com.android.application") version "8.7.0" apply false
22+
id("org.jetbrains.kotlin.android") version "1.8.22" apply false
23+
}
24+
25+
include(":app")

tfserving-flutter/codelab2/finished/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>9.0</string>
24+
<string>12.0</string>
2525
</dict>
2626
</plist>

0 commit comments

Comments
 (0)