/// <summary>
 /// Quick copy this artefact in the context of the specific package, but wherever this artefact is contained in that package.
 /// </summary>
 /// <param name="packageProject"></param>
 /// <param name="requiresQuickPackage"></param>
 public override void QuickCopy(SharePointPackageArtefact packageProject, bool requiresQuickPackage)
 {
     // We are directly deploying just this feature and have not been called by our parent.
     if (feature.IsPartOfProjectPackage(packageProject.Project))
     {
         // Pass in the package itself as the parent.
         this.QuickCopy(packageProject, packageProject, requiresQuickPackage);
     }
 }
Exemple #2
0
 /// <summary>
 /// Quick copy this artefact in the context of the specific package, and the specific containing artefact only.
 /// </summary>
 /// <param name="packageProject">The project.</param>
 /// <param name="parentArtefact">The deployable SharePoint artefact.</param>
 /// <param name="requiresQuickPackage">Flag to indicate it requires a quick package.</param>
 public override void QuickCopy(SharePointPackageArtefact packageProject, QuickCopyableSharePointArtefact parentArtefact, bool requiresQuickPackage)
 {
     if (parentArtefact == null)
     {
         throw new NotSupportedException();
     }
     else if (parentArtefact is SharePointProjectFeatureArtefact || parentArtefact is SharePointPackageArtefact)
     {
         SharePointProjectFeatureArtefact feature = parentArtefact as SharePointProjectFeatureArtefact;
         this.QuickCopy(packageProject, feature, requiresQuickPackage);
     }
     else
     {
         throw new NotSupportedException();
     }
 }
Exemple #3
0
 /// <summary>
 /// Quick copy this artefact in the context of the specific package, but wherever this artefact is contained in that package.
 /// </summary>
 /// <param name="packageProject"></param>
 /// <param name="requiresQuickPackage"></param>
 public override void QuickCopy(SharePointPackageArtefact packageProject, bool requiresQuickPackage)
 {
     // We are directly deploying just this SPI and have not been called by our parent.
     // An SPI may be included in multiple features, or be against the project directly.
     if (item.IsDirectPartOfProjectPackage(packageProject.Project))
     {
         // Pass in the package itself as the parent.
         this.QuickCopy(packageProject, packageProject, requiresQuickPackage);
     }
     else
     {
         // The SPI may be included in multiple features in the project in context.
         foreach (ISharePointProjectFeature feature in item.GetFeaturesWhereInPackage(packageProject.Project))
         {
             QuickCopyableSharePointArtefact parent = new SharePointProjectFeatureArtefact(feature);
             this.QuickCopy(packageProject, parent, requiresQuickPackage);
         }
     }
 }
        /// <summary>
        /// Quick copy this artefact in the context of the specific package, and the specific containing artefact only.
        /// </summary>
        /// <param name="packageProject">The project.</param>
        /// <param name="parentArtefact">The deployable SharePoint artefact.</param>
        /// <param name="requiresQuickPackage">Flag to indicate it requires a quick package.</param>
        public override void QuickCopy(SharePointPackageArtefact packageProject, QuickCopyableSharePointArtefact parentArtefact, bool requiresQuickPackage)
        {
            if (parentArtefact == null)
            {
                throw new NotSupportedException();
            }
            else if (parentArtefact is SharePointPackageArtefact)
            {
                string sourcePathBase    = packageProject.BasePackagePath;
                string featureFolderName = this.FeatureFolderName;

                feature.Project.ProjectService.Logger.ActivateOutputWindow();
                feature.Project.ProjectService.Logger.WriteLine("------ Quick Copying Feature: " + this.FeatureFolderName + " ------", LogCategory.Status);

                // Feature.xml must first be Quick Copied.
                if (requiresQuickPackage)
                {
                    // Tokens consist of those from this package, and feature.
                    Dictionary <string, string> allTokens = new Dictionary <string, string>();
                    allTokens.AddRange(packageProject.GetReplacementTokens());
                    allTokens.AddRange(this.Tokens);

                    // TODO: Merge feature.feature.
                    feature.Project.ProjectService.Logger.ActivateOutputWindow();
                    feature.Project.ProjectService.Logger.WriteLine("WARNING: Quick packaging of changes to Feature.feature is not yet supported.  The last packaged version of the file will be copied.", LogCategory.Warning);

                    //QuickDeploymentUtilities.CopyFileWithTokenReplacement(packageProject.Project, file.Name, originalFileProjectRelative, sourcePackagePathProjectRelative, allTokens);
                }

                DeploymentUtilities.CopyFile(packageProject.Project, "Feature.xml", Path.Combine(sourcePathBase, featureFolderName), "{SharePointRoot}\\Template\\Features\\" + featureFolderName);

                // Process items in features.  Note that we are only processing items that have been set to be packaged.
                foreach (SharePointProjectItemArtefact spi in this.ChildArtefacts.Select(ca => ca as SharePointProjectItemArtefact))
                {
                    spi.QuickCopy(packageProject, this, requiresQuickPackage);
                }
            }
            else
            {
                throw new NotSupportedException();
            }
        }
