Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Commit

Permalink
Project Restructure
Browse files Browse the repository at this point in the history
- reorganize around a standard gradle directory structure
- create gradle build files
- separate Android specific utilities from the physics core
  to allow use on other java platforms (processing)
- create a continuous integration build script for travis CI
- move to proper semver versioning. The API for rebound is not fully
  finalized we should be at version 0.3
- API is unchanged

TODO:
- maven hosting for build artifacts to allow easy integration
  • Loading branch information
willbailey committed Jan 30, 2014
1 parent bc55a77 commit 6e5a8dc
Show file tree
Hide file tree
Showing 67 changed files with 636 additions and 563 deletions.
9 changes: 9 additions & 0 deletions .buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[alias]
core = //rebound-core:src
test = //rebound-core:test
android = //rebound-android:src
app = //rebound-android-example:bin
rebound = //:rebound

[project]
ignore = .git
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ buck-*
out
docs
build
.DS_Store
.DS_Store
_site
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
language: java
jdk: oraclejdk7
env:
matrix:
- ANDROID_SDKS=android-19,sysimg-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
before_install:
# Install base Android SDK
- sudo apt-get update -qq
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi
- wget http://dl.google.com/android/android-sdk_r22.3-linux.tgz
- tar xzf android-sdk_r22.3-linux.tgz
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools

# Gradle
- wget http://services.gradle.org/distributions/gradle-1.8-bin.zip
- unzip gradle-1.8-bin.zip
- export GRADLE_HOME=$PWD/gradle-1.8
- export PATH=$GRADLE_HOME/bin:$PATH

# install android build tools
- wget https://dl-ssl.google.com/android/repository/build-tools_r19-linux.zip
- unzip build-tools_r19-linux.zip -d $ANDROID_HOME
- mkdir -p $ANDROID_HOME/build-tools/
- mv $ANDROID_HOME/android-4.4 $ANDROID_HOME/build-tools/19
- ls -la $ANDROID_HOME/build-tools/19
- echo $ANDROID_HOME

# Install required components.
# For a full list, run `android list sdk -a --extended`
# Note that sysimg-18 downloads the ARM, x86 and MIPS images (we should optimize this).
# Other relevant API's
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-18 --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-19 --no-ui --force > /dev/null
- echo yes | android update sdk --filter sysimg-19 --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
52 changes: 5 additions & 47 deletions BUCK
Original file line number Diff line number Diff line change
@@ -1,50 +1,8 @@
prebuilt_jar(
name = 'mockito',
binary_jar = 'libs/mockito-all-1.9.5.jar',
)

prebuilt_jar(
name = 'robolectric',
binary_jar = 'libs/robolectric-2.2-20130606.235928-4-jar-with-dependencies.jar',
)

prebuilt_jar(
name = 'junit',
binary_jar = 'libs/junit-4.11.jar',
)

android_resource(
name = 'res',
res = 'res',
package = 'com.facebook.rebound',
visibility = ['//:rebound'],
)

java_test(
name = 'rebound_test',
srcs = glob(['test/**/*Test.java']),
visibility = ['//:rebound'],
deps = [
'//:robolectric',
'//:mockito',
'//:junit',
'//:rebound'
],
source_under_test = ['//:rebound'],
)

