diff --git a/YOGA_DEFS b/YOGA_DEFS index 1aaf9c11..1c71e4c0 100644 --- a/YOGA_DEFS +++ b/YOGA_DEFS @@ -11,6 +11,9 @@ JNI_TARGET = '//lib/jni:jni' FBJNI_TARGET = '//lib/fb:fbjni' APPCOMPAT_TARGET = '//lib/appcompat:appcompat' ANDROID_SUPPORT_TARGET = '//lib/android-support:android-support' +ANDROID_TARGET = '//android:android' +ANDROID_JAVA_TARGET = '//android/src/main/java/com/facebook/yoga/android:android' +ANDROID_RES_TARGET = '//android:res' ANDROID_SAMPLE_JAVA_TARGET = '//android/sample/java/com/facebook/samples/yoga:yoga' ANDROID_SAMPLE_RES_TARGET = '//android/sample:res' diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 00000000..f471999a --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + diff --git a/android/BUCK b/android/BUCK new file mode 100644 index 00000000..037f3be5 --- /dev/null +++ b/android/BUCK @@ -0,0 +1,36 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. An additional grant +# of patent rights can be found in the PATENTS file in the same directory. + +include_defs('//YOGA_DEFS') + +android_aar( + name = 'android', + manifest_skeleton = 'AndroidManifest.xml', + deps = [ + ANDROID_JAVA_TARGET, + ANDROID_RES_TARGET, + INFER_ANNOTATIONS_TARGET, + JAVA_TARGET, + PROGRUARD_ANNOTATIONS_TARGET, + ], + visibility = [ + 'PUBLIC', + ], +) + +android_resource( + name = 'res', + res = 'src/main/res', + package = 'com.facebook.yoga.android', + visibility = [ + 'PUBLIC', + ], +) + +project_config( + src_target = ':android', +) diff --git a/android/sample/BUCK b/android/sample/BUCK index 238d0ed2..cd8b65cb 100644 --- a/android/sample/BUCK +++ b/android/sample/BUCK @@ -1,9 +1,8 @@ -# Copyright (c) 2014-present, Facebook, Inc. +# Copyright 2014-present, Facebook, Inc. # All rights reserved. # -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. +# This source code is licensed under the license found in the +# LICENSE-examples file in the root directory of this source tree. include_defs('//YOGA_DEFS') @@ -21,6 +20,9 @@ android_resource( name = 'res', res = 'res', package = 'com.facebook.samples.yoga', + deps = [ + ANDROID_RES_TARGET, + ], visibility = [ 'PUBLIC', ], diff --git a/android/sample/java/com/facebook/samples/yoga/BUCK b/android/sample/java/com/facebook/samples/yoga/BUCK index bc411285..a3f7c717 100644 --- a/android/sample/java/com/facebook/samples/yoga/BUCK +++ b/android/sample/java/com/facebook/samples/yoga/BUCK @@ -11,17 +11,13 @@ android_library( name = 'yoga', srcs = glob(['**/*.java']), deps = [ + ANDROID_JAVA_TARGET, ANDROID_SAMPLE_RES_TARGET, ANDROID_SUPPORT_TARGET, APPCOMPAT_TARGET, - JAVA_TARGET, SOLOADER_TARGET, ], visibility = [ 'PUBLIC', ] ) - -project_config( - src_target = ":yoga" -) diff --git a/android/sample/java/com/facebook/samples/yoga/MainActivity.java b/android/sample/java/com/facebook/samples/yoga/MainActivity.java index 12de8c91..2c61f3a4 100644 --- a/android/sample/java/com/facebook/samples/yoga/MainActivity.java +++ b/android/sample/java/com/facebook/samples/yoga/MainActivity.java @@ -13,6 +13,7 @@ import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import com.facebook.samples.yoga.R; +import com.facebook.yoga.android.YogaViewLayoutFactory; /** * An activity to show off Yoga in Android. This activity shows a simple layout (defined in diff --git a/android/sample/java/com/facebook/samples/yoga/SplashScreenActivity.java b/android/sample/java/com/facebook/samples/yoga/SplashScreenActivity.java index 5553360d..6905d687 100644 --- a/android/sample/java/com/facebook/samples/yoga/SplashScreenActivity.java +++ b/android/sample/java/com/facebook/samples/yoga/SplashScreenActivity.java @@ -17,6 +17,7 @@ import android.view.LayoutInflater; import com.facebook.samples.yoga.R; import com.facebook.soloader.SoLoader; +import com.facebook.yoga.android.YogaViewLayoutFactory; /** * A (non-interactive) splash screen. Displays for two seconds before calling the main activity. diff --git a/android/src/main/java/com/facebook/yoga/android/BUCK b/android/src/main/java/com/facebook/yoga/android/BUCK new file mode 100644 index 00000000..07cdd110 --- /dev/null +++ b/android/src/main/java/com/facebook/yoga/android/BUCK @@ -0,0 +1,23 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. An additional grant +# of patent rights can be found in the PATENTS file in the same directory. + +include_defs('//YOGA_DEFS') + +android_library( + name = 'android', + srcs = glob(['**/*.java']), + deps = [ + ANDROID_RES_TARGET, + INFER_ANNOTATIONS_TARGET, + JAVA_TARGET, + JSR_305_TARGET, + SOLOADER_TARGET, + ], + visibility = [ + 'PUBLIC', + ] +) diff --git a/android/sample/java/com/facebook/samples/yoga/VirtualYogaLayout.java b/android/src/main/java/com/facebook/yoga/android/VirtualYogaLayout.java similarity index 99% rename from android/sample/java/com/facebook/samples/yoga/VirtualYogaLayout.java rename to android/src/main/java/com/facebook/yoga/android/VirtualYogaLayout.java index 865a02da..fe8d2cdf 100644 --- a/android/sample/java/com/facebook/samples/yoga/VirtualYogaLayout.java +++ b/android/src/main/java/com/facebook/yoga/android/VirtualYogaLayout.java @@ -7,7 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.samples.yoga; +package com.facebook.yoga.android; import java.util.HashMap; import java.util.LinkedList; diff --git a/android/sample/java/com/facebook/samples/yoga/YogaLayout.java b/android/src/main/java/com/facebook/yoga/android/YogaLayout.java similarity index 99% rename from android/sample/java/com/facebook/samples/yoga/YogaLayout.java rename to android/src/main/java/com/facebook/yoga/android/YogaLayout.java index 23dbc747..52607944 100644 --- a/android/sample/java/com/facebook/samples/yoga/YogaLayout.java +++ b/android/src/main/java/com/facebook/yoga/android/YogaLayout.java @@ -7,7 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.samples.yoga; +package com.facebook.yoga.android; import java.util.HashMap; import java.util.Map; @@ -25,7 +25,7 @@ import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; -import com.facebook.samples.yoga.R; +import com.facebook.yoga.android.R; import com.facebook.yoga.YogaAlign; import com.facebook.yoga.YogaConstants; import com.facebook.yoga.YogaDirection; diff --git a/android/sample/java/com/facebook/samples/yoga/YogaViewLayoutFactory.java b/android/src/main/java/com/facebook/yoga/android/YogaViewLayoutFactory.java similarity index 98% rename from android/sample/java/com/facebook/samples/yoga/YogaViewLayoutFactory.java rename to android/src/main/java/com/facebook/yoga/android/YogaViewLayoutFactory.java index 45df625f..e315ba78 100644 --- a/android/sample/java/com/facebook/samples/yoga/YogaViewLayoutFactory.java +++ b/android/src/main/java/com/facebook/yoga/android/YogaViewLayoutFactory.java @@ -7,7 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.samples.yoga; +package com.facebook.yoga.android; import android.content.Context; import android.util.AttributeSet; diff --git a/android/sample/res/values/attrs.xml b/android/src/main/res/values/attrs.xml similarity index 100% rename from android/sample/res/values/attrs.xml rename to android/src/main/res/values/attrs.xml