Created
January 20, 2024 21:08
-
-
Save renatoathaydes/eb4ac02c8363f5534dd9e083f55995d5 to your computer and use it in GitHub Desktop.
Example code sharing in Gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// main build file, using code from buildSrc project.... | |
// notice that the buildSrc project can be written in any JVM language! | |
task sayHello { | |
doLast { | |
println foo.MyFunctions.hello() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// buildSrc/build.gradle | |
plugins { | |
id 'groovy' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add this to buildSrc/src/main/groovy/foo/MyFunctions.groovy | |
package foo | |
class MyFunctions { | |
static String hello() { 'hello' } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment