public BuildIntegrationTests(ITestOutputHelper logger)
        : base(logger)
    {
        int seed = (int)DateTime.Now.Ticks;
        this.random = new Random(seed);
        this.Logger.WriteLine("Random seed: {0}", seed);
        this.buildManager = new BuildManager();
        this.projectCollection = new ProjectCollection();
        this.projectDirectory = Path.Combine(this.RepoPath, "projdir");
        Directory.CreateDirectory(this.projectDirectory);
        this.LoadTargetsIntoProjectCollection();
        this.testProject = this.CreateProjectRootElement(this.projectDirectory, "test.proj");
        this.testProjectInRoot = this.CreateProjectRootElement(this.RepoPath, "root.proj");
        this.globalProperties.Add("NerdbankGitVersioningTasksPath", Environment.CurrentDirectory + "\\");

        // Sterilize the test of any environment variables.
        foreach (System.Collections.DictionaryEntry variable in Environment.GetEnvironmentVariables())
        {
            string name = (string)variable.Key;
            if (ToxicEnvironmentVariablePrefixes.Any(toxic => name.StartsWith(toxic, StringComparison.OrdinalIgnoreCase)))
            {
                this.globalProperties[name] = string.Empty;
            }
        }
    }
 void Awake()
 {
     if (instance != null) {
         Debug.LogError ("More than one BuildManager");
     }
     instance = this;
 }
Example #3
0
    public static BuildResult Build(string projectOrSolution, string targets, Dictionary<string, string> properties = null, ILogger logger = null)
    {
        if (!Path.IsPathRooted(projectOrSolution))
            projectOrSolution = Path.Combine(ModuleInitializer.BaseDirectory, projectOrSolution);

        if (!File.Exists(projectOrSolution))
            throw new FileNotFoundException($"Project or solution to build {projectOrSolution} was not found.", projectOrSolution);

        // Without this, builds end up running in process and colliding with each other,
        // especially around the current directory used to resolve relative paths in projects.
        Environment.SetEnvironmentVariable("MSBUILDNOINPROCNODE", "1");
        using (var manager = new BuildManager(Guid.NewGuid().ToString()))
        {
            properties = properties ?? new Dictionary<string, string>();

            // If file is not a solution, build up a fake solution configuration so P2P references just work
            if (Path.GetExtension(projectOrSolution) != ".sln")
                AddSolutionConfiguration(projectOrSolution, properties);

            var request = new BuildRequestData(projectOrSolution, properties, "14.0", targets.Split(','), null);
            var parameters = new BuildParameters
            {
                GlobalProperties = properties,
            };

            if (logger != null)
                parameters.Loggers = new[] { logger };

            return manager.Build(parameters, request);
        }
    }
Example #4
0
 // Use this for initialization
 private void Start()
 {
     if (unitManager == null)
     {
         unitManager = GetComponent<UnitManager>();
     }
     if (buildManager == null)
     {
         buildManager = GetComponent<BuildManager>();
     }
 }
 public BuildIntegrationTests(ITestOutputHelper logger)
     : base(logger)
 {
     int seed = (int)DateTime.Now.Ticks;
     this.random = new Random(seed);
     this.Logger.WriteLine("Random seed: {0}", seed);
     this.buildManager = new BuildManager();
     this.projectCollection = new ProjectCollection();
     this.projectDirectory = Path.Combine(this.RepoPath, "projdir");
     Directory.CreateDirectory(this.projectDirectory);
     this.testProject = this.CreateProjectRootElement();
     this.globalProperties.Add("NerdbankGitVersioningTasksPath", Environment.CurrentDirectory + "\\");
 }
Example #6
0
        public void CanCalculateNextBuildWithNoDayNoTime()
        {
            var bm = new BuildManager()
            {
                Config = new BuildConfiguration()
                {
                },
                Data = new BuildData()
                {
                    LastBuild = new DateTime(2013, 2, 4, 16, 12, 59),
                },
            };

            Assert.Equal(new DateTime(2013, 2, 4, 16, 12, 59), bm.CalculateNextBuildTime());
        }
Example #7
0
        public void CanCalculateNextBuildForTommorrowNoDay()
        {
            var bm = new BuildManager()
            {
                Config = new BuildConfiguration()
                {
                    Time = new TimeSpan(14, 30, 0),
                },
                Data = new BuildData()
                {
                    LastBuild = new DateTime(2013, 2, 4, 16, 12, 59),
                },
            };

            Assert.Equal(new DateTime(2013, 2, 5, 14, 30, 0), bm.CalculateNextBuildTime());
        }
Example #8
0
        public void CanCalculateNextBuild()
        {
            var bm = new BuildManager()
            {
                Config = new BuildConfiguration()
                {
                    Day = DayOfWeek.Friday,
                    Time = new TimeSpan(14, 30, 0),
                },
                Data = new BuildData()
                {
                    LastBuild = new DateTime(2013, 2, 4, 16, 12, 59),
                },
            };

            Assert.Equal(new DateTime(2013, 2, 8, 14, 30, 0), bm.CalculateNextBuildTime());
        }
Example #9
0
    static void GetTower()
    {
        towerList=new UnitTower[0];
        nameList=new string[0];

        buildManager=(BuildManager)FindObjectOfType(typeof(BuildManager));

        if(buildManager!=null){
            towerList=buildManager.towers;

            nameList=new string[towerList.Length];
            for(int i=0; i<towerList.Length; i++){
                nameList[i]=towerList[i].name;
            }
        }
        else{
            towerList=new UnitTower[0];
            nameList=new string[0];
        }
    }
