From 4fc172c3071cd3e921d4ea9b37f293f6c0b8895b Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Sun, 7 Apr 2019 22:23:34 +0800 Subject: [PATCH] add android sample gradle support --- .gitignore | 3 ++ android/sample/BUCK | 2 +- android/sample/build.gradle | 30 ++++++++++++++++++ .../sample/{ => src/main}/AndroidManifest.xml | 8 ----- .../main}/java/com/facebook/samples/yoga/BUCK | 0 .../samples/yoga/BenchmarkActivity.java | 0 .../samples/yoga/BenchmarkAggregator.java | 0 .../samples/yoga/BenchmarkFragment.java | 0 .../samples/yoga/BenchmarkInflate.java | 0 .../samples/yoga/BenchmarkLayout.java | 0 .../samples/yoga/BenchmarkMeasure.java | 0 .../facebook/samples/yoga/MainActivity.java | 0 .../res/drawable/action_bar_background.xml | 0 .../main}/res/drawable/ic_launcher.png | Bin .../drawable/sample_children_background.xml | 0 .../main}/res/layout/benchmark_fragment.xml | 0 .../main}/res/layout/benchmark_layout_1.xml | 0 .../res/layout/benchmark_layout_1_linear.xml | 0 .../main}/res/layout/benchmark_layout_2.xml | 0 .../res/layout/benchmark_layout_2_linear.xml | 0 .../main}/res/layout/benchmark_layout_3.xml | 0 .../res/layout/benchmark_layout_3_linear.xml | 0 .../res/layout/benchmark_select_layout.xml | 0 .../{ => src/main}/res/layout/main_layout.xml | 0 .../main}/res/menu/action_bar_benchmark.xml | 0 .../main}/res/menu/action_bar_home.xml | 0 .../{ => src/main}/res/values/colors.xml | 0 .../{ => src/main}/res/values/strings.xml | 0 .../{ => src/main}/res/values/styles.xml | 0 build.gradle | 6 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 1 + 32 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 android/sample/build.gradle rename android/sample/{ => src/main}/AndroidManifest.xml (85%) rename android/sample/{ => src/main}/java/com/facebook/samples/yoga/BUCK (100%) rename android/sample/{ => src/main}/java/com/facebook/samples/yoga/BenchmarkActivity.java (100%) rename android/sample/{ => src/main}/java/com/facebook/samples/yoga/BenchmarkAggregator.java (100%) rename android/sample/{ => src/main}/java/com/facebook/samples/yoga/BenchmarkFragment.java (100%) rename android/sample/{ => src/main}/java/com/facebook/samples/yoga/BenchmarkInflate.java (100%) rename android/sample/{ => src/main}/java/com/facebook/samples/yoga/BenchmarkLayout.java (100%) rename android/sample/{ => src/main}/java/com/facebook/samples/yoga/BenchmarkMeasure.java (100%) rename android/sample/{ => src/main}/java/com/facebook/samples/yoga/MainActivity.java (100%) rename android/sample/{ => src/main}/res/drawable/action_bar_background.xml (100%) rename android/sample/{ => src/main}/res/drawable/ic_launcher.png (100%) rename android/sample/{ => src/main}/res/drawable/sample_children_background.xml (100%) rename android/sample/{ => src/main}/res/layout/benchmark_fragment.xml (100%) rename android/sample/{ => src/main}/res/layout/benchmark_layout_1.xml (100%) rename android/sample/{ => src/main}/res/layout/benchmark_layout_1_linear.xml (100%) rename android/sample/{ => src/main}/res/layout/benchmark_layout_2.xml (100%) rename android/sample/{ => src/main}/res/layout/benchmark_layout_2_linear.xml (100%) rename android/sample/{ => src/main}/res/layout/benchmark_layout_3.xml (100%) rename android/sample/{ => src/main}/res/layout/benchmark_layout_3_linear.xml (100%) rename android/sample/{ => src/main}/res/layout/benchmark_select_layout.xml (100%) rename android/sample/{ => src/main}/res/layout/main_layout.xml (100%) rename android/sample/{ => src/main}/res/menu/action_bar_benchmark.xml (100%) rename android/sample/{ => src/main}/res/menu/action_bar_home.xml (100%) rename android/sample/{ => src/main}/res/values/colors.xml (100%) rename android/sample/{ => src/main}/res/values/strings.xml (100%) rename android/sample/{ => src/main}/res/values/styles.xml (100%) diff --git a/.gitignore b/.gitignore index c4a6bf0f..6d847cab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.idea/ +*.iml +local.properties .DS_STORE /buck-cache/ diff --git a/android/sample/BUCK b/android/sample/BUCK index 0989fcd6..f248059e 100644 --- a/android/sample/BUCK +++ b/android/sample/BUCK @@ -10,7 +10,7 @@ load("//tools/build_defs/oss:yoga_defs.bzl", "ANDROID_RES_TARGET", "ANDROID_SAMP yoga_android_binary( name = "sample", keystore = ":debug_keystore", - manifest = "AndroidManifest.xml", + manifest = "src/main/AndroidManifest.xml", deps = [ ANDROID_SAMPLE_JAVA_TARGET, ANDROID_SAMPLE_RES_TARGET, diff --git a/android/sample/build.gradle b/android/sample/build.gradle new file mode 100644 index 00000000..cffb4165 --- /dev/null +++ b/android/sample/build.gradle @@ -0,0 +1,30 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +apply plugin: 'com.android.application' + +android { + compileSdkVersion rootProject.compileSdkVersion + buildToolsVersion rootProject.buildToolsVersion + + defaultConfig { + applicationId "com.facebook.samples.yoga" + minSdkVersion rootProject.minSdkVersion + targetSdkVersion rootProject.targetSdkVersion + } + + compileOptions { + targetCompatibility rootProject.targetCompatibilityVersion + sourceCompatibility rootProject.sourceCompatibilityVersion + } +} + +dependencies { + implementation project(':yoga-layout') + implementation "com.android.support:appcompat-v7:28.0.0" + implementation "com.facebook.soloader:soloader:0.6.0" +} diff --git a/android/sample/AndroidManifest.xml b/android/sample/src/main/AndroidManifest.xml similarity index 85% rename from android/sample/AndroidManifest.xml rename to android/sample/src/main/AndroidManifest.xml index a47e1e0d..3775d73f 100644 --- a/android/sample/AndroidManifest.xml +++ b/android/sample/src/main/AndroidManifest.xml @@ -14,14 +14,6 @@ android:versionName="1.0" > - - - - -