예제 #1
0
        public SourceFileSet GetSourceFiles()
        {
            string path = SourcePath;

            // Copy All files back to their original locations. We'll use SourceFileSet again for this.
            SourceFileSet set = new SourceFileSet(path);

            // Add all the source files:
            set.Add(path);

            return(set);
        }
        /// <summary>Creates a precompile module for the given source paths. It's then precompiled, optionally in editor mode.</summary>
        /// <param name="paths">Paths to folders containing source code.</param>
        /// <param name="moduleName">A name which represents this group of files. This can be used to reverse the precompilation, or recompile.</param>
        /// <param name="editor">True if it should be precompiled in editor mode (with UNITY_EDITOR).</param>
        public static void Precompile(List <string> paths, string moduleName, bool editor)
        {
            // The target folder where we'll place all the source etc:
            string path = Path + "/" + moduleName;

            // Create the folder:
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
                Directory.CreateDirectory(path + "/Source");
            }

            // Create the source file set:
            SourceFileSet files = new SourceFileSet("Assets");

            // Ignore/include "Editor" folders based on editor setting:
            if (!editor)
            {
                files.Ignore("Editor");
            }

            // Ignore SVN folders:
            files.Ignore(".svn");

            // Could ignore platform specific folders here too!

            // Collect all source files now:
            foreach (string sourcePath in paths)
            {
                files.Add(sourcePath);
            }

            // Copy the files out of the Assets folder into one where the source will no longer get compiled by Unity.
            if (!files.CopyTo(path + "/Source"))
            {
                return;
            }

            // Write some settings:
            File.WriteAllText(path + "/Settings.conf", "Editor=" + editor + ";");

            if (Build(editor, moduleName, files))
            {
                // Delete all the source files from the unity asset folder(s):
                files.Delete();

                Debug.Log("Precompiled " + moduleName);

                // Inform the asset DB:
                AssetDatabase.Refresh();
            }
        }
예제 #3
0
        /// <summary>The full set of source files in this module.</summary>
        public SourceFileSet GetFileSet()
        {
            // Create the source file set:
            SourceFileSet files = new SourceFileSet();

            // Ignore "Editor" folders:
            files.Ignore("Editor");

            // Ignore SVN folders:
            files.Ignore(".svn");

            // Collect all source files now:
            foreach (string sourceDir in SourceFolders)
            {
                files.Add(sourceDir);
            }

            return(files);
        }
예제 #4
0
//--------------------------------------
		/// <summary>Creates a precompile module for the given source paths. It's then precompiled, optionally in editor mode.</summary>
		/// <param name="paths">Paths to folders containing source code.</param>
		/// <param name="moduleName">A name which represents this group of files. This can be used to reverse the precompilation, or recompile.</param>
		/// <param name="editor">True if it should be precompiled in editor mode (with UNITY_EDITOR).</param>
		public static void Precompile(List<string> paths,string moduleName,bool editor){
			
			// The target folder where we'll place all the source etc:
			string path=Path+"/"+moduleName;
			
			// Create the folder:
			if(!Directory.Exists(path)){
				Directory.CreateDirectory(path);
				Directory.CreateDirectory(path+"/Source");
			}
			
			// Create the source file set:
			SourceFileSet files=new SourceFileSet("Assets");
			
			// Ignore/include "Editor" folders based on editor setting:
			if(!editor){
				files.Ignore("Editor");
			}
			
			// Ignore SVN folders:
			files.Ignore(".svn");
			
			// Could ignore platform specific folders here too!
			
			// Collect all source files now:
			foreach(string sourcePath in paths){
				files.Add(sourcePath);
			}
			
			// Copy the files out of the Assets folder into one where the source will no longer get compiled by Unity.
			if(!files.CopyTo(path+"/Source")){
				return;
			}
			
			// Write some settings:
			File.WriteAllText(path+"/Settings.conf","Editor="+editor+";");
			
			if(Build(editor,moduleName,files)){
				
				// Delete all the source files from the unity asset folder(s):
				files.Delete();
				
				Debug.Log("Precompiled "+moduleName);
				
				// Inform the asset DB:
				AssetDatabase.Refresh();
				
			}
			
		}