示例#1
0
        public void BuildJar(string workingDirectory)
        {
            if (string.IsNullOrWhiteSpace(workingDirectory))
            {
                throw new ArgumentNullException(nameof(workingDirectory));
            }

            this.ValidateConfiguration();

            // Create the config and manifest files
            string configFilePath   = BuildConfigFile(workingDirectory);
            string manifestFilePath = this.jarManifestBuilder.WriteManifest(workingDirectory);

            // Update the jar
            string         templateJarFilePath = ExtractTemplateJarFile(workingDirectory);
            ArchiveUpdater updater             = new ArchiveUpdater(workingDirectory, this.logger);

            updater.SetInputArchive(templateJarFilePath)
            .SetOutputArchive(this.outputJarFilePath)
            .AddFile(manifestFilePath, RelativeManifestResourcePath)
            .AddFile(configFilePath, RelativeConfigurationResourcePath)
            .AddFile(this.rulesFilePath, RelativeRulesXmlResourcePath);

            foreach (KeyValuePair <string, string> kvp in this.fileToRelativePathMap)
            {
                updater.AddFile(kvp.Key, kvp.Value);
            }

            if (!string.IsNullOrWhiteSpace(this.sqaleFilePath))
            {
                updater.AddFile(this.sqaleFilePath, RelativeSqaleXmlResourcePath);
            }

            updater.UpdateArchive();
        }
        public void BuildJar(string workingDirectory)
        {
            if (string.IsNullOrWhiteSpace(workingDirectory))
            {
                throw new ArgumentNullException(nameof(workingDirectory));
            }

            this.ValidateConfiguration();

            // Create the config and manifest files
            string configFilePath = BuildConfigFile(workingDirectory);
            string manifestFilePath = this.jarManifestBuilder.WriteManifest(workingDirectory);

            // Update the jar
            string templateJarFilePath = ExtractTemplateJarFile(workingDirectory);
            ArchiveUpdater updater = new ArchiveUpdater(workingDirectory, this.logger);

            updater.SetInputArchive(templateJarFilePath)
                .SetOutputArchive(this.outputJarFilePath)
                .AddFile(manifestFilePath, RelativeManifestResourcePath)
                .AddFile(configFilePath, RelativeConfigurationResourcePath)
                .AddFile(this.rulesFilePath, RelativeRulesXmlResourcePath);

            foreach(KeyValuePair<string, string> kvp in this.fileToRelativePathMap)
            {
                updater.AddFile(kvp.Key, kvp.Value);
            }

            if (!string.IsNullOrWhiteSpace(this.sqaleFilePath))
            {
                updater.AddFile(this.sqaleFilePath, RelativeSqaleXmlResourcePath);
            }

            updater.UpdateArchive();
        }