Hi ,

I also followed similar steps , build flag is not updating with proper 
value. 
Is there any thing we need to take care apart from these changes.
Please let us know.

Thanks,
Manoj

On Wednesday, 24 May 2017 19:59:12 UTC+5:30, Jeffrey An wrote:
>
> Hi,
> With your comment, finally it works. But I have another issue.
> I added BOARD_HAVE_EXT_AVDT := true and avdt_ext.cc file was compiled.
> But I removed BOARD_HAVE_EXT_AVDT := true in 
> BoardConfig.mk(device/huawei/angler/) but still avdt_ext.cc file was 
> compiled.
>
> Without BOARD_HAVE_EXT_AVDT := true in BoardConfig.mk, avdt_ext.cc file 
> should not be compiled.
> Here's my changes.
> build/soong/
> diff --git a/android/variable.go b/android/variable.go
> old mode 100644
> new mode 100755
> index 163113e..a1ff5bb
> --- a/android/variable.go
> +++ b/android/variable.go
> @@ -74,7 +74,11 @@ type variableProperties struct {
>                         Cflags   []string
>                         Cppflags []string
>                 }
> +               Ext_avd struct { 
> +                       Srcs []string 
> +               }
>         } `android:"arch_variant"`
> +
>  }
>  
>  var zeroProductVariables variableProperties
> @@ -136,6 +140,8 @@ type productVariables struct {
>         ArtUseReadBarrier *bool `json:",omitempty"`
>  
>         BtConfigIncludeDir *string `json:",omitempty"`
> +       
> +       Ext_avd *string `json:",omitempty"`
>  }
>
> system/bt
> diff --git a/stack/Android.bp b/stack/Android.bp
> old mode 100644
> new mode 100755
> index 58c8fe9..f67fcbc
> --- a/stack/Android.bp
> +++ b/stack/Android.bp
> @@ -179,7 +179,13 @@ cc_library_static {
>      required: [
>          "libldacBT_enc",
>          "libldacBT_abr",
> -    ]
> +    ],
> +
> +               product_variables: {
> +                   ext_avd: {
> +                       srcs: ["avdt/avdt_ext.cc"],
> +                   },
> +               },
>  }
>  
>  // Bluetooth stack unit tests for target
>
> system/bt/stack/avdt/avdt_ext.cc
>
> ADSFA
>
> #if AVDT_EXT == TRUE
>
> /******************************************************************************
> ...
> #endif
>
> compile result
> Error should not be printed since I didn't want to compile avdt_ext.cc
> [  2% 1/44] cc 
> out/soong/.intermediates/system/bt/stack/libbt-stack/andro..._arm64_armv8-a_cortex-a53_static_core/obj/system/bt/stack/avdt/avdt_ext.o
> FAILED: 
> out/soong/.intermediates/system/bt/stack/libbt-stack/android_arm64_armv8-a_cortex-a53_static_core/obj/system/bt/stack/avdt/avdt_ext.o
>  
> PWD=/proc/self/cwd prebuilts/misc/linux-x86/ccache/ccache 
> prebuilts/clang/host/linux-x86/clang-3859424/bin/clang++ -c 
> -Isystem/bt/stack/include -Isystem/bt/stack/avct -Isystem/bt/stack/btm 
> -Isystem/bt/stack/avrc -Isystem/bt/stack/l2cap -Isystem/bt/stack/avdt 
> -Isystem/bt/stack/gatt -Isystem/bt/stack/gap -Isystem/bt/stack/pan 
> -Isystem/bt/stack/bnep -Isystem/bt/stack/hid -Isystem/bt/stack/sdp 
> -Isystem/bt/stack/smp -Isystem/bt/stack/srvc 
> -Idevice/huawei/angler/bluetooth -Iexternal/aac/libAACenc/include 
> -Iexternal/aac/libSYS/include -Iexternal/libldac/inc 
> -Iexternal/libldac/abr/inc -Isystem/bt -Isystem/bt/btcore/include 
> -Isystem/bt/vnd/include -Isystem/bt/vnd/ble -Isystem/bt/btif/include 
> -Isystem/bt/hci/include -Isystem/bt/include -Isystem/bt/udrv/include 
> -Isystem/bt/bta/include -Isystem/bt/bta/sys -Isystem/bt/utils/include 
> -Isystem/bt/stack  -fno-exceptions -Wno-multichar -fno-strict-aliasing 
> -fstack-protector-strong -ffunction-sections -fdata-sections 
> -funwind-tables -Wa,--noexecstack -Werror=format-security 
> -D_FORTIFY_SOURCE=2 -fno-short-enums -no-canonical-prefixes 
> -Werror=pointer-to-int-cast -Werror=int-to-pointer-cast 
> -Werror=implicit-function-declaration -DNDEBUG -O2 -g -Wstrict-aliasing=2 
> -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self 
> -Wpointer-arith -DNDEBUG -UDEBUG -fdebug-prefix-map=/proc/self/cwd= 
> -D__compiler_offsetof=__builtin_offsetof -Werror=int-conversion 
> -Wno-reserved-id-macro -Wno-format-pedantic 
> -Wno-unused-command-line-argument -fcolor-diagnostics 
> -Wno-expansion-to-defined -fdebug-prefix-map=$PWD/= -Werror=return-type 
> -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point 
> -Werror=date-time -nostdlibinc -mcpu=cortex-a53 
> -Iexternal/aac/libAACdec/include -Iexternal/aac/libAACenc/include 
> -Iexternal/aac/libPCMutils/include -Iexternal/aac/libFDK/include 
> -Iexternal/aac/libSYS/include -Iexternal/aac/libMpegTPDec/include 
> -Iexternal/aac/libMpegTPEnc/include -Iexternal/aac/libSBRdec/include 
> -Iexternal/aac/libSBRenc/include -Iexternal/libcxx/include 
> -Iexternal/libcxxabi/include -Iexternal/libchrome 
> -Iexternal/googletest/googletest/include 
> -Iexternal/googletest/googletest/include -Isystem/core/base/include 
> -Isystem/core/libutils/include -Isystem/core/libbacktrace/include 
> -Isystem/core/libsystem/include -Isystem/core/libcutils/include 
> -Isystem/core/liblog/include -Isystem/core/include 
> -Isystem/media/audio/include -Ihardware/libhardware/include 
> -Ihardware/libhardware_legacy/include -Ihardware/ril/include 
> -Ilibnativehelper/include -Iframeworks/native/include 
> -Iframeworks/native/opengl/include -isystem frameworks/av/include -isystem 
> bionic/libc/arch-arm64/include -isystem bionic/libc/include -isystem 
> bionic/libc/kernel/uapi -isystem bionic/libc/kernel/uapi/asm-arm64 -isystem 
> bionic/libc/kernel/android/uapi -Ilibnativehelper/include/nativehelper 
> '-DEXPORT_SYMBOL=__attribute__((visibility("default")))' 
> -fvisibility=hidden -Wall -Wextra -Werror 
> -Wno-gnu-variable-sized-type-not-at-end -Wno-typedef-redefinition 
> -Wno-unused-parameter -DLOG_NDEBUG=1 -DHAS_BDROID_BUILDCFG 
> -DBLUEDROID_DEBUG -DDCHECK_ALWAYS_ON -target aarch64-linux-android 
> -Bprebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin
>  
> -DANDROID_STRICT -fPIC -D_USING_LIBCXX -std=gnu++14 -Wsign-promo 
> -Wno-inconsistent-missing-override -Wno-null-dereference -fno-rtti 
> -fvisibility-inlines-hidden -Werror=int-to-pointer-cast 
> -Werror=pointer-to-int-cast -Werror=address-of-temporary 
> -Werror=return-type -MD -MF 
> out/soong/.intermediates/system/bt/stack/libbt-stack/android_arm64_armv8-a_cortex-a53_static_core/obj/system/bt/stack/avdt/avdt_ext.o.d
>  
> -o 
> out/soong/.intermediates/system/bt/stack/libbt-stack/android_arm64_armv8-a_cortex-a53_static_core/obj/system/bt/stack/avdt/avdt_ext.o
>  
> system/bt/stack/avdt/avdt_ext.cc
> system/bt/stack/avdt/avdt_ext.cc:2:1: error: unknown type name 'ADSFA'
> ADSFA
>
>
> Could you give me more advice?
>
> Thanks,
>
> 2017년 5월 24일 수요일 오전 3시 21분 41초 UTC+9, Dan Willemsen 님의 말:
>>
>> And you need to be in the product_variables map:
>>
>> product_variables: {
>>     ext_avd: {
>>         srcs: [...],
>>     },
>> },
>>
>> - Dan
>>
>> On Tue, May 23, 2017 at 11:07 AM Colin Cross <ccr...@android.com> wrote:
>>
>>> The property in the Android.bp file should be "ext_avd", not
>>> "Ext_avd".  The required capitalization in the go files is an
>>> unfortunate consequence of reflection requiring exported go fields.
>>>
>>> On Tue, May 23, 2017 at 12:29 AM, Jeffrey An <jeffr...@gmail.com> wrote:
>>> > Hi,
>>> >
>>> > Thanks for the answer! I understand the purpose of the soong build 
>>> system.
>>> >
>>> > As you said, for local experimentation, I've tried like below,
>>> > build/soong
>>> >
>>> > diff --git a/android/variable.go b/android/variable.go
>>> > old mode 100644
>>> > new mode 100755
>>> > index 163113e..475cee0
>>> > --- a/android/variable.go
>>> > +++ b/android/variable.go
>>> > @@ -75,6 +75,10 @@ type variableProperties struct {
>>> >                         Cppflags []string
>>> >                 }
>>> >         } `android:"arch_variant"`
>>> > +
>>> > +       Ext_avd struct {
>>> > +               Srcs []string
>>> > +       }
>>> >  }
>>> >
>>> >  var zeroProductVariables variableProperties
>>> > @@ -136,6 +140,8 @@ type productVariables struct {
>>> >         ArtUseReadBarrier *bool `json:",omitempty"`
>>> >
>>> >         BtConfigIncludeDir *string `json:",omitempty"`
>>> > +
>>> > +       Ext_avd *string `json:",omitempty"`
>>> >  }
>>> >
>>> > build/make
>>> > diff --git a/core/soong_config.mk b/core/soong_config.mk
>>> > old mode 100644
>>> > new mode 100755
>>> > index 576c8ab..cf08a8b
>>> > --- a/core/soong_config.mk
>>> > +++ b/core/soong_config.mk
>>> > @@ -69,6 +69,7 @@ $(SOONG_VARIABLES): FORCE
>>> >         echo ''; \
>>> >         echo '    "ArtUseReadBarrier": $(if $(filter
>>> > false,$(PRODUCT_ART_USE_READ_BARRIER)),false,true),'; \
>>> >         echo ''; \
>>> > +       echo '    "Ext_avd": "$(BOARD_HAVE_EXT_AVDT)",'; \
>>> >         echo '    "BtConfigIncludeDir":
>>> > "$(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)"'; \
>>> >         echo '}') > $(SOONG_VARIABLES_TMP); \
>>> >         if ! cmp -s $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); then \
>>> >
>>> > device/huawei/angler
>>> > diff --git a/BoardConfig.mk b/BoardConfig.mk
>>> > old mode 100644
>>> > new mode 100755
>>> > index 141d0a4..2e24d88
>>> > --- a/BoardConfig.mk
>>> > +++ b/BoardConfig.mk
>>> > @@ -45,6 +45,7 @@ BOARD_USES_ALSA_AUDIO := true
>>> >  BOARD_HAVE_BLUETOOTH := true
>>> >  BOARD_HAVE_BLUETOOTH_BCM := true
>>> >  BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR :=
>>> > device/huawei/angler/bluetooth
>>> > +BOARD_HAVE_EXT_AVDT := true
>>> >
>>> >  BOARD_USES_SECURE_SERVICES := true
>>> >
>>> > system/bt
>>> > diff --git a/stack/Android.bp b/stack/Android.bp
>>> > old mode 100644
>>> > new mode 100755
>>> > index 58c8fe9..82cf586
>>> > --- a/stack/Android.bp
>>> > +++ b/stack/Android.bp
>>> > @@ -179,7 +179,10 @@ cc_library_static {
>>> >      required: [
>>> >          "libldacBT_enc",
>>> >          "libldacBT_abr",
>>> > -    ]
>>> > +    ],
>>> > +    Ext_avd: {
>>> > +           srcs: ["avdt/avdt_ext.cc"],
>>> > +    },
>>> >  }
>>> >
>>> > And tried to build but got error.
>>> > [2/2] bootstrap out/soong/.minibootstrap/build.ninja.in
>>> > [1/1] out/soong/.bootstrap/bin/minibp out/soong/.bootstrap/build.ninja
>>> > [1/2] glob device/*/*/Android.bp
>>> > [1/2] soong_build docs out/soong/.bootstrap/docs/soong_build.html
>>> > FAILED: out/soong/.bootstrap/docs/soong_build.html
>>> > out/soong/.bootstrap/bin/soong_build  -t -b out/soong --docs
>>> > out/soong/.bootstrap/docs/soong_build.html ./Android.bp
>>> > error: system/bt/stack/Android.bp:183:12: unrecognized property 
>>> "Ext_avd"
>>> > [2/2] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
>>> > FAILED: out/soong/build.ninja
>>> > out/soong/.bootstrap/bin/soong_build -t -b out/soong -d
>>> > out/soong/build.ninja.d -o out/soong/build.ninja Android.bp
>>> > error: system/bt/stack/Android.bp:183:12: unrecognized property 
>>> "Ext_avd"
>>> > ninja: build stopped: subcommand failed.
>>> > 16:25:21 soong bootstrap failed with: exit status 1
>>> > make: *** [run_soong_ui] Error 1
>>> > make: Leaving directory `/home/jeffrey/work/google/pdk'
>>> >
>>> > #### make failed to build some targets (1 seconds) ####
>>> >
>>> >
>>> > Could you give me more advice here?
>>> >
>>> > Thanks,
>>> >
>>> >
>>> > 2017년 5월 23일 화요일 오전 5시 13분 12초 UTC+9, Colin Cross 님의 말:
>>> >>
>>> >> One of our goals for build health is to reduce the number of different
>>> >> ways we build modules.  Adding too many build flags makes it harder to
>>> >> tell if a change will break the build, and hard to run tests.  We
>>> >> would much rather compiling everything the same on all devices, and
>>> >> then determine which parts to use at runtime.
>>> >>
>>> >> For local experimentation, you can add flags with:
>>> >> 1.  Add: Ext_avd struct { Srcs []string } to varaibleProperties in
>>> >> build/soong/android/variable.go
>>> >> 2.  Add: Ext_avd *bool `json:",omitempty"` to productVariables in the 
>>> same
>>> >> file
>>> >> 3.  Modify build/make/core/soong_config.mk to pass 
>>> BOARD_HAVE_EXT_AVDT to
>>> >> soong.
>>> >>
>>> >> On Tue, May 16, 2017 at 11:12 PM, Jeffrey An <jeffr...@gmail.com> 
>>> wrote:
>>> >> > Hi,
>>> >> >
>>> >> >
>>> >> >
>>> >> > I have been studying android-o-preview-1 especially Soong and Go 
>>> build
>>> >> > system.
>>> >> >
>>> >> >
>>> >> >
>>> >> > I’d like to add new feature to Bluetooth stack and attachment is 
>>> one way
>>> >> > to
>>> >> > do it.
>>> >> >
>>> >> > In the attachment, I can use #ifdef EXT_AVDT in the cc source file.
>>> >> >
>>> >> > As you can see in the attachment, BOARD_HAVE_EXT_AVDT := true in the
>>> >> > BoardConfig.mk will enable EXT_AVDT in the system/bt stack.
>>> >> >
>>> >> > And Soong will always compile avdt_ext_avdt.cc file even if
>>> >> > BOARD_HAVE_EXT_AVDT is not true in the BoardConfig.mk
>>> >> >
>>> >> >
>>> >> >
>>> >> > I’d like to know another way that avdt_ext_avdt.cc file would not be
>>> >> > compiled without BOARD_HAVE_EXT_AVDT
>>> >> >
>>> >> >
>>> >> >
>>> >> > In the readme file in the Soong, you said
>>> >> >
>>> >> > ```
>>> >> >
>>> >> > cc_library {
>>> >> >
>>> >> >     ...
>>> >> >
>>> >> >     srcs: ["generic.cpp"],
>>> >> >
>>> >> >     arch: {
>>> >> >
>>> >> >         arm: {
>>> >> >
>>> >> >             srcs: ["arm.cpp"],
>>> >> >
>>> >> >         },
>>> >> >
>>> >> >         x86: {
>>> >> >
>>> >> >             srcs: ["x86.cpp"],
>>> >> >
>>> >> >         },
>>> >> >
>>> >> >     },
>>> >> >
>>> >> > }
>>> >> >
>>> >> > ```
>>> >> >
>>> >> >
>>> >> >
>>> >> > I tried to find example about it but I couldn’t find it.
>>> >> >
>>> >> >
>>> >> >
>>> >> > I want to change system/bt/stack/Android.bp like below
>>> >> >
>>> >> > …
>>> >> >
>>> >> > "smp/smp_utils.cc",
>>> >> >
>>> >> >         "srvc/srvc_battery.cc",
>>> >> >
>>> >> >         "srvc/srvc_dis.cc",
>>> >> >
>>> >> >         "srvc/srvc_eng.cc",
>>> >> >
>>> >> >     ],
>>> >> >
>>> >> >     static_libs: [
>>> >> >
>>> >> >         "libbt-hci",
>>> >> >
>>> >> >         "libFraunhoferAAC",
>>> >> >
>>> >> >     ],
>>> >> >
>>> >> >     shared_libs: [
>>> >> >
>>> >> >         "libcutils",
>>> >> >
>>> >> >         "liblog",
>>> >> >
>>> >> >     ],
>>> >> >
>>> >> >     required: [
>>> >> >
>>> >> >         "libldacBT_enc",
>>> >> >
>>> >> >     ],
>>> >> >
>>> >> >     ext-avdt: {
>>> >> >
>>> >> > srcs: ["avdt/avdt_ext_avdt.cc "],
>>> >> >
>>> >> >     }
>>> >> >
>>> >> > }
>>> >> >
>>> >> > And  avdt_ext_avdt.cc file will be compiled when BoardConfig.mk 
>>> file has
>>> >> > BOARD_HAVE_EXT_AVDT := true
>>> >> >
>>> >> >
>>> >> >
>>> >> > Could anyone guide me how to do it?
>>> >> >
>>> >> >
>>> >> > --
>>> >> > --
>>> >> > You received this message because you are subscribed to the "Android
>>> >> > Building" mailing list.
>>> >> > To post to this group, send email to android-...@googlegroups.com
>>> >> > To unsubscribe from this group, send email to
>>> >> > android-buildi...@googlegroups.com
>>> >> > For more options, visit this group at
>>> >> > http://groups.google.com/group/android-building?hl=en
>>> >> >
>>> >> > ---
>>> >> > You received this message because you are subscribed to the Google
>>> >> > Groups
>>> >> > "Android Building" group.
>>> >> > To unsubscribe from this group and stop receiving emails from it, 
>>> send
>>> >> > an
>>> >> > email to android-buildi...@googlegroups.com.
>>> >> > For more options, visit https://groups.google.com/d/optout.
>>> >
>>> > --
>>> > --
>>> > You received this message because you are subscribed to the "Android
>>> > Building" mailing list.
>>> > To post to this group, send email to android-...@googlegroups.com
>>> > To unsubscribe from this group, send email to
>>> > android-buildi...@googlegroups.com
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/android-building?hl=en
>>> >
>>> > ---
>>> > You received this message because you are subscribed to the Google 
>>> Groups
>>> > "Android Building" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send 
>>> an
>>> > email to android-buildi...@googlegroups.com.
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the "Android 
>>> Building" mailing list.
>>> To post to this group, send email to android-...@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-buildi...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-building?hl=en
>>>
>>> ---
>>> You received this message because you are subscribed to the Google 
>>> Groups "Android Building" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to android-buildi...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to android-building@googlegroups.com
To unsubscribe from this group, send email to
android-building+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-building+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to