public static void SetUnity3DPlayerSettings(this ICakeContext context, Unity3DProjectOptions projectOptions, Unity3DPlayerSettings settings)
        {
            var jobContext = new Unity3DPlayerContext(context, projectOptions, settings);

            jobContext.DumpOptions();
            jobContext.Build();
        }
        public static void BuildUnity3DDependency(this ICakeContext context, Unity3DProjectOptions projectOptions, Unity3DBuildDependencyOptions options)
        {
            var unityBuildContext = new Unity3DBuildDependencyContext(context, projectOptions, options);

            unityBuildContext.DumpOptions();
            unityBuildContext.Build();
        }
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="context">The current cake context.</param>
 /// <param name="projectOptions">The Unity3d Project options to use when building the project.</param>
 /// <param name="options">The build options to use when building the project.</param>
 public Unity3DBuildDependencyContext(ICakeContext context, Unity3DProjectOptions projectOptions, Unity3DBuildDependencyOptions options)
     : base(context, projectOptions, options)
 {
     if (options.Dependencies == null || options.Dependencies.Count <= 0)
     {
         throw new Exception($"You need to set at least one TargetDependencieNames");
     }
 }
 public static void BuildUnity3DProject(this ICakeContext context, Unity3DProjectOptions projectOptions, Unity3DBuildOptions options)
 {
     try
     {
         var unityBuildContext = new Unity3DBuildContext(context, projectOptions, options);
         unityBuildContext.DumpOptions();
         unityBuildContext.Build();
     }
     catch (System.Exception ex)
     {
         System.Console.WriteLine(ex.Message);
         System.Console.WriteLine(ex.StackTrace);
     }
 }
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="context">The current cake context.</param>
        /// <param name="projectOptions">The Unity3d Project options to use when building the project.</param>
        /// <param name="options">The build options to use when building the project.</param>
        public Unity3DContext(ICakeContext context, Unity3DProjectOptions projectOptions, T options)
        {
            if (projectOptions == null)
            {
                throw new Exception("Project Options must be set.");
            }

            if (options == null)
            {
                throw new Exception("Build Options mus be set.");
            }

            m_cakeContext    = context;
            m_projectOptions = projectOptions;
            m_buildOptions   = options;
        }
        public static void SetUnity3DDependency(this ICakeContext context, Unity3DProjectOptions projectOptions, string dependencyName, string value)
        {
            string path      = System.IO.Path.Combine(projectOptions.ProjectFolder.ToString(), "Packages/manifest.json");
            var    manifest  = PackageManifest.ReadFile(path);
            bool   hasChange = false;

            if (string.IsNullOrEmpty(value))
            {
                if (manifest.dependencies.ContainsKey(dependencyName))
                {
                    // Clear Entry
                    manifest.dependencies.Remove(dependencyName);
                    hasChange = true;
                    System.Console.WriteLine($"- {dependencyName}");
                }
            }
            else
            {
                string currentValue;
                if (!manifest.dependencies.TryGetValue(dependencyName, out currentValue))
                {
                    // Add Entry
                    manifest.dependencies.Add(dependencyName, value);
                    hasChange = true;
                    System.Console.WriteLine($"+ {dependencyName} => {value}");
                }
                else if (currentValue != value)
                {
                    // Update Entry
                    manifest.dependencies[dependencyName] = value;
                    hasChange = true;
                    System.Console.WriteLine($"  {dependencyName} => {value}");
                }
            }

            if (hasChange)
            {
                PackageManifest.WriteFile(path, manifest);
            }
        }
Example #7
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="context">The current cake context.</param>
        /// <param name="projectOptions">The Unity3d Project options to use when building the project.</param>
        /// <param name="options">The build options to use when building the project.</param>
        public Unity3DBuildContext(ICakeContext context, Unity3DProjectOptions projectOptions, Unity3DBuildOptions options)
            : base(context, projectOptions, options)
        {
            if (string.IsNullOrEmpty(options.OutputPath))
            {
                throw new Exception("The output path build option must be set.");
            }

            if (string.IsNullOrEmpty(options.OutputPath))
            {
                throw new Exception("The output path must be set.");
            }
            else if (options.OutputPath.Contains(" "))
            {
                throw new Exception("The output path can not contain any spaces.");
            }

            if (!string.IsNullOrEmpty(options.BuildVersion) && options.BuildVersion.Contains(" "))
            {
                throw new Exception("The build version can not contain any spaces.");
            }
        }
 public Unity3DPlayerContext(ICakeContext context, Unity3DProjectOptions projectOptions, Unity3DPlayerSettings settings)
     : base(context, projectOptions, settings)
 {
 }