Merge "Migrate to Android.bp files to support Kotlin"
diff --git a/car-systemtest-lib/Android.bp b/car-systemtest-lib/Android.bp
new file mode 100644
index 0000000..aee61a3
--- /dev/null
+++ b/car-systemtest-lib/Android.bp
@@ -0,0 +1,28 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+
+java_library {
+
+    name: "car-systemtest",
+
+    srcs: [
+        "src/**/*.java",
+        "src/**/I*.aidl",
+    ],
+
+    libs: ["android.car"],
+
+}
diff --git a/car-systemtest-lib/Android.mk b/car-systemtest-lib/Android.mk
deleted file mode 100644
index 6e4def5..0000000
--- a/car-systemtest-lib/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := car-systemtest
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-Iaidl-files-under, src)
-
-LOCAL_AIDL_INCLUDES += packages/services/Car/libvehiclenetwork/java/src/
-
-LOCAL_JAVA_LIBRARIES += android.car
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/procfs-inspector/client/Android.bp b/procfs-inspector/client/Android.bp
new file mode 100644
index 0000000..91b5e98
--- /dev/null
+++ b/procfs-inspector/client/Android.bp
@@ -0,0 +1,26 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+
+java_library {
+
+    name: "com.android.car.procfsinspector-client",
+
+    srcs: [
+        "src/**/*.java",
+        "src/**/I*.aidl",
+    ],
+
+}
diff --git a/procfs-inspector/client/Android.mk b/procfs-inspector/client/Android.mk
deleted file mode 100644
index d9713de..0000000
--- a/procfs-inspector/client/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := com.android.car.procfsinspector-client
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-Iaidl-files-under, src)
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/service/Android.bp b/service/Android.bp
new file mode 100644
index 0000000..30f99d4
--- /dev/null
+++ b/service/Android.bp
@@ -0,0 +1,106 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+
+// Build the Car service.
+
+car_service_sources = ["src/**/*.java", "src/**/*.kt"]
+
+android_app {
+    name: "CarService",
+
+    srcs: car_service_sources,
+
+    resource_dirs: ["res"],
+
+    platform_apis: true,
+
+    // Each update should be signed by OEMs
+    certificate: "platform",
+    privileged: true,
+
+    optimize: {
+        proguard_flags_files: ["proguard.flags"],
+        enabled: false,
+    },
+
+    libs: ["android.car"],
+
+    static_libs: [
+        "android.car.userlib",
+        "android.hidl.base-V1.0-java",
+        "android.hardware.automotive.audiocontrol-V1.0-java",
+        "android.hardware.automotive.vehicle-V2.0-java",
+        "android.hardware.health-V1.0-java",
+        "android.hardware.health-V2.0-java",
+        "vehicle-hal-support-lib",
+        "car-frameworks-service",
+        "car-systemtest",
+        "com.android.car.procfsinspector-client",
+        "blestream-protos",
+        "SettingsLib",
+        "androidx.preference_preference",
+        "EncryptionRunner",
+    ],
+
+    required: ["privapp_whitelist_com.android.car"],
+
+    // Disable build in PDK, missing aidl import breaks build
+    product_variables: {
+        pdk: {
+            enabled: false,
+        },
+    },
+}
+
+//####################################################################################
+// Build a static library to help mocking various car services in testing
+//####################################################################################
+android_library {
+    name: "car-service-lib-for-test",
+
+    srcs: car_service_sources,
+
+    resource_dirs: ["res"],
+
+    libs: [
+        "android.car",
+        "car-frameworks-service",
+    ],
+
+    static_libs: [
+        "android.car.userlib",
+        "android.hidl.base-V1.0-java",
+        "android.hardware.automotive.audiocontrol-V1.0-java",
+        "android.hardware.automotive.vehicle-V2.0-java",
+        "android.hardware.health-V1.0-java",
+        "android.hardware.health-V2.0-java",
+        "vehicle-hal-support-lib",
+        "car-systemtest",
+        "com.android.car.procfsinspector-client",
+        "blestream-protos",
+        "SettingsLib",
+        "androidx.preference_preference",
+        "EncryptionRunner",
+    ],
+
+    min_sdk_version: "25",
+
+    product_variables: {
+        pdk: {
+            enabled: false,
+        },
+    },
+}
diff --git a/service/Android.mk b/service/Android.mk
deleted file mode 100644
index 2f081c6..0000000
--- a/service/Android.mk
+++ /dev/null
@@ -1,109 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-# Build the Car service.
-
-#disble build in PDK, missing aidl import breaks build
-ifneq ($(TARGET_BUILD_PDK),true)
-
-LOCAL_PATH:= $(call my-dir)
-
-car_service_sources := $(call all-java-files-under, src)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(car_service_sources)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_PACKAGE_NAME := CarService
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-# Each update should be signed by OEMs
-LOCAL_CERTIFICATE := platform
-LOCAL_PRIVILEGED_MODULE := true
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_JAVA_LIBRARIES += \
-    android.car \
-
-LOCAL_STATIC_JAVA_LIBRARIES += \
-    android.car.userlib \
-    android.hidl.base-V1.0-java \
-    android.hardware.automotive.audiocontrol-V1.0-java \
-    android.hardware.automotive.vehicle-V2.0-java \
-    android.hardware.health-V1.0-java \
-    android.hardware.health-V2.0-java \
-    vehicle-hal-support-lib \
-    car-frameworks-service \
-    car-systemtest \
-    com.android.car.procfsinspector-client \
-    blestream-protos \
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
-    SettingsLib \
-    androidx.preference_preference \
-    EncryptionRunner
-
-LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.car
-
-include $(BUILD_PACKAGE)
-
-#####################################################################################
-# Build a static library to help mocking various car services in testing
-#####################################################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(car_service_sources)
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_MODULE := car-service-lib-for-test
-
-LOCAL_JAVA_LIBRARIES += \
-    android.car \
-    car-frameworks-service \
-
-LOCAL_STATIC_JAVA_LIBRARIES += \
-    android.car.userlib \
-    android.hidl.base-V1.0-java \
-    android.hardware.automotive.audiocontrol-V1.0-java \
-    android.hardware.automotive.vehicle-V2.0-java \
-    android.hardware.health-V1.0-java \
-    android.hardware.health-V2.0-java \
-    vehicle-hal-support-lib \
-    car-systemtest \
-    com.android.car.procfsinspector-client \
-    blestream-protos \
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
-    SettingsLib \
-    androidx.preference_preference \
-    EncryptionRunner
-
-LOCAL_MIN_SDK_VERSION := 25
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
-
-endif #TARGET_BUILD_PDK
diff --git a/vehicle-hal-support-lib/Android.bp b/vehicle-hal-support-lib/Android.bp
new file mode 100644
index 0000000..92e1ccf
--- /dev/null
+++ b/vehicle-hal-support-lib/Android.bp
@@ -0,0 +1,28 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+java_library {
+
+    name: "vehicle-hal-support-lib",
+
+    srcs: ["src/**/*.java"],
+
+    static_libs: [
+        "android.hidl.base-V1.0-java",
+        "android.hardware.automotive.vehicle-V2.0-java",
+        "junit",
+    ],
+
+}
diff --git a/vehicle-hal-support-lib/Android.mk b/vehicle-hal-support-lib/Android.mk
deleted file mode 100644
index 22e094c..0000000
--- a/vehicle-hal-support-lib/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := vehicle-hal-support-lib
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    android.hidl.base-V1.0-java \
-    android.hardware.automotive.vehicle-V2.0-java \
-    junit
-
-include $(BUILD_STATIC_JAVA_LIBRARY)