From c11e80ec94a6c4a9cb48643cc39b1a889d804465 Mon Sep 17 00:00:00 2001 From: Joey Armstrong Date: Tue, 19 Mar 2013 15:34:59 -0400 Subject: [PATCH] bug 751156: robocop dependency build should be a nop --- build/mobile/robocop/Makefile.in | 99 ++++++++++++++------------- config/makefiles/java-build.mk | 3 + config/makefiles/mochitest.mk | 23 +++++-- config/rules.mk | 1 + js/src/config/makefiles/java-build.mk | 3 + js/src/config/makefiles/mochitest.mk | 23 +++++-- js/src/config/rules.mk | 1 + 7 files changed, 95 insertions(+), 58 deletions(-) diff --git a/build/mobile/robocop/Makefile.in b/build/mobile/robocop/Makefile.in index 49d4f4f9f5a8..af59f43a8466 100644 --- a/build/mobile/robocop/Makefile.in +++ b/build/mobile/robocop/Makefile.in @@ -6,7 +6,10 @@ DEPTH = @DEPTH@ topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ -TESTPATH = $(topsrcdir)/mobile/android/base/tests + +mobile-tests := mobile/android/base/tests +TESTPATH := $(topsrcdir)/$(mobile-tests) +dir-tests := $(DEPTH)/$(mobile-tests) include $(DEPTH)/config/autoconf.mk @@ -16,6 +19,11 @@ ROBOTIUM_PATH = $(srcdir)/robotium-solo-3.6.jar JAVAFILES = \ R.java \ + $(NULL) + +RES_FILES = \ + res/values/strings.xml \ + $(NULL) _JAVA_HARNESS = \ Actions.java \ @@ -32,37 +40,57 @@ _JAVA_HARNESS = \ PaintedSurface.java \ $(NULL) -_JAVA_TESTS = $(patsubst $(TESTPATH)/%.in,%,$(wildcard $(TESTPATH)/*.java.in)) +# pre-process harness sources +PP_TARGETS += java-harness +java-harness := $(addprefix $(srcdir)/,$(addsuffix .in,$(_JAVA_HARNESS))) +java-harness-dep := $(addprefix $(CURDIR)/,$(_JAVA_HARNESS)) +java-harness_PATH := $(CURDIR) -_TEST_FILES = \ +# pre-process test sources +PP_TARGETS += java-tests +java-tests-src := $(wildcard $(TESTPATH)/*.java.in) +java-tests-dep := $(patsubst $(TESTPATH)/%.java.in,$(dir-tests)/%.java,$(java-tests-src)) +java-tests := $(java-tests-src) +java-tests_PATH := $(dir-tests) + +PP_TARGETS += manifest +manifest := $(srcdir)/AndroidManifest.xml.in +manifest_TARGET := AndroidManifest.xml + + +# Install robocop configs and helper +INSTALL_TARGETS += robocop +robocop_TARGET := libs +robocop_DEST := $(CURDIR) +robocop_FILES := \ + $(TESTPATH)/robocop.ini \ + $(TESTPATH)/robocop_autophone.ini \ + $(srcdir)/parse_ids.py \ + $(NULL) +robocop-deps := $(notdir $(robocop_FILES)) + +MOCHITEST_ROBOCOP_FILES := \ $(wildcard $(TESTPATH)/*.html) \ $(wildcard $(TESTPATH)/*.jpg) \ $(wildcard $(TESTPATH)/*.sjs) \ $(NULL) -_ROBOCOP_TOOLS = \ - $(TESTPATH)/robocop.ini \ - $(TESTPATH)/robocop_autophone.ini \ - parse_ids.py \ - $(NULL) - GARBAGE += \ AndroidManifest.xml \ - _JAVA_TESTS \ - _JAVA_HARNESS \ + $(java-tests-dep) \ + $(_JAVA_HARNESS) \ classes.dex \ robocop.apk \ robocop.ap_ \ robocop-unsigned-unaligned.apk \ robocop-unaligned.apk \ + $(robocop-deps) \ $(NULL) DEFINES += \ -DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME) \ $(NULL) -GARBAGE_DIRS += res - JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar:$(ROBOTIUM_PATH) include $(topsrcdir)/config/rules.mk @@ -70,43 +98,22 @@ include $(topsrcdir)/config/rules.mk # Override rules.mk java flags with the android specific ones include $(topsrcdir)/config/android-common.mk -$(_JAVA_HARNESS): % : %.in - $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $< > $@ +GENERATED_DIRS_tools = classes $(dir-tests) -AndroidManifest.xml: % : %.in - $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $< > $@ - -$(_JAVA_TESTS): % : $(TESTPATH)/%.in - $(NSINSTALL) -D $(DEPTH)/mobile/android/base/tests - $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $< > $(DEPTH)/mobile/android/base/tests/$@ - -$(_ROBOCOP_TOOLS): - cp $(TESTPATH)/robocop.ini robocop.ini - cp $(TESTPATH)/robocop_autophone.ini robocop_autophone.ini - -libs:: $(_TEST_FILES) - $(NSINSTALL) -D $(DEPTH)/_tests/testing/mochitest/tests/robocop - $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/robocop/ - -tools:: robocop.apk +tools:: $(robocop-deps) robocop.apk classes.dex: robocop.ap_ -classes.dex: $(_ROBOCOP_TOOLS) -classes.dex: $(_JAVA_HARNESS) -classes.dex: $(_JAVA_TESTS) - $(NSINSTALL) -D classes - $(JAVAC) $(JAVAC_FLAGS) -d classes $(JAVAFILES) $(_JAVA_HARNESS) $(addprefix $(DEPTH)/mobile/android/base/tests/,$(_JAVA_TESTS)) +classes.dex: $(robocop-deps) +classes.dex: $(java-harness-dep) +classes.dex: $(java-tests-dep) + $(JAVAC) $(JAVAC_FLAGS) -d classes $(JAVAFILES) $(_JAVA_HARNESS) $(java-tests-dep) $(DX) --dex --output=$@ classes $(ROBOTIUM_PATH) $(ANDROID_COMPT_LIB) +robocop.apk: $(robocop-deps) robocop.ap_ classes.dex robocop.ap_: AndroidManifest.xml $(TESTPATH)/assets/* - $(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -I . -S res -A $(TESTPATH)/assets -F $@ -J ./ - -robocop.apk: robocop.ap_ classes.dex - cp $(TESTPATH)/robocop.ini robocop.ini - cp $(TESTPATH)/robocop_autophone.ini robocop_autophone.ini - cp $(srcdir)/parse_ids.py parse_ids.py - -export:: - $(NSINSTALL) -D res - @(cd $(srcdir)/res && tar $(TAR_CREATE_FLAGS) - *) | (cd $(DEPTH)/build/mobile/robocop/res && tar -xf -) + $(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar -I . -S res -A $(TESTPATH)/assets -F $@ -J ./ +# PP_java-tests not fully usable here +# Intermediate step toward a library rule. +$(dir-tests)/%.java: $(TESTPATH)/%.java.in $(call mkdir_deps,$(dir-tests)) + $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $< > $@ diff --git a/config/makefiles/java-build.mk b/config/makefiles/java-build.mk index 256809812c1b..34620e7fe1e4 100644 --- a/config/makefiles/java-build.mk +++ b/config/makefiles/java-build.mk @@ -30,6 +30,9 @@ endif #} ifdef JAVAFILES #{ GENERATED_DIRS += classes + +export:: classes +classes: $(call mkdir_deps,classes) endif #} INCLUDED_JAVA_BUILD_MK := 1 diff --git a/config/makefiles/mochitest.mk b/config/makefiles/mochitest.mk index 51f10377db4f..1861216ea485 100644 --- a/config/makefiles/mochitest.mk +++ b/config/makefiles/mochitest.mk @@ -7,15 +7,22 @@ ifndef INCLUDED_TESTS_MOCHITEST_MK #{ -ifdef relativesrcdir - mochitestdir = $(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir) -else - mochitestdir = $(DEPTH)/_tests/testing/mochitest/$1/$(subst $(topsrcdir),,$(srcdir)) -endif +# $1- test directory name +# $2- optional: if passed dot used to flatten directory hierarchy copy +# else- relativesrcdir +# else- determine relative path +mochitestdir = \ + $(strip \ + $(if $(2),$(DEPTH)/_tests/testing/mochitest/$1/. \ + ,$(if $(value relativesrcdir) \ + ,$(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir) \ + ,$(DEPTH)/_tests/testing/mochitest/$1/$(subst $(topsrcdir),,$(srcdir)) \ + ))) + define mochitest-libs-rule-template libs:: $$($(1)) - $$(call install_cmd,$$(foreach f,$$^,"$$(f)") $$(call mochitestdir,$(2))) + $$(call install_cmd,$$(foreach f,$$^,"$$(f)") $$(call mochitestdir,$(2),$(3))) endef # Provide support for modules with such a large number of tests that @@ -51,6 +58,10 @@ ifdef MOCHITEST_A11Y_FILES $(eval $(call mochitest-libs-rule-template,MOCHITEST_A11Y_FILES,a11y)) endif +ifdef MOCHITEST_ROBOCOP_FILES +$(eval $(call mochitest-libs-rule-template,MOCHITEST_ROBOCOP_FILES,tests/robocop,flat_hierarchy)) +endif + ifdef MOCHITEST_WEBAPPRT_CHROME_FILES $(eval $(call mochitest-libs-rule-template,MOCHITEST_WEBAPPRT_CHROME_FILES,webapprtChrome)) endif diff --git a/config/rules.mk b/config/rules.mk index 44d8d46ea7f0..4e89e69a4703 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -1800,6 +1800,7 @@ FREEZE_VARIABLES = \ MOCHITEST_BROWSER_FILES \ MOCHITEST_BROWSER_FILES_PARTS \ MOCHITEST_A11Y_FILES \ + MOCHITEST_ROBOCOP_FILES \ MOCHITEST_WEBAPPRT_CHROME_FILES \ $(NULL) diff --git a/js/src/config/makefiles/java-build.mk b/js/src/config/makefiles/java-build.mk index 256809812c1b..34620e7fe1e4 100644 --- a/js/src/config/makefiles/java-build.mk +++ b/js/src/config/makefiles/java-build.mk @@ -30,6 +30,9 @@ endif #} ifdef JAVAFILES #{ GENERATED_DIRS += classes + +export:: classes +classes: $(call mkdir_deps,classes) endif #} INCLUDED_JAVA_BUILD_MK := 1 diff --git a/js/src/config/makefiles/mochitest.mk b/js/src/config/makefiles/mochitest.mk index 51f10377db4f..1861216ea485 100644 --- a/js/src/config/makefiles/mochitest.mk +++ b/js/src/config/makefiles/mochitest.mk @@ -7,15 +7,22 @@ ifndef INCLUDED_TESTS_MOCHITEST_MK #{ -ifdef relativesrcdir - mochitestdir = $(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir) -else - mochitestdir = $(DEPTH)/_tests/testing/mochitest/$1/$(subst $(topsrcdir),,$(srcdir)) -endif +# $1- test directory name +# $2- optional: if passed dot used to flatten directory hierarchy copy +# else- relativesrcdir +# else- determine relative path +mochitestdir = \ + $(strip \ + $(if $(2),$(DEPTH)/_tests/testing/mochitest/$1/. \ + ,$(if $(value relativesrcdir) \ + ,$(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir) \ + ,$(DEPTH)/_tests/testing/mochitest/$1/$(subst $(topsrcdir),,$(srcdir)) \ + ))) + define mochitest-libs-rule-template libs:: $$($(1)) - $$(call install_cmd,$$(foreach f,$$^,"$$(f)") $$(call mochitestdir,$(2))) + $$(call install_cmd,$$(foreach f,$$^,"$$(f)") $$(call mochitestdir,$(2),$(3))) endef # Provide support for modules with such a large number of tests that @@ -51,6 +58,10 @@ ifdef MOCHITEST_A11Y_FILES $(eval $(call mochitest-libs-rule-template,MOCHITEST_A11Y_FILES,a11y)) endif +ifdef MOCHITEST_ROBOCOP_FILES +$(eval $(call mochitest-libs-rule-template,MOCHITEST_ROBOCOP_FILES,tests/robocop,flat_hierarchy)) +endif + ifdef MOCHITEST_WEBAPPRT_CHROME_FILES $(eval $(call mochitest-libs-rule-template,MOCHITEST_WEBAPPRT_CHROME_FILES,webapprtChrome)) endif diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk index 44d8d46ea7f0..4e89e69a4703 100644 --- a/js/src/config/rules.mk +++ b/js/src/config/rules.mk @@ -1800,6 +1800,7 @@ FREEZE_VARIABLES = \ MOCHITEST_BROWSER_FILES \ MOCHITEST_BROWSER_FILES_PARTS \ MOCHITEST_A11Y_FILES \ + MOCHITEST_ROBOCOP_FILES \ MOCHITEST_WEBAPPRT_CHROME_FILES \ $(NULL)