Example #1
0
        /// <summary>
        /// Generate a .Net native assembly for the given Smalltalk runtime definition.
        /// </summary>
        /// <param name="parameters">
        /// Parameter object that contains the information about the Smalltalk runtime
        /// as well as additional parameters that govern the native assembly generation.
        /// </param>
        /// <returns>The path to the newly generated assembly.</returns>
        public static string GenerateNativeAssembly(NativeCompilerParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (parameters.Runtime == null)
            {
                throw new ArgumentNullException("parameters.Runtime");
            }
            if (String.IsNullOrWhiteSpace(parameters.RootNamespace))
            {
                throw new ArgumentNullException("parameters.RootNamespace");
            }
            if (String.IsNullOrWhiteSpace(parameters.OutputDirectory))
            {
                throw new ArgumentNullException("parameters.OutputDirectory");
            }
            if (String.IsNullOrWhiteSpace(parameters.AssemblyName))
            {
                throw new ArgumentNullException("parameters.AssemblyName");
            }
            if (parameters.IsBaseLibrary && (parameters.AssemblyType != NativeCompilerParameters.AssemblyTypeEnum.Dll))
            {
                throw new ArgumentException("parameters.IsBaseLibrary requires parameters.AssemblyType = AssemblyTypeEnum.Dll");
            }
            if (parameters.IsBaseLibrary && !parameters.Runtime.GlobalScope.IsEmpty)
            {
                throw new ArgumentException("parameters.IsBaseLibrary requires parameters.Runtime.GlobalScope to be empty");
            }

            NativeCompiler compiler = new NativeCompiler(parameters);

            return(compiler.Generate());
        }
Example #2
0
        private NativeCompiler(NativeCompilerParameters parameters)
        {
            this.Parameters = parameters.Copy();

            this.NativeGenerator = new NativeGenerator(parameters);
        }