From 8da4778e1d36111e39829d88edbe91dc041368f4 Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Wed, 15 Feb 2017 17:13:10 +0100 Subject: [PATCH] Update /examples/ to new gradle based build flow (#8173) * Update hello_world to new gradle based build flow * Update flutter_gallery to gradle based build * Align hello_services with new gradle based build * Update platform_services to new gradle based build * Upgrade stock to gradle based build --- examples/flutter_gallery/android/.gitignore | 12 +++++ .../flutter_gallery/android/app/build.gradle | 46 ++++++++++++++++++ .../{ => app/src/main}/AndroidManifest.xml | 0 .../src/main}/res/mipmap-hdpi/ic_launcher.png | Bin .../src/main}/res/mipmap-mdpi/ic_launcher.png | Bin .../main}/res/mipmap-xhdpi/ic_launcher.png | Bin .../main}/res/mipmap-xxhdpi/ic_launcher.png | Bin .../main}/res/mipmap-xxxhdpi/ic_launcher.png | Bin examples/flutter_gallery/android/build.gradle | 23 +++++++++ .../flutter_gallery/android/gradle.properties | 1 + .../flutter_gallery/android/settings.gradle | 1 + .../hello_services/android/app/build.gradle | 2 +- examples/hello_world/android/.gitignore | 12 +++++ examples/hello_world/android/app/build.gradle | 46 ++++++++++++++++++ .../{ => app/src/main}/AndroidManifest.xml | 0 examples/hello_world/android/build.gradle | 23 +++++++++ .../hello_world/android/gradle.properties | 1 + examples/hello_world/android/settings.gradle | 1 + .../android/app/build.gradle | 2 +- .../android/app/src/main/AndroidManifest.xml | 6 +-- examples/stocks/android/.gitignore | 12 +++++ examples/stocks/android/app/build.gradle | 46 ++++++++++++++++++ .../{ => app/src/main}/AndroidManifest.xml | 0 .../src/main}/res/mipmap-hdpi/ic_launcher.png | Bin .../src/main}/res/mipmap-mdpi/ic_launcher.png | Bin .../main}/res/mipmap-xhdpi/ic_launcher.png | Bin .../main}/res/mipmap-xxhdpi/ic_launcher.png | Bin .../main}/res/mipmap-xxxhdpi/ic_launcher.png | Bin examples/stocks/android/build.gradle | 23 +++++++++ examples/stocks/android/gradle.properties | 1 + examples/stocks/android/settings.gradle | 1 + 31 files changed, 254 insertions(+), 5 deletions(-) create mode 100644 examples/flutter_gallery/android/.gitignore create mode 100644 examples/flutter_gallery/android/app/build.gradle rename examples/flutter_gallery/android/{ => app/src/main}/AndroidManifest.xml (100%) rename examples/flutter_gallery/android/{ => app/src/main}/res/mipmap-hdpi/ic_launcher.png (100%) rename examples/flutter_gallery/android/{ => app/src/main}/res/mipmap-mdpi/ic_launcher.png (100%) rename examples/flutter_gallery/android/{ => app/src/main}/res/mipmap-xhdpi/ic_launcher.png (100%) rename examples/flutter_gallery/android/{ => app/src/main}/res/mipmap-xxhdpi/ic_launcher.png (100%) rename examples/flutter_gallery/android/{ => app/src/main}/res/mipmap-xxxhdpi/ic_launcher.png (100%) create mode 100644 examples/flutter_gallery/android/build.gradle create mode 100644 examples/flutter_gallery/android/gradle.properties create mode 100644 examples/flutter_gallery/android/settings.gradle create mode 100644 examples/hello_world/android/.gitignore create mode 100644 examples/hello_world/android/app/build.gradle rename examples/hello_world/android/{ => app/src/main}/AndroidManifest.xml (100%) create mode 100644 examples/hello_world/android/build.gradle create mode 100644 examples/hello_world/android/gradle.properties create mode 100644 examples/hello_world/android/settings.gradle create mode 100644 examples/stocks/android/.gitignore create mode 100644 examples/stocks/android/app/build.gradle rename examples/stocks/android/{ => app/src/main}/AndroidManifest.xml (100%) rename examples/stocks/android/{ => app/src/main}/res/mipmap-hdpi/ic_launcher.png (100%) rename examples/stocks/android/{ => app/src/main}/res/mipmap-mdpi/ic_launcher.png (100%) rename examples/stocks/android/{ => app/src/main}/res/mipmap-xhdpi/ic_launcher.png (100%) rename examples/stocks/android/{ => app/src/main}/res/mipmap-xxhdpi/ic_launcher.png (100%) rename examples/stocks/android/{ => app/src/main}/res/mipmap-xxxhdpi/ic_launcher.png (100%) create mode 100644 examples/stocks/android/build.gradle create mode 100644 examples/stocks/android/gradle.properties create mode 100644 examples/stocks/android/settings.gradle diff --git a/examples/flutter_gallery/android/.gitignore b/examples/flutter_gallery/android/.gitignore new file mode 100644 index 0000000000..5c4ef82869 --- /dev/null +++ b/examples/flutter_gallery/android/.gitignore @@ -0,0 +1,12 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures + +/gradle +/gradlew +/gradlew.bat diff --git a/examples/flutter_gallery/android/app/build.gradle b/examples/flutter_gallery/android/app/build.gradle new file mode 100644 index 0000000000..90c289901d --- /dev/null +++ b/examples/flutter_gallery/android/app/build.gradle @@ -0,0 +1,46 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withInputStream { stream -> + localProperties.load(stream) + } +} + +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.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 25 + buildToolsVersion '24.0.1' + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + testInstrumentationRunner "android.support.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 + } + } +} + +flutter { + source '../..' +} + +dependencies { + androidTestCompile 'com.android.support:support-annotations:25.0.0' + androidTestCompile 'com.android.support.test:runner:0.5' + androidTestCompile 'com.android.support.test:rules:0.5' +} diff --git a/examples/flutter_gallery/android/AndroidManifest.xml b/examples/flutter_gallery/android/app/src/main/AndroidManifest.xml similarity index 100% rename from examples/flutter_gallery/android/AndroidManifest.xml rename to examples/flutter_gallery/android/app/src/main/AndroidManifest.xml diff --git a/examples/flutter_gallery/android/res/mipmap-hdpi/ic_launcher.png b/examples/flutter_gallery/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from examples/flutter_gallery/android/res/mipmap-hdpi/ic_launcher.png rename to examples/flutter_gallery/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/examples/flutter_gallery/android/res/mipmap-mdpi/ic_launcher.png b/examples/flutter_gallery/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from examples/flutter_gallery/android/res/mipmap-mdpi/ic_launcher.png rename to examples/flutter_gallery/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/examples/flutter_gallery/android/res/mipmap-xhdpi/ic_launcher.png b/examples/flutter_gallery/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from examples/flutter_gallery/android/res/mipmap-xhdpi/ic_launcher.png rename to examples/flutter_gallery/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/examples/flutter_gallery/android/res/mipmap-xxhdpi/ic_launcher.png b/examples/flutter_gallery/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from examples/flutter_gallery/android/res/mipmap-xxhdpi/ic_launcher.png rename to examples/flutter_gallery/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/examples/flutter_gallery/android/res/mipmap-xxxhdpi/ic_launcher.png b/examples/flutter_gallery/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from examples/flutter_gallery/android/res/mipmap-xxxhdpi/ic_launcher.png rename to examples/flutter_gallery/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/examples/flutter_gallery/android/build.gradle b/examples/flutter_gallery/android/build.gradle new file mode 100644 index 0000000000..d82a1548b9 --- /dev/null +++ b/examples/flutter_gallery/android/build.gradle @@ -0,0 +1,23 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:2.2.3' + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.14.1' +} diff --git a/examples/flutter_gallery/android/gradle.properties b/examples/flutter_gallery/android/gradle.properties new file mode 100644 index 0000000000..8bd86f6805 --- /dev/null +++ b/examples/flutter_gallery/android/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M diff --git a/examples/flutter_gallery/android/settings.gradle b/examples/flutter_gallery/android/settings.gradle new file mode 100644 index 0000000000..e7b4def49c --- /dev/null +++ b/examples/flutter_gallery/android/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/examples/hello_services/android/app/build.gradle b/examples/hello_services/android/app/build.gradle index a8a6695f60..90c289901d 100644 --- a/examples/hello_services/android/app/build.gradle +++ b/examples/hello_services/android/app/build.gradle @@ -16,7 +16,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion 25 - buildToolsVersion '24.0.2' + buildToolsVersion '24.0.1' lintOptions { disable 'InvalidPackage' diff --git a/examples/hello_world/android/.gitignore b/examples/hello_world/android/.gitignore new file mode 100644 index 0000000000..5c4ef82869 --- /dev/null +++ b/examples/hello_world/android/.gitignore @@ -0,0 +1,12 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures + +/gradle +/gradlew +/gradlew.bat diff --git a/examples/hello_world/android/app/build.gradle b/examples/hello_world/android/app/build.gradle new file mode 100644 index 0000000000..90c289901d --- /dev/null +++ b/examples/hello_world/android/app/build.gradle @@ -0,0 +1,46 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withInputStream { stream -> + localProperties.load(stream) + } +} + +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.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 25 + buildToolsVersion '24.0.1' + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + testInstrumentationRunner "android.support.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 + } + } +} + +flutter { + source '../..' +} + +dependencies { + androidTestCompile 'com.android.support:support-annotations:25.0.0' + androidTestCompile 'com.android.support.test:runner:0.5' + androidTestCompile 'com.android.support.test:rules:0.5' +} diff --git a/examples/hello_world/android/AndroidManifest.xml b/examples/hello_world/android/app/src/main/AndroidManifest.xml similarity index 100% rename from examples/hello_world/android/AndroidManifest.xml rename to examples/hello_world/android/app/src/main/AndroidManifest.xml diff --git a/examples/hello_world/android/build.gradle b/examples/hello_world/android/build.gradle new file mode 100644 index 0000000000..d82a1548b9 --- /dev/null +++ b/examples/hello_world/android/build.gradle @@ -0,0 +1,23 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:2.2.3' + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.14.1' +} diff --git a/examples/hello_world/android/gradle.properties b/examples/hello_world/android/gradle.properties new file mode 100644 index 0000000000..8bd86f6805 --- /dev/null +++ b/examples/hello_world/android/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M diff --git a/examples/hello_world/android/settings.gradle b/examples/hello_world/android/settings.gradle new file mode 100644 index 0000000000..e7b4def49c --- /dev/null +++ b/examples/hello_world/android/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/examples/platform_services/android/app/build.gradle b/examples/platform_services/android/app/build.gradle index 4e2e46b56c..90c289901d 100644 --- a/examples/platform_services/android/app/build.gradle +++ b/examples/platform_services/android/app/build.gradle @@ -16,7 +16,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion 25 - buildToolsVersion '25.0.2' + buildToolsVersion '24.0.1' lintOptions { disable 'InvalidPackage' diff --git a/examples/platform_services/android/app/src/main/AndroidManifest.xml b/examples/platform_services/android/app/src/main/AndroidManifest.xml index 772377e0e8..37157b749a 100644 --- a/examples/platform_services/android/app/src/main/AndroidManifest.xml +++ b/examples/platform_services/android/app/src/main/AndroidManifest.xml @@ -1,10 +1,10 @@ + android:versionName="0.0.1"> - + diff --git a/examples/stocks/android/.gitignore b/examples/stocks/android/.gitignore new file mode 100644 index 0000000000..5c4ef82869 --- /dev/null +++ b/examples/stocks/android/.gitignore @@ -0,0 +1,12 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures + +/gradle +/gradlew +/gradlew.bat diff --git a/examples/stocks/android/app/build.gradle b/examples/stocks/android/app/build.gradle new file mode 100644 index 0000000000..90c289901d --- /dev/null +++ b/examples/stocks/android/app/build.gradle @@ -0,0 +1,46 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withInputStream { stream -> + localProperties.load(stream) + } +} + +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.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 25 + buildToolsVersion '24.0.1' + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + testInstrumentationRunner "android.support.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 + } + } +} + +flutter { + source '../..' +} + +dependencies { + androidTestCompile 'com.android.support:support-annotations:25.0.0' + androidTestCompile 'com.android.support.test:runner:0.5' + androidTestCompile 'com.android.support.test:rules:0.5' +} diff --git a/examples/stocks/android/AndroidManifest.xml b/examples/stocks/android/app/src/main/AndroidManifest.xml similarity index 100% rename from examples/stocks/android/AndroidManifest.xml rename to examples/stocks/android/app/src/main/AndroidManifest.xml diff --git a/examples/stocks/android/res/mipmap-hdpi/ic_launcher.png b/examples/stocks/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from examples/stocks/android/res/mipmap-hdpi/ic_launcher.png rename to examples/stocks/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/examples/stocks/android/res/mipmap-mdpi/ic_launcher.png b/examples/stocks/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from examples/stocks/android/res/mipmap-mdpi/ic_launcher.png rename to examples/stocks/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/examples/stocks/android/res/mipmap-xhdpi/ic_launcher.png b/examples/stocks/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from examples/stocks/android/res/mipmap-xhdpi/ic_launcher.png rename to examples/stocks/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/examples/stocks/android/res/mipmap-xxhdpi/ic_launcher.png b/examples/stocks/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from examples/stocks/android/res/mipmap-xxhdpi/ic_launcher.png rename to examples/stocks/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/examples/stocks/android/res/mipmap-xxxhdpi/ic_launcher.png b/examples/stocks/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from examples/stocks/android/res/mipmap-xxxhdpi/ic_launcher.png rename to examples/stocks/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/examples/stocks/android/build.gradle b/examples/stocks/android/build.gradle new file mode 100644 index 0000000000..d82a1548b9 --- /dev/null +++ b/examples/stocks/android/build.gradle @@ -0,0 +1,23 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:2.2.3' + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.14.1' +} diff --git a/examples/stocks/android/gradle.properties b/examples/stocks/android/gradle.properties new file mode 100644 index 0000000000..8bd86f6805 --- /dev/null +++ b/examples/stocks/android/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M diff --git a/examples/stocks/android/settings.gradle b/examples/stocks/android/settings.gradle new file mode 100644 index 0000000000..e7b4def49c --- /dev/null +++ b/examples/stocks/android/settings.gradle @@ -0,0 +1 @@ +include ':app'