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 > <javascript:>> 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 > <javascript:> > > To unsubscribe from this group, send email to > > android-buildi...@googlegroups.com <javascript:> > > 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 <javascript:>. > > 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.