Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 1 | // Copyright 2015 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame^] | 15 | package android |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 16 | |
| 17 | import ( |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 18 | "encoding/json" |
| 19 | "fmt" |
| 20 | "os" |
Colin Cross | 35cec12 | 2015-04-02 14:37:16 -0700 | [diff] [blame] | 21 | "path/filepath" |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 22 | "runtime" |
Dan Willemsen | 34cc69e | 2015-09-23 15:26:20 -0700 | [diff] [blame] | 23 | "strings" |
Colin Cross | c1e86a3 | 2015-04-15 12:33:28 -0700 | [diff] [blame] | 24 | "sync" |
Colin Cross | 6ff5138 | 2015-12-17 16:39:19 -0800 | [diff] [blame] | 25 | |
| 26 | "github.com/google/blueprint/proptools" |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 27 | ) |
| 28 | |
Colin Cross | 6ff5138 | 2015-12-17 16:39:19 -0800 | [diff] [blame] | 29 | var Bool = proptools.Bool |
| 30 | |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 31 | // The configuration file name |
Dan Willemsen | 87b17d1 | 2015-07-14 00:39:06 -0700 | [diff] [blame] | 32 | const configFileName = "soong.config" |
| 33 | const productVariablesFileName = "soong.variables" |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 34 | |
| 35 | // A FileConfigurableOptions contains options which can be configured by the |
| 36 | // config file. These will be included in the config struct. |
| 37 | type FileConfigurableOptions struct { |
Dan Willemsen | 322acaf | 2016-01-12 23:07:05 -0800 | [diff] [blame] | 38 | Mega_device *bool `json:",omitempty"` |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 39 | } |
| 40 | |
Colin Cross | 2738597 | 2015-09-18 10:57:10 -0700 | [diff] [blame] | 41 | func (f *FileConfigurableOptions) SetDefaultConfig() { |
| 42 | *f = FileConfigurableOptions{} |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 43 | } |
| 44 | |
Colin Cross | c3c0a49 | 2015-04-10 15:43:55 -0700 | [diff] [blame] | 45 | type Config struct { |
| 46 | *config |
| 47 | } |
| 48 | |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 49 | // A config object represents the entire build configuration for Android. |
Colin Cross | 1332b00 | 2015-04-07 17:11:30 -0700 | [diff] [blame] | 50 | type config struct { |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 51 | FileConfigurableOptions |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 52 | ProductVariables productVariables |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 53 | |
Dan Willemsen | 87b17d1 | 2015-07-14 00:39:06 -0700 | [diff] [blame] | 54 | ConfigFileName string |
| 55 | ProductVariablesFileName string |
| 56 | |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 57 | DeviceArches []Arch |
| 58 | HostArches map[HostType][]Arch |
| 59 | |
Dan Willemsen | 87b17d1 | 2015-07-14 00:39:06 -0700 | [diff] [blame] | 60 | srcDir string // the path of the root source directory |
| 61 | buildDir string // the path of the build output directory |
Colin Cross | c1e86a3 | 2015-04-15 12:33:28 -0700 | [diff] [blame] | 62 | |
Dan Willemsen | e7680ba | 2015-09-11 17:06:19 -0700 | [diff] [blame] | 63 | envLock sync.Mutex |
| 64 | envDeps map[string]string |
| 65 | envFrozen bool |
Dan Willemsen | 5ba07e8 | 2015-12-11 13:51:06 -0800 | [diff] [blame] | 66 | |
| 67 | inMake bool |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 68 | } |
| 69 | |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 70 | type jsonConfigurable interface { |
Colin Cross | 2738597 | 2015-09-18 10:57:10 -0700 | [diff] [blame] | 71 | SetDefaultConfig() |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 72 | } |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 73 | |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 74 | func loadConfig(config *config) error { |
Dan Willemsen | 87b17d1 | 2015-07-14 00:39:06 -0700 | [diff] [blame] | 75 | err := loadFromConfigFile(&config.FileConfigurableOptions, config.ConfigFileName) |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 76 | if err != nil { |
| 77 | return err |
| 78 | } |
| 79 | |
Dan Willemsen | 87b17d1 | 2015-07-14 00:39:06 -0700 | [diff] [blame] | 80 | return loadFromConfigFile(&config.ProductVariables, config.ProductVariablesFileName) |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | // loads configuration options from a JSON file in the cwd. |
| 84 | func loadFromConfigFile(configurable jsonConfigurable, filename string) error { |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 85 | // Try to open the file |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 86 | configFileReader, err := os.Open(filename) |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 87 | defer configFileReader.Close() |
| 88 | if os.IsNotExist(err) { |
| 89 | // Need to create a file, so that blueprint & ninja don't get in |
| 90 | // a dependency tracking loop. |
| 91 | // Make a file-configurable-options with defaults, write it out using |
| 92 | // a json writer. |
Colin Cross | 2738597 | 2015-09-18 10:57:10 -0700 | [diff] [blame] | 93 | configurable.SetDefaultConfig() |
| 94 | err = saveToConfigFile(configurable, filename) |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 95 | if err != nil { |
| 96 | return err |
| 97 | } |
| 98 | } else { |
| 99 | // Make a decoder for it |
| 100 | jsonDecoder := json.NewDecoder(configFileReader) |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 101 | err = jsonDecoder.Decode(configurable) |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 102 | if err != nil { |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 103 | return fmt.Errorf("config file: %s did not parse correctly: "+err.Error(), filename) |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 104 | } |
| 105 | } |
| 106 | |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 107 | // No error |
| 108 | return nil |
| 109 | } |
| 110 | |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 111 | func saveToConfigFile(config jsonConfigurable, filename string) error { |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 112 | data, err := json.MarshalIndent(&config, "", " ") |
| 113 | if err != nil { |
| 114 | return fmt.Errorf("cannot marshal config data: %s", err.Error()) |
| 115 | } |
| 116 | |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 117 | configFileWriter, err := os.Create(filename) |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 118 | if err != nil { |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 119 | return fmt.Errorf("cannot create empty config file %s: %s\n", filename, err.Error()) |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 120 | } |
| 121 | defer configFileWriter.Close() |
| 122 | |
| 123 | _, err = configFileWriter.Write(data) |
| 124 | if err != nil { |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 125 | return fmt.Errorf("default config file: %s could not be written: %s", filename, err.Error()) |
| 126 | } |
| 127 | |
| 128 | _, err = configFileWriter.WriteString("\n") |
| 129 | if err != nil { |
| 130 | return fmt.Errorf("default config file: %s could not be written: %s", filename, err.Error()) |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | return nil |
| 134 | } |
| 135 | |
| 136 | // New creates a new Config object. The srcDir argument specifies the path to |
| 137 | // the root source directory. It also loads the config file, if found. |
Dan Willemsen | 87b17d1 | 2015-07-14 00:39:06 -0700 | [diff] [blame] | 138 | func NewConfig(srcDir, buildDir string) (Config, error) { |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 139 | // Make a config with default options |
Colin Cross | c3c0a49 | 2015-04-10 15:43:55 -0700 | [diff] [blame] | 140 | config := Config{ |
| 141 | config: &config{ |
Dan Willemsen | 87b17d1 | 2015-07-14 00:39:06 -0700 | [diff] [blame] | 142 | ConfigFileName: filepath.Join(buildDir, configFileName), |
| 143 | ProductVariablesFileName: filepath.Join(buildDir, productVariablesFileName), |
| 144 | |
| 145 | srcDir: srcDir, |
| 146 | buildDir: buildDir, |
| 147 | envDeps: make(map[string]string), |
Colin Cross | c3c0a49 | 2015-04-10 15:43:55 -0700 | [diff] [blame] | 148 | }, |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 149 | } |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 150 | |
Dan Willemsen | 34cc69e | 2015-09-23 15:26:20 -0700 | [diff] [blame] | 151 | // Sanity check the build and source directories. This won't catch strange |
| 152 | // configurations with symlinks, but at least checks the obvious cases. |
| 153 | absBuildDir, err := filepath.Abs(buildDir) |
| 154 | if err != nil { |
| 155 | return Config{}, err |
| 156 | } |
| 157 | |
| 158 | absSrcDir, err := filepath.Abs(srcDir) |
| 159 | if err != nil { |
| 160 | return Config{}, err |
| 161 | } |
| 162 | |
| 163 | if strings.HasPrefix(absSrcDir, absBuildDir) { |
| 164 | return Config{}, fmt.Errorf("Build dir must not contain source directory") |
| 165 | } |
| 166 | |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 167 | // Load any configurable options from the configuration file |
Dan Willemsen | 34cc69e | 2015-09-23 15:26:20 -0700 | [diff] [blame] | 168 | err = loadConfig(config.config) |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 169 | if err != nil { |
Colin Cross | c3c0a49 | 2015-04-10 15:43:55 -0700 | [diff] [blame] | 170 | return Config{}, err |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 171 | } |
| 172 | |
Dan Willemsen | 5ba07e8 | 2015-12-11 13:51:06 -0800 | [diff] [blame] | 173 | inMakeFile := filepath.Join(buildDir, ".soong.in_make") |
| 174 | if _, err := os.Stat(inMakeFile); err == nil { |
| 175 | config.inMake = true |
| 176 | } |
| 177 | |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 178 | hostArches, deviceArches, err := decodeArchProductVariables(config.ProductVariables) |
| 179 | if err != nil { |
| 180 | return Config{}, err |
| 181 | } |
| 182 | |
Dan Willemsen | 322acaf | 2016-01-12 23:07:05 -0800 | [diff] [blame] | 183 | if Bool(config.Mega_device) { |
| 184 | deviceArches, err = decodeMegaDevice() |
| 185 | if err != nil { |
| 186 | return Config{}, err |
| 187 | } |
| 188 | } |
| 189 | |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 190 | config.HostArches = hostArches |
| 191 | config.DeviceArches = deviceArches |
| 192 | |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 193 | return config, nil |
| 194 | } |
| 195 | |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 196 | func (c *config) RemoveAbandonedFiles() bool { |
| 197 | return false |
| 198 | } |
| 199 | |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 200 | // PrebuiltOS returns the name of the host OS used in prebuilts directories |
Colin Cross | 1332b00 | 2015-04-07 17:11:30 -0700 | [diff] [blame] | 201 | func (c *config) PrebuiltOS() string { |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 202 | switch runtime.GOOS { |
| 203 | case "linux": |
| 204 | return "linux-x86" |
| 205 | case "darwin": |
| 206 | return "darwin-x86" |
| 207 | default: |
| 208 | panic("Unknown GOOS") |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | // GoRoot returns the path to the root directory of the Go toolchain. |
Colin Cross | 1332b00 | 2015-04-07 17:11:30 -0700 | [diff] [blame] | 213 | func (c *config) GoRoot() string { |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 214 | return fmt.Sprintf("%s/prebuilts/go/%s", c.srcDir, c.PrebuiltOS()) |
| 215 | } |
| 216 | |
Colin Cross | 1332b00 | 2015-04-07 17:11:30 -0700 | [diff] [blame] | 217 | func (c *config) CpPreserveSymlinksFlags() string { |
Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 218 | switch runtime.GOOS { |
Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 219 | case "darwin": |
| 220 | return "-R" |
| 221 | case "linux": |
| 222 | return "-d" |
| 223 | default: |
| 224 | return "" |
| 225 | } |
| 226 | } |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 227 | |
Colin Cross | 1332b00 | 2015-04-07 17:11:30 -0700 | [diff] [blame] | 228 | func (c *config) Getenv(key string) string { |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 229 | var val string |
| 230 | var exists bool |
Colin Cross | c1e86a3 | 2015-04-15 12:33:28 -0700 | [diff] [blame] | 231 | c.envLock.Lock() |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 232 | if val, exists = c.envDeps[key]; !exists { |
Dan Willemsen | e7680ba | 2015-09-11 17:06:19 -0700 | [diff] [blame] | 233 | if c.envFrozen { |
| 234 | panic("Cannot access new environment variables after envdeps are frozen") |
| 235 | } |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 236 | val = os.Getenv(key) |
| 237 | c.envDeps[key] = val |
| 238 | } |
Colin Cross | c1e86a3 | 2015-04-15 12:33:28 -0700 | [diff] [blame] | 239 | c.envLock.Unlock() |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 240 | return val |
| 241 | } |
| 242 | |
Colin Cross | 1332b00 | 2015-04-07 17:11:30 -0700 | [diff] [blame] | 243 | func (c *config) EnvDeps() map[string]string { |
Dan Willemsen | e7680ba | 2015-09-11 17:06:19 -0700 | [diff] [blame] | 244 | c.envLock.Lock() |
| 245 | c.envFrozen = true |
| 246 | c.envLock.Unlock() |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 247 | return c.envDeps |
| 248 | } |
Colin Cross | 35cec12 | 2015-04-02 14:37:16 -0700 | [diff] [blame] | 249 | |
Dan Willemsen | 5ba07e8 | 2015-12-11 13:51:06 -0800 | [diff] [blame] | 250 | func (c *config) EmbeddedInMake() bool { |
| 251 | return c.inMake |
| 252 | } |
| 253 | |
Colin Cross | 35cec12 | 2015-04-02 14:37:16 -0700 | [diff] [blame] | 254 | // DeviceName returns the name of the current device target |
| 255 | // TODO: take an AndroidModuleContext to select the device name for multi-device builds |
Colin Cross | 1332b00 | 2015-04-07 17:11:30 -0700 | [diff] [blame] | 256 | func (c *config) DeviceName() string { |
Dan Willemsen | 1d31ec3 | 2015-09-22 16:56:09 -0700 | [diff] [blame] | 257 | return *c.ProductVariables.DeviceName |
Colin Cross | 35cec12 | 2015-04-02 14:37:16 -0700 | [diff] [blame] | 258 | } |
| 259 | |
Dan Willemsen | dd0e2c3 | 2015-10-20 14:29:35 -0700 | [diff] [blame] | 260 | func (c *config) DeviceUsesClang() bool { |
| 261 | if c.ProductVariables.DeviceUsesClang != nil { |
| 262 | return *c.ProductVariables.DeviceUsesClang |
| 263 | } |
Dan Willemsen | 0084d78 | 2016-03-01 14:54:24 -0800 | [diff] [blame] | 264 | return true |
Dan Willemsen | dd0e2c3 | 2015-10-20 14:29:35 -0700 | [diff] [blame] | 265 | } |
| 266 | |
Dan Willemsen | 34cc69e | 2015-09-23 15:26:20 -0700 | [diff] [blame] | 267 | func (c *config) ResourceOverlays() []SourcePath { |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 268 | return nil |
| 269 | } |
| 270 | |
| 271 | func (c *config) PlatformVersion() string { |
| 272 | return "M" |
| 273 | } |
| 274 | |
| 275 | func (c *config) PlatformSdkVersion() string { |
| 276 | return "22" |
| 277 | } |
| 278 | |
| 279 | func (c *config) BuildNumber() string { |
| 280 | return "000000" |
| 281 | } |
| 282 | |
| 283 | func (c *config) ProductAaptConfig() []string { |
| 284 | return []string{"normal", "large", "xlarge", "hdpi", "xhdpi", "xxhdpi"} |
| 285 | } |
| 286 | |
| 287 | func (c *config) ProductAaptPreferredConfig() string { |
| 288 | return "xhdpi" |
| 289 | } |
| 290 | |
| 291 | func (c *config) ProductAaptCharacteristics() string { |
| 292 | return "nosdcard" |
| 293 | } |
| 294 | |
Dan Willemsen | 34cc69e | 2015-09-23 15:26:20 -0700 | [diff] [blame] | 295 | func (c *config) DefaultAppCertificateDir(ctx PathContext) SourcePath { |
| 296 | return PathForSource(ctx, "build/target/product/security") |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 297 | } |
| 298 | |
Dan Willemsen | 34cc69e | 2015-09-23 15:26:20 -0700 | [diff] [blame] | 299 | func (c *config) DefaultAppCertificate(ctx PathContext) SourcePath { |
| 300 | return c.DefaultAppCertificateDir(ctx).Join(ctx, "testkey") |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 301 | } |
Colin Cross | 6ff5138 | 2015-12-17 16:39:19 -0800 | [diff] [blame] | 302 | |
| 303 | func (c *config) AllowMissingDependencies() bool { |
Dan Willemsen | b503816 | 2016-03-16 12:35:33 -0700 | [diff] [blame] | 304 | return Bool(c.ProductVariables.Allow_missing_dependencies) |
Colin Cross | 6ff5138 | 2015-12-17 16:39:19 -0800 | [diff] [blame] | 305 | } |
Dan Willemsen | 322acaf | 2016-01-12 23:07:05 -0800 | [diff] [blame] | 306 | |
Dan Willemsen | 7f730fd | 2016-01-14 11:22:23 -0800 | [diff] [blame] | 307 | func (c *config) SkipDeviceInstall() bool { |
Dan Willemsen | 322acaf | 2016-01-12 23:07:05 -0800 | [diff] [blame] | 308 | return c.EmbeddedInMake() || Bool(c.Mega_device) |
| 309 | } |
Colin Cross | 16b2349 | 2016-01-06 14:41:07 -0800 | [diff] [blame] | 310 | |
| 311 | func (c *config) SanitizeHost() []string { |
| 312 | if c.ProductVariables.SanitizeHost == nil { |
| 313 | return nil |
| 314 | } |
| 315 | return *c.ProductVariables.SanitizeHost |
| 316 | } |
| 317 | |
| 318 | func (c *config) SanitizeDevice() []string { |
| 319 | if c.ProductVariables.SanitizeDevice == nil { |
| 320 | return nil |
| 321 | } |
| 322 | return *c.ProductVariables.SanitizeDevice |
| 323 | } |