Example #10
0
    /// <summary>
    /// Compression process
    /// </summary>
    /// <param name="bm">Buld manager object working on</param>
    /// <param name="label">Label to show in messages</param>
    /// <param name="arguments">Arguments needed to compression process</param>
    private static void Compress(BuildManager bm, string label, string arguments)
    {
        Debug.Log("Compressing " + label + " build");

        // Create a new parallel process
        System.Diagnostics.Process proc = new System.Diagnostics.Process();

        try {

            // Get zip location
            proc.StartInfo.FileName = MakeAbsolute(bm.bd.zipPath);

            // Get directory where process will work
            proc.StartInfo.WorkingDirectory = MakeAbsolute(bm.bd.workPath);

            // Set arguments
            proc.StartInfo.Arguments = arguments;

            // Set custom options for not open a shell and no create a window
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.CreateNoWindow = true;

            // Start compression
            proc.Start();

        } catch (Exception e) {

            // Compression failed
            Debug.LogError("Compression for " + label + " failed: " + e.ToString());
        }
    }
Example #11
0
    /// <summary>
    /// Windows build process
    /// </summary>
    /// <param name="bm">Buld manager object working on</param>
    /// <param name="development">Build type</param>
    private static bool BuildWindows64(BuildManager bm, BuildOptions bo, BuildType bt)
    {
        Debug.Log("Building for Windows64 platform");

        // Get full build name
        string fullPath = bm.bd.workPath + "/" + bm.bd.buildName + "_win64.exe";

        // Build it
        string error = BuildPipeline.BuildPlayer(bm.bd.scenes.ToArray(), fullPath, BuildTarget.StandaloneWindows64, bo);

        if (String.IsNullOrEmpty(error)) {
            Debug.Log("Build for Windows64 done");

            // Compress
            if (bt == BuildType.Release)
                Compress(bm, "Windows64", "-9 -r " + bm.bd.buildName + "_win64.zip " + bm.bd.buildName + "_win64.exe " + bm.bd.buildName + "_win64_Data ");

            return true;

        } else {
            Debug.Log("Error While building to Windows: " + error);

            return false;
        }
    }
Example #12
0
 public static void BuildAllZipped()
 {
     BuildManager.BuildAllSequence(true, false);
 }
Example #13
0
 public static void BuildLinux()
 {
     BuildManager.BuildLinux(false);
 }
Example #14
0
 public EditorPresenter(EditorView view) {
   mView = view;
   mBuildManager = CommonInjector.provideBuildManager();
 }
Example #15
0
        private bool EmitNupkg(PublishRoot root)
        {
            root.Reports.Quiet.WriteLine("  Packing nupkg from {0} dependency {1}",
                _projectDescription.Type, _projectDescription.Identity.Name);

            IsPackage = true;

            var project = GetCurrentProject();
            if (project == null)
            {
                return false;
            }

            var resolver = new DefaultPackagePathResolver(root.TargetPackagesPath);
            var targetNupkg = resolver.GetPackageFileName(project.Name, project.Version);
            TargetPath = resolver.GetInstallPath(project.Name, project.Version);

            root.Reports.Quiet.WriteLine("    Source {0}", _projectDescription.Path.Bold());
            root.Reports.Quiet.WriteLine("    Target {0}", TargetPath);

            if (Directory.Exists(TargetPath))
            {
                root.Operations.Delete(TargetPath);
            }

            // If this is a wrapper project, we need to generate a lock file before building it
            if (IsWrappingAssembly())
            {
                var success = Restore(root, publishProject: this, restoreDirectory: project.ProjectDirectory)
                    .GetAwaiter().GetResult();
                if (!success)
                {
                    return false;
                }
            }

            // Generate nupkg from this project dependency
            var buildOptions = new BuildOptions();
            buildOptions.ProjectPatterns.Add(project.ProjectDirectory);
            buildOptions.OutputDir = Path.Combine(project.ProjectDirectory, "bin");
            buildOptions.Configurations.Add(root.Configuration);
            buildOptions.GeneratePackages = true;
            buildOptions.Reports = root.Reports.ShallowCopy();

            if (root.Frameworks.Any())
            {
                // Make sure we only emit the nupkgs for the specified frameworks
                // We need to pick actual project frameworks relevant to the publish
                // but the project may not target exactly the right framework so we need
                // to use a compatibility check.
                foreach (var framework in root.Frameworks)
                {
                    var selectedFramework = project.GetCompatibleTargetFramework(framework.Key);
                    if (selectedFramework == null)
                    {
                        root.Reports.WriteError($"Unable to build {project.Name}. It is not compatible with the requested target framework: {framework.Key}");
                        return false;
                    }
                    buildOptions.TargetFrameworks.Add(selectedFramework.FrameworkName, VersionUtility.GetShortFrameworkName(selectedFramework.FrameworkName));
                }
            }

            // Mute "dnu pack" completely if it is invoked by "dnu publish --quiet"
            buildOptions.Reports.Information = root.Reports.Quiet;

            var buildManager = new BuildManager(root.HostServices, buildOptions);
            if (!buildManager.Build())
            {
                return false;
            }

            // Extract the generated nupkg to target path
            var srcNupkgPath = Path.Combine(buildOptions.OutputDir, root.Configuration, targetNupkg);
            var srcSymbolsNupkgPath = Path.ChangeExtension(srcNupkgPath, "symbols.nupkg");

            var options = new Packages.AddOptions
            {
                NuGetPackage = root.IncludeSymbols ? srcSymbolsNupkgPath : srcNupkgPath,
                SourcePackages = root.TargetPackagesPath,
                Reports = root.Reports
            };

            var packagesAddCommand = new Packages.AddCommand(options);
            packagesAddCommand.Execute().GetAwaiter().GetResult();

            // Copy content files (e.g. html, js and images) of main project into "root" folder of the exported package
            var rootFolderPath = Path.Combine(TargetPath, "root");
            var rootProjectJson = Path.Combine(rootFolderPath, Runtime.Project.ProjectFileName);

            root.Operations.Delete(rootFolderPath);
            CopyProject(root, project, rootFolderPath, includeSource: false);

            UpdateWebRoot(root, rootFolderPath);

            UpdateJson(rootProjectJson, jsonObj =>
            {
                // Update the project entrypoint
                jsonObj["entryPoint"] = _projectDescription.Identity.Name;

                // Set mark this as non loadable
                jsonObj["loadable"] = false;

                // Update the dependencies node to reference the main project
                var deps = new JObject();
                jsonObj["dependencies"] = deps;

                deps[_projectDescription.Identity.Name] = _projectDescription.Identity.Version.ToString();
            });

            var appBase = Path.Combine(PublishRoot.AppRootName, "packages", resolver.GetPackageDirectory(_projectDescription.Identity.Name, _projectDescription.Identity.Version), "root");

            _relativeAppBase = Path.Combine("..", appBase);
            ApplicationBasePath = Path.Combine(root.OutputPath, appBase);

            root.Reports.Quiet.WriteLine("Removing {0}", srcNupkgPath);
            File.Delete(srcNupkgPath);

            root.Reports.Quiet.WriteLine("Removing {0}", srcSymbolsNupkgPath);
            File.Delete(srcSymbolsNupkgPath);

            return true;
        }