Exemple #5
0
        /// <summary>
        /// Quick copy this artefact in the context of the specific package, and the specific containing artefact only.
        /// </summary>
        /// <param name="packageProject">The project.</param>
        /// <param name="parentArtefact">The deployable SharePoint artefact.</param>
        /// <param name="requiresQuickPackage">Flag to indicate it requires a quick package.</param>
        public override void QuickCopy(SharePointPackageArtefact packageProject, QuickCopyableSharePointArtefact parentArtefact, bool requiresQuickPackage)
        {
            if (parentArtefact == null)
            {
                throw new NotSupportedException();
            }
            else if (parentArtefact is SharePointProjectFeatureArtefact || parentArtefact is SharePointPackageArtefact)
            {
                packageProject.Project.ProjectService.Logger.ActivateOutputWindow();
                packageProject.Project.ProjectService.Logger.WriteLine("------ Quick Copying SPI in " + (parentArtefact is SharePointPackageArtefact ? "Package" : "Feature") + ": " + item.Name + " ------", LogCategory.Status);

                foreach (SharePointProjectItemFileArtefact spiFile in this.ChildArtefacts.Select(ca => ca as SharePointProjectItemFileArtefact))
                {
                    spiFile.QuickCopy(packageProject, parentArtefact, requiresQuickPackage);
                }
            }
            else
            {
                throw new NotSupportedException();
            }
        }
 /// <summary>
 /// Quick copy this artefact in the context of the specific package, but wherever this artefact is contained in that package.
 /// </summary>
 /// <param name="packageProject"></param>
 /// <param name="requiresQuickPackage"></param>
 public abstract void QuickCopy(SharePointPackageArtefact packageProject, bool requiresQuickPackage);
Exemple #7
0
 /// <summary>
 /// Quick copy this artefact in the context of the specific package, and the specific containing artefact only.
 /// </summary>
 /// <param name="packageProject">The project.</param>
 /// <param name="parentArtefact">The deployable SharePoint artefact.</param>
 /// <param name="requiresQuickPackage">Flag to indicate it requires a quick package.</param>
 public override void QuickCopy(SharePointPackageArtefact packageProject, QuickCopyableSharePointArtefact parentArtefact, bool requiresQuickPackage)
 {
     QuickCopy(requiresQuickPackage);
 }
