diff options
author | Jaewoong Jung <jungjw@google.com> | 2019-02-11 08:30:11 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-02-11 08:30:11 -0800 |
commit | 9f3972866f2cda71d9ef5905fb5d12445ee049fa (patch) | |
tree | 582360931c8db9b845469ddcd99c318e6f123d08 | |
parent | f37a99398b91aa65bb4d28db1423976ff985c12b (diff) | |
parent | a93da91a40afa2c89d1427e2ee69ad9b6149e375 (diff) | |
download | ca-certificates-9f3972866f2cda71d9ef5905fb5d12445ee049fa.tar.gz |
Convert Android.mk's to Soong.
am: a93da91a40
Change-Id: I8adbd2bcc13b95fb9f4bcf304d2cff24d5c58e7e
-rw-r--r-- | Android.bp | 27 | ||||
-rw-r--r-- | Android.mk | 73 | ||||
-rw-r--r-- | google/Android.bp | 27 | ||||
-rw-r--r-- | google/Android.mk | 45 | ||||
-rw-r--r-- | soong/Android.bp | 12 | ||||
-rw-r--r-- | soong/ca_certificates.go | 81 | ||||
-rw-r--r-- | wfa_certs/Android.bp | 28 | ||||
-rw-r--r-- | wfa_certs/Android.mk | 35 |
8 files changed, 175 insertions, 153 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..22b31c8 --- /dev/null +++ b/Android.bp @@ -0,0 +1,27 @@ +// Copyright (C) 2011 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. + +ca_certificates { + name: "cacerts", + src_dir: "files", + dest_dir: "security/cacerts", + module_name_prefix: "target-cacert-", +} + +ca_certificates_host { + name: "cacerts-host", + src_dir: "files", + dest_dir: "security/cacerts", + module_name_prefix: "host-cacert-", +} diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 25a6043..0000000 --- a/Android.mk +++ /dev/null @@ -1,73 +0,0 @@ -# -*- mode: makefile -*- -# Copyright (C) 2011 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) - -# -# Definitions for installing Certificate Authority (CA) certificates -# - -define all-files-under -$(patsubst ./%,%, \ - $(shell cd $(LOCAL_PATH) ; \ - find $(1) -type f) \ - ) -endef - -# $(1): module name -# $(2): source file -# $(3): destination directory -define include-prebuilt-with-destination-directory -include $$(CLEAR_VARS) -LOCAL_MODULE := $(1) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk -LOCAL_MODULE_STEM := $(notdir $(2)) -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(3) -LOCAL_SRC_FILES := $(2) -include $$(BUILD_PREBUILT) -endef - -cacerts := $(call all-files-under,files) - -$(foreach cacert,$(cacerts),$(eval \ - $(call include-prebuilt-with-destination-directory,\ - target-cacert-$(notdir $(cacert)),\ - $(cacert),\ - $(TARGET_OUT)/etc/security/cacerts\ - )\ -)) - -include $(CLEAR_VARS) -LOCAL_MODULE := cacerts -LOCAL_REQUIRED_MODULES := $(foreach cacert,$(cacerts),target-cacert-$(notdir $(cacert))) -include $(BUILD_PHONY_PACKAGE) - -$(foreach cacert,$(cacerts),$(eval \ - $(call include-prebuilt-with-destination-directory,\ - host-cacert-$(notdir $(cacert)),\ - $(cacert),\ - $(HOST_OUT)/etc/security/cacerts\ - )\ -)) - -include $(CLEAR_VARS) -LOCAL_MODULE := cacerts-host -LOCAL_IS_HOST_MODULE := true -LOCAL_REQUIRED_MODULES := $(foreach cacert,$(cacerts),host-cacert-$(notdir $(cacert))) -include $(BUILD_PHONY_PACKAGE) - -include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/google/Android.bp b/google/Android.bp new file mode 100644 index 0000000..3268917 --- /dev/null +++ b/google/Android.bp @@ -0,0 +1,27 @@ +// 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. + +ca_certificates { + name: "cacerts_google", + src_dir: "files", + dest_dir: "security/cacerts_google", + module_name_prefix: "target-cacert-google-", +} + +ca_certificates_host { + name: "cacerts_google-host", + src_dir: "files", + dest_dir: "security/cacerts_google", + module_name_prefix: "host-cacert-google-", +} diff --git a/google/Android.mk b/google/Android.mk deleted file mode 100644 index 5955efd..0000000 --- a/google/Android.mk +++ /dev/null @@ -1,45 +0,0 @@ -# -*- mode: makefile -*- -# 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) - -cacerts_google := $(call all-files-under,files) - -$(foreach cacert,$(cacerts_google),$(eval \ - $(call include-prebuilt-with-destination-directory,\ - target-cacert-google-$(notdir $(cacert)),\ - $(cacert),\ - $(TARGET_OUT)/etc/security/cacerts_google\ - )\ -)) - -include $(CLEAR_VARS) -LOCAL_MODULE := cacerts_google -LOCAL_REQUIRED_MODULES := $(foreach cacert,$(cacerts_google),target-cacert-google-$(notdir $(cacert))) -include $(BUILD_PHONY_PACKAGE) - -$(foreach cacert,$(cacerts_google),$(eval \ - $(call include-prebuilt-with-destination-directory,\ - host-cacert-google-$(notdir $(cacert)),\ - $(cacert),\ - $(HOST_OUT)/etc/security/cacerts_google\ - )\ -)) - -include $(CLEAR_VARS) -LOCAL_MODULE := cacerts_google-host -LOCAL_IS_HOST_MODULE := true -LOCAL_REQUIRED_MODULES := $(foreach cacert,$(cacerts_google),host-cacert-google-$(notdir $(cacert))) -include $(BUILD_PHONY_PACKAGE) diff --git a/soong/Android.bp b/soong/Android.bp new file mode 100644 index 0000000..252d314 --- /dev/null +++ b/soong/Android.bp @@ -0,0 +1,12 @@ +bootstrap_go_package { + name: "soong-ca-certificates", + pkgPath: "android/soong/system/ca-certificates", + deps: [ + "soong-android", + "soong-phony", + ], + srcs: [ + "ca_certificates.go", + ], + pluginFor: ["soong_build"], +} diff --git a/soong/ca_certificates.go b/soong/ca_certificates.go new file mode 100644 index 0000000..bf9e5e2 --- /dev/null +++ b/soong/ca_certificates.go @@ -0,0 +1,81 @@ +package ca_certificates + +import ( + "path" + "path/filepath" + + "github.com/google/blueprint/proptools" + + "android/soong/android" + "android/soong/phony" +) + +func init() { + android.RegisterModuleType("ca_certificates", caCertificatesFactory) + android.RegisterModuleType("ca_certificates_host", caCertificatesHostFactory) +} + +type caCertificatesProperties struct { + Src_dir *string + Dest_dir *string + Module_name_prefix *string +} + +func caCertificatesLoadHook( + ctx android.LoadHookContext, factory android.ModuleFactory, c *caCertificatesProperties) { + // Find all files in src_dir. + srcs, err := ctx.GlobWithDeps(path.Join(ctx.ModuleDir(), *c.Src_dir, "*"), nil) + if err != nil || len(srcs) == 0 { + ctx.PropertyErrorf("src_dir", "cannot find files to install") + return + } + + // Scan through the found files to create a prebuilt_etc module for each of them. + requiredModuleNames := make([]string, len(srcs)) + for i, src := range srcs { + etcProps := struct { + Name *string + Src *string + Sub_dir *string + Filename *string + }{} + filename := filepath.Base(src) + moduleName := *c.Module_name_prefix + filename + etcProps.Name = proptools.StringPtr(moduleName) + etcProps.Src = proptools.StringPtr(path.Join(*c.Src_dir, filename)) + etcProps.Sub_dir = c.Dest_dir + etcProps.Filename = proptools.StringPtr(filename) + ctx.CreateModule(android.ModuleFactoryAdaptor(factory), &etcProps) + + // Add it to the required module list of the parent phony rule. + requiredModuleNames[i] = moduleName + } + + phonyProps := struct { + Required []string + }{} + phonyProps.Required = requiredModuleNames + ctx.AppendProperties(&phonyProps) +} + +func caCertificatesFactory() android.Module { + p := phony.PhonyFactory() + c := &caCertificatesProperties{} + android.AddLoadHook(p, func(ctx android.LoadHookContext) { + caCertificatesLoadHook(ctx, android.PrebuiltEtcFactory, c) + }) + p.AddProperties(c) + + return p +} + +func caCertificatesHostFactory() android.Module { + p := phony.PhonyFactory() + c := &caCertificatesProperties{} + android.AddLoadHook(p, func(ctx android.LoadHookContext) { + caCertificatesLoadHook(ctx, android.PrebuiltEtcHostFactory, c) + }) + p.AddProperties(c) + + return p +} diff --git a/wfa_certs/Android.bp b/wfa_certs/Android.bp new file mode 100644 index 0000000..68a894a --- /dev/null +++ b/wfa_certs/Android.bp @@ -0,0 +1,28 @@ +// Copyright (C) 2018 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. + +// This target is reference by frameworks/opt/net/wifi/service/Android.mk and used by WfaKeyStore +ca_certificates { + name: "cacerts_wfa", + src_dir: "files", + dest_dir: "security/cacerts_wfa", + module_name_prefix: "target-cacert-wifi-", +} + +ca_certificates_host { + name: "cacerts_wfa-host", + src_dir: "files", + dest_dir: "security/cacerts_wfa", + module_name_prefix: "host-cacert-wifi-", +} diff --git a/wfa_certs/Android.mk b/wfa_certs/Android.mk deleted file mode 100644 index 94db8ad..0000000 --- a/wfa_certs/Android.mk +++ /dev/null @@ -1,35 +0,0 @@ -# -*- mode: makefile -*- -# Copyright (C) 2018 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) - -cacerts_wfa := $(call all-files-under,files) - -#This target is reference by frameworks/opt/net/wifi/service/Android.mk and used by WfaKeyStore -cacerts_wfa_target_directory := $(TARGET_OUT)/etc/security/cacerts_wfa -$(foreach cacert, $(cacerts_wfa), $(eval $(call include-prebuilt-with-destination-directory,target-cacert-wifi-$(notdir $(cacert)),$(cacert),$(cacerts_wfa_target_directory)))) -cacerts_wfa_target := $(addprefix $(cacerts_wfa_target_directory)/,$(foreach cacert,$(cacerts_wfa),$(notdir $(cacert)))) -.PHONY: cacerts_wfa -cacerts_wfa: $(cacerts_wfa_target) - -# This is so that build/target/product/core.mk can use cacerts_wfa in PRODUCT_PACKAGES -ALL_MODULES.cacerts_wfa.INSTALLED := $(cacerts_wfa_target) - -cacerts_wfa_host_directory := $(HOST_OUT)/etc/security/cacerts_wfa -$(foreach cacert, $(cacerts_wfa), $(eval $(call include-prebuilt-with-destination-directory,host-cacert-wifi-$(notdir $(cacert)),$(cacert),$(cacerts_wfa_host_directory)))) - -cacerts_wfa_host := $(addprefix $(cacerts_wfa_host_directory)/,$(foreach cacert,$(cacerts_wfa),$(notdir $(cacert)))) -.PHONY: cacerts_wfa-host -cacerts_wfa-host: $(cacerts_wfa_host) |