Return to Snippet

Revision: 58954
at August 11, 2012 01:54 by laurenceosx


Updated Code
apply plugin: 'groovy'

buildscript {
	// for debug
	project.ext.swingWaitRaw = javax.swing.SwingUtilities.&invokeAndWait;
	project.ext.isEdt = javax.swing.SwingUtilities.&isEventDispatchThread;
	project.ext.swingWait  = { aRunnable -> // prevent exception if in edtThread
		if( isEdt() ) { aRunnable.run(); } else { swingWaitRaw(aRunnable) }; 
	}
	project.ext.swingLater = javax.swing.SwingUtilities.&invokeLater;
	project.ext.gi = { aObjToInspect -> swingWait { 
			groovy.inspect.swingui.ObjectBrowser.inspect(aObjToInspect) } }
	project.ext.kgi = { // kill gi windows
		swingWait({
			java.awt.Frame.getFrames().each {
				if (it.title == 'Groovy Object Browser') {
					it.visible = false;
					it.dispose();
				}
			}
		}) // end swingWait
	}; // end kgi
} // end buildscript

dependencies {
	groovy localGroovy()
}

task 'create-dirs' << {
/*	Example Output:
	$ gradle create-dirs
	:create-dirs
	src/main/resources
	src/main/java
	src/main/groovy
	src/test/resources
	src/test/java
	src/test/groovy
*/
	
	project.sourceSets*.each {
		it.allSource.srcDirs.each {
			println "$it" - "${projectDir}${File.separator}";
			if ( !(it.exists()) )
				it.mkdirs();
			}
	}
}

task "hello-world" << {
	println "Hello World"
}

Revision: 58953
at August 11, 2012 00:48 by laurenceosx


Initial Code
apply plugin: 'groovy'

buildscript {
	// for debug
	project.ext.swingWaitRaw = javax.swing.SwingUtilities.&invokeAndWait;
	project.ext.isEdt = javax.swing.SwingUtilities.&isEventDispatchThread;
	project.ext.swingWait  = { aRunnable -> // prevent exception if in edtThread
		if( isEdt() ) { aRunnable.run(); } else { swingWaitRaw(aRunnable) }; 
	}
	project.ext.swingLater = javax.swing.SwingUtilities.&invokeLater;
	project.ext.gi = { aObjToInspect -> swingWait { 
			groovy.inspect.swingui.ObjectBrowser.inspect(aObjToInspect) } }
	project.ext.kgi = { // kill gi windows
		swingWait({
			java.awt.Frame.getFrames().each {
				if (it.title == 'Groovy Object Inspector') {
					it.visible = false;
					it.dispose();
				}
			}
		}) // end swingWait
	}; // end kgi
} // end buildscript

dependencies {
	groovy localGroovy()
}

task 'create-dirs' << {
/*	Example Output:
	$ gradle create-dirs
	:create-dirs
	src/main/resources
	src/main/java
	src/main/groovy
	src/test/resources
	src/test/java
	src/test/groovy
*/
	
	project.sourceSets*.each {
		it.allSource.srcDirs.each {
			println "$it" - "${projectDir}${File.separator}";
			if ( !(it.exists()) )
				it.mkdirs();
			}
	}
}

task "hello-world" << {
	println "Hello World"
}

Initial URL

                                

Initial Description
Groovy Gradle create-dirs

Initial Title
Groovy Gradle create-dirs

Initial Tags
groovy

Initial Language
Groovy