![JAR search and dependency download from the Maven repository](/logo.png)
org.akhikhl.gretty.GradleUtils.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gretty Show documentation
Show all versions of gretty Show documentation
Advanced gradle plugin for running web-apps on jetty and tomcat
/*
* Gretty
*
* Copyright (C) 2013-2015 Andrey Hihlovskiy and contributors.
*
* See the file "LICENSE" for copying and usage permission.
* See the file "CONTRIBUTORS" for complete list of contributors.
*/
package org.akhikhl.gretty
import org.gradle.api.Project
/**
*
* @author akhikhl
*/
class GradleUtils {
static boolean derivedFrom(Class targetClass, String className) {
while(targetClass != null) {
if(targetClass.getName() == className)
return true
for(Class intf in targetClass.getInterfaces())
if(derivedFrom(intf, className))
return true
targetClass = targetClass.getSuperclass()
}
return false
}
/**
* Replacement for instanceof operator, workaround for Gradle 1.10 bug:
* task classes defined in "build.gradle" fail instanceof check for base classes in gradle plugins.
*/
static boolean instanceOf(Object obj, String className) {
derivedFrom(obj.getClass(), className)
}
static void disableTaskOnOtherProjects(Project thisProject, String taskName) {
thisProject.rootProject.allprojects { proj ->
if(proj != thisProject && proj.tasks.findByName(taskName))
proj.tasks[taskName].enabled = false
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy