Пример #1
0
        public override bool Execute()
        {
            // TODO: I18N
            this.Log.LogMessage("Copying runtime");

            String path = Path.Combine(this.ToDirectory.GetMetadata("FullPath"), this.ApplicationName);

            FileProvider.CopyFile(this.targetOSVersion, "runtime", path, "a+x");

            return(true);
        }
Пример #2
0
 public void WriteRuntime(MacOSVersion version)
 {
     FileProvider.CopyFile(version, "runtime", this.Runtime, "a+x");
 }
        /// <summary>
        ///   Executes the task.
        /// </summary>
        protected override void ExecuteTask()
        {
            this.Log(Level.Info, "Building application '{0}'", this.ApplicationName);

            String bundleName       = this.ApplicationName + ".app";
            String bundleBase       = Path.Combine(this.ToDirectory.ToString(), bundleName);
            String bundleContents   = Path.Combine(bundleBase, "Contents");
            String bundleMacOS      = Path.Combine(bundleContents, "MacOS");
            String bundleResources  = Path.Combine(bundleContents, "Resources");
            String bundleFrameworks = Path.Combine(bundleContents, "Frameworks");

            //
            // Create the bundle structure
            //
            // + <Name>.app
            // |
            // +-+ Contents
            //   |
            //   +-+ Frameworks
            //   |
            //   +-+ MacoOS
            //   |
            //   +-+ Resources
            //
            this.Log(Level.Info, "Creating bundle structure...");
            Directory.CreateDirectory(bundleBase);
            Directory.CreateDirectory(bundleContents);
            Directory.CreateDirectory(bundleMacOS);
            Directory.CreateDirectory(bundleResources);

            // Copy or create the Info.plist file
            this.Log(Level.Info, "Copying Info.plist...");
            this.CopyFile(this.InfoPList, bundleContents);

            // Create the launcher
            if (!this.Native)
            {
                this.Log(Level.Info, "Copying custom runtime...");

                String path = Path.Combine(bundleMacOS, this.ApplicationName);
                FileProvider.CopyFile(this.TargetOSVersion, "runtime", path, "a+x");
            }

            // Copy files in Contents if any
            if (this.CopyInContents != null && this.CopyInContents.Length > 0)
            {
                this.Log(Level.Info, "Copying files in 'Contents' folder...");
                foreach (FileSet fileSet in this.CopyInContents)
                {
                    this.CopyFileSet(fileSet, bundleContents);
                }
            }

            // Copy files in MacOS if any
            if (this.CopyInMacOS != null && this.CopyInMacOS.Length > 0)
            {
                this.Log(Level.Info, "Copying files in 'MacOS' folder...");
                foreach (FileSet fileSet in this.CopyInMacOS)
                {
                    this.CopyFileSet(fileSet, bundleMacOS);
                }
            }

            // Copy files in Resources if any
            if (this.CopyInResources != null && this.CopyInResources.Length > 0)
            {
                this.Log(Level.Info, "Copying files in 'Resources' folder...");
                foreach (FileSet fileSet in this.CopyInResources)
                {
                    this.CopyFileSet(fileSet, bundleResources);
                }
            }

            // Copy folder in Frameworks if any
            if (this.CopyInFrameworks != null && this.CopyInFrameworks.Length > 0)
            {
                Directory.CreateDirectory(bundleFrameworks);
                this.Log(Level.Info, "Copying frameworks in 'Frameworks' folder...");
                foreach (FrameworkDirSet dirSet in this.CopyInFrameworks)
                {
                    CopyFrameworkDirSet(dirSet, bundleFrameworks);
                }
            }
        }