/// <summary> /// Copy constructor. /// </summary> /// <param name="other">Configuration to replicate.</param> private BuildConfiguration(BuildConfiguration other) { this.scenes = new List<string>( other.scenes ); this.dirMappings = new Dictionary<string, string>(); foreach (var mapping in other.dirMappings) { this.dirMappings[mapping.Key] = mapping.Value; } this.fileMappings = new Dictionary<string, string>( other.fileMappings ); foreach (var mapping in other.fileMappings) { this.fileMappings[mapping.Key] = mapping.Value; } this.options = other.Options; this.targetDir = other.targetDir; this.execName = other.execName; }
/// <summary> /// Set the name of the executable file to generate. /// Do not include file extensions (i.e. ".exe"). /// </summary> /// <param name="execName">Desired name for the executable.</param> /// <returns>A copy of this configuration, with the executable name.</returns> public BuildConfiguration SetExecName(string execName) { var clone = new BuildConfiguration( this ); clone.execName = execName; return clone; }
/// <summary> /// Set the directory where the builds should be placed. /// </summary> /// <param name="pathname">Path where builds are placed.</param> /// <returns>A copy of this configuration, with the target dir.</returns> public BuildConfiguration SetTargetDir(string pathname) { var clone = new BuildConfiguration( this ); clone.targetDir = pathname; return clone; }
/// <summary> /// Remove a directory mapping. /// </summary> /// <param name="projectDirPath">Project path to not copy.</param> /// <returns>A copy of this configuration, without the given directory mapping.</returns> public BuildConfiguration RemoveDirMapping(string projectDirPath) { var clone = new BuildConfiguration( this ); clone.dirMappings.Remove( projectDirPath ); return clone; }
/// <summary> /// Remove a file from the set of files to copy. /// </summary> /// <param name="projectFilePath">Path to the file to not copy.</param> /// <returns>A copy of this configuration, without the file mapping.</returns> public BuildConfiguration RemoveFile(string projectFilePath) { var clone = new BuildConfiguration( this ); clone.fileMappings.Remove( projectFilePath ); return clone; }
/// <summary> /// Remove a previously set build option. /// </summary> /// <param name="_options">Option or options to remove.</param> /// <returns>A copy of this configuration, without the given options.</returns> public BuildConfiguration RemoveBuildOption(BuildOptions _options) { var clone = new BuildConfiguration( this ); clone.options &= ~_options; return clone; }
/// <summary> /// Add a scene to the executable. At least one is needed. /// </summary> /// <param name="scenename">The path of the scene to add.</param> /// <returns>A copy of this configuration, with the scene added.</returns> public BuildConfiguration AddScene(string scenename) { var clone = new BuildConfiguration( this ); clone.scenes.Add( scenename ); return clone; }
/// <summary> /// Configure a file which shall be copied to the build data directory. /// </summary> /// <param name="projectFilePath">Path to the file to copy.</param> /// <param name="buildFilePath">Path where the file shall be copied. /// Names or relative paths may not match.</param> /// <returns>A copy of this configuration, with a new file mapping.</returns> public BuildConfiguration AddFileMapping(string projectFilePath, string buildFilePath) { var clone = new BuildConfiguration( this ); clone.fileMappings.Add( projectFilePath, buildFilePath ); return clone; }
/// <summary> /// Configure a directory to copy recursively to the target data directory /// after the build is completed. /// A source directory can only appear once. /// </summary> /// <param name="projectDirPath">Source directory to copy.</param> /// <param name="buildDirPath">Target directory to copy the source to. /// The names or relative paths may not coincide.</param> /// <returns>A copy of this configuration, with a new directory mapping.</returns> public BuildConfiguration AddDirMapping(string projectDirPath, string buildDirPath) { var clone = new BuildConfiguration( this ); clone.dirMappings.Add( projectDirPath, buildDirPath ); return clone; }
/// <summary> /// Add Unity build options. Can do it one by one, /// or add a mask of several BuildOptions. /// </summary> /// <param name="_options">Option or options to use when creating the build.</param> /// <returns>A copy of this configuration, with the new options.</returns> public BuildConfiguration AddBuildOption(BuildOptions _options) { var clone = new BuildConfiguration( this ); clone.options |= _options; return clone; }