summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2024-10-24 18:47:06 +0000
committer Yu Liu <yudiliu@google.com> 2024-10-24 22:59:30 +0000
commit3cadf7d81600c89d49d1d4836bbc2c74a8c7b6dd (patch)
treecd92abd2d907bc19899e41e98b2e2fc9f09d8ccb
parent39bebd1002c80d206fbd696956e46595a3d0b5f2 (diff)
Move some gob helpers to a new package.
Bug: 358427516 Test: CI Change-Id: Ib25bbfb6e89c35cf4a080e2baaffadabf0e5636e
-rw-r--r--android/Android.bp1
-rw-r--r--android/compliance_metadata.go5
-rw-r--r--android/module.go11
-rw-r--r--android/packaging.go5
-rw-r--r--android/paths.go17
5 files changed, 22 insertions, 17 deletions
diff --git a/android/Android.bp b/android/Android.bp
index 87ac65789..1ed2dbaa1 100644
--- a/android/Android.bp
+++ b/android/Android.bp
@@ -9,6 +9,7 @@ bootstrap_go_package {
"blueprint",
"blueprint-bootstrap",
"blueprint-depset",
+ "blueprint-gobtools",
"blueprint-metrics",
"sbox_proto",
"soong",
diff --git a/android/compliance_metadata.go b/android/compliance_metadata.go
index d28831e62..0b876c3bf 100644
--- a/android/compliance_metadata.go
+++ b/android/compliance_metadata.go
@@ -23,6 +23,7 @@ import (
"strings"
"github.com/google/blueprint"
+ "github.com/google/blueprint/gobtools"
)
var (
@@ -146,11 +147,11 @@ func (m *ComplianceMetadataInfo) FromGob(data *complianceMetadataInfoGob) {
}
func (c *ComplianceMetadataInfo) GobEncode() ([]byte, error) {
- return blueprint.CustomGobEncode[complianceMetadataInfoGob](c)
+ return gobtools.CustomGobEncode[complianceMetadataInfoGob](c)
}
func (c *ComplianceMetadataInfo) GobDecode(data []byte) error {
- return blueprint.CustomGobDecode[complianceMetadataInfoGob](data, c)
+ return gobtools.CustomGobDecode[complianceMetadataInfoGob](data, c)
}
func (c *ComplianceMetadataInfo) SetStringValue(propertyName string, value string) {
diff --git a/android/module.go b/android/module.go
index ec0f44688..124b06630 100644
--- a/android/module.go
+++ b/android/module.go
@@ -16,7 +16,6 @@ package android
import (
"fmt"
- "github.com/google/blueprint/depset"
"net/url"
"path/filepath"
"reflect"
@@ -25,6 +24,8 @@ import (
"strings"
"github.com/google/blueprint"
+ "github.com/google/blueprint/depset"
+ "github.com/google/blueprint/gobtools"
"github.com/google/blueprint/proptools"
)
@@ -2201,11 +2202,11 @@ func (k *katiInstall) FromGob(data *katiInstallGob) {
}
func (k *katiInstall) GobEncode() ([]byte, error) {
- return blueprint.CustomGobEncode[katiInstallGob](k)
+ return gobtools.CustomGobEncode[katiInstallGob](k)
}
func (k *katiInstall) GobDecode(data []byte) error {
- return blueprint.CustomGobDecode[katiInstallGob](data, k)
+ return gobtools.CustomGobDecode[katiInstallGob](data, k)
}
type extraFilesZip struct {
@@ -2231,11 +2232,11 @@ func (e *extraFilesZip) FromGob(data *extraFilesZipGob) {
}
func (e *extraFilesZip) GobEncode() ([]byte, error) {
- return blueprint.CustomGobEncode[extraFilesZipGob](e)
+ return gobtools.CustomGobEncode[extraFilesZipGob](e)
}
func (e *extraFilesZip) GobDecode(data []byte) error {
- return blueprint.CustomGobDecode[extraFilesZipGob](data, e)
+ return gobtools.CustomGobDecode[extraFilesZipGob](data, e)
}
type katiInstalls []katiInstall
diff --git a/android/packaging.go b/android/packaging.go
index fe76bfc4a..acafcd4f2 100644
--- a/android/packaging.go
+++ b/android/packaging.go
@@ -21,6 +21,7 @@ import (
"strings"
"github.com/google/blueprint"
+ "github.com/google/blueprint/gobtools"
"github.com/google/blueprint/proptools"
)
@@ -109,11 +110,11 @@ func (p *PackagingSpec) FromGob(data *packagingSpecGob) {
}
func (p *PackagingSpec) GobEncode() ([]byte, error) {
- return blueprint.CustomGobEncode[packagingSpecGob](p)
+ return gobtools.CustomGobEncode[packagingSpecGob](p)
}
func (p *PackagingSpec) GobDecode(data []byte) error {
- return blueprint.CustomGobDecode[packagingSpecGob](data, p)
+ return gobtools.CustomGobDecode[packagingSpecGob](data, p)
}
func (p *PackagingSpec) Equals(other *PackagingSpec) bool {
diff --git a/android/paths.go b/android/paths.go
index 371aed86d..bf2c3a097 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -24,6 +24,7 @@ import (
"strings"
"github.com/google/blueprint"
+ "github.com/google/blueprint/gobtools"
"github.com/google/blueprint/pathtools"
)
@@ -368,11 +369,11 @@ func (p *OptionalPath) FromGob(data *optionalPathGob) {
}
func (p OptionalPath) GobEncode() ([]byte, error) {
- return blueprint.CustomGobEncode[optionalPathGob](&p)
+ return gobtools.CustomGobEncode[optionalPathGob](&p)
}
func (p *OptionalPath) GobDecode(data []byte) error {
- return blueprint.CustomGobDecode[optionalPathGob](data, p)
+ return gobtools.CustomGobDecode[optionalPathGob](data, p)
}
// Valid returns whether there is a valid path
@@ -1157,11 +1158,11 @@ func (p *basePath) FromGob(data *basePathGob) {
}
func (p basePath) GobEncode() ([]byte, error) {
- return blueprint.CustomGobEncode[basePathGob](&p)
+ return gobtools.CustomGobEncode[basePathGob](&p)
}
func (p *basePath) GobDecode(data []byte) error {
- return blueprint.CustomGobDecode[basePathGob](data, p)
+ return gobtools.CustomGobDecode[basePathGob](data, p)
}
func (p basePath) Ext() string {
@@ -1435,11 +1436,11 @@ func (p *OutputPath) FromGob(data *outputPathGob) {
}
func (p OutputPath) GobEncode() ([]byte, error) {
- return blueprint.CustomGobEncode[outputPathGob](&p)
+ return gobtools.CustomGobEncode[outputPathGob](&p)
}
func (p *OutputPath) GobDecode(data []byte) error {
- return blueprint.CustomGobDecode[outputPathGob](data, p)
+ return gobtools.CustomGobDecode[outputPathGob](data, p)
}
func (p OutputPath) withRel(rel string) OutputPath {
@@ -1869,11 +1870,11 @@ func (p *InstallPath) FromGob(data *installPathGob) {
}
func (p InstallPath) GobEncode() ([]byte, error) {
- return blueprint.CustomGobEncode[installPathGob](&p)
+ return gobtools.CustomGobEncode[installPathGob](&p)
}
func (p *InstallPath) GobDecode(data []byte) error {
- return blueprint.CustomGobDecode[installPathGob](data, p)
+ return gobtools.CustomGobDecode[installPathGob](data, p)
}
// Will panic if called from outside a test environment.