diff --git a/engine/src/flutter/testing/scenario_app/.gitignore b/engine/src/flutter/testing/scenario_app/.gitignore new file mode 100644 index 0000000000..6dc8f6e23d --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/.gitignore @@ -0,0 +1,7 @@ +.packages +pubspec.lock # This only has local dependencies in it. +build/ + +ios/Scenarios/*.framework/ +android/app/libs/flutter.jar +android/app/src/main/jniLibs/arm64-v8a/libapp.so diff --git a/engine/src/flutter/testing/scenario_app/README.md b/engine/src/flutter/testing/scenario_app/README.md new file mode 100644 index 0000000000..2bf5448798 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/README.md @@ -0,0 +1,47 @@ +# Scenario App + +This folder contains a dart:ui application and scripts to compile it to AOT +for exercising embedders. + +It intentionally has no dependencies on the Flutter framework or tooling, such +that it should be buildable as a presubmit or postsubmit to the engine even in +the face of changes to Dart or dart:ui that require upstream changes in the +Flutter tooling. + +To add a new scenario, create a new subclass of `Scenario` and add it to the +map in `main.dart`. For an example, see animated_color_square.dart, which draws +a continuously animating colored square that bounces off the sides of the +viewport. + +## Building for iOS + +In this folder, after building the `ios_host` and `ios_profile` engine targets, +run: + +```bash +./compile_ios_aot.sh ../../../out/host_profile ../../../out/ios_profile/clang_x64/ +``` + +This will create an `App.framework` copy it as well as the correct +`Flutter.framework` to where the Xcode project expects to find them. + +You can then use `xcodebuild` to build the `ios/Scenarios/Scenarios.xcodeproj`, +or open that in Xcode and build it that way. + +Currently, only AOT modes are supported. + +## Building for Android + +In this folder, after building the `host_profile` and `android_profile_arm64` +engine targets, run: + +```bash +./compile_android_aot.sh ../../../out/host_profile ../../../out/android_profile_arm64/clang_x64/ +``` + +This will produce a suitable `libapp.so` for building with an Android app and +copy it (along with flutter.jar) to where Gradle will expect to find it to build +the app in the `android/` folder. The app can be run by opening it in Android +Studio and running it, or by running `./gradlew assemble` in the `android/` +folder and installing the APK from the correct folder in +`android/app/build/outputs/apk`. diff --git a/engine/src/flutter/testing/scenario_app/android/.gitignore b/engine/src/flutter/testing/scenario_app/android/.gitignore new file mode 100644 index 0000000000..b32f6f298e --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/.gitignore @@ -0,0 +1,14 @@ +*.iml +.gradle +/local.properties +.settings +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/engine/src/flutter/testing/scenario_app/android/app/.gitignore b/engine/src/flutter/testing/scenario_app/android/app/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/engine/src/flutter/testing/scenario_app/android/app/build.gradle b/engine/src/flutter/testing/scenario_app/android/app/build.gradle new file mode 100644 index 0000000000..8dee894a27 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/build.gradle @@ -0,0 +1,33 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 28 + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + defaultConfig { + applicationId "dev.flutter.scenarios" + minSdkVersion 16 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'com.android.support.constraint:constraint-layout:1.1.3' + implementation 'com.android.support:design:28.0.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' +} diff --git a/engine/src/flutter/testing/scenario_app/android/app/proguard-rules.pro b/engine/src/flutter/testing/scenario_app/android/app/proguard-rules.pro new file mode 100644 index 0000000000..f1b424510d --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenarios/ExampleInstrumentedTest.java b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenarios/ExampleInstrumentedTest.java new file mode 100644 index 0000000000..edcfc22fee --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenarios/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package dev.flutter.scenarios; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("dev.flutter.scenarios", appContext.getPackageName()); + } +} diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/AndroidManifest.xml b/engine/src/flutter/testing/scenario_app/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..87eef225a8 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/MainActivity.java b/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/MainActivity.java new file mode 100644 index 0000000000..c288494438 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/MainActivity.java @@ -0,0 +1,12 @@ +package dev.flutter.scenarios; + +import android.os.Bundle; + +import io.flutter.app.FlutterActivity; + +public class MainActivity extends FlutterActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } +} diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000000..1f6bb29060 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/drawable/ic_launcher_background.xml b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000000..0d025f9bf6 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000000..eca70cfe52 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000000..eca70cfe52 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..898f3ed59a Binary files /dev/null and b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000000..dffca3601e Binary files /dev/null and b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..64ba76f75e Binary files /dev/null and b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000000..dae5e08234 Binary files /dev/null and b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..e5ed46597e Binary files /dev/null and b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..14ed0af350 Binary files /dev/null and b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..b0907cac3b Binary files /dev/null and b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..d8ae031549 Binary files /dev/null and b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..2c18de9e66 Binary files /dev/null and b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..beed3cdd2c Binary files /dev/null and b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/colors.xml b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/colors.xml new file mode 100644 index 0000000000..69b22338c6 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #008577 + #00574B + #D81B60 + diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/dimens.xml b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000000..59a0b0c4f5 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/dimens.xml @@ -0,0 +1,3 @@ + + 16dp + diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/strings.xml b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000000..1cc6e997d7 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + Scenarios + MainActivity + diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/styles.xml b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000..545b9c6d2c --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + +