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