Static Libs for Popular CTS Stub Components

com.android.cts.stub is growing very large. Split apart some of
the popular components into separate static libraries. This
should allow packages to depend on the components they need
rather than all of cts.stub.

Current code at the moment doesn't have to be changed, because
I have CtsTestStubs depending on these new shared libraries.
However, change the net package to depend on the ctstestserver
static library as a proof of concept rather than including
its source directly.

Change-Id: I32c54eab3ddfb1d4391d6ffc347fbc9cb2fe97f9
diff --git a/libs/testserver/Android.mk b/libs/testserver/Android.mk
new file mode 100644
index 0000000..dfe357b
--- /dev/null
+++ b/libs/testserver/Android.mk
@@ -0,0 +1,25 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# 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.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := ctstestserver
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/src/android/webkit/cts/CtsTestServer.java b/libs/testserver/src/android/webkit/cts/CtsTestServer.java
similarity index 99%
rename from tests/src/android/webkit/cts/CtsTestServer.java
rename to libs/testserver/src/android/webkit/cts/CtsTestServer.java
index b0d20ba..856d348 100755
--- a/tests/src/android/webkit/cts/CtsTestServer.java
+++ b/libs/testserver/src/android/webkit/cts/CtsTestServer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2012 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/libs/util/Android.mk b/libs/util/Android.mk
new file mode 100644
index 0000000..b3e128c
--- /dev/null
+++ b/libs/util/Android.mk
@@ -0,0 +1,25 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# 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.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := ctsutil
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/src/android/cts/util/PollingCheck.java b/libs/util/src/android/cts/util/PollingCheck.java
similarity index 95%
rename from tests/src/android/cts/util/PollingCheck.java
rename to libs/util/src/android/cts/util/PollingCheck.java
index 8870fb9..2990992 100644
--- a/tests/src/android/cts/util/PollingCheck.java
+++ b/libs/util/src/android/cts/util/PollingCheck.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2012 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/tests/Android.mk b/tests/Android.mk
index cfaeb57..4868654 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -34,6 +34,8 @@
 
 LOCAL_PACKAGE_NAME := CtsTestStubs
 
+LOCAL_STATIC_JAVA_LIBRARIES := ctsutil ctstestserver
+
 include $(BUILD_PACKAGE)
 
 # Build the test APK using its own makefile, and any other CTS-related packages
diff --git a/tests/tests/net/Android.mk b/tests/tests/net/Android.mk
index c139d1c..3e48cd2 100644
--- a/tests/tests/net/Android.mk
+++ b/tests/tests/net/Android.mk
@@ -24,11 +24,12 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner
 
 # include CtsTestServer as a temporary hack to free net.cts from cts.stub.
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-	../../src/android/webkit/cts/CtsTestServer.java
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_PACKAGE_NAME := CtsNetTestCases
 
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestserver
+
 # uncomment when dalvik.annotation.Test* are removed or part of SDK
 #LOCAL_SDK_VERSION := current