Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  module_info_json.go   Sprache: unbekannt

 
Spracherkennung für: .go vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

package android

import (
 "encoding/json"
 "io"
 "slices"
 "strconv"
 "strings"
)

func init() {
 RegisterParallelSingletonType("soong_only_module_info", soongOnlyModuleInfoSingletonFactory)
}

//go:generate go run ../../blueprint/gobtools/codegen

// @auto-generate: gob
type CoreModuleInfoJSON struct {
 RegisterName       string   `json:"-"`
 Path               []string `json:"path,omitempty"`                // $(sort $(ALL_MODULES.$(m).PATH))
 Installed          []string `json:"installed,omitempty"`           // $(sort $(ALL_MODULES.$(m).INSTALLED))
 ModuleName         string   `json:"module_name,omitempty"`         // $(ALL_MODULES.$(m).MODULE_NAME)
 SupportedVariants  []string `json:"supported_variants,omitempty"`  // $(sort $(ALL_MODULES.$(m).SUPPORTED_VARIANTS))
 HostDependencies   []string `json:"host_dependencies,omitempty"`   // $(sort $(ALL_MODULES.$(m).HOST_REQUIRED_FROM_TARGET))
 TargetDependencies []string `json:"target_dependencies,omitempty"` // $(sort $(ALL_MODULES.$(m).TARGET_REQUIRED_FROM_HOST))
 Data               []string `json:"data,omitempty"`                // $(sort $(ALL_MODULES.$(m).TEST_DATA))
 Required           []string `json:"required,omitempty"`            // $(sort $(ALL_MODULES.$(m).REQUIRED_FROM_TARGET))
}

// @auto-generate: gob
type ExtraModuleInfoJSON struct {
 SubName             string   `json:"-"`
 Uninstallable       bool     `json:"-"`
 Class               []string `json:"class,omitempty"`                 // $(sort $(ALL_MODULES.$(m).CLASS))
 Tags                []string `json:"tags,omitempty"`                  // $(sort $(ALL_MODULES.$(m).TAGS))
 Dependencies        []string `json:"dependencies,omitempty"`          // $(sort $(ALL_DEPS.$(m).ALL_DEPS))
 SharedLibs          []string `json:"shared_libs,omitempty"`           // $(sort $(ALL_MODULES.$(m).SHARED_LIBS))
 StaticLibs          []string `json:"static_libs,omitempty"`           // $(sort $(ALL_MODULES.$(m).STATIC_LIBS))
 SystemSharedLibs    []string `json:"system_shared_libs,omitempty"`    // $(sort $(ALL_MODULES.$(m).SYSTEM_SHARED_LIBS))
 Srcs                []string `json:"srcs,omitempty"`                  // $(sort $(ALL_MODULES.$(m).SRCS))
 SrcJars             []string `json:"srcjars,omitempty"`               // $(sort $(ALL_MODULES.$(m).SRCJARS))
 ClassesJar          []string `json:"classes_jar,omitempty"`           // $(sort $(ALL_MODULES.$(m).CLASSES_JAR))
 TestMainlineModules []string `json:"test_mainline_modules,omitempty"` // $(sort $(ALL_MODULES.$(m).TEST_MAINLINE_MODULES))
 IsUnitTest          string   `json:"is_unit_test,omitempty"`          // $(ALL_MODULES.$(m).IS_UNIT_TEST)
 TestOptionsTags     []string `json:"test_options_tags,omitempty"`     // $(sort $(ALL_MODULES.$(m).TEST_OPTIONS_TAGS))
 RuntimeDependencies []string `json:"runtime_dependencies,omitempty"`  // $(sort $(ALL_MODULES.$(m).LOCAL_RUNTIME_LIBRARIES))
 StaticDependencies  []string `json:"static_dependencies,omitempty"`   // $(sort $(ALL_MODULES.$(m).LOCAL_STATIC_LIBRARIES))
 DataDependencies    []string `json:"data_dependencies,omitempty"`     // $(sort $(ALL_MODULES.$(m).TEST_DATA_BINS))

 CompatibilitySuites  []string `json:"compatibility_suites,omitempty"` // $(sort $(ALL_MODULES.$(m).COMPATIBILITY_SUITES))
 AutoTestConfig       []string `json:"auto_test_config,omitempty"`     // $(ALL_MODULES.$(m).auto_test_config)
 TestConfig           []string `json:"test_config,omitempty"`          // $(strip $(ALL_MODULES.$(m).TEST_CONFIG) $(ALL_MODULES.$(m).EXTRA_TEST_CONFIGS)
 TestModuleConfigBase string   `json:"test_module_config_base,omitempty"`
 ExtraRequired        []string `json:"-"`
 ExtraHostRequired    []string `json:"-"`

 SupportedVariantsOverride []string `json:"-"`
 Disabled                  bool     `json:"-"`
 RegisterNameOverride      string   `json:"-"`
 ModuleNameOverride        string   `json:"-"`
}

