예제 #1
0
        protected void openResultFileStreamForNewNamespaceGroup(ExtJsPackage extJsPackage, string groupedNamespace)
        {
            string packageAndNsGroup = extJsPackage.ToString().ToLower().Replace("_", "-");

            if (groupedNamespace.Length > 0)
            {
                packageAndNsGroup += "-" + groupedNamespace.Replace(".", "-");
            }
            string resultFileName = this.resultFileNameBase.Replace(
                "<package>[-<nsGroup>]", packageAndNsGroup
                );

            this.resultFileFullPath = this.processor.ResultsDirFullPath + "/" + resultFileName;
            this.generatedFileNames.Add(resultFileName);
            this.openResultFileStream();
        }
예제 #2
0
파일: Preparer.cs 프로젝트: ExtTS/generator
        internal void completePackageTransferDirs(ref List <string> packagesClone, string packageName, bool extrackToolkitDirs)
        {
            if (!this.processor.Store.SourcesPaths.ContainsKey(packageName))
            {
                throw new Exception($"Package name `{packageName}` is not configured.");
            }
            PkgCfg pkgCfg = this.processor.Store.SourcesPaths[packageName];
            // Complete package source files dir in tmp:
            string targetDirFullPath = this.processor.Store.TmpFullPath + "/src-" + packageName;

            // Create the directory if doesn't exist:
            if (!Directory.Exists(targetDirFullPath))
            {
                Directory.CreateDirectory(targetDirFullPath);
            }
            // Complete source dir full path - it always exist for any package:
            string[] srcDirs = new string[] { pkgCfg.Source };
            if (pkgCfg is PkgCfgAdv)
            {
                srcDirs = (pkgCfg as PkgCfgAdv).Source;
            }
            string packageBaseSourceDir;

            for (int i = 0; i < srcDirs.Length; i++)
            {
                packageBaseSourceDir = this.processor.Store.SourceFullPath + "/" + srcDirs[i];
                if (!Directory.Exists(packageBaseSourceDir))
                {
                    if (pkgCfg.Optional)
                    {
                        packagesClone.Remove(packageName);                         // not in this version
                        return;
                    }
                    throw new Exception(
                              $"Package `{packageName}` source directory `{srcDirs[i]}` not found in given ZIP file."
                              );
                }
                this.dirTransfers.Add(new DirTransfer {
                    TargetDirFullPath = targetDirFullPath,
                    SrcDirFullPath    = packageBaseSourceDir,
                    AppendToExisting  = false
                });
            }
            // Complete source overrides dir full path - it doesn't exist for all package:
            if (!String.IsNullOrEmpty(pkgCfg.SourceOverrides))
            {
                this.dirTransfers.Add(new DirTransfer {
                    TargetDirFullPath = targetDirFullPath,
                    SrcDirFullPath    = this.processor.Store.SourceFullPath + "/" + pkgCfg.SourceOverrides,
                    AppendToExisting  = true
                });
            }
            if (extrackToolkitDirs)
            {
                // Complete toolkit dir full path - it doesn't exist for all package:
                bool   classicToolkit = this.processor.Toolkit == "classic";
                string toolkitRelPath = classicToolkit
                                        ? (String.IsNullOrEmpty(pkgCfg.Classic) ? "" : pkgCfg.Classic)
                                        : (String.IsNullOrEmpty(pkgCfg.Modern) ? "" : pkgCfg.Modern);
                if (!String.IsNullOrEmpty(toolkitRelPath))
                {
                    this.dirTransfers.Add(new DirTransfer {
                        TargetDirFullPath = targetDirFullPath,
                        SrcDirFullPath    = this.processor.Store.SourceFullPath + "/" + toolkitRelPath,
                        AppendToExisting  = false
                    });
                }
                string toolkitOverridesRelPath = classicToolkit
                                        ? (String.IsNullOrEmpty(pkgCfg.ClassicOverrides) ? "" : pkgCfg.ClassicOverrides)
                                        : (String.IsNullOrEmpty(pkgCfg.ModernOverrides) ? "" : pkgCfg.ModernOverrides);
                if (!String.IsNullOrEmpty(toolkitOverridesRelPath))
                {
                    this.dirTransfers.Add(new DirTransfer {
                        TargetDirFullPath = targetDirFullPath,
                        SrcDirFullPath    = this.processor.Store.SourceFullPath + "/" + toolkitOverridesRelPath,
                        AppendToExisting  = true
                    });
                }
            }
            // Complete store package source data record:
            ExtJsPackage extJsPackage = ExtJsPackages.Names[packageName];

            this.processor.Store.PackagesData.Add(new PackageSource {
                PackageName          = packageName,
                Type                 = extJsPackage,
                JsSourcesDirFullPath = targetDirFullPath,
                JsSourcesFilesCount  = 0                // will be completed after transfer
            });
        }
예제 #3
0
 public Processor SetPackages(ExtJsPackage extJsPackages)
 {
     this.Packages = extJsPackages.ToString().Replace(" ", "").Replace("_", "-").ToLower().Split(',').ToList <string>();
     return(this);
 }