Example #1
0
        /// <summary>
        ///     When overridden in a derived class, executes the task.
        /// </summary>
        /// <returns> true if the task successfully executed; otherwise, false. </returns>
        public override bool Execute()
        {
            Called       = true;
            LastInstance = this;
            log("start dsl");
            if (Lang.IsEmpty())
            {
                Log.LogWarning("no DSL defined - skip dsl");
                return(true);
            }
            log("DSL Lang: {0}", Lang);
            log("DSL Type: {0}", DslProjectType);
            log("DSL Root: {0}", DslDir);
            log("OutCode Dir: {0}", OutputCodeDir);
            log("PreprocessObly: {0}", Preprocess);
            if (TraceOnly)
            {
                log("skip because traceonly mode choosed");
                return(true);
            }
            var proj = new DslProject
            {
                LangName            = Lang,
                ProjectType         = DslProjectType,
                NativeCodeDirectory = OutputCodeDir,
                PreprocessOnly      = Preprocess,
                DslDirectory        = DslDir
            };

            foreach (var src in Sources)
            {
                proj.FileSources.Add(src.GetMetadata("FullPath"));
            }
            var provider = new XsltBasedDslProvider();
            var result   = provider.Run(proj);

            foreach (var srcfile in result.LoadedXmlSources)
            {
                log("Src: " + srcfile.Key);
            }

            if (Preprocess)
            {
                foreach (var generated in result.GeneratedNativeCode)
                {
                    log("Generated: " + generated.Key);
                }
            }
            else
            {
                log("Compiled: " + result.GetProductionFileName());
            }


            return(true);
        }
Example #2
0
		/// <summary>
		/// 	When overridden in a derived class, executes the task.
		/// </summary>
		/// <returns> true if the task successfully executed; otherwise, false. </returns>
		public override bool Execute() {
			Called = true;
			LastInstance = this;
			log("start dsl");
			if (Lang.IsEmpty()) {
				Log.LogWarning("no DSL defined - skip dsl");
				return true;
			}
			log("DSL Lang: {0}", Lang);
			log("DSL Type: {0}", DslProjectType);
			log("DSL Root: {0}", DslDir);
			log("OutCode Dir: {0}", OutputCodeDir);
			log("PreprocessObly: {0}", Preprocess);
			if (TraceOnly) {
				log("skip because traceonly mode choosed");
				return true;
			}
			var proj = new DslProject
				{
					LangName = Lang,
					ProjectType = DslProjectType,
					NativeCodeDirectory = OutputCodeDir,
					PreprocessOnly = Preprocess,
					DslDirectory = DslDir
				};
			foreach (var src in Sources) {
				proj.FileSources.Add(src.GetMetadata("FullPath"));
			}
			var provider = new XsltBasedDslProvider();
			var result = provider.Run(proj);

			foreach (var srcfile in result.LoadedXmlSources) {
				log("Src: " + srcfile.Key);
			}

			if (Preprocess) {
				foreach (var generated in result.GeneratedNativeCode) {
					log("Generated: " + generated.Key);
				}
			}
			else {
				log("Compiled: " + result.GetProductionFileName());
			}


			return true;
		}