Example #16
0
	// Use this for initialization
	void Start () {
		player = GetComponent<Player>();
		startBoxPos = Vector2.zero;
		endBoxPos =  Vector2.zero;
		bm = GetComponent<BuildManager>();
	}
        private void buildManagerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            BuildManager BManager = new BuildManager();

            BManager.Show();
        }
        private void OnEnable()
        {
            Target = (BuildManager)target;

            MainEditor.LoadAddons((BuildManager)target, AddOnTarget.BuildManager);
        }
Example #19
0
 public static void BuildIos()
 {
     BuildManager.BuildIos(false);
 }
Example #20
0
 public static void BuildAndroid()
 {
     BuildManager.BuildAndroid(false);
 }
Example #21
0
 public static void BuildWeb()
 {
     BuildManager.BuildWeb(false);
 }
Example #22
0
 public static void BuildOSX()
 {
     BuildManager.BuildOSX(false);
 }
Example #23
0
    /// <summary>
    /// Share file
    /// </summary>
    /// <param name="bm">Buld manager object working on</param>
    /// <param name="label">Label to show in messages</param>
    private static void ShareFile(BuildManager bm, string label)
    {
        Debug.Log("Sharing " + label + " build");

        string path = MakeAbsolute (bm.bd.sharedFolderPath);
        System.IO.Directory.CreateDirectory (path);

        try {

            // Get folders
            string from = bm.bd.workPath + "/" + bm.bd.buildName + ".zip ";
            string to = bm.bd.sharedFolderPath + "/" + bm.bd.buildName + ".zip ";

            // Make paths absolute
            from = MakeAbsolute(from);
            to = MakeAbsolute(to);

            // Copy package to shared folder
            FileUtil.CopyFileOrDirectory(from, to);

            // Move done
            Debug.Log("File shared in: " + to);

        } catch (Exception e) {

            // Move failed
            Debug.LogError("Share failed: " + e.ToString());
        }
    }