android_library(
# A special build that includes rebound-android but not the resources so that a jar file can be
# created for distribution to users who do not use the gradle aar and don't need the utils like
# SpringConfiguratorView.
java_binary(
name = 'rebound',
srcs = glob(['src/**/*.java']),
deps = [
'//:res'
],
deps = ['//rebound-android:src-no-res'],
visibility = ['PUBLIC'],
)

project_config(
src_target = '//:rebound',
test_target = '//:rebound_test',
src_roots = ['src'],
test_roots = ['test'],
)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Rebound is available as a prebuilt jar or can be built using Gradle or Buck.
at Facebook that encourages the creation of small, reusable modules consisting
of code and resources.

[![Build Status](https://travis-ci.org/willbailey/rebound.png?branch=master)](https://travis-ci.org/willbailey/rebound)

##License

BSD License
Expand Down
35 changes: 1 addition & 34 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,34 +1 @@
buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:0.7.1+'
}
}

apply plugin: 'android-library'

repositories {
mavenCentral()
}

android {
compileSdkVersion 19
buildToolsVersion "19.0.0"

defaultConfig {
minSdkVersion 14
targetSdkVersion 17
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
Binary file removed example/res/drawable-xhdpi/landscape.jpg
Binary file not shown.
Binary file removed example/res/drawable-xhdpi/rebound_icon.png
Binary file not shown.
14 changes: 0 additions & 14 deletions example/res/layout/main.xml

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Sun Jan 19 22:25:11 CET 2014
#Wed Jan 29 14:33:14 PST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

android.library=true
android.library=false
# Project target.
target=android-17
target=android-10
20 changes: 10 additions & 10 deletions example/BUCK → rebound-android-example/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ keystore(

android_resource(
name = 'res',
res = 'res',
res = 'src/main/res',
package = 'com.facebook.rebound.example',
visibility = ['//example:example'],
visibility = ['//rebound-android-example:src'],
)

android_library(
name = 'src',
srcs = glob(['src/**/*.java']),
srcs = glob(['src/main/java/**/*.java']),
deps = [
':res',
'//:rebound',
'//rebound-core:src',
'//rebound-android:src',
],
)

android_binary(
name = 'example',
manifest = 'AndroidManifest.xml',
target = 'Google Inc.:Google APIs:16',
package_type = 'debug',
name = 'bin',
manifest = 'src/main/AndroidManifest.xml',
target = 'Google Inc.:Google APIs:19',
keystore = ':debug_keystore',
deps = [
':res',
Expand All @@ -33,6 +33,6 @@ android_binary(
)

project_config(
src_target = ':example',
src_roots = ['src'],
src_target = ':bin',
src_roots = ['src/main/java'],
)
40 changes: 40 additions & 0 deletions rebound-android-example/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:0.7.1+'
}
}

apply plugin: 'android'

dependencies {
compile project(':rebound-android')
}

android {
compileSdkVersion 19
buildToolsVersion "19.0.0"

defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}

signingConfigs {
debug {
storeFile file("debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
}

buildTypes {
debug {
signingConfig signingConfigs.debug
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-17
android.library.reference.1=../../rebound
android.library.reference.2=../../rebound
target=android-19
android.library.reference.1=../rebound-android
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
package="com.facebook.rebound.example"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="11"/>
<application android:label="@string/app_name" android:hardwareAccelerated="true">
<uses-sdk android:targetSdkVersion="19"
android:minSdkVersion="14"/>
<application
android:label="@string/app_name"
android:hardwareAccelerated="true"
android:allowBackup="false"
android:icon="@drawable/rebound_icon"
>
<activity android:name="com.facebook.rebound.example.MainActivity"
android:theme="@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen"
android:icon="@drawable/rebound_icon"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
import android.widget.FrameLayout;
import com.facebook.rebound.SimpleSpringListener;
import com.facebook.rebound.Spring;
import com.facebook.rebound.BaseSpringSystem;
import com.facebook.rebound.SpringSystem;
import com.facebook.rebound.SpringUtil;

public class ZoomFragment extends Fragment {

private final SpringSystem mSpringSystem = SpringSystem.create();
private final BaseSpringSystem mSpringSystem = SpringSystem.create();
private final ExampleSpringListener mSpringListener = new ExampleSpringListener();
private FrameLayout mRootView;
private Spring mScaleSpring;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions rebound-android-example/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.facebook.rebound.example.ZoomFragment"
android:id="@+id/zoom_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>

Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
>
<ImageView
android:id="@+id/image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/landscape"
android:scaleType="centerCrop"
android:layout_gravity="center"
android:contentDescription="@string/cd_scaling_image"
/>
<com.facebook.rebound.ui.SpringConfiguratorView
android:id="@+id/spring_configurator"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Rebound Example</string>
<string name="cd_scaling_image">landscape photo</string>
</resources>
33 changes: 33 additions & 0 deletions rebound-android/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
android_resource(
name = 'res',
res = 'src/main/res',
package = 'com.facebook.rebound',
visibility = ['//rebound-android:src'],
)

android_library(
name = 'src',
srcs = glob(['src/main/java/**/*.java']),
deps = [
'//rebound-core:src',
'//rebound-android:res',
],
visibility = ['PUBLIC'],
)

android_library(
name = 'src-no-res',
srcs = glob(
['src/main/java/**/*.java'],
excludes = ['src/main/java/com/facebook/rebound/ui/*'],
),
deps = [
'//rebound-core:src',
],
visibility = ['PUBLIC'],
)

project_config(
src_target = '//rebound-android:src',
src_roots = ['src/main/java'],
)
Loading

0 comments on commit 6e5a8dc

Please sign in to comment.