// @auto-generate: gob
type ModuleInfoJSON struct {
 core CoreModuleInfoJSON
 ExtraModuleInfoJSON
}

//ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \
//$(ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS) \
//$(LOCAL_STATIC_LIBRARIES) \
//$(LOCAL_WHOLE_STATIC_LIBRARIES) \
//$(LOCAL_SHARED_LIBRARIES) \
//$(LOCAL_DYLIB_LIBRARIES) \
//$(LOCAL_RLIB_LIBRARIES) \
//$(LOCAL_PROC_MACRO_LIBRARIES) \
//$(LOCAL_HEADER_LIBRARIES) \
//$(LOCAL_STATIC_JAVA_LIBRARIES) \
//$(LOCAL_JAVA_LIBRARIES) \
//$(LOCAL_JNI_SHARED_LIBRARIES))

type combinedModuleInfoJSON struct {
 *CoreModuleInfoJSON
 *ExtraModuleInfoJSON
}

func encodeModuleInfoJSON(w io.Writer, moduleInfoJSON *ModuleInfoJSON) error {
 moduleInfoJSONCopy := *moduleInfoJSON

 sortAndUnique := func(s *[]string) {
  *s = slices.Clone(*s)
  slices.Sort(*s)
  *s = slices.Compact(*s)
 }

 sortAndUnique(&moduleInfoJSONCopy.core.Path)
 sortAndUnique(&moduleInfoJSONCopy.core.Installed)
 sortAndUnique(&moduleInfoJSONCopy.core.SupportedVariants)
 sortAndUnique(&moduleInfoJSONCopy.core.HostDependencies)
 sortAndUnique(&moduleInfoJSONCopy.core.TargetDependencies)
 sortAndUnique(&moduleInfoJSONCopy.core.Data)
 sortAndUnique(&moduleInfoJSONCopy.core.Required)

 sortAndUnique(&moduleInfoJSONCopy.Class)
 sortAndUnique(&moduleInfoJSONCopy.Tags)
 sortAndUnique(&moduleInfoJSONCopy.Dependencies)
 sortAndUnique(&moduleInfoJSONCopy.SharedLibs)
 sortAndUnique(&moduleInfoJSONCopy.StaticLibs)
 sortAndUnique(&moduleInfoJSONCopy.SystemSharedLibs)
 sortAndUnique(&moduleInfoJSONCopy.Srcs)
 sortAndUnique(&moduleInfoJSONCopy.SrcJars)
 sortAndUnique(&moduleInfoJSONCopy.ClassesJar)
 sortAndUnique(&moduleInfoJSONCopy.TestMainlineModules)
 sortAndUnique(&moduleInfoJSONCopy.TestOptionsTags)
 sortAndUnique(&moduleInfoJSONCopy.RuntimeDependencies)
 sortAndUnique(&moduleInfoJSONCopy.StaticDependencies)
 sortAndUnique(&moduleInfoJSONCopy.DataDependencies)
 sortAndUnique(&moduleInfoJSONCopy.CompatibilitySuites)
 sortAndUnique(&moduleInfoJSONCopy.AutoTestConfig)
 sortAndUnique(&moduleInfoJSONCopy.TestConfig)

 encoder := json.NewEncoder(w)
 return encoder.Encode(combinedModuleInfoJSON{&moduleInfoJSONCopy.core, &moduleInfoJSONCopy.ExtraModuleInfoJSON})
}

