Move flutter_gallery to the testing folder (#52532)
Move Flutter Gallery to dev/integration_tests/ as it is an older copy used only for testing. The current version of the Flutter Gallery now lives in https://github.com/flutter/gallery.
@@ -0,0 +1,84 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file('local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
localPropertiesFile.withReader('UTF-8') { reader ->
|
||||
localProperties.load(reader)
|
||||
}
|
||||
}
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
if (flutterRoot == null) {
|
||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
// The Gallery app's version is defined by the Flutter framework's version.
|
||||
def flutterVersion = file("$flutterRoot/version").text
|
||||
def flutterVersionComponents = flutterVersion.split(/[^0-9]+/)
|
||||
// Let the integer version code of xx.yy.zz-pre.nnn be xxyyzznnn.
|
||||
int flutterVersionNumber = Math.min(flutterVersionComponents[0].toInteger(), 20) * 100000000
|
||||
flutterVersionNumber += Math.min(flutterVersionComponents[1].toInteger(), 99) * 1000000
|
||||
flutterVersionNumber += Math.min(flutterVersionComponents[2].toInteger(), 999) * 1000
|
||||
if (flutterVersionComponents.length > 3) {
|
||||
flutterVersionNumber += Math.min(flutterVersionComponents[3].toInteger(), 999)
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = "$flutterVersionNumber"
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||
if (flutterVersionName == null) {
|
||||
flutterVersionName = "$flutterVersion"
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
|
||||
lintOptions {
|
||||
disable 'InvalidPackage'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId "io.flutter.demo.gallery"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 28
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
|
||||
aaptOptions {
|
||||
// TODO(goderbauer): remove when https://github.com/flutter/flutter/issues/8986 is resolved.
|
||||
if(System.getenv("FLUTTER_CI_WIN")) {
|
||||
println "AAPT cruncher disabled when running on Win CI."
|
||||
cruncherEnabled false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation 'junit:junit:4.13'
|
||||
androidTestImplementation 'androidx.test:rules:1.1.1'
|
||||
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package io.flutter.demo.gallery;
|
||||
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class FlutterGalleryInstrumentationTest {
|
||||
@Rule
|
||||
public ActivityTestRule<MainActivity> mActivityRule =
|
||||
new ActivityTestRule<>(MainActivity.class);
|
||||
|
||||
private MainActivity activity;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
activity = mActivityRule.getActivity();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void activityLoaded() throws Exception {
|
||||
FlutterGalleryInstrumentation instrumentation = activity.getInstrumentation();
|
||||
instrumentation.waitForTestToFinish();
|
||||
assertThat(instrumentation.isTestSuccessful(), is(true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
Use of this source code is governed by a BSD-style license that can be
|
||||
found in the LICENSE file. -->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="io.flutter.demo.gallery">
|
||||
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<application android:label="Gallery" android:icon="@mipmap/ic_launcher">
|
||||
<activity android:name=".MainActivity"
|
||||
android:theme="@android:style/Theme.Light.NoTitleBar"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package io.flutter.demo.gallery;
|
||||
|
||||
import android.os.ConditionVariable;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import io.flutter.plugin.common.BinaryMessenger;
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
|
||||
import io.flutter.plugin.common.MethodChannel.Result;
|
||||
|
||||
/** Instrumentation for testing using Android Espresso framework. */
|
||||
public class FlutterGalleryInstrumentation implements MethodCallHandler {
|
||||
private final ConditionVariable testFinished = new ConditionVariable();
|
||||
private volatile boolean testSuccessful;
|
||||
|
||||
FlutterGalleryInstrumentation(@NonNull BinaryMessenger messenger) {
|
||||
new MethodChannel(messenger, "io.flutter.demo.gallery/TestLifecycleListener")
|
||||
.setMethodCallHandler(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
|
||||
testSuccessful = call.method.equals("success");
|
||||
testFinished.open();
|
||||
result.success(null);
|
||||
}
|
||||
|
||||
public boolean isTestSuccessful() {
|
||||
return testSuccessful;
|
||||
}
|
||||
|
||||
public void waitForTestToFinish() throws Exception {
|
||||
testFinished.block();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package io.flutter.demo.gallery;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import io.flutter.embedding.android.FlutterActivity;
|
||||
import io.flutter.embedding.engine.FlutterEngine;
|
||||
|
||||
public class MainActivity extends FlutterActivity {
|
||||
private FlutterGalleryInstrumentation instrumentation;
|
||||
|
||||
/** Instrumentation for testing. */
|
||||
public FlutterGalleryInstrumentation getInstrumentation() {
|
||||
return instrumentation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
|
||||
super.configureFlutterEngine(flutterEngine);
|
||||
instrumentation = new FlutterGalleryInstrumentation(flutterEngine.getDartExecutor());
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 442 B |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
36
dev/integration_tests/flutter_gallery/android/build.gradle
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
maven {
|
||||
url 'https://google.bintray.com/exoplayer/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.buildDir = '../build'
|
||||
subprojects {
|
||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||
}
|
||||
subprojects {
|
||||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package_name "io.flutter.demo.gallery"
|
||||
@@ -0,0 +1,25 @@
|
||||
# Prevent Fastlane from overwriting README.md
|
||||
skip_docs
|
||||
|
||||
default_platform(:android)
|
||||
|
||||
# This should be run after running
|
||||
# flutter build apk --release
|
||||
# to build the app using the Flutter toolchain.
|
||||
platform :android do
|
||||
desc 'Push the built release APK to alpha or beta depending on current branch'
|
||||
lane :deploy_play_store do
|
||||
begin
|
||||
upload_to_play_store(
|
||||
track: 'alpha',
|
||||
apk: '../build/app/outputs/apk/release/app-release.apk',
|
||||
json_key_data: ENV['GOOGLE_DEVELOPER_SERVICE_ACCOUNT_ACTOR_FASTLANE'],
|
||||
skip_upload_screenshots: true,
|
||||
skip_upload_images: true
|
||||
)
|
||||
rescue => exception
|
||||
raise exception unless exception.message.include?('apkUpgradeVersionConflict')
|
||||
puts 'Current version already present on the Play Store. Omitting this upload.'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
FastLane documentation
|
||||
================
|
||||
This folder contains hermetic scripts to deploy a built APK to the play store.
|
||||
|
||||
This is done using the [FastLane](https://fastlane.tools) tool suite.
|
||||
|
||||
Deployment can be done manually by Googlers by following
|
||||
go/flutter-gallery-publish (internal doc).
|
||||
|
||||
Deployment is automatically done by Cirrus on tagged branch commits.
|
||||
@@ -0,0 +1,9 @@
|
||||
(Flutter is beta technology)
|
||||
|
||||
A gallery of widgets and behaviors, plus demos and vignettes, all built with Flutter.
|
||||
|
||||
Flutter is Google’s multi-platform mobile app SDK for crafting beautiful native experiences on iOS and Android in record time.
|
||||
|
||||
This app is open source. Check out the code to see how this app is built: https://github.com/flutter/flutter/tree/master/dev/integration_tests/flutter_gallery
|
||||
|
||||
Visit https://flutter.dev to learn more.
|
||||
@@ -0,0 +1 @@
|
||||
A gallery showcasing apps and widgets build using the Flutter framework
|
||||
@@ -0,0 +1 @@
|
||||
Flutter Gallery
|
||||
@@ -0,0 +1,4 @@
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
android.enableR8=true
|
||||
6
dev/integration_tests/flutter_gallery/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#Fri Jun 23 08:50:38 CEST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
|
||||
@@ -0,0 +1,19 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
include ':app'
|
||||
|
||||
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||
|
||||
def plugins = new Properties()
|
||||
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
||||
if (pluginsFile.exists()) {
|
||||
pluginsFile.withInputStream { stream -> plugins.load(stream) }
|
||||
}
|
||||
|
||||
plugins.each { name, path ->
|
||||
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
||||
include ":$name"
|
||||
project(":$name").projectDir = pluginDirectory
|
||||
}
|
||||