/// <summary>
        /// Loads combined config for the specified target/type.
        /// </summary>
        public static IBuildConfig LoadConfig(Settings settings, BuildTarget target, Type configType, IBuildConfig config = null)
        {
            if (target == BuildTarget.NoTarget)
            {
                throw new ArgumentException("Invalid build target", "target");
            }

            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            if (configType == null)
            {
                throw new ArgumentNullException("configType");
            }

            settings.Validate();

            var envConfig          = BuildConfig.FromEnvironment(configType, settings.EnvNamePrefix);
            var platformConfigPath = GetConfigPath(settings.BuildConfigPath, settings.BuildConfigName, target);
            var sharedConfigPath   = GetConfigPath(settings.BuildConfigPath, settings.BuildConfigName, BuildTarget.NoTarget);

            if (config != null)
            {
                config = config.Combine(envConfig);
            }

            if (File.Exists(platformConfigPath))
            {
                var platformConfig = BuildConfig.FromXml(configType, platformConfigPath);
                config = envConfig.Combine(platformConfig);
            }

            if (File.Exists(sharedConfigPath))
            {
                var sharedConfig = BuildConfig.FromXml(configType, sharedConfigPath);
                config = config.Combine(sharedConfig);
            }

            if (File.Exists(settings.GitVersionPath))
            {
                var versionConfig = new AppVersionInfo(settings.GitVersionPath);
                config = config.Combine(versionConfig);
            }

            return(config);
        }
        /// <summary>
        /// Builds the project for the specified target.
        /// </summary>
        public static BuildReport Build(BuildTarget target, IBuildConfig config, Settings settings)
        {
            if (target == BuildTarget.NoTarget)
            {
                throw new ArgumentException("Invalid build target", "target");
            }

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            settings.Validate();

            var versionInfo    = new AppVersionInfo(settings.GitVersionPath);
            var buildPath      = GetBuildPath(config.ProductName, config.BundleVersion, settings.BuildPath, target);
            var executableName = GetExecutableName(config.ProductName, target);
            var executablePath = Path.Combine(buildPath, executableName);
            var sceneNames     = EditorBuildSettings.scenes.Where(s => s.enabled).Select(s => s.path).ToArray();
            var buildOptions   = GetBuildOptions(!versionInfo.IsRelease);
            var playerOptions  = new BuildPlayerOptions()
            {
                locationPathName = executablePath,
                options          = buildOptions,
                scenes           = sceneNames,
                target           = target
            };

            Directory.CreateDirectory(buildPath);

            config.Apply();
            config.DebugLog();

            return(BuildPipeline.BuildPlayer(playerOptions));
        }