From f1d448b6a9a79f7e80a964fe97f4b0d5da9b8f38 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Thu, 22 Sep 2016 10:54:27 -0700 Subject: [PATCH] [Java] Add a test to verify that typedefs in types.hal does not mistakenly generate a makefile rule. Bug: 31678014 Test: regenerate makefiles using hidl-gen. Change-Id: I72ceaedd33288269b74e2aa233043c741994cd1a --- tests/baz/1.0/Android.mk | 17 +++++++++++++++++ tests/baz/1.0/types.hal | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/baz/1.0/types.hal diff --git a/tests/baz/1.0/Android.mk b/tests/baz/1.0/Android.mk index 165237fe7c..a0b36b0179 100644 --- a/tests/baz/1.0/Android.mk +++ b/tests/baz/1.0/Android.mk @@ -8,6 +8,23 @@ intermediates := $(local-generated-sources-dir) HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX) +# +# Build types.hal +# +GEN := $(intermediates)/android/hardware/tests/baz/1.0/types.cpp +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal +$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) +$(GEN): PRIVATE_CUSTOM_TOOL = \ + $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ + -Lc++ -randroid.hardware:hardware/interfaces \ + android.hardware.tests.baz@1.0::types + +$(GEN): $(LOCAL_PATH)/types.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + # # Build IBase.hal # diff --git a/tests/baz/1.0/types.hal b/tests/baz/1.0/types.hal new file mode 100644 index 0000000000..030dbe58c4 --- /dev/null +++ b/tests/baz/1.0/types.hal @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2016 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. + */ + +package android.hardware.tests.baz@1.0; + +/* + * Verify that introducing a typedef in types.hal does not mistakenly emit + * a makefile section to create a dedicated ulong.java class as it used to. + */ +typedef uint32_t ulong;