Exemple #8
0
        /// <summary>
        /// Quick copy this artefact in the context of the specific package, and the specific containing artefact only.
        /// </summary>
        /// <param name="packageProject">The project.</param>
        /// <param name="parentFeature">The deployable SharePoint artefact.</param>
        /// <param name="requiresQuickPackage">Flag to indicate it requires a quick package.</param>
        public void QuickCopy(SharePointPackageArtefact packageProject, SharePointProjectFeatureArtefact parentFeature, bool requiresQuickPackage)
        {
            if (file.DeploymentType != DeploymentType.NoDeployment)
            {
                // Determine the folder name of the parent feature (if applicable).
                string featureFolderName = parentFeature == null ? "" : parentFeature.FeatureFolderName;

                // The default destination path is given to us by the tooling (though includes tokens).
                string destinationPathHiveRelative = String.Empty;
                if (String.IsNullOrEmpty(file.DeploymentPath))
                {
                    destinationPathHiveRelative = file.DeploymentRoot;
                }
                else
                {
                    destinationPathHiveRelative = Path.Combine(file.DeploymentRoot, file.DeploymentPath);
                }

                // The source path of the packageable file begins with the base package path of the project.
                string sourcePackagePathProjectRelative = packageProject.BasePackagePath;

                // The remainder of the package path depends on the type of file.
                if (file.DeploymentType == DeploymentType.ElementFile || file.DeploymentType == DeploymentType.ElementManifest)
                {
                    // Source path within pkg is {FeatureName} + the item's relative path.
                    sourcePackagePathProjectRelative = Path.Combine(sourcePackagePathProjectRelative, featureFolderName);
                    sourcePackagePathProjectRelative = Path.Combine(sourcePackagePathProjectRelative, Path.GetDirectoryName(file.RelativePath));
                }
                if (file.DeploymentType == DeploymentType.AppGlobalResource || file.DeploymentType == DeploymentType.ApplicationResource)
                {
                    sourcePackagePathProjectRelative = Path.Combine(sourcePackagePathProjectRelative, Path.GetDirectoryName(file.RelativePath));
                }
                else if (file.DeploymentType == DeploymentType.RootFile || file.DeploymentType == DeploymentType.TemplateFile)
                {
                    // For both template and root files, these are stored relative to the pkg folder with a
                    // path matching file.DeploymentPath.
                    sourcePackagePathProjectRelative = Path.Combine(sourcePackagePathProjectRelative, Path.GetDirectoryName(file.DeploymentPath));
                }
                else
                {
                    // Unhandled file type.  Just show a message for now.
                    // TODO: check all the file types we should spuport and test.
                    packageProject.Project.ProjectService.Logger.ActivateOutputWindow();
                    packageProject.Project.ProjectService.Logger.WriteLine(string.Format("Unhandled File Type - {0} at {1} - please notify the CKSDEV team", file.DeploymentType, file.FullPath), LogCategory.Status);
                }

                // Make some final substitutions on the paths as necessary.
                sourcePackagePathProjectRelative = sourcePackagePathProjectRelative.Replace("{FeatureName}", featureFolderName);
                destinationPathHiveRelative      = destinationPathHiveRelative.Replace("{FeatureName}", featureFolderName);

                // First package (if appropriate), then quick copy the file.
                if (requiresQuickPackage)
                {
                    // The actual project file path is also given to us by the tooling.
                    string originalFileProjectRelative = Path.GetDirectoryName(file.FullPath);

                    Dictionary <string, string> allTokens = null;
                    if (DeploymentUtilities.IsTokenReplacementFile(file.Project, file.Name))
                    {
                        // Tokens consist of those from this package, SPI, and (optionally) the feature.
                        allTokens = new Dictionary <string, string>();
                        allTokens.AddRange(packageProject.GetReplacementTokens());
                        allTokens.AddRange(new SharePointProjectItemArtefact(file.ProjectItem).GetReplacementTokens());
                        if (parentFeature != null)
                        {
                            allTokens.AddRange(parentFeature.GetReplacementTokens());
                        }
                    }

                    DeploymentUtilities.CopyFileWithTokenReplacement(packageProject.Project, file.Name, originalFileProjectRelative, sourcePackagePathProjectRelative, allTokens);
                }

                DeploymentUtilities.CopyFile(packageProject.Project, file.Name, sourcePackagePathProjectRelative, destinationPathHiveRelative);
            }
        }