func (m *ModuleInfoJSON) GetInstalled() []string {
 return m.core.Installed
}

func (m *ModuleInfoJSON) GetClass() []string {
 return m.Class
}

func writeModuleInfoJSON(ctx SingletonContext, moduleInfoJSONs []*ModuleInfoJSON, moduleInfoJSONPath WritablePath) error {
 moduleInfoJSONBuf := &strings.Builder{}
 moduleInfoJSONBuf.WriteString("[")
 for i, moduleInfoJSON := range moduleInfoJSONs {
  if i != 0 {
   moduleInfoJSONBuf.WriteString(",\n")
  }
  moduleInfoJSONBuf.WriteString("{")
  moduleInfoJSONBuf.WriteString(strconv.Quote(moduleInfoJSON.core.RegisterName))
  moduleInfoJSONBuf.WriteString(":")
  err := encodeModuleInfoJSON(moduleInfoJSONBuf, moduleInfoJSON)
  moduleInfoJSONBuf.WriteString("}")
  if err != nil {
   return err
  }
 }
 moduleInfoJSONBuf.WriteString("]")
 WriteFileRule(ctx, moduleInfoJSONPath, moduleInfoJSONBuf.String())
 return nil
}

// @auto-generate: gob
type ModuleInfoJSONInfo struct {
 Data []*ModuleInfoJSON
}

type soongOnlyModuleInfoSingleton struct {
 Singleton
}

func soongOnlyModuleInfoSingletonFactory() Singleton {
 return &soongOnlyModuleInfoSingleton{}
}

func (p *soongOnlyModuleInfoSingleton) IncrementalSupported() bool {
 return true
}

// TODO(b/397766191): Change the signature to take ModuleProxy
// Please only access the module's internal data through providers.
func (so *soongOnlyModuleInfoSingleton) GenerateBuildActions(ctx SingletonContext) {
 if ctx.Config().KatiEnabled() {
  return
 }
 // We need a named device to have a TARGET_OUT folder.
 if !ctx.Config().HasDeviceProduct() {
  return
 }
 mods := allModulesSorted(ctx)

 var moduleInfoJSONs []*ModuleInfoJSON
 for _, mod := range mods {
  commonInfo := OtherModulePointerProviderOrDefault(ctx, mod, CommonModuleInfoProvider)
  if commonInfo.SkipAndroidMkProcessing {
   continue
  }
  if moduleInfoJSON := commonInfo.ModuleInfoJSON; moduleInfoJSON != nil {
   moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON.Data...)
  }
 }

 preMergePath := PathForOutput(ctx, "module_info_pre_merging.json")
 moduleInfoJSONPath := pathForInstall(ctx, Android, X86_64, "", "module-info.json")
 if err := writeModuleInfoJSON(ctx, moduleInfoJSONs, preMergePath); err != nil {
  ctx.Errorf("%s", err)
 }
 builder := NewRuleBuilder(pctx, ctx)
 builder.Command().
  BuiltTool("merge_module_info_json").
  FlagWithOutput("-o ", moduleInfoJSONPath).
  Input(preMergePath)
 builder.Build("merge_module_info_json", "merge module info json")
 ctx.Phony("module-info", moduleInfoJSONPath)
 ctx.Phony("droidcore-unbundled", moduleInfoJSONPath)
 ctx.DistForGoals([]string{"general-tests", "droidcore-unbundled", "haiku", "module-info"}, moduleInfoJSONPath)
}

[Dauer der Verarbeitung: 0.22 Sekunden, vorverarbeitet 2026-06-28]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik