Home | History | Annotate | Download | only in monitor
      1 # Copyright 2012 The Android Open Source Project
      2 
      3 # Expose the Monitor RCP only for the SDK builds.
      4 ifneq (,$(is_sdk_build)$(filter sdk sdk_x86 sdk_mips,$(TARGET_PRODUCT)))
      5 
      6 LOCAL_PATH := $(call my-dir)
      7 include $(CLEAR_VARS)
      8 
      9 LOCAL_MODULE := monitor
     10 LOCAL_MODULE_CLASS := EXECUTABLES
     11 LOCAL_MODULE_TAGS := optional
     12 LOCAL_IS_HOST_MODULE := true
     13 include $(BUILD_SYSTEM)/base_rules.mk
     14 
     15 RCP_LOG_FILE := out/host/eclipse/rcp/build/monitor.log
     16 RCP_MONITOR_DIR := $(TOPDIR)out/host/eclipse/rcp/build/I.RcpBuild
     17 
     18 define mk-rcp-monitor-atree-file
     19     srczip=$(RCP_MONITOR_DIR)/RcpBuild-$(1).$(2).zip && \
     20     dstdir=$(HOST_OUT)/eclipse/monitor-$(1).$(2) && \
     21     rm -rf $(V) $$dstdir && \
     22     mkdir -p $$dstdir && \
     23     unzip -q $$srczip -d $$dstdir
     24 endef
     25 
     26 MONITOR_DEP_LIBRARIES := $(shell $(TOPDIR)sdk/eclipse/scripts/create_all_symlinks.sh -d)
     27 MONITOR_DEPS := $(foreach m,$(MONITOR_DEP_LIBRARIES),$(HOST_OUT_JAVA_LIBRARIES)/$(m).jar)
     28 
     29 # The RCP monitor. It is referenced by build/target/products/sdk.mk
     30 $(LOCAL_BUILT_MODULE) : $(TOPDIR)sdk/monitor/monitor \
     31 			$(TOPDIR)sdk/monitor/build.xml \
     32 			$(TOPDIR)sdk/monitor/build.properties \
     33 			$(MONITOR_DEPS)
     34 	@mkdir -p $(dir $@)
     35 	$(hide) $(TOPDIR)sdk/eclipse/scripts/create_all_symlinks.sh -c
     36 	$(hide)cd $(TOPDIR)sdk/monitor && \
     37 		rm -f ../../$(RCP_LOG_FILE) && mkdir -p ../../$(dir $(RCP_LOG_FILE)) && \
     38 		( java -jar ../../external/eclipse-basebuilder/basebuilder-3.6.2/org.eclipse.releng.basebuilder/plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar \
     39 			org.eclipse.equinox.launcher.Main \
     40 			-application org.eclipse.ant.core.antRunner \
     41 			-configuration ../../out/host/eclipse/rcp/build/configuration \
     42 			-DbuildFor=$(HOST_OS) 2>&1 && \
     43 		  mv -f ../../$(RCP_LOG_FILE) ../../$(RCP_LOG_FILE).1 ) \
     44 		| tee ../../$(RCP_LOG_FILE) \
     45 		| sed -E '/\[java\]/!d; /SUCCESSFUL/d ; s/^ +\[java\] //; /^ *$$/d; /:$$/d; /\[javac\] [^C]/d; s/^/monitor: /'; \
     46 		if [[ -f ../../$(RCP_LOG_FILE) ]]; then \
     47 		  echo "Monitor failed. Full log:" ; \
     48 		  cat ../../$(RCP_LOG_FILE) ; \
     49 		  exit 1 ; \
     50 		fi
     51 	$(hide)if [[ $(HOST_OS) == "linux" ]]; then \
     52 		$(call mk-rcp-monitor-atree-file,linux.gtk,x86)    ; \
     53 		$(call mk-rcp-monitor-atree-file,linux.gtk,x86_64) ; \
     54 	elif [[ $(HOST_OS) == "darwin" ]]; then \
     55 		$(call mk-rcp-monitor-atree-file,macosx.cocoa,x86_64) ; \
     56 	elif [[ $(HOST_OS) == "windows" ]]; then \
     57 		$(call mk-rcp-monitor-atree-file,win32.win32,x86)    ; \
     58 		$(call mk-rcp-monitor-atree-file,win32.win32,x86_64) ; \
     59 	fi
     60 	$(hide)$(ACP) -fp $(V) $(TOPDIR)sdk/monitor/monitor $@
     61 
     62 endif
     63