コード例 #1
0
        public bool Build(string fullJarPath)
        {
            if (string.IsNullOrWhiteSpace(fullJarPath))
            {
                throw new ArgumentNullException("fullJarPath");
            }

            if (!this.jdkWrapper.IsJdkInstalled())
            {
                throw new InvalidOperationException(UIResources.JarB_JDK_NotInstalled);
            }

            string tempPath = Path.Combine(Path.GetTempPath(), ".jarBuilder", Guid.NewGuid().ToString());

            JarFolders folders = new JarFolders(tempPath);

            this.LayoutFiles(tempPath);

            bool success = this.jdkWrapper.CompileJar(folders.JarContentDirectory, folders.ManifestFilePath, fullJarPath, this.logger);

            if (success)
            {
                this.logger.LogInfo(UIResources.JarB_JarBuiltSuccessfully, fullJarPath);
            }
            else
            {
                this.logger.LogInfo(UIResources.JarB_JarBuildingFailed);
            }
            return(success);
        }
コード例 #2
0
        /// <summary>
        /// Writes the files to be embedded into the jar in the correct locations
        /// under the specified folder
        /// </summary>
        public void LayoutFiles(string outputDirectory)
        {
            if (string.IsNullOrWhiteSpace(outputDirectory))
            {
                throw new ArgumentNullException("outputDirectory");
            }

            if (!Directory.Exists(outputDirectory))
            {
                Directory.CreateDirectory(outputDirectory);
            }

            JarFolders folders = new JarFolders(outputDirectory);

            this.WriteManifestFile(folders.ManifestFilePath);

            this.WriteContentFiles(folders.JarContentDirectory);
        }
コード例 #3
0
        public bool Build(string fullJarPath)
        {
            if (string.IsNullOrWhiteSpace(fullJarPath))
            {
                throw new ArgumentNullException("fullJarPath");
            }

            if (!this.jdkWrapper.IsJdkInstalled())
            {
                throw new InvalidOperationException(UIResources.JarB_JDK_NotInstalled);
            }

            string tempPath = Path.Combine(Path.GetTempPath(), ".jarBuilder", Guid.NewGuid().ToString());

            JarFolders folders = new JarFolders(tempPath);
            this.LayoutFiles(tempPath);

            bool success = this.jdkWrapper.CompileJar(folders.JarContentDirectory, folders.ManifestFilePath, fullJarPath, this.logger);
            if (success)
            {
                this.logger.LogInfo(UIResources.JarB_JarBuiltSuccessfully, fullJarPath);
            }
            else
            {
                this.logger.LogInfo(UIResources.JarB_JarBuildingFailed);
            }
            return success;
        }
コード例 #4
0
        /// <summary>
        /// Writes the files to be embedded into the jar in the correct locations
        /// under the specified folder
        /// </summary>
        public void LayoutFiles(string outputDirectory)
        {
            if (string.IsNullOrWhiteSpace(outputDirectory))
            {
                throw new ArgumentNullException("outputDirectory");
            }

            if (!Directory.Exists(outputDirectory))
            {
                Directory.CreateDirectory(outputDirectory);
            }

            JarFolders folders = new JarFolders(outputDirectory);

            this.WriteManifestFile(folders.ManifestFilePath);

            this.WriteContentFiles(folders.JarContentDirectory);
        }