Initial Contribution
diff --git a/core/tasks/apicheck.mk b/core/tasks/apicheck.mk
new file mode 100644
index 0000000..3ba5fb7
--- /dev/null
+++ b/core/tasks/apicheck.mk
@@ -0,0 +1,72 @@
+# Copyright (C) 2008 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.
+
+#
+# Rules for running apicheck to confirm that you haven't broken
+# api compatibility or added apis illegally.
+#
+
+.PHONY: checkapi
+
+# eval this to define a rule that runs apicheck.
+#
+# Args:
+# $(1) target
+# $(2) stable api xml file
+# $(3) api xml file to be tested
+# $(4) arguments for apicheck
+# $(5) command to run if apicheck failed
+define check-api
+$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp: $(2) $(3) $(APICHECK)
+ @echo "Checking API:" $(1)
+ $(hide) ( $(APICHECK) $(4) $(2) $(3) || ( $(5) ; exit 38 ) )
+ $(hide) mkdir -p $$(dir $$@)
+ $(hide) touch $$@
+checkapi: $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp
+endef
+
+# Run the checkapi rules by default.
+droidcore: checkapi
+
+# INTERNAL_PLATFORM_API_FILE is the one build by droiddoc.
+
+# Check that the API we're building hasn't broken the last-released
+# SDK version.
+$(eval $(call check-api, \
+ checkapi-last, \
+ $(BUILD_SYSTEM)/api/$(lastword $(TARGET_AVAILABLE_SDK_VERSIONS)).xml, \
+ $(INTERNAL_PLATFORM_API_FILE), \
+ -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 \
+ -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
+ -error 16 -error 17 -error 18 , \
+ cat $(BUILD_SYSTEM)/apicheck_msg_last.txt \
+ ))
+
+# Check that the API we're building hasn't changed from the not-yet-released
+# SDK version.
+$(eval $(call check-api, \
+ checkapi-current, \
+ $(BUILD_SYSTEM)/api/current.xml, \
+ $(INTERNAL_PLATFORM_API_FILE), \
+ -error 2 -error 3 -error 4 -error 5 -error 6 \
+ -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
+ -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 , \
+ cat $(BUILD_SYSTEM)/apicheck_msg_current.txt \
+ ))
+
+.PHONY: update-api
+update-api: $(INTERNAL_PLATFORM_API_FILE) | $(ACP)
+ @echo Copying current.xml
+ $(hide) $(ACP) $(INTERNAL_PLATFORM_API_FILE) $(BUILD_SYSTEM)/api/current.xml
+
diff --git a/core/tasks/localize.mk b/core/tasks/localize.mk
new file mode 100644
index 0000000..ee0ec9a
--- /dev/null
+++ b/core/tasks/localize.mk
@@ -0,0 +1,47 @@
+# Copyright (C) 2008 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.
+
+#
+# Rules for building the xlb files for export for translation.
+#
+
+# Gather all of the resource files for the default locale -- that is,
+# all resources in directories called values or values-something, where
+# one of the - separated segments is not two characters long -- those are the
+# language directories, and we don't want those.
+all_resource_files := $(foreach pkg, \
+ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES), \
+ $(PACKAGES.$(pkg).RESOURCE_FILES))
+values_resource_files := $(shell echo $(all_resource_files) | \
+ tr -s / | \
+ tr " " "\n" | \
+ grep -E "\/values[^/]*/(strings.xml|arrays.xml)$$" | \
+ grep -v -E -e "-[a-zA-Z]{2}[/\-]")
+
+xlb_target := $(PRODUCT_OUT)/strings.xlb
+
+$(xlb_target): $(values_resource_files) | $(LOCALIZE)
+ @echo XLB: $@
+ $(hide) mkdir -p $(dir $@)
+ $(hide) rm -f $@
+ $(hide) $(LOCALIZE) xlb $@ $^
+
+# Add a phony target so typing make xlb is convenient
+.PHONY: xlb
+xlb: $(xlb_target)
+
+# We want this on the build-server builds, but no reason to inflict it on
+# everyone
+$(call dist-for-goals, user droid, $(xlb_target))
+