Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fallbackConfig"></param>
        /// <param name="result"></param>
        protected virtual void Combine(IBuildConfig fallbackConfig, BuildConfig result)
        {
            // Defines.
            var defines = new HashSet <string>();

            if (Defines != null)
            {
                defines.UnionWith(Defines);
            }

            if (fallbackConfig.Defines != null)
            {
                defines.UnionWith(fallbackConfig.Defines);
            }

            result.Defines = defines.ToArray();

            // App/version configs.
            CombineAppConfig(fallbackConfig, result);
            CombineVersionConfig(fallbackConfig, result);
        }
Exemplo n.º 3
0
 private void CombineAppConfig(IAppConfig fallbackConfig, BuildConfig result)
 {
     throw new NotImplementedException();
 }