Example #1
0
        /// <summary>
        /// Writes the build specification into the path (see <see cref="RelativePath" />) relative to <paramref name="directory" />.
        /// </summary>
        /// <param name="directory">Directory for writing the build specification.</param>
        public void Write(string directory, DsTestWriter testWriter)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(directory));

            var fullPath = Path.Combine(directory, RelativePath);

            testWriter.WriteFile(fullPath, Spec);

            if (IsPackage)
            {
                WriteAsPackage(directory, testWriter);
            }
        }
Example #2
0
        /// <summary>
        /// Writes the configuration into <paramref name="directory" />.
        /// </summary>
        /// <param name="directory">Directory for writing the configuration.</param>
        public void Write(string directory, DsTestWriter testWriter)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(directory));

            for (int i = 0; i < m_buildSpecWriters.Count; ++i)
            {
                m_buildSpecWriters[i].Write(directory, testWriter);
            }

            var fullPath = Path.Combine(
                directory,
                PrimaryConfigurationFileName);

            testWriter.WriteFile(fullPath, m_configContent ?? ToString());
        }
Example #3
0
        private void WriteAsPackage(string directory, DsTestWriter testWriter)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(directory));
            Contract.Requires(!string.IsNullOrWhiteSpace(m_name));

            var builder = new StringBuilder();

            builder.AppendLine("module({");
            builder.AppendLine("    name: \"" + m_name + "\",");

            if (m_implicitReferenceSemantics)
            {
                builder.AppendLine("    nameResolutionSemantics: NameResolutionSemantics.implicitProjectReferences,");
            }

            builder.AppendLine("});");

            var fullPath = Path.Combine(directory, Path.ChangeExtension(RelativePath, Names.DotConfigDotDscExtension));

            testWriter.WriteFile(fullPath, builder.ToString());
        }