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

flair.gradle.plugins.PluginManager.groovy Maven / Gradle / Ivy

package flair.gradle.plugins

import flair.gradle.variants.Platform
import org.gradle.api.Project

/**
 * @author SamYStudiO ( [email protected] )
 */
public class PluginManager
{
	public static boolean hasPlugin( Project project , Class type )
	{
		boolean hasPlugin = false

		project.plugins.each { plugin -> if( plugin.getClass( ) == type ) hasPlugin = true }

		return hasPlugin
	}

	public static boolean hasPlatformPlugin( Project project , Platform platform )
	{
		boolean hasPlatform = false

		project.plugins.each { plugin ->

			if( plugin instanceof IPlatformPlugin && plugin.platform == platform ) hasPlatform = true
		}

		return hasPlatform
	}

	public static List getCurrentPlatforms( Project project )
	{
		List list = new ArrayList( )

		project.plugins.each { plugin ->

			if( plugin instanceof IPlatformPlugin && list.indexOf( plugin.platform ) < 0 ) list.add( plugin.platform )
		}

		return list
	}

	public static boolean hasSinglePlatform( Project project )
	{
		return getCurrentPlatforms( project ).size( ) == 1
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy