Add a multi-component app that uses a maven repo.
Xavier Ducrohet [Fri, 21 Sep 2012 21:46:03 +0000 (14:46 -0700)]
This is a copy of multiproject but uploads the libs and jars to
a Maven repo and the app use those from the repo.

Change-Id: Ied5b3c51908b596184243b7974af2d7d52f4fbe8

20 files changed:
.gitignore
testapps/repo/app/build.gradle [new file with mode: 0644]
testapps/repo/app/src/main/AndroidManifest.xml [new file with mode: 0644]
testapps/repo/app/src/main/java/com/example/android/multiproject/MainActivity.java [new file with mode: 0644]
testapps/repo/app/src/main/res/drawable-hdpi/ic_launcher.png [new file with mode: 0644]
testapps/repo/app/src/main/res/drawable-ldpi/ic_launcher.png [new file with mode: 0644]
testapps/repo/app/src/main/res/drawable-mdpi/ic_launcher.png [new file with mode: 0644]
testapps/repo/app/src/main/res/drawable-xhdpi/ic_launcher.png [new file with mode: 0644]
testapps/repo/app/src/main/res/layout/main.xml [new file with mode: 0644]
testapps/repo/app/src/main/res/values/strings.xml [new file with mode: 0644]
testapps/repo/baseLibrary/build.gradle [new file with mode: 0644]
testapps/repo/baseLibrary/src/main/AndroidManifest.xml [new file with mode: 0644]
testapps/repo/baseLibrary/src/main/java/com/sample/android/multiproject/PersonView.java [new file with mode: 0644]
testapps/repo/library/build.gradle [new file with mode: 0644]
testapps/repo/library/src/main/AndroidManifest.xml [new file with mode: 0644]
testapps/repo/library/src/main/java/com/example/android/multiproject/ShowPeopleActivity.java [new file with mode: 0644]
testapps/repo/library/src/main/res/values/strings.xml [new file with mode: 0644]
testapps/repo/util/build.gradle [new file with mode: 0644]
testapps/repo/util/src/main/java/com/example/android/multiproject/person/People.java [new file with mode: 0644]
testapps/repo/util/src/main/java/com/example/android/multiproject/person/Person.java [new file with mode: 0644]

index 7540c8f..9ad1507 100644 (file)
@@ -11,5 +11,6 @@ testapps/multiproject/*/build
 testapps/tictactoe/*/build
 testapps/applibtest/*/build
 testapps/libsTest/*/build
