1 # 2 # Copyright (C) 2015 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 LOCAL_PATH:= $(call my-dir) 17 18 jack_server_version := 4.8.ALPHA 19 jack_server_jar := $(LOCAL_PATH)/jack-server-$(jack_server_version).jar 20 21 22 ifneq ($(ANDROID_JACK_VM_ARGS),) 23 jack_vm_args := $(ANDROID_JACK_VM_ARGS) 24 else 25 jack_vm_args := -Dfile.encoding=UTF-8 -XX:+TieredCompilation 26 endif 27 available_jack_jars := $(wildcard $(LOCAL_PATH)/jacks/jack-*.jar) 28 29 ifdef JACK_SERVER 30 ifneq ($(JACK_SERVER),true) 31 jack_server_disabled=true 32 endif 33 endif 34 35 .PHONY: setup-jack-server 36 setup-jack-server : PRIVATE_JACK_ADMIN := $(LOCAL_PATH)/jack-admin 37 setup-jack-server : PRIVATE_PATH := $(LOCAL_PATH) 38 setup-jack-server : PRIVATE_SERVER_VERSION := $(jack_server_version) 39 setup-jack-server : PRIVATE_SERVER_JAR := $(jack_server_jar) 40 setup-jack-server: $(JACK) $(LOCAL_PATH)/jack-launcher.jar $(jack_server_jar) $(available_jack_jars) 41 ifndef jack_server_disabled 42 @echo Ensure Jack server is installed and started 43 ifneq ($(dist_goal),) 44 $(hide) $(PRIVATE_JACK_ADMIN) stop-server 2>&1 || (exit 0) 45 $(hide) $(PRIVATE_JACK_ADMIN) kill-server 2>&1 || (exit 0) 46 $(hide) $(PRIVATE_JACK_ADMIN) uninstall-server 2>&1 || (exit 0) 47 endif 48 $(hide) $(PRIVATE_JACK_ADMIN) install-server $(PRIVATE_PATH)/jack-launcher.jar $(PRIVATE_SERVER_JAR) 2>&1 || (exit 0) 49 ifneq ($(dist_goal),) 50 $(hide) mkdir -p "$(DIST_DIR)/logs/jack/" 51 $(hide) JACK_SERVER_VM_ARGUMENTS="$(jack_vm_args) -Dcom.android.jack.server.log.file=$(abspath $(DIST_DIR))/logs/jack/jack-server-%u-%g.log" $(PRIVATE_JACK_ADMIN) start-server 2>&1 || exit 0 52 else 53 $(hide) JACK_SERVER_VM_ARGUMENTS="$(jack_vm_args)" $(PRIVATE_JACK_ADMIN) start-server 2>&1 || exit 0 54 endif 55 $(hide) $(PRIVATE_JACK_ADMIN) update server $(PRIVATE_SERVER_JAR) $(PRIVATE_SERVER_VERSION) 2>&1 || exit 0 56 $(hide) $(foreach jack_jar,$(available_jack_jars),$(PRIVATE_JACK_ADMIN) update jack $(jack_jar) $(patsubst $(PRIVATE_PATH)/jacks/jack-%.jar,%,$(jack_jar)) || exit 47;) 57 endif 58