Bug 567945 Android agent needs to build in mozilla-central r=ted

This commit is contained in:
Clint Talbert 2010-06-21 14:26:55 -07:00
parent ffcc91e19c
commit 7ee47c2f86
4 changed files with 196 additions and 17 deletions

View File

@ -71,6 +71,10 @@ endif
DIRS += pgo
ifeq (Android,$(OS_TARGET))
DIRS += mobile/sutagent/android
endif
include $(topsrcdir)/config/rules.mk
# we install to _leaktest/

View File

@ -0,0 +1,110 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Android sutagent for testing.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Clint Talbert <ctalbert@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = sutAgentAndroid
JAVAFILES = \
AlertLooperThread.java \
ASMozStub.java \
CmdWorkerThread.java \
DataWorkerThread.java \
DoAlert.java \
DoCommand.java \
Power.java \
RedirOutputThread.java \
RunCmdThread.java \
RunDataThread.java \
SUTAgentAndroid.java \
SUTStartupIntentReceiver.java \
WifiConfiguration.java \
R.java \
$(NULL)
RES_FILES = \
res/drawable/icon.png \
res/layout/main.xml \
res/values/strings.xml \
$(NULL)
GARBAGE += \
AndroidManifest.xml \
classes.dex \
sutAgentAndroid.apk \
$(NULL)
GARBAGE_DIRS += res classes network-libs
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar:$(srcdir)/network-libs/commons-net-2.0.jar
include $(topsrcdir)/config/rules.mk
# include Android specific java flags - using these instead of what's in rules.mk
include $(topsrcdir)/config/android-common.mk
tools:: sutAgentAndroid.apk
classes.dex: $(JAVAFILES)
$(NSINSTALL) -D classes
$(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES))
$(DX) --dex --output=$@ classes
sutAgentAndroid.ap_: $(srcdir)/AndroidManifest.xml
$(AAPT) package -f -M $(srcdir)/AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -F $@
sutAgentAndroid-unsigned-unaligned.apk: sutAgentAndroid.ap_ classes.dex
$(APKBUILDER) $@ -v $(APKBUILDER_FLAGS) -z sutAgentAndroid.ap_ -f classes.dex
sutAgentAndroid-unaligned.apk: sutAgentAndroid-unsigned-unaligned.apk
cp sutAgentAndroid-unsigned-unaligned.apk $@
ifdef JARSIGNER
$(JARSIGNER) $@
endif
sutAgentAndroid.apk: sutAgentAndroid-unaligned.apk
$(ZIPALIGN) -f -v 4 sutAgentAndroid-unaligned.apk $@
export::
$(NSINSTALL) -D res
@(cd $(srcdir)/res && tar $(TAR_CREATE_FLAGS) - *) | (cd $(DEPTH)/build/mobile/sutagent/android/res && tar -xf -)

78
config/android-common.mk Normal file
View File

@ -0,0 +1,78 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Android Java Make Settings.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Clint Talbert <cmtalbert@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
# Ensure JAVA_CLASSPATH and ANDROID_SDK are defined before including this file.
# We use common android defaults for boot class path and java version.
ifndef ANDROID_SDK
$(error ANDROID_SDK must be defined before including android-common.mk)
endif
ifndef JAVA_CLASSPATH
$(error JAVA_CLASSPATH must be defined before including android-common.mk)
endif
DX=$(ANDROID_SDK)/tools/dx
AAPT=$(ANDROID_SDK)/tools/aapt
APKBUILDER=$(ANDROID_SDK)/../../tools/apkbuilder
ZIPALIGN=$(ANDROID_SDK)/../../tools/zipalign
ifdef JARSIGNER
APKBUILDER_FLAGS += -u
endif
# For Android, this defaults to $(ANDROID_SDK)/android.jar
ifndef JAVA_BOOTCLASSPATH
JAVA_BOOTCLASSPATH = $(ANDROID_SDK)/android.jar
endif
# For Android, we default to 1.5
ifndef JAVA_VERSION
JAVA_VERSION = 1.5
endif
JAVAC_FLAGS = \
-target $(JAVA_VERSION) \
-classpath $(JAVA_CLASSPATH) \
-bootclasspath $(JAVA_BOOTCLASSPATH) \
-encoding ascii \
-g \
$(NULL)
# Note that we're going to set up a dependency directly between embed_android.dex and the java files
# Instead of on the .class files, since more than one .class file might be produced per .java file
# The $JAVAFILES_IN are for any optional, interpolated java files that are needed.

View File

@ -42,11 +42,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DX=$(ANDROID_SDK)/tools/dx
AAPT=$(ANDROID_SDK)/tools/aapt
APKBUILDER=$(ANDROID_SDK)/../../tools/apkbuilder
ZIPALIGN=$(ANDROID_SDK)/../../tools/zipalign
JAVAFILES = \
GeckoApp.java \
GeckoAppShell.java \
@ -71,10 +66,6 @@ GARBAGE += \
GARBAGE_DIRS += res libs dist classes
ifdef JARSIGNER
APKBUILDER_FLAGS += -u
endif
# Bug 567884 - Need a way to find appropriate icons during packaging
ifeq ($(MOZ_APP_NAME),fennec)
ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_48x48.png
@ -108,16 +99,12 @@ DIST_LINK_FILES = \
blocklist.xml \
$(NULL)
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
include $(topsrcdir)/config/rules.mk
# rules.mk has some java stuff, but we're going to ignore it for now
JAVAC_FLAGS = \
-target 1.5 \
-classpath $(ANDROID_SDK)/android.jar \
-bootclasspath $(ANDROID_SDK)/android.jar \
-encoding ascii \
-g \
$(NULL)
# Override the Java settings with some specific android settings
include $(topsrcdir)/config/android-common.mk
tools:: $(MOZ_APP_NAME).apk