Ejemplo n.º 1
0
        public virtual void Setup()
        {
            var mtouchPaths = SetupProjectPaths("MySingleView");

            MonoTouchProjectBinPath    = mtouchPaths.ProjectBinPath;
            MonoTouchProjectObjPath    = mtouchPaths.ProjectObjPath;
            MonoTouchProjectCSProjPath = mtouchPaths.ProjectCSProjPath;
            MonoTouchProjectPath       = mtouchPaths.ProjectPath;

            AppBundlePath = mtouchPaths.AppBundlePath;

            var libraryPaths = SetupProjectPaths("MyLibrary", "../MySingleView/", false);

            LibraryProjectBinPath    = libraryPaths.ProjectBinPath;
            LibraryProjectObjPath    = libraryPaths.ProjectObjPath;
            LibraryProjectPath       = libraryPaths.ProjectPath;
            LibraryProjectCSProjPath = libraryPaths.ProjectCSProjPath;

            SetupEngine();

            MonoTouchProject         = SetupProject(Engine, MonoTouchProjectCSProjPath);
            MonoTouchProjectInstance = MonoTouchProject.CreateProjectInstance();
            LibraryProject           = SetupProject(Engine, LibraryProjectCSProjPath);
            LibraryProjectInstance   = LibraryProject.CreateProjectInstance();

            CleanUp();
        }
Ejemplo n.º 2
0
        public void PackLibraryResources_LibraryProject()
        {
            RunTarget(LibraryProject, TargetName.PackLibraryResources);
            var embeddedResources = LibraryProject.GetEvaluatedItemsByName("EmbeddedResource").ToArray();

            Assert.AreEqual(13, embeddedResources.Length, "#1");
        }
Ejemplo n.º 3
0
        public virtual void Setup()
        {
            var mtouchPaths = SetupProjectPaths("MySingleView");

            MonoTouchProjectBinPath    = mtouchPaths ["project_binpath"];
            MonoTouchProjectObjPath    = mtouchPaths ["project_objpath"];
            MonoTouchProjectCSProjPath = mtouchPaths ["project_csprojpath"];
            MonoTouchProjectPath       = mtouchPaths ["project_path"];

            AppBundlePath = mtouchPaths ["app_bundlepath"];

            var libraryPaths = SetupProjectPaths("MyLibrary", "../MySingleView/", false);

            LibraryProjectBinPath    = libraryPaths ["project_binpath"];
            LibraryProjectObjPath    = libraryPaths ["project_objpath"];
            LibraryProjectPath       = libraryPaths ["project_path"];
            LibraryProjectCSProjPath = libraryPaths ["project_csprojpath"];

            SetupEngine();

            MonoTouchProject         = SetupProject(Engine, MonoTouchProjectCSProjPath);
            MonoTouchProjectInstance = MonoTouchProject.CreateProjectInstance();
            LibraryProject           = SetupProject(Engine, LibraryProjectCSProjPath);
            LibraryProjectInstance   = LibraryProject.CreateProjectInstance();

            CleanUp();
        }
Ejemplo n.º 4
0
        public void BuildLibrary_NoInterfaceDefinitions()
        {
            LibraryProject.RemoveItems(LibraryProject.GetItems("InterfaceDefinition"));
            LibraryProjectInstance = LibraryProject.CreateProjectInstance();

            BuildLibraryCore(ExpectedLibraryEmbeddedResources.Where(s => !s.Contains("storyboardc")).ToArray());
        }
Ejemplo n.º 5
0
        private void OutputForm_Load(object sender, EventArgs e)
        {
            this.Text = "Output - " + MainForm.RootDir_ProjectCodeName;
            Print("Generating..." + Environment.NewLine + Environment.NewLine);

            // Print the projects directory location
            Print("Project location: " + MainForm.RootDir_ProjectLocation + Environment.NewLine);

            // Generate selected project type
            switch (MainForm.ProjectTypes_SelectedProject)
            {
            case MainForm.ProjectTypes.Console:
                ConsoleProject consoleProject = new ConsoleProject();
                consoleProject.Generate(ref outputForm);
                break;

            case MainForm.ProjectTypes.Library:
                LibraryProject libraryProject = new LibraryProject();
                libraryProject.Generate(ref outputForm);
                break;

            case MainForm.ProjectTypes.SDL2:
                SDL2Project sdl2Project = new SDL2Project();
                sdl2Project.Generate(ref outputForm);
                break;

            default:
                Print("ERROR: Unknown project. Aborting!" + Environment.NewLine);
                MessageBox.Show("Unknown project. Aborting!", "ERROR");
                return;
            }

            // Finished
            GenerationComplete();
        }
Ejemplo n.º 6
0
        public void UnpackLibraryResources_LibraryProject()
        {
            // We should not unpack any EmbeddedResources into BundleResources
            RunTarget(LibraryProject, TargetName.Build);
            var bundleResources = LibraryProject.GetEvaluatedItemsByName("_BundleResourceWithLogicalName").ToArray();

            Assert.AreEqual(11, bundleResources.Length, "#1");
        }
Ejemplo n.º 7
0
        public void BuildLibrary_NoInterfaceDefinitions()
        {
            foreach (var item in LibraryProject.GetEvaluatedItemsByName("InterfaceDefinition"))
            {
                LibraryProject.RemoveItem((Microsoft.Build.BuildEngine.BuildItem)item);
            }

            BuildLibraryCore(ExpectedLibraryEmbeddedResources.Where(s => !s.Contains("storyboardc")).ToArray());
        }
Ejemplo n.º 8
0
        public void GetReferencedAssemblies_Library()
        {
            RunTarget(LibraryProject, TargetName.ResolveReferences);
            var references = LibraryProject.GetEvaluatedItemsByName("ReferencePath").ToArray();

            Assert.AreEqual(5, references.Length, "#1");
            Assert.IsTrue(references.Any(t => t.Include.Contains("System")), "#2a");
            Assert.IsTrue(references.Any(t => t.Include.Contains("System.Xml")), "#2b");
            Assert.IsTrue(references.Any(t => t.Include.Contains("System.Core")), "#2c");
            Assert.IsTrue(references.Any(t => t.Include.Contains("mscorlib")), "#2d");
            Assert.IsTrue(references.Any(t => t.Include.Contains("Xamarin.iOS")), "#2e");
        }
Ejemplo n.º 9
0
        void BuildLibraryCore(string[] expectedResources)
        {
            var library = Path.Combine(LibraryProjectBinPath, "MyLibrary.dll");

            RunTarget(LibraryProject, TargetName.Build);

            Assert.IsTrue(string.IsNullOrEmpty(LibraryProject.GetEvaluatedProperty("AppBundleDir")), "#1");
            var entries = Directory.GetFileSystemEntries(LibraryProjectBinPath);

            Assert.AreEqual(2, entries.Length, "#1");
            Assert.IsTrue(File.Exists(library), "#2");
            Assert.IsTrue(File.Exists(library + ".mdb"), "#3");

            var assemblyDef     = AssemblyDefinition.ReadAssembly(library);
            var actualResources = assemblyDef.MainModule.Resources.Select(n => n.Name).ToList();

            foreach (var resource in expectedResources)
            {
                Assert.IsTrue(actualResources.Contains(resource), "#1. " + resource);
            }
            Assert.AreEqual(expectedResources.Length, assemblyDef.MainModule.Resources.OfType <EmbeddedResource> ().Count(), "#2");
        }
Ejemplo n.º 10
0
 public void DetectAppManifest_LibraryProject()
 {
     RunTarget(LibraryProject, TargetName.DetectAppManifest);
     Assert.IsNull(LibraryProject.GetEvaluatedProperty("_AppManifest"), "#1");
 }