All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openbakery.appledoc.AppledocTask.groovy Maven / Gradle / Ivy

Go to download

XCode-Plugin is a plugin to allow custom XCode projects to build as generated by CMake

The newest version!
package org.openbakery.appledoc

import org.apache.commons.io.FileUtils
import org.gradle.api.InvalidUserDataException
import org.gradle.api.tasks.TaskAction
import org.openbakery.AbstractXcodeTask
import org.openbakery.CommandRunnerException

class AppledocTask extends AbstractXcodeTask {

	AppledocTask() {
		super()
		this.description = "Runs the appledoc for the given project"
	}

	@TaskAction
	def documentation() {

		def appledocSettings = new File('AppledocSettings.plist')
		if (!appledocSettings.exists()) {
			throw new InvalidUserDataException("The AppledocSettings.plist is missing.")
		}


		def documentationDirectory = project.getFileResolver().withBaseDir(project.getBuildDir()).resolve("documentation")
		if (!documentationDirectory.exists()) {
			documentationDirectory.mkdirs()
		}

		def appledocCommand = new File(documentationDirectory, 'appledoc')

		def zip = new File(documentationDirectory, 'appledoc.zip')
		ant.get(src: 'https://github.com/tomaz/appledoc/releases/download/v2.2-963/appledoc.zip', dest: documentationDirectory, verbose:true)
		ant.unzip(src: zip,  dest:documentationDirectory)
		ant.chmod(file: appledocCommand, perm:"+x")

		def appledocOutput = new File(documentationDirectory, 'appledoc-output.txt')

		commandRunner.setOutputFile(appledocOutput)
		try {
			commandRunner.run([appledocCommand.absolutePath, "--print-settings", "--output", documentationDirectory.absolutePath, "."])
		} catch (CommandRunnerException ex) {
			logger.error(FileUtils.readFileToString(appledocOutput))
			throw ex
		}

	}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy