public ConsoleLoggerService(
     IBuildConfig currentBuildConfig,
     IConsoleLogger consoleLogger)
 {
     _currentBuildConfig = currentBuildConfig;
     ConsoleLogger       = consoleLogger;
 }
        /// <summary>
        /// Loads combined config for the specified target.
        /// </summary>
        public static IBuildConfig LoadConfig(Settings settings, IBuildConfig config = null)
        {
            var configType = GetBuildConfigType();
            var target     = EditorUserBuildSettings.activeBuildTarget;

            return(LoadConfig(settings, target, configType, config));
        }
Beispiel #3
0
        public HostedClusterClient(
            IBuildConfig buildConfig,
            IOrleansConfig clusterConfig)
        {
            var clientBuilder = new ClientBuilder()
                                .AddSimpleMessageStreamProvider(StreamProvider.Transient)
                                .UseAzureStorageClustering(options =>
            {
                options.ConnectionString = clusterConfig.AzureStorageConnectionString;
                options.TableName        = clusterConfig.StorageTableName;
            })
                                .Configure <ClusterOptions>(options =>
            {
                options.ServiceId = clusterConfig.ServiceId;
                options.ClusterId = clusterConfig.ClusterId;
            });

            if (buildConfig.Equals(BuildConfig.Debug))
            {
                clientBuilder
                .Configure <ClusterMembershipOptions>(x => x.ValidateInitialConnectivity = false);
            }

            Client = clientBuilder.Build();
        }
Beispiel #4
0
        private static void ProcessPackageIncludes(
            IBuildConfig config,
            PackagingSettings settings,
            string location,
            string projectName,
            string projectPackageConfig,
            Encoding encoding)
        {
            PackageContents includes = null;

            if (File.Exists($"{projectName}.{PackageIncludeFile}"))
            {
                includes = new PackageContents(projectPackageConfig);
            }
            else if (File.Exists(Path.Combine(location, PackageIncludeFile)))
            {
                includes = new PackageContents(Path.Combine(location, PackageIncludeFile));
            }
            if (includes != null)
            {
                var expander = new Expander();
                var nupkg    = Path.Combine(location, expander.Expand(config, "${id}.nuspec"));
                if (!File.Exists(nupkg))
                {
                    return;
                }
                XDocument doc;
                using (var reader = new StreamReader(nupkg, encoding))
                {
                    doc = XDocument.Load(reader);
                }
                if (doc?.Root == null)
                {
                    return;
                }
                var filesEelement = doc.Root.Element(XName.Get("files"));
                if (filesEelement == null)
                {
                    doc.Root.Add(new XElement("files"));
                    filesEelement = doc.Root.Element(XName.Get("files"));
                }
                foreach (var packageInclude in includes)
                {
                    if (settings.ExcludeMissingFiles && !File.Exists(Path.Combine(location, packageInclude.Source)))
                    {
                        continue;
                    }
                    var includeElement = new XElement(
                        "file",
                        new XAttribute("src", expander.Expand(config, packageInclude.Source)),
                        new XAttribute("target", expander.Expand(config, packageInclude.Destination)));
                    filesEelement.Add(includeElement);
                }

                using (var writer = new StreamWriter(nupkg, false, encoding))
                {
                    doc.Save(writer);
                }
            }
        }
Beispiel #5
0
        private bool TryExpand(IBuildConfig config, int previousCount, string raw, out string result)
        {
            result = raw;
            var keys = GetSubstitutableKeys(raw);

            if (keys.Count == 0)
            {
                return(true);
            }
            if (keys.Count != previousCount)
            {
                foreach (var key in keys)
                {
                    var nakedKey    = key.Substring(2, key.Length - 3);
                    var replacement = config[nakedKey];
                    if (replacement == null)
                    {
                        return(false);
                    }
                    result = result.Replace(key, config[nakedKey]);
                }
                return(TryExpand(config, keys.Count, result, out result));
            }
            return(false);
        }
 public ConsoleLogger(
     ITraceProxy traceProxy,
     IBuildConfig currentBuildConfig)
 {
     _traceProxy         = traceProxy;
     _currentBuildConfig = currentBuildConfig;
 }
 public void AddConfig(IBuildConfig config, bool isNewCurrentConfig)
 {
     buildConfigs.Add(config);
     if (isNewCurrentConfig)
     {
         currentConfigIndex = buildConfigs.Count - 1;
     }
 }
Beispiel #8
0
 public PackagingSettings(IBuildConfig config)
 {
     OutputLocation      = config[Properties.OutputLocation];
     OutputFilePatterns  = config[Properties.OutputFilePatterns];
     Commands            = config[Properties.Commands];
     OutputAutoRemove    = bool.TryParse(config[Properties.OutputAutoremove], out bool autoremove) && autoremove;
     ExcludeMissingFiles = bool.TryParse(config[Properties.ExcludeMissingFiles], out bool excludeMissing) && excludeMissing;
 }
 public ErrorHandler(
     IDialogService dialogService,
     IAnalyticsService analyticsService,
     IBuildConfig buildConfig)
 {
     _dialogService    = dialogService;
     _analyticsService = analyticsService;
     _buildConfig      = buildConfig;
 }
 /// <summary>
 /// Builds asset bundles.
 /// </summary>
 public static void Build(
     ref List <string> scenesToBuild,
     ref BuildTarget buildTarget,
     ref BuildOptions buildOptions,
     IBuildConfig buildConfig,
     string producedIndexFilename)
 {
     Build(ref scenesToBuild, ref buildTarget, ref buildOptions, buildConfig, null, producedIndexFilename, null);
 }
 /// <summary>
 /// Builds asset bundles and put them outside of the project,
 /// so they would not be included in the application package.
 /// If asset bundles already exist, they would be removed.
 /// Built asset bundles will be always compressed.
 /// </summary>
 public static void BuildOutsideOfPlayer(
     ref List <string> scenesToBuild,
     ref BuildTarget buildTarget,
     ref BuildOptions buildOptions,
     IBuildConfig buildConfig)
 {
     CleanStreamingAssets();
     Build(ref scenesToBuild, ref buildTarget, ref buildOptions, buildConfig, null, null, true);
     SeparateBundles();
 }
 /// <summary>
 /// Builds asset bundles.
 /// </summary>
 public static void Build(
     ref List <string> scenesToBuild,
     ref BuildTarget buildTarget,
     ref BuildOptions buildOptions,
     IBuildConfig buildConfig,
     string producedIndexFilename,
     bool?compressAssetBundles)
 {
     Build(ref scenesToBuild, ref buildTarget, ref buildOptions, buildConfig, null, producedIndexFilename, compressAssetBundles);
 }
 public AppCenterAnalyticsService(
     IApplicationInsightsConfig config,
     IConsoleLogger consoleLogger,
     ITelemetryClientProxy telemetryClient,
     ITelemetryDecorator telemetryDecorator,
     IBuildConfig currentBuildConfig,
     IAnalyticsSessionFactory sessionFactory)
     : base(config, consoleLogger, telemetryClient, telemetryDecorator, currentBuildConfig, sessionFactory)
 {
 }
 /// <summary>
 /// Builds asset bundles and put them inside the project,
 /// so they would be included in the application package.
 /// If asset bundles already exist, they would be removed.
 /// Built asset bundles could be compressed or not.
 /// </summary>
 public static void BuildInsidePlayer(
     ref List <string> scenesToBuild,
     ref BuildTarget buildTarget,
     ref BuildOptions buildOptions,
     IBuildConfig buildConfig)
 {
     CleanStreamingAssets();
     Build(ref scenesToBuild, ref buildTarget, ref buildOptions, buildConfig, null, null, null);
     CopyToStreamingAssets();
 }
 /// <summary>
 /// Builds asset bundles and put them outside the project, and split the bundles into two folders,
 /// one for compressed, another for uncompressed. Uncompressed bundles will be used for release, compressed for
 /// download.
 /// </summary>
 public static void BuildOutsidePlayer2(
     ref List <string> scenesToBuild,
     ref BuildTarget buildTarget,
     ref BuildOptions buildOptions,
     IBuildConfig buildConfig)
 {
     CleanStreamingAssets();
     Build(ref scenesToBuild, ref buildTarget, ref buildOptions, buildConfig, null, null, null);
     //copy bundles to different folders by their compressed property
     SeparateBundles();
 }
