Merge changes Id3de4ede,Iae326016
* changes: Consolidate Bazel conversion state into a single field in CommonProperties Index Go code in the build/make/tools
This commit is contained in:
@@ -35,6 +35,20 @@ const (
|
|||||||
Bp2BuildTopLevel = "."
|
Bp2BuildTopLevel = "."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type BazelConversionStatus struct {
|
||||||
|
// Information about _all_ bp2build targets generated by this module. Multiple targets are
|
||||||
|
// supported as Soong handles some things within a single target that we may choose to split into
|
||||||
|
// multiple targets, e.g. renderscript, protos, yacc within a cc module.
|
||||||
|
Bp2buildInfo []bp2buildInfo `blueprint:"mutated"`
|
||||||
|
|
||||||
|
// UnconvertedBp2buildDep stores the module names of direct dependency that were not converted to
|
||||||
|
// Bazel
|
||||||
|
UnconvertedDeps []string `blueprint:"mutated"`
|
||||||
|
|
||||||
|
// MissingBp2buildDep stores the module names of direct dependency that were not found
|
||||||
|
MissingDeps []string `blueprint:"mutated"`
|
||||||
|
}
|
||||||
|
|
||||||
type bazelModuleProperties struct {
|
type bazelModuleProperties struct {
|
||||||
// The label of the Bazel target replacing this Soong module. When run in conversion mode, this
|
// The label of the Bazel target replacing this Soong module. When run in conversion mode, this
|
||||||
// will import the handcrafted build target into the autogenerated file. Note: this may result in
|
// will import the handcrafted build target into the autogenerated file. Note: this may result in
|
||||||
|
@@ -909,17 +909,8 @@ type commonProperties struct {
|
|||||||
// constants in image.go, but can also be set to a custom value by individual module types.
|
// constants in image.go, but can also be set to a custom value by individual module types.
|
||||||
ImageVariation string `blueprint:"mutated"`
|
ImageVariation string `blueprint:"mutated"`
|
||||||
|
|
||||||
// Information about _all_ bp2build targets generated by this module. Multiple targets are
|
// Bazel conversion status
|
||||||
// supported as Soong handles some things within a single target that we may choose to split into
|
BazelConversionStatus BazelConversionStatus `blueprint:"mutated"`
|
||||||
// multiple targets, e.g. renderscript, protos, yacc within a cc module.
|
|
||||||
Bp2buildInfo []bp2buildInfo `blueprint:"mutated"`
|
|
||||||
|
|
||||||
// UnconvertedBp2buildDep stores the module names of direct dependency that were not converted to
|
|
||||||
// Bazel
|
|
||||||
UnconvertedBp2buildDeps []string `blueprint:"mutated"`
|
|
||||||
|
|
||||||
// MissingBp2buildDep stores the module names of direct dependency that were not found
|
|
||||||
MissingBp2buildDeps []string `blueprint:"mutated"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommonAttributes represents the common Bazel attributes from which properties
|
// CommonAttributes represents the common Bazel attributes from which properties
|
||||||
@@ -1489,40 +1480,40 @@ func (b bp2buildInfo) BazelAttributes() []interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *ModuleBase) addBp2buildInfo(info bp2buildInfo) {
|
func (m *ModuleBase) addBp2buildInfo(info bp2buildInfo) {
|
||||||
m.commonProperties.Bp2buildInfo = append(m.commonProperties.Bp2buildInfo, info)
|
m.commonProperties.BazelConversionStatus.Bp2buildInfo = append(m.commonProperties.BazelConversionStatus.Bp2buildInfo, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsConvertedByBp2build returns whether this module was converted via bp2build.
|
// IsConvertedByBp2build returns whether this module was converted via bp2build.
|
||||||
func (m *ModuleBase) IsConvertedByBp2build() bool {
|
func (m *ModuleBase) IsConvertedByBp2build() bool {
|
||||||
return len(m.commonProperties.Bp2buildInfo) > 0
|
return len(m.commonProperties.BazelConversionStatus.Bp2buildInfo) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bp2buildTargets returns the Bazel targets bp2build generated for this module.
|
// Bp2buildTargets returns the Bazel targets bp2build generated for this module.
|
||||||
func (m *ModuleBase) Bp2buildTargets() []bp2buildInfo {
|
func (m *ModuleBase) Bp2buildTargets() []bp2buildInfo {
|
||||||
return m.commonProperties.Bp2buildInfo
|
return m.commonProperties.BazelConversionStatus.Bp2buildInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddUnconvertedBp2buildDep stores module name of a dependency that was not converted to Bazel.
|
// AddUnconvertedBp2buildDep stores module name of a dependency that was not converted to Bazel.
|
||||||
func (b *baseModuleContext) AddUnconvertedBp2buildDep(dep string) {
|
func (b *baseModuleContext) AddUnconvertedBp2buildDep(dep string) {
|
||||||
unconvertedDeps := &b.Module().base().commonProperties.UnconvertedBp2buildDeps
|
unconvertedDeps := &b.Module().base().commonProperties.BazelConversionStatus.UnconvertedDeps
|
||||||
*unconvertedDeps = append(*unconvertedDeps, dep)
|
*unconvertedDeps = append(*unconvertedDeps, dep)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddMissingBp2buildDep stores module name of a dependency that was not found in a Android.bp file.
|
// AddMissingBp2buildDep stores module name of a dependency that was not found in a Android.bp file.
|
||||||
func (b *baseModuleContext) AddMissingBp2buildDep(dep string) {
|
func (b *baseModuleContext) AddMissingBp2buildDep(dep string) {
|
||||||
missingDeps := &b.Module().base().commonProperties.MissingBp2buildDeps
|
missingDeps := &b.Module().base().commonProperties.BazelConversionStatus.MissingDeps
|
||||||
*missingDeps = append(*missingDeps, dep)
|
*missingDeps = append(*missingDeps, dep)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUnconvertedBp2buildDeps returns the list of module names of this module's direct dependencies that
|
// GetUnconvertedBp2buildDeps returns the list of module names of this module's direct dependencies that
|
||||||
// were not converted to Bazel.
|
// were not converted to Bazel.
|
||||||
func (m *ModuleBase) GetUnconvertedBp2buildDeps() []string {
|
func (m *ModuleBase) GetUnconvertedBp2buildDeps() []string {
|
||||||
return FirstUniqueStrings(m.commonProperties.UnconvertedBp2buildDeps)
|
return FirstUniqueStrings(m.commonProperties.BazelConversionStatus.UnconvertedDeps)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMissingBp2buildDeps eturns the list of module names that were not found in Android.bp files.
|
// GetMissingBp2buildDeps eturns the list of module names that were not found in Android.bp files.
|
||||||
func (m *ModuleBase) GetMissingBp2buildDeps() []string {
|
func (m *ModuleBase) GetMissingBp2buildDeps() []string {
|
||||||
return FirstUniqueStrings(m.commonProperties.MissingBp2buildDeps)
|
return FirstUniqueStrings(m.commonProperties.BazelConversionStatus.MissingDeps)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ModuleBase) AddJSONData(d *map[string]interface{}) {
|
func (m *ModuleBase) AddJSONData(d *map[string]interface{}) {
|
||||||
|
@@ -44,14 +44,18 @@ declare -r go_extractor=$(realpath prebuilts/build-tools/linux-x86/bin/go_extrac
|
|||||||
declare -r go_root=$(realpath prebuilts/go/linux-x86)
|
declare -r go_root=$(realpath prebuilts/go/linux-x86)
|
||||||
declare -r source_root=$PWD
|
declare -r source_root=$PWD
|
||||||
|
|
||||||
# TODO(asmundak): Until b/182183061 is fixed, default corpus has to be specified
|
# For the Go code, we invoke the extractor directly. The two caveats are that
|
||||||
# in the rules file. Generate this file on the fly with corpus value set from the
|
# the extractor's rewrite rules are generated on the fly as they depend on the XREF_CORPUS
|
||||||
# environment variable.
|
# value, and that the name of the kzip file is derived from the directory name
|
||||||
for dir in blueprint soong; do
|
# by replacing '/' with '_'.
|
||||||
(cd "build/$dir";
|
declare -ar go_modules=(build/blueprint build/soong
|
||||||
|
build/make/tools/canoninja build/make/tools/compliance build/make/tools/rbcrun)
|
||||||
|
for dir in "${go_modules[@]}"; do
|
||||||
|
(cd "$dir";
|
||||||
|
outfile=$(echo "$dir" | sed -r 's|/|_|g;s|(.*)|\1.go.kzip|');
|
||||||
KYTHE_ROOT_DIRECTORY="${source_root}" "$go_extractor" --goroot="$go_root" \
|
KYTHE_ROOT_DIRECTORY="${source_root}" "$go_extractor" --goroot="$go_root" \
|
||||||
--rules=<(printf '[{"pattern": "(.*)","vname": {"path": "@1@", "corpus":"%s"}}]' "${XREF_CORPUS}") \
|
--rules=<(printf '[{"pattern": "(.*)","vname": {"path": "@1@", "corpus":"%s"}}]' "${XREF_CORPUS}") \
|
||||||
--canonicalize_package_corpus --output "${abspath_out}/soong/build_${dir}.go.kzip" ./...
|
--canonicalize_package_corpus --output "${abspath_out}/soong/$outfile" ./...
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user