mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	
							
								
								
									
										18
									
								
								samples/Gradle/build.gradle
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								samples/Gradle/build.gradle
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
apply plugin: GreetingPlugin
 | 
			
		||||
 | 
			
		||||
greeting.message = 'Hi from Gradle'
 | 
			
		||||
 | 
			
		||||
class GreetingPlugin implements Plugin<Project> {
 | 
			
		||||
    void apply(Project project) {
 | 
			
		||||
        // Add the 'greeting' extension object
 | 
			
		||||
        project.extensions.create("greeting", GreetingPluginExtension)
 | 
			
		||||
        // Add a task that uses the configuration
 | 
			
		||||
        project.task('hello') << {
 | 
			
		||||
            println project.greeting.message
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class GreetingPluginExtension {
 | 
			
		||||
    def String message = 'Hello from GreetingPlugin'
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								samples/Gradle/builder.gradle
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								samples/Gradle/builder.gradle
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
apply plugin: GreetingPlugin
 | 
			
		||||
 | 
			
		||||
greeting {
 | 
			
		||||
    message = 'Hi'
 | 
			
		||||
    greeter = 'Gradle'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class GreetingPlugin implements Plugin<Project> {
 | 
			
		||||
    void apply(Project project) {
 | 
			
		||||
        project.extensions.create("greeting", GreetingPluginExtension)
 | 
			
		||||
        project.task('hello') << {
 | 
			
		||||
            println "${project.greeting.message} from ${project.greeting.greeter}"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class GreetingPluginExtension {
 | 
			
		||||
    String message
 | 
			
		||||
    String greeter
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user