Beispiel #16
0
 public OrleansAnalyticsService(
     IApplicationInsightsConfig config,
     IConsoleLogger consoleLogger,
     ITelemetryClientProxy telemetryClient,
     ITelemetryDecorator telemetryDecorator,
     IBuildConfig currentBuildConfig,
     IAnalyticsSessionFactory sessionFactory,
     IOrleansRequestContext requestContext)
     : base(config, consoleLogger, telemetryClient, telemetryDecorator, currentBuildConfig, sessionFactory)
 {
     _requestContext = requestContext;
 }
        /// <summary>
        /// Creates a new configuration with combined settings from this config and the <paramref name="fallbackConfig"/>.
        /// </summary>
        public IBuildConfig Combine(IBuildConfig fallbackConfig)
        {
            if (fallbackConfig == null)
            {
                throw new ArgumentNullException("fallbackConfig");
            }

            var result = MemberwiseClone() as BuildConfig;

            Combine(fallbackConfig, result);
            return(result);
        }
        public void CurrentConfigTest()
        {
            IProject     project        = null;                                     // TODO: Initialize to an appropriate value
            bool         CreateDefaults = false;                                    // TODO: Initialize to an appropriate value
            BuildSystem  target         = new BuildSystem(project, CreateDefaults); // TODO: Initialize to an appropriate value
            IBuildConfig expected       = null;                                     // TODO: Initialize to an appropriate value
            IBuildConfig actual;

            target.CurrentConfig = expected;
            actual = target.CurrentConfig;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="InvalidOperationException"></exception>
        public static void ApplyBuildConfig(IBuildConfig config)
        {
            ApplyAppConfig(config);
            ApplyVersionConfig(config);

#if UNITY_PURCHASING
            if (config.Store != AppStore.NotSpecified)
            {
                UnityPurchasingEditor.TargetAndroidStore(config.Store);
            }
#endif

            PlayerSettings.SetScriptingDefineSymbolsForGroup(GetActiveBuildTargetGroup(), string.Join(";", config.Defines));
        }
        protected OrleansConfiguration(
            string azureAzureStorageConnectionString,
            string clusterName,
            IBuildConfig buildConfig,
            int dashboardPort)
        {
            BuildConfig   = buildConfig;
            DashboardPort = dashboardPort;
            AzureStorageConnectionString = azureAzureStorageConnectionString;

            ClusterName      = clusterName;
            StorageTableName = clusterName + "ClusterInfo";
            ServiceId        = clusterName + "Service";
            ClusterId        = clusterName + "Cluster";
        }
 public AnalyticsService(
     IApplicationInsightsConfig config,
     IConsoleLogger consoleLogger,
     ITelemetryClientProxy telemetryClient,
     ITelemetryDecorator telemetryDecorator,
     IBuildConfig currentBuildConfig,
     IAnalyticsSessionFactory sessionFactory)
 {
     Config             = config;
     ConsoleLogger      = consoleLogger;
     TelemetryClient    = telemetryClient;
     TelemetryDecorator = telemetryDecorator;
     CurrentBuildConfig = currentBuildConfig;
     _sessionFactory    = sessionFactory;
 }
Beispiel #22
0
        public void CloneTest()
        {
            string      projectFile = @"C:\Users\Test\file.wcodeproj";
            string      projectName = "Project";
            IProject    project     = new Project(projectFile, projectName);
            string      name        = "Debug Config";
            BuildConfig target      = new BuildConfig(project, name);

            target.Steps.Add(new InternalBuildStep(project, 1, StepType.All, null, null));
            target.Steps.Add(new InternalBuildStep(project, 0, StepType.Listing, null, null));

            IBuildConfig actual = (IBuildConfig)target.Clone();

            Assert.AreEqual(target, actual);
        }
Beispiel #23
0
 public DefaultBuildIterator(IBuildConfig buildConfig)
     : base(buildConfig)
 {
     BuildOrder = new List <string>
     {
         "before_install",
         "install",
         "before_script",
         "script",
         "after_success",
         "after_failure",
         "before_deploy",
         "deploy",
         "after_deploy",
         "after_script"
     };
 }
        /// <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);
        }
        /// <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));
        }
        /// <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>
        /// Loads combined config for the specified target.
        /// </summary>
        public static IBuildConfig LoadConfig(Settings settings, BuildTarget target, IBuildConfig config = null)
        {
            var configType = GetBuildConfigType();

            return(LoadConfig(settings, target, configType, config));
        }
 protected AbstractBuildIterator(IBuildConfig buildConfig, List <string> buildOrder = null)
 {
     BuildConfig = buildConfig;
     BuildOrder  = buildOrder ?? new List <string>();
 }
        /// <summary>
        /// Builds asset bundles.
        /// </summary>
        public static void Build(
            ref List <string> scenesToBuild,
            ref BuildTarget buildTarget,
            ref BuildOptions buildOptions,
            IBuildConfig buildConfig,
            string originalIndexFilename,
            string producedIndexFilename,
            bool?compressAssetBundles)
        {
            // set output folder
            Assertion.Check(buildConfig != null, "BuildConfig must be specified!");
            InitDistDirectory(buildConfig);

            // configure builder
            Index index = Builder.index;

            Builder.index = null;             // means, build all found indices
            if (!string.IsNullOrEmpty(originalIndexFilename))
            {
                bool    found   = false;
                Index[] indices = Builder.GetIndexInstances();
                Builder.index = index;                 // restores original value
                foreach (Index i in indices)
                {
                    if (i.m_filename.ToLower().Equals(originalIndexFilename.ToLower()))
                    {
                        Builder.index = i;
                        found         = true;
                        break;
                    }
                }
                Assertion.Check(found, "Index \"{0}\" has not been found!", originalIndexFilename);
                if (!found)
                {
                    throw new NotSupportedException(string.Format("Index \"{0}\" has not been found. No asset bundles will be built.", originalIndexFilename));
                }
            }
            Index.m_overridenFilenameMask = producedIndexFilename;
            bool buildReadableIndex = Builder.BuildReadableIndex;

            Builder.BuildReadableIndex = ETUtils.IsUnityInBatchMode();             // means, on buildmachines only
            Builder.AssetBundlesCompressionOverriding overrideAssetBundlesCompression = Builder.OverrideAssetBundlesCompression;
            if ((compressAssetBundles != null) && compressAssetBundles.HasValue)
            {
                Builder.OverrideAssetBundlesCompression = compressAssetBundles.Value ? Builder.AssetBundlesCompressionOverriding.Compressed : Builder.AssetBundlesCompressionOverriding.Uncompressed;
            }
            else
            {
                Builder.OverrideAssetBundlesCompression = Builder.AssetBundlesCompressionOverriding.DoNotOverride;
            }

            // produce bundles
            UpdateScenes(ref scenesToBuild);
            Builder.BuildAssetBundles(DistDirectory, buildTarget, buildOptions);

            // restore builder
            Builder.index = index;
            Index.m_overridenFilenameMask           = null;
            Builder.BuildReadableIndex              = buildReadableIndex;
            Builder.OverrideAssetBundlesCompression = overrideAssetBundlesCompression;
        }
 private static void InitDistDirectory(IBuildConfig buildConfig)
 {
     DistDirectory = "./dist/" + buildConfig.GetType().Name + "/AssetBundles";
 }