+testapps/repo/*/build
 /repo
 /out
diff --git a/testapps/repo/app/build.gradle b/testapps/repo/app/build.gradle
new file mode 100644 (file)
index 0000000..92c18bc
--- /dev/null
@@ -0,0 +1,23 @@
+buildscript {
+    repositories {
+        maven { url '../../../repo' }
+    }
+    dependencies {
+        classpath 'com.android.build:gradle-android:0.1-SNAPSHOT'
+    }
+}
+apply plugin: 'android'
+apply plugin: 'maven'
+
+repositories {
+    maven { url '../../../repo' }
+    mavenCentral()
+}
+
+dependencies {
+    compile 'com.example.android.multiproject:lib:1.0'
+}
+
+android {
+    target 'android-15'
+}
diff --git a/testapps/repo/app/src/main/AndroidManifest.xml b/testapps/repo/app/src/main/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..71e7a47
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="com.example.android.multiproject"
+      android:versionCode="1"
+      android:versionName="1.0">
+    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
+        <activity android:name="MainActivity"
+                  android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/testapps/repo/app/src/main/java/com/example/android/multiproject/MainActivity.java b/testapps/repo/app/src/main/java/com/example/android/multiproject/MainActivity.java
new file mode 100644 (file)
index 0000000..e984b9e
--- /dev/null
@@ -0,0 +1,19 @@
+package com.example.android.multiproject;
+
+import android.app.Activity;
+import android.view.View;
+import android.content.Intent;
+import android.os.Bundle;
+
+public class MainActivity extends Activity {
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.main);
+    }
+
+    public void sendMessage(View view) {
+        Intent intent = new Intent(this, ShowPeopleActivity.class);
+        startActivity(intent);
+    }
+}
diff --git a/testapps/repo/app/src/main/res/drawable-hdpi/ic_launcher.png b/testapps/repo/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..96a442e
Binary files /dev/null and b/testapps/repo/app/src/main/res/drawable-hdpi/ic_launcher.png differ
diff --git a/testapps/repo/app/src/main/res/drawable-ldpi/ic_launcher.png b/testapps/repo/app/src/main/res/drawable-ldpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..9923872
Binary files /dev/null and b/testapps/repo/app/src/main/res/drawable-ldpi/ic_launcher.png differ
diff --git a/testapps/repo/app/src/main/res/drawable-mdpi/ic_launcher.png b/testapps/repo/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..359047d
Binary files /dev/null and b/testapps/repo/app/src/main/res/drawable-mdpi/ic_launcher.png differ
diff --git a/testapps/repo/app/src/main/res/drawable-xhdpi/ic_launcher.png b/testapps/repo/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..71c6d76
Binary files /dev/null and b/testapps/repo/app/src/main/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/testapps/repo/app/src/main/res/layout/main.xml b/testapps/repo/app/src/main/res/layout/main.xml
new file mode 100644 (file)
index 0000000..ccc59fb
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="horizontal"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+    <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/button_send"
+            android:onClick="sendMessage" />
+</LinearLayout>
diff --git a/testapps/repo/app/src/main/res/values/strings.xml b/testapps/repo/app/src/main/res/values/strings.xml
new file mode 100644 (file)
index 0000000..e1f49b6
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">Composite App</string>
+    <string name="button_send">Go</string>
+</resources>
diff --git a/testapps/repo/baseLibrary/build.gradle b/testapps/repo/baseLibrary/build.gradle
new file mode 100644 (file)
index 0000000..6c38546
--- /dev/null
@@ -0,0 +1,35 @@
+buildscript {
+    repositories {
+        maven { url '../../../repo' }
+    }
+    dependencies {
+        classpath 'com.android.build:gradle-android:0.1-SNAPSHOT'
+    }
+}
+apply plugin: 'android-library'
+apply plugin: 'maven'
+
+repositories {
+    maven { url '../../../repo' }
+    mavenCentral()
+}
+
+dependencies {
+    compile 'com.example.android.multiproject:util:1.0'
+}
+
+android {
+    target 'android-15'
+}
+
+group = 'com.example.android.multiproject'
+archivesBaseName = 'baseLib'
+version = '1.0'
+
+uploadArchives {
+    repositories {
+        mavenDeployer {
+            repository(url: uri("../../../repo"))
+        }
+    }
+}
diff --git a/testapps/repo/baseLibrary/src/main/AndroidManifest.xml b/testapps/repo/baseLibrary/src/main/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..54d079c
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="com.example.android.multiproject.library.base">
+</manifest>
diff --git a/testapps/repo/baseLibrary/src/main/java/com/sample/android/multiproject/PersonView.java b/testapps/repo/baseLibrary/src/main/java/com/sample/android/multiproject/PersonView.java
new file mode 100644 (file)
index 0000000..a8f253f
--- /dev/null
@@ -0,0 +1,13 @@
+package com.example.android.multiproject;
+
+import android.widget.TextView;
+import android.content.Context;
+import com.example.android.multiproject.person.Person;
+
+class PersonView extends TextView {
+    public PersonView(Context context, Person person) {
+        super(context);
+        setTextSize(20);
+        setText(person.getName());
+    }
+}
diff --git a/testapps/repo/library/build.gradle b/testapps/repo/library/build.gradle
new file mode 100644 (file)
index 0000000..28cb13f
--- /dev/null
@@ -0,0 +1,35 @@
+buildscript {
+    repositories {
+        maven { url '../../../repo' }
+    }
+    dependencies {
+        classpath 'com.android.build:gradle-android:0.1-SNAPSHOT'
+    }
+}
+apply plugin: 'android-library'
+apply plugin: 'maven'
+
+repositories {
+    maven { url '../../../repo' }
+    mavenCentral()
+}
+
+dependencies {
+    compile 'com.example.android.multiproject:baseLib:1.0'
+}
+
+android {
+    target 'android-15'
+}
+
+group = 'com.example.android.multiproject'
+archivesBaseName = 'lib'
+version = '1.0'
+
+uploadArchives {
+    repositories {
+        mavenDeployer {
+            repository(url: uri("../../../repo"))
+        }
+    }
+}
diff --git a/testapps/repo/library/src/main/AndroidManifest.xml b/testapps/repo/library/src/main/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..2bc9331
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="com.example.android.multiproject.library">
+    <application>
+        <activity
+                android:name="ShowPeopleActivity"
+                android:label="@string/title_activity_display_message" >
+            </activity>
+    </application>
+</manifest>
diff --git a/testapps/repo/library/src/main/java/com/example/android/multiproject/ShowPeopleActivity.java b/testapps/repo/library/src/main/java/com/example/android/multiproject/ShowPeopleActivity.java
new file mode 100644 (file)
index 0000000..b10f0d3
--- /dev/null
@@ -0,0 +1,30 @@
+package com.example.android.multiproject;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.content.Intent;
+import android.widget.TextView;
+import android.widget.LinearLayout;
+
+import java.lang.String;
+import java.util.Arrays;
+
+import com.example.android.multiproject.person.Person;
+import com.example.android.multiproject.person.People;
+
+public class ShowPeopleActivity extends Activity {
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        LinearLayout group = new LinearLayout(this);
+        group.setOrientation(LinearLayout.VERTICAL);
+
+        Iterable<Person> people = new People();
+        for (Person person : people) {
+            group.addView(new PersonView(this, person));
+        }
+
+        setContentView(group);
+    }
+}
diff --git a/testapps/repo/library/src/main/res/values/strings.xml b/testapps/repo/library/src/main/res/values/strings.xml
new file mode 100644 (file)
index 0000000..45e9dbb
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="title_activity_display_message">People</string>
+</resources>
diff --git a/testapps/repo/util/build.gradle b/testapps/repo/util/build.gradle
new file mode 100644 (file)
index 0000000..2d87e94
--- /dev/null
@@ -0,0 +1,23 @@
+apply plugin: 'java'
+apply plugin: 'maven'
+
+repositories {
+    mavenCentral()
+}
+
+dependencies {
+    compile 'com.google.guava:guava:11.0.2'
+}
+
+group = 'com.example.android.multiproject'
+archivesBaseName = 'util'
+version = '1.0'
+
+uploadArchives {
+    repositories {
+        mavenDeployer {
+            repository(url: uri("../../../repo"))
+        }
+    }
+}
+
diff --git a/testapps/repo/util/src/main/java/com/example/android/multiproject/person/People.java b/testapps/repo/util/src/main/java/com/example/android/multiproject/person/People.java
new file mode 100644 (file)
index 0000000..8b99248
--- /dev/null
@@ -0,0 +1,10 @@
+package com.example.android.multiproject.person;
+
+import java.util.Iterator;
+import com.google.common.collect.Lists;
+
+public class People implements Iterable<Person> {
+    public Iterator<Person> iterator() {
+        return Lists.newArrayList(new Person("Fred"), new Person("Barney")).iterator();
+    }
+}
diff --git a/testapps/repo/util/src/main/java/com/example/android/multiproject/person/Person.java b/testapps/repo/util/src/main/java/com/example/android/multiproject/person/Person.java
new file mode 100644 (file)
index 0000000..2f4aa9f
--- /dev/null
@@ -0,0 +1,13 @@
+package com.example.android.multiproject.person;
+
+public class Person {
+    private final String name;
+
+    public Person(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+}