コード例 #1
0
        internal ContentImporterContext(BuildContent buildTask, string intermediateDirectory, string outputDirectory, ContentBuildLogger logger)
        {
			this.buildTask = buildTask;
			this.intermediateDirectory = intermediateDirectory;
			this.outputDirectory = outputDirectory;
			this.logger = logger;
        }
コード例 #2
0
        private bool XNA_Build_Execute(EditorApplication packageCopy, BuildContent build, IList<XNACirrusAsset> sourceAssets)
        {
            // the RootDirectory must contain the sourceFile to avoid an "%0" from being appended to the   
            // output file name  
            //  
            var computedRootDirectory = String.IsNullOrEmpty(packageCopy.CurrentPackage.BuildRootRelativeDirectory)
            ? GetContentBaseDirectory(packageCopy)
            : Path.Combine(GetContentBaseDirectory(packageCopy), packageCopy.CurrentPackage.BuildRootRelativeDirectory);

            Environment.CurrentDirectory = build.RootDirectory = computedRootDirectory;

            build.IntermediateDirectory = XNAIntermediateDirectory;
            build.LoggerRootDirectory = null;
            build.SourceAssets = (from sourceAsset in sourceAssets select sourceAsset.TaskItem).ToArray();

            for (int i = 0; i < sourceAssets.Count; ++i)
            {
                build.SourceAssets[i] = sourceAssets[i].TaskItem;
            }

            //const string xnaVersion = ", Version=2.0.0.0, PublicKeyToken=6d5c3888ef60e27d";  
            // TODO: Why is "Culture" required?  
            //const string xnaVersion = ", Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d";

            // Don't append .dll??? if loading from the GAC  
            build.PipelineAssemblies = (from xnaReference in packageCopy.CurrentPackage.XNAReferences select new TaskItem(ParseReferencePath(packageCopy, xnaReference.Reference))).ToArray();
            
            try
            {
                return build.Execute();
            }
            catch (Exception e)
            {
                Build_Message(e.Message, e.Source, BuildMessageSeverity.Error);
                return false;
            }
        }
コード例 #3
0
        private bool Build_Execute(EditorApplication packageCopy, string contextId, bool rebuild, bool compress, Predicate<EditorContentFile> filesFilter = null, List<string> callTree = null, List<string> builtPackages = null)
        {
            /* callTree is used to identify circular references */
            if (callTree == null)
                callTree = new List<string>();

            /* builtPackages is used to skip the recompilation of an already processed package reference */
            if (builtPackages == null)
                builtPackages = new List<string>();

            callTree.Add(packageCopy.CurrentPackagePath);

            /* first, processes referenced package */
            foreach (var packageReference in packageCopy.CurrentPackage.CirrusReferences)
            {
                if (!String.IsNullOrEmpty(packageReference.Reference))
                {
                    if (packageReference.Build)
                    {
                        var referencePath = ParseReferencePath(packageCopy, packageReference.Reference);

                        if (!ProcessPackageReference(packageCopy, referencePath, contextId, rebuild, compress, filesFilter, callTree, builtPackages))
                            return false;
                    }
                    else
                    {
                        Build_Message(String.Format("--- Ignore --- The package {0} has been ignored because not marked for Build", packageReference.Reference),
                            "PackageReferenceCondition", BuildMessageSeverity.Information);
                    }
                }
            }

            /* then process the current package*/
            var decodedAssets = new List<XNACirrusAsset>();

            bool success = Build_ActionForAllFiles(packageCopy, (file) =>
            {
                if (filesFilter == null || filesFilter(file))
                {
                    Build_ProcessFile(decodedAssets, packageCopy, file);
                }
                else
                    Build_Message("-- Skipped by filter");

                return true;
            });

            if (success)
            {
                var build = new BuildContent();
                // BuildEngine is used by TaskLoggingHelper, so an implementation must be provided  
                //  
                build.BuildEngine = new BuildEngine(this);
                build.RebuildAll = rebuild;
                build.CompressContent = compress;
                build.TargetProfile = GraphicsProfile.HiDef.ToString();
                build.BuildConfiguration = "Debug";
                build.TargetPlatform = TargetPlatform.Windows.ToString();

                build.OutputDirectory = XNAOutputDirectory;

                if (decodedAssets.Count > 0)
                {
                    success = XNA_Build_Execute(packageCopy, build, decodedAssets);
                }

                builtPackages.Add(packageCopy.CurrentPackagePath);
            }

            return success;
        }