Example #24
0
        private bool EmitNupkg(PublishRoot root)
        {
            root.Reports.Quiet.WriteLine("  Packing nupkg from {0} dependency {1}",
                _libraryDescription.Type, _libraryDescription.Identity.Name);

            IsPackage = true;

            var project = GetCurrentProject();
            var resolver = new DefaultPackagePathResolver(root.TargetPackagesPath);
            var targetNupkg = resolver.GetPackageFileName(project.Name, project.Version);
            TargetPath = resolver.GetInstallPath(project.Name, project.Version);

            root.Reports.Quiet.WriteLine("    Source {0}", _libraryDescription.Path.Bold());
            root.Reports.Quiet.WriteLine("    Target {0}", TargetPath);

            if (Directory.Exists(TargetPath))
            {
                root.Operations.Delete(TargetPath);
            }

            // Generate nupkg from this project dependency
            var buildOptions = new BuildOptions();
            buildOptions.ProjectDir = project.ProjectDirectory;
            buildOptions.OutputDir = Path.Combine(project.ProjectDirectory, "bin");
            buildOptions.Configurations.Add(root.Configuration);
            buildOptions.Reports = root.Reports;
            buildOptions.GeneratePackages = true;
            var buildManager = new BuildManager(root.HostServices, buildOptions);
            if (!buildManager.Build())
            {
                return false;
            }

            // Extract the generated nupkg to target path
            var srcNupkgPath = Path.Combine(buildOptions.OutputDir, root.Configuration, targetNupkg);
            var targetNupkgPath = resolver.GetPackageFilePath(project.Name, project.Version);
            var hashFile = resolver.GetHashPath(project.Name, project.Version);

            using (var sourceStream = new FileStream(srcNupkgPath, FileMode.Open, FileAccess.Read))
            {
                using (var archive = new ZipArchive(sourceStream, ZipArchiveMode.Read))
                {
                    root.Operations.ExtractNupkg(archive, TargetPath);
                }
            }

            using (var sourceStream = new FileStream(srcNupkgPath, FileMode.Open, FileAccess.Read))
            {
                using (var targetStream = new FileStream(targetNupkgPath, FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    sourceStream.CopyTo(targetStream);
                }

                sourceStream.Seek(0, SeekOrigin.Begin);
                var sha512Bytes = SHA512.Create().ComputeHash(sourceStream);
                File.WriteAllText(hashFile, Convert.ToBase64String(sha512Bytes));
            }

            // Copy content files (e.g. html, js and images) of main project into "root" folder of the exported package
            var rootFolderPath = Path.Combine(TargetPath, "root");
            var rootProjectJson = Path.Combine(rootFolderPath, Runtime.Project.ProjectFileName);

            root.Operations.Delete(rootFolderPath);
            CopyProject(root, project, rootFolderPath, includeSource: false);

            UpdateWebRoot(root, rootFolderPath);

            UpdateJson(rootProjectJson, jsonObj =>
            {
                // Update the project entrypoint
                jsonObj["entryPoint"] = _libraryDescription.Identity.Name;

                // Set mark this as non loadable
                jsonObj["loadable"] = false;

                // Update the dependencies node to reference the main project
                var deps = new JObject();
                jsonObj["dependencies"] = deps;

                deps[_libraryDescription.Identity.Name] = _libraryDescription.Identity.Version.ToString();
            });

            _applicationBase = Path.Combine("..", PublishRoot.AppRootName, "packages", resolver.GetPackageDirectory(_libraryDescription.Identity.Name, _libraryDescription.Identity.Version), "root");

            root.Reports.Quiet.WriteLine("Removing {0}", srcNupkgPath);
            File.Delete(srcNupkgPath);

            srcNupkgPath = Path.ChangeExtension(srcNupkgPath, "symbols.nupkg");
            root.Reports.Quiet.WriteLine("Removing {0}", srcNupkgPath);
            File.Delete(srcNupkgPath);

            return true;
        }
 void Start()
 {
     rend         = GetComponent <Renderer>();
     startColor   = rend.material.color; //сохранение базового цвета
     buildManager = BuildManager.instance;
 }
Example #26
0
 public static void BuildAllZippedPush()
 {
     BuildManager.BuildAllSequence(true, true);
 }
 protected override bool FileExists(ControllerContext controllerContext, string virtualPath)
 {
     return(BuildManager.GetObjectFactory(virtualPath, false) != null);
 }
Example #28
0
 void Awake()
 {
     instance    = this;
     playerStats = PlayerManager.instance.player.GetComponent <PlayerStats>();
 }
Example #29
0
        private void _ExportBeginImpl(string[] features, bool isDebug, string path, int flags)
        {
            _ = flags; // Unused

            if (!File.Exists(GodotSharpDirs.ProjectSlnPath))
            {
                return;
            }

            if (!DeterminePlatformFromFeatures(features, out string platform))
            {
                throw new NotSupportedException("Target platform not supported");
            }

            string outputDir = new FileInfo(path).Directory?.FullName ??
                               throw new FileNotFoundException("Base directory not found");

            string buildConfig = isDebug ? "ExportDebug" : "ExportRelease";

            string scriptsMetadataPath = BuildManager.GenerateExportedGameScriptMetadata(isDebug);

            AddFile(scriptsMetadataPath, scriptsMetadataPath);

            if (!BuildManager.BuildProjectBlocking(buildConfig, platform: platform))
            {
                throw new Exception("Failed to build project");
            }

            // Add dependency assemblies

            var assemblies = new Godot.Collections.Dictionary <string, string>();

            string projectDllName    = GodotSharpEditor.ProjectAssemblyName;
            string projectDllSrcDir  = Path.Combine(GodotSharpDirs.ResTempAssembliesBaseDir, buildConfig);
            string projectDllSrcPath = Path.Combine(projectDllSrcDir, $"{projectDllName}.dll");

            assemblies[projectDllName] = projectDllSrcPath;

            string bclDir = DeterminePlatformBclDir(platform);

            if (platform == OS.Platforms.Android)
            {
                string godotAndroidExtProfileDir = GetBclProfileDir("godot_android_ext");
                string monoAndroidAssemblyPath   = Path.Combine(godotAndroidExtProfileDir, "Mono.Android.dll");

                if (!File.Exists(monoAndroidAssemblyPath))
                {
                    throw new FileNotFoundException("Assembly not found: 'Mono.Android'", monoAndroidAssemblyPath);
                }

                assemblies["Mono.Android"] = monoAndroidAssemblyPath;
            }
            else if (platform == OS.Platforms.HTML5)
            {
                // Ideally these would be added automatically since they're referenced by the wasm BCL assemblies.
                // However, at least in the case of 'WebAssembly.Net.Http' for some reason the BCL assemblies
                // reference a different version even though the assembly is the same, for some weird reason.

                var wasmFrameworkAssemblies = new[] { "WebAssembly.Bindings", "WebAssembly.Net.WebSockets" };

                foreach (string thisWasmFrameworkAssemblyName in wasmFrameworkAssemblies)
                {
                    string thisWasmFrameworkAssemblyPath = Path.Combine(bclDir, thisWasmFrameworkAssemblyName + ".dll");
                    if (!File.Exists(thisWasmFrameworkAssemblyPath))
                    {
                        throw new FileNotFoundException($"Assembly not found: '{thisWasmFrameworkAssemblyName}'", thisWasmFrameworkAssemblyPath);
                    }
                    assemblies[thisWasmFrameworkAssemblyName] = thisWasmFrameworkAssemblyPath;
                }

                // Assemblies that can have a different name in a newer version. Newer version must come first and it has priority.
                (string newName, string oldName)[] wasmFrameworkAssembliesOneOf = new[]
Example #30
0
        public void CanDetectBuildOutOfDate()
        {
            var bm = new BuildManager()
            {
                Config = new BuildConfiguration()
                {
                    Time = new TimeSpan(14, 30, 0),
                },
                Data = new BuildData()
                {
                    LastBuild = new DateTime(2013, 2, 4, 16, 12, 59),
                },
            };

            Assert.False(bm.BuildOutOfDate(new DateTime(2013, 2, 4, 14, 30, 00)));
            Assert.False(bm.BuildOutOfDate(new DateTime(2013, 2, 5, 14, 29, 59)));
            Assert.True(bm.BuildOutOfDate(new DateTime(2013, 2, 5, 14, 30, 00)));
            Assert.True(bm.BuildOutOfDate(new DateTime(2013, 2, 6, 14, 30, 00)));
        }
Example #31
0
        internal object InstantiateClass(string virtualPath, string className = null, string relativePath = null, bool throwOnError = true)
        {
            var    wrapLog  = Log.Call($"{virtualPath}, {nameof(className)}:{className}, {nameof(relativePath)}:{relativePath}, {throwOnError}");
            string errorMsg = null;

            // Perform various checks on the path values
            var hasErrorMessage = CheckIfPathsOkAndCleanUp(ref virtualPath, relativePath);

            if (hasErrorMessage != null)
            {
                Log.Add($"Error: {hasErrorMessage}");
                wrapLog("failed");
                if (throwOnError)
                {
                    throw new Exception(hasErrorMessage);
                }
                return(null);
            }

            var pathLowerCase = virtualPath.ToLowerInvariant();
            var isCs          = pathLowerCase.EndsWith(CsFileExtension);
            var isCshtml      = pathLowerCase.EndsWith(CsHtmlFileExtension);

            Type compiledType = null;

            if (isCshtml && string.IsNullOrEmpty(className))
            {
#if NETSTANDARD
                throw new Exception("On-the Fly / Runtime Compile Not Yet Implemented in .net standard #TodoNetStandard");
#else
                compiledType = BuildManager.GetCompiledType(virtualPath);
#endif
                if (compiledType == null)
                {
                    errorMsg = $"Couldn't create instance of {virtualPath}. Compiled type == null";
                }
            }
            // compile .cs files
            else if (isCs || isCshtml)
            {
                // if no name provided, use the name which is the same as the file name
                className = className ?? Path.GetFileNameWithoutExtension(virtualPath) ?? "unknown";

                Assembly assembly = null;
#if NETSTANDARD
                var fullPath = _serviceProvider.Build <IServerPaths>().FullContentPath(virtualPath.Backslash());
                try
                {
                    assembly = new Compiler().Compile(fullPath, className);
                }
                catch
                {
                    errorMsg = $"can't compile '{className}' in {virtualPath}";
                }
#else
                assembly = BuildManager.GetCompiledAssembly(virtualPath);
#endif
                if (errorMsg == null)
                {
                    compiledType = assembly?.GetType(className, throwOnError, true);

                    if (compiledType == null)
                    {
                        errorMsg = $"didn't find type '{className}' in {virtualPath}";
                    }
                }
            }
            else
            {
                errorMsg = $"Error: given path '{virtualPath}' doesn't point to a .cs or .cshtml";
            }

            if (errorMsg != null)
            {
                Log.Add(errorMsg + $"; throw error: {throwOnError}");
                wrapLog("failed");
                if (throwOnError)
                {
                    throw new Exception(errorMsg);
                }
                return(null);
            }

            var instance = RuntimeHelpers.GetObjectValue(Activator.CreateInstance(compiledType));
            AttachRelativePath(virtualPath, instance);

            wrapLog($"found: {instance != null}");
            return(instance);
        }
 /// <summary>
 /// Returns the handler for webforms requests
 /// </summary>
 /// <returns></returns>
 internal static IHttpHandler GetWebFormsHandler()
 {
     return((global::umbraco.UmbracoDefault)BuildManager.CreateInstanceFromVirtualPath("~/default.aspx", typeof(global::umbraco.UmbracoDefault)));
 }
        public IExporter GetExcelExporter()
        {
            var type = Type.GetType(ExcelExporterType) ?? BuildManager.GetType(ExcelExporterType, false, true);

            return((IExporter)Activator.CreateInstance(type));
        }
Example #34
0
    /// <summary>
    /// Mac build process
    /// </summary>
    /// <param name="bm">Buld manager object working on</param>
    /// <param name="development">Build type</param>
    private static bool BuildMac(BuildManager bm, BuildOptions bo, BuildType bt)
    {
        Debug.Log("Building for Mac platform");

        // Get full build name
        string fullPath = bm.bd.workPath + "/" + bm.bd.buildName + "_mac.app";

        // Build it
        string error = BuildPipeline.BuildPlayer(bm.bd.scenes.ToArray(), fullPath, BuildTarget.StandaloneOSXUniversal, bo);

        if (String.IsNullOrEmpty(error) && bt == BuildType.Release) {
            Debug.Log("Build for Mac done");

            // Compress
            if (bt == BuildType.Release)
                Compress(bm, "Mac", "-9 -r " + bm.bd.buildName + "_mac.zip " + bm.bd.buildName + "_mac.app ");

            return true;

        } else {
            Debug.Log("Error While building to Linux: " + error);

            return false;
        }
    }
Example #35
0
    private Renderer rend; //cant call renderer its a key word

    void Start()
    {
        buildManager = BuildManager.instance;
        rend         = GetComponent <Renderer>();
        startColour  = rend.material.color;
    }
Example #36
0
    /// <summary>
    /// Build main process
    /// </summary>
    /// <param name="buildTyoe">Build type</param>
    public static void BuildGame(BuildType buildType)
    {
        // Load data from file
        BuildManager bm = new BuildManager();
        bm.bd = BuildData.Load();

        //Verify that all data is ok
        if (bm.ValidateData()) {

            BuildOptions bo;
            string popUpTitle;
            // Set the desired build options
            if (buildType == BuildType.Release) {
                bo = BuildOptions.None;
                popUpTitle = "Release Configuration";
            } else {
                bo = BuildOptions.Development | BuildOptions.AllowDebugging;
                if (buildType == BuildType.Development)
                    popUpTitle = "Development Build Configuration";
                else {
                    popUpTitle = "Fast Build Configuration";

                    string name = DateTime.Now.ToString(new CultureInfo("en-GB"));
                    name = name.Replace(" ", "_");
                    name = name.Replace(":", "-");
                    name = name.Replace("/", "-");
                    bm.bd.buildName = "drop_" + name;
                    bm.bd.workPath = "Build/" + bm.bd.buildName;
                    bm.bd.win32 = true;
                    bm.bd.win64 = false;
                    bm.bd.lin = false;
                    bm.bd.mac = false;
                    bm.bd.scenes = new List<string>();
                    bm.bd.countScenes = false;
                }
            }

            // Construct configuration confirmation string
            string popupMessage = GetSuccesString(bm, buildType);

            Debug.Log(popupMessage);

            // Show confirmation dialog
            if (EditorUtility.DisplayDialog(popUpTitle, popupMessage, "Proceed", "Abort")) {

                Debug.Log("Proceed to build");
                Debug.Log("Using \"" + bm.bd.workPath + "\" directory");

                /*
                // Copy a file from the project folder to the build folder, alongside the built game.
                FileUtil.CopyFileOrDirectory("Assets/WebPlayerTemplates/Readme.txt", path + "Readme.txt");*/

                bool goOn = true;

                // Build Windows
                if (goOn && bm.bd.win32) {
                    goOn = BuildWindows32(bm, bo, buildType);
                }

                // Build Windows
                if (goOn && bm.bd.win64) {
                    goOn = BuildWindows64(bm, bo, buildType);
                }

                // Build Linux
                if (goOn && bm.bd.lin) {
                    goOn = BuildLinux(bm, bo, buildType);
                }

                // Build Mac
                if (goOn && bm.bd.mac) {
                    goOn = BuildMac(bm, bo, buildType);
                }

                if (buildType == BuildType.Release) {

                    if (goOn)
                        // Wait for all work done
                        System.Threading.Thread.Sleep(5000);

                    // Packing all
                    Debug.Log("Packing");

                    if (goOn)
                        // Compress to one file
                        Compress(bm, "Package", "-9 -r " + bm.bd.buildName + ".zip " + (bm.bd.win32 ? bm.bd.buildName + "_win32.zip " : "") + (bm.bd.win64 ? bm.bd.buildName + "_win64.zip " : "") + (bm.bd.lin ? bm.bd.buildName + "_lin.zip " : "") + (bm.bd.mac ? bm.bd.buildName + "_mac.zip " : ""));

                    if (goOn)
                        // Wait for all work done
                        System.Threading.Thread.Sleep(15000);

                    // Share file
                    if (goOn && bm.bd.share)
                        ShareFile(bm, "Package");
                }

                if (goOn)
                    ShowExplorer(bm.bd.workPath);
            }
        }
    }
Example #37
0
 public void OnPostprocessBuild(BuildReport report)
 {
     Debug.Log("PostProcess started. Assuming build finished successfuly.");
     Debug.Log("Actual result: " + report.summary.result);
     BuildManager.BuildCompleted();
 }
Example #38
0
    /// <summary>
    /// Construct configuration confirmation string process
    /// </summary>
    /// <param name="bm">Buld manager object working on</param>
    /// <returns>Configuration confirmation string</returns>
    private static string GetSuccesString(BuildManager bm, BuildType bt)
    {
        string res;

        if (bt == BuildType.Fast) {
            res = " Fast Build configurated succesfully"

            + "\n\nBuild name:\n"
            + bm.bd.buildName

            + "\n\nBuild for windows platforms on \""
            + bm.bd.workPath +"\" folder";

        }else if(bt == BuildType.Development) {

            res = " Development Build configurated succesfully"

            + "\n\nBuild name:\n"
            + bm.bd.buildName

            + "\n\nTarget platforms: "
            + (bm.bd.win32 == true ? "\n - Windows32" : "")
            + (bm.bd.win64 == true ? "\n - Windows64" : "")
            + (bm.bd.mac == true ? "\n - Mac" : "")
            + (bm.bd.lin == true ? "\n - Linux" : "")

            + "\n\nWork folder:\n"
            + bm.bd.workPath;

        } else {

            res = " Release configurated succesfully"

            + "\n\nBuild name:\n"
            + bm.bd.buildName

            + "\n\nTarget platforms: "
            + (bm.bd.win32 == true ? "\n - Windows" : "")
            + (bm.bd.win64 == true ? "\n - Windows" : "")
            + (bm.bd.mac == true ? "\n - Mac" : "")
            + (bm.bd.lin == true ? "\n - Linux" : "")

            + "\n\nWork folder:\n"
            + bm.bd.workPath

            + (bm.bd.share == true ?
                "\n\nShared folder:\n" + bm.bd.sharedFolderPath
                : "")

            + "\n\nZip location:\n"
            + bm.bd.zipPath;

        }

        return res;
    }
Example #39
0
 public void OnPreprocessBuild(BuildReport report)
 {
     Debug.Log("PreProcess started.");
     BuildManager.StartPreBuild();
 }
Example #40
0
 public static void BuildAllPush()
 {
     BuildManager.BuildAllSequence(false, true);
 }
Example #41
0
 Type IBuildManager.GetCompiledType(string virtualPath)
 {
     return(BuildManager.GetCompiledType(virtualPath));
 }
Example #42
0
	// Use this for initialization
	void Start () {
        bm = GetComponent<BuildManager>();
        StartCoroutine("DB_GetRowCount");
       
	}
Example #43
0
 ICollection IBuildManager.GetReferencedAssemblies()
 {
     return(BuildManager.GetReferencedAssemblies());
 }
Example #44
0
 public BuildManager provideBuildManager() {
   return mBuildManager ?? (mBuildManager = new BuildManager());
 }
Example #45
0
 public static void BuildAll()
 {
     BuildManager.BuildAllSequence(false, false);
 }
Example #46
0
        private bool EmitNupkg(PublishRoot root)
        {
            root.Reports.Quiet.WriteLine("  Packing nupkg from {0} dependency {1}",
                _libraryDescription.Type, _libraryDescription.Identity.Name);

            IsPackage = true;

            var project = GetCurrentProject();
            var resolver = new DefaultPackagePathResolver(root.TargetPackagesPath);
            var targetNupkg = resolver.GetPackageFileName(project.Name, project.Version);
            TargetPath = resolver.GetInstallPath(project.Name, project.Version);

            root.Reports.Quiet.WriteLine("    Source {0}", _libraryDescription.Path.Bold());
            root.Reports.Quiet.WriteLine("    Target {0}", TargetPath);

            if (Directory.Exists(TargetPath))
            {
                root.Operations.Delete(TargetPath);
            }

            // Generate nupkg from this project dependency
            var buildOptions = new BuildOptions();
            buildOptions.ProjectPatterns.Add(project.ProjectDirectory);
            buildOptions.OutputDir = Path.Combine(project.ProjectDirectory, "bin");
            buildOptions.Configurations.Add(root.Configuration);
            buildOptions.GeneratePackages = true;
            buildOptions.Reports = root.Reports.ShallowCopy();

            // Mute "dnu pack" completely if it is invoked by "dnu publish --quiet"
            buildOptions.Reports.Information = root.Reports.Quiet;

            var buildManager = new BuildManager(root.HostServices, buildOptions);
            if (!buildManager.Build())
            {
                return false;
            }

            // Extract the generated nupkg to target path
            var srcNupkgPath = Path.Combine(buildOptions.OutputDir, root.Configuration, targetNupkg);
            var srcSymbolsNupkgPath = Path.ChangeExtension(srcNupkgPath, "symbols.nupkg");

            var options = new Microsoft.Framework.PackageManager.Packages.AddOptions
            {
                NuGetPackage = root.IncludeSymbols ? srcSymbolsNupkgPath : srcNupkgPath,
                SourcePackages = root.TargetPackagesPath,
                Reports = root.Reports
            };

            var packagesAddCommand = new Microsoft.Framework.PackageManager.Packages.AddCommand(options);
            packagesAddCommand.Execute().GetAwaiter().GetResult();

            // Copy content files (e.g. html, js and images) of main project into "root" folder of the exported package
            var rootFolderPath = Path.Combine(TargetPath, "root");
            var rootProjectJson = Path.Combine(rootFolderPath, Runtime.Project.ProjectFileName);

            root.Operations.Delete(rootFolderPath);
            CopyProject(root, project, rootFolderPath, includeSource: false);

            UpdateWebRoot(root, rootFolderPath);

            UpdateJson(rootProjectJson, jsonObj =>
            {
                // Update the project entrypoint
                jsonObj["entryPoint"] = _libraryDescription.Identity.Name;

                // Set mark this as non loadable
                jsonObj["loadable"] = false;

                // Update the dependencies node to reference the main project
                var deps = new JObject();
                jsonObj["dependencies"] = deps;

                deps[_libraryDescription.Identity.Name] = _libraryDescription.Identity.Version.ToString();
            });

            var appBase = Path.Combine(PublishRoot.AppRootName, "packages", resolver.GetPackageDirectory(_libraryDescription.Identity.Name, _libraryDescription.Identity.Version), "root");

            _relativeAppBase = Path.Combine("..", appBase);
            ApplicationBasePath = Path.Combine(root.OutputPath, appBase);

            root.Reports.Quiet.WriteLine("Removing {0}", srcNupkgPath);
            File.Delete(srcNupkgPath);

            root.Reports.Quiet.WriteLine("Removing {0}", srcSymbolsNupkgPath);
            File.Delete(srcSymbolsNupkgPath);

            return true;
        }
Example #47
0
 public static BulletPalamaterData GetData(BuildManager.WeaponID id)
 {
     return data.Find(i => i.weaponID == id);
 }
Example #48
0
 void Start()
 {
     buildManager = BuildManager.instance;
 }
Example #49
0
 private void Start()
 {
     Original   = GetComponent <Image>();
     BuildTower = BuildManager.instance;
     //ChangeImage();
 }
Example #50
0
    void Awake()
    {
        buildManager=this;

        foreach(UnitTower tower in towers){
            tower.thisObj=tower.gameObject;
        }

        towerCount=0;

        gridSize=Mathf.Clamp(gridSize, 0.5f, 3.0f);
        _gridSize=gridSize;

        InitPlatform();
    }
 private void Start()
 {
     buildManager = BuildManager.instance;
 }
Example #52
0
 public virtual IHttpHandler GetHandler(HttpContext context, string requestType, string virtualPath, string path)
 {
     // virtualPath is like "/fortunes", turn that into "/fortunes.aspx"
     return(BuildManager.CreateInstanceFromVirtualPath(virtualPath + ".aspx", typeof(Page)) as Page);
 }
        public IHttpHandler GetHandler(HttpContext context, string verb, string url, string filePath)
        {
            string fp = filePath != null?filePath.Replace(HttpRuntime.AppDomainAppPath, "/").Replace(Path.DirectorySeparatorChar, '/') : null;

            Type type;

#if NET_2_0
            type = BuildManager.GetCompiledType(url);
#else
            type = WebServiceParser.GetCompiledType(fp, context);
#endif

            WSProtocol protocol = GuessProtocol(context, verb);
#if NET_2_0
            context.Items ["WebServiceSoapVersion"] =
                protocol == WSProtocol.HttpSoap12 ?
                SoapProtocolVersion.Soap12 :
                SoapProtocolVersion.Default;
#endif
            bool         supported = false;
            IHttpHandler handler   = null;

            supported = WSConfig.IsSupported(protocol);
            if (!supported)
            {
                switch (protocol)
                {
#if NET_2_0
                default:
                    if (((protocol & WSProtocol.AnyHttpSoap) != WSProtocol.Unknown) &&
                        (WSConfig.Current.EnabledProtocols & WSProtocol.AnyHttpSoap) != WSProtocol.Unknown)
                    {
                        throw new InvalidOperationException("Possible SOAP version mismatch.");
                    }
                    break;
#endif
                case WSProtocol.HttpPost:
                    if (WSConfig.IsSupported(WSProtocol.HttpPostLocalhost))
                    {
#if NET_2_0
                        supported = context.Request.IsLocal;
#else
                        string localAddr = context.Request.ServerVariables ["LOCAL_ADDR"];

                        supported = localAddr != null &&
                                    (localAddr == context.Request.ServerVariables ["REMOTE_ADDR"] ||
                                     IPAddress.IsLoopback(IPAddress.Parse(localAddr)));
#endif
                    }
                    break;
                }
            }
            if (!supported)
            {
                throw new InvalidOperationException("Unsupported request format.");
            }

            switch (protocol)
            {
            case WSProtocol.HttpSoap12:
            case WSProtocol.HttpSoap:
                handler = GetTypeHandler(context, new HttpSoapWebServiceHandler(type));
                break;

            case WSProtocol.HttpPost:
            case WSProtocol.HttpGet:
                handler = GetTypeHandler(context, new HttpSimpleWebServiceHandler(type, protocol.ToString()));
                break;

            case WSProtocol.Documentation:
                SoapDocumentationHandler soapHandler;
                soapHandler = new SoapDocumentationHandler(type, context);
                if (soapHandler.PageHandler is IRequiresSessionState)
                {
                    if (soapHandler.PageHandler is IReadOnlySessionState)
                    {
                        handler = new ReadOnlySessionWrapperHandler(soapHandler);
                    }
                    else
                    {
                        handler = new SessionWrapperHandler(soapHandler);
                    }
                }
                else
                {
                    handler = soapHandler;
                }
                break;
            }

            return(handler);
        }
Example #54
0
 Stream IBuildManager.CreateCachedFile(string fileName)
 {
     return(BuildManager.CreateCachedFile(fileName));
 }
Example #55
0
 public static void BuildWindowsX64()
 {
     BuildManager.BuildWindowsX64(false);
 }
Example #56
0
 bool IBuildManager.FileExists(string virtualPath)
 {
     return(BuildManager.GetObjectFactory(virtualPath, false) != null);
 }
Example #57
0
 void Start()
 {
     buildManager = BuildManager.instance;
     rend =  GetComponent<Renderer> ();
     startColor = rend.material.color;
 }