Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Add initial codebase
Browse files Browse the repository at this point in the history
This is a very simple Android codebase that includes two apps.  The apps
share some code, but not all.
  • Loading branch information
dreiss committed Jan 19, 2018
1 parent 8b14008 commit 7794857
Show file tree
Hide file tree
Showing 17 changed files with 282 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[java]
src_roots = src
[android]
target = android-25
build_tools_version = 26.0.2
[ndk]
ndk_version = 15.2.4203891
gcc_version = 4.9
app_platform = android-15
cpu_abis = armv7, x86
23 changes: 23 additions & 0 deletions apps/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
android_binary(
name = "mammals",
manifest_skeleton = "mammals-app-manifest.xml",
keystore = ":debug_keystore",
deps = [
"//src/com/facebook/example/mammals/activity:activity",
],
)

android_binary(
name = "animals",
manifest_skeleton = "animals-app-manifest.xml",
keystore = ":debug_keystore",
deps = [
"//src/com/facebook/example/animals:animals",
],
)

keystore(
name = "debug_keystore",
properties = "debug.keystore.properties",
store = "debug.keystore",
)
10 changes: 10 additions & 0 deletions apps/animals-app-manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.example.cppmerge.animals"
>

<application>
</application>

</manifest>
Binary file added apps/debug.keystore
Binary file not shown.
3 changes: 3 additions & 0 deletions apps/debug.keystore.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
key.alias=android
key.store.password=android
key.alias.password=android
10 changes: 10 additions & 0 deletions apps/mammals-app-manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.example.cppmerge.mammals"
>

<application>
</application>

</manifest>
37 changes: 37 additions & 0 deletions src/com/facebook/example/animals/AnimalsActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.example.animals;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import com.facebook.example.mammals.SeaLion;

public class AnimalsActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

String text =
"Mammal: " + SeaLion.getDescription() + "\n" +
"Bird: " + Penguin.getDescription();

TextView view = new TextView(this);
setContentView(view);
view.setText(text);
}
}
10 changes: 10 additions & 0 deletions src/com/facebook/example/animals/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
android_library(
name = "animals",
manifest = "manifest.xml",
srcs = glob(["*.java"]),
deps = [
"//src/com/facebook/example/habitat:habitat",
"//src/com/facebook/example/mammals:mammals",
],
visibility = ["PUBLIC"],
)
29 changes: 29 additions & 0 deletions src/com/facebook/example/animals/Penguin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.example.animals;

import com.facebook.example.habitat.Ice;

public class Penguin {
public static String getDescription() {
return getName() + " on " + Ice.getName();
}

private static String getName() {
return "penguin";
}
}
17 changes: 17 additions & 0 deletions src/com/facebook/example/animals/manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.example.animals"
>

<application>

<activity android:name=".AnimalsActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
</manifest>
7 changes: 7 additions & 0 deletions src/com/facebook/example/habitat/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
java_library(
name = "habitat",
srcs = glob(["*.java"]),
deps = [
],
visibility = ["PUBLIC"],
)
25 changes: 25 additions & 0 deletions src/com/facebook/example/habitat/Ice.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.example.habitat;

public class Ice {
private static int dxWorkaround = 0;

public static String getName() {
return "ice";
}
}
7 changes: 7 additions & 0 deletions src/com/facebook/example/mammals/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
java_library(
name = "mammals",
srcs = glob(["*.java"]),
deps = [
],
visibility = ["PUBLIC"],
)
27 changes: 27 additions & 0 deletions src/com/facebook/example/mammals/SeaLion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.example.mammals;

public class SeaLion {
public static String getDescription() {
return "just a " + getName();
}

private static String getName() {
return "sea lion";
}
}
10 changes: 10 additions & 0 deletions src/com/facebook/example/mammals/activity/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
android_library(
name = "activity",
manifest = "manifest.xml",
srcs = glob(["*.java"]),
deps = [
"//src/com/facebook/example/habitat:habitat",
"//src/com/facebook/example/mammals:mammals",
],
visibility = ["PUBLIC"],
)
40 changes: 40 additions & 0 deletions src/com/facebook/example/mammals/activity/MammalsActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.example.mammals.activity;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import com.facebook.example.habitat.Ice;
import com.facebook.example.mammals.SeaLion;

public class MammalsActivity extends Activity {
private int justKidding;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

String text =
"Mammal: " + SeaLion.getDescription() + "\n" +
"Environment: " + Ice.getName();

TextView view = new TextView(this);
setContentView(view);
view.setText(text);
}
}
17 changes: 17 additions & 0 deletions src/com/facebook/example/mammals/activity/manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.example.mammals.activity"
>

<application>

<activity android:name=".MammalsActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
</manifest>

0 comments on commit 7794857

Please sign in to comment.