| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | plugins { | 
					
						
							| 
									
										
										
										
											2016-09-21 09:19:45 -04:00
										 |  |  |   id "us.kirchmeier.capsule" version "1.0.2" | 
					
						
							|  |  |  |   id 'com.google.protobuf' version '0.8.0' | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | apply plugin: 'java' | 
					
						
							|  |  |  | apply plugin: 'eclipse' | 
					
						
							|  |  |  | apply plugin: 'idea' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-10 06:56:45 -05:00
										 |  |  | apply plugin: 'maven-publish' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Uncomment the lines below to define an application | 
					
						
							|  |  |  | // (this will also allow you to build a "fatCapsule" which includes | 
					
						
							|  |  |  | // the entire application, including all dependencies in a single jar) | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | //apply plugin: 'application' | 
					
						
							|  |  |  | //mainClassName='your.main.ApplicationClass' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Is this a snapshot version? | 
					
						
							|  |  |  | ext { isSnapshot = false }  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ext { | 
					
						
							|  |  |  |         groupId = 'org.factcenter.meerkat' | 
					
						
							|  |  |  |         nexusRepository = "https://cs.idc.ac.il/nexus/content/groups/${isSnapshot ? 'unstable' : 'public'}/" | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |         // Credentials for IDC nexus repositories (needed only for using unstable repositories and publishing) | 
					
						
							|  |  |  |         // Should be set in ${HOME}/.gradle/gradle.properties | 
					
						
							|  |  |  |         nexusUser =  project.hasProperty('nexusUser') ? project.property('nexusUser') : "" | 
					
						
							|  |  |  |         nexusPassword = project.hasProperty('nexusPassword') ? project.property('nexusPassword') : "" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | description = "TODO: Add a description" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Your project version | 
					
						
							|  |  |  | version = "0.0" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | version += "${isSnapshot ? '-SNAPSHOT' : ''}" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | dependencies { | 
					
						
							|  |  |  |     // Meerkat common | 
					
						
							|  |  |  |     compile project(':meerkat-common') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Logging | 
					
						
							|  |  |  |     compile 'org.slf4j:slf4j-api:1.7.7' | 
					
						
							|  |  |  |     runtime 'ch.qos.logback:logback-classic:1.1.2' | 
					
						
							|  |  |  |     runtime 'ch.qos.logback:logback-core:1.1.2' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Google protobufs | 
					
						
							|  |  |  |     compile 'com.google.protobuf:protobuf-java:3.+' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     testCompile 'junit:junit:4.+' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     runtime 'org.codehaus.groovy:groovy:2.4.+' | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*==== You probably don't have to edit below this line =======*/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-22 08:31:51 -05:00
										 |  |  | // Setup test configuration that can appear as a dependency in | 
					
						
							|  |  |  | // other subprojects | 
					
						
							|  |  |  | configurations { | 
					
						
							|  |  |  |     testOutput.extendsFrom (testCompile) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | task testJar(type: Jar, dependsOn: testClasses) { | 
					
						
							|  |  |  |     classifier = 'tests' | 
					
						
							|  |  |  |     from sourceSets.test.output | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | artifacts { | 
					
						
							|  |  |  |     testOutput testJar | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-12 16:06:24 -05:00
										 |  |  | // The run task added by the application plugin | 
					
						
							|  |  |  | // is also of type JavaExec. | 
					
						
							|  |  |  | tasks.withType(JavaExec) { | 
					
						
							|  |  |  |     // Assign all Java system properties from | 
					
						
							|  |  |  |     // the command line to the JavaExec task. | 
					
						
							|  |  |  |     systemProperties System.properties | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | protobuf { | 
					
						
							|  |  |  |     // Configure the protoc executable | 
					
						
							|  |  |  |     protoc { | 
					
						
							|  |  |  |     // Download from repositories | 
					
						
							|  |  |  |         artifact = 'com.google.protobuf:protoc:3.+' | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | idea { | 
					
						
							|  |  |  |     module { | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  |         project.sourceSets.each { sourceSet -> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             def srcDir = "${protobuf.generatedFilesBaseDir}/$sourceSet.name/java" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             println "Adding $srcDir" | 
					
						
							|  |  |  |             // add protobuf generated sources to generated source dir. | 
					
						
							|  |  |  |             if ("test".equals(sourceSet.name)) { | 
					
						
							|  |  |  |                 testSourceDirs += file(srcDir) | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 sourceDirs += file(srcDir) | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             generatedSourceDirs += file(srcDir) | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	    // Don't exclude build directory | 
					
						
							|  |  |  | 	    excludeDirs -= file(buildDir) | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | /*=================================== | 
					
						
							|  |  |  |  *        "Fat" Build targets | 
					
						
							|  |  |  |  *===================================*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  | if (project.hasProperty('mainClassName') && (mainClassName != null)) { | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  |     task mavenCapsule(type: MavenCapsule) { | 
					
						
							|  |  |  |         description = "Generate a capsule jar that automatically downloads and caches dependencies when run." | 
					
						
							|  |  |  |         applicationClass mainClassName | 
					
						
							|  |  |  |         destinationDir = buildDir | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  |     task fatCapsule(type: FatCapsule) { | 
					
						
							|  |  |  |         description = "Generate a single capsule jar containing everything. Use -Pfatmain=... to override main class" | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  |         destinationDir = buildDir | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  |         def fatMain = hasProperty('fatmain') ? fatmain : mainClassName | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  |         applicationClass fatMain | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  |         def testJar = hasProperty('test') | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  |         if (hasProperty('fatmain')) { | 
					
						
							|  |  |  |             appendix = "fat-${fatMain}" | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             appendix = "fat" | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (testJar) { | 
					
						
							|  |  |  |             from sourceSets.test.output | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 18:49:17 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 09:01:59 -05:00
										 |  |  | /*=================================== | 
					
						
							|  |  |  |  *        Repositories | 
					
						
							|  |  |  |  *===================================*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | repositories { | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |         // Prefer the local nexus repository (it may have 3rd party artifacts not found in mavenCentral) | 
					
						
							|  |  |  |         maven {  | 
					
						
							|  |  |  |             url nexusRepository | 
					
						
							|  |  |  |              | 
					
						
							|  |  |  |             if (isSnapshot) { | 
					
						
							|  |  |  |                 credentials { username  | 
					
						
							|  |  |  |                     password  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     username nexusUser | 
					
						
							|  |  |  |                     password nexusPassword  | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Use local maven repository | 
					
						
							|  |  |  |         mavenLocal() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Use 'maven central' for other dependencies. | 
					
						
							|  |  |  |         mavenCentral() | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | task "info" << { | 
					
						
							|  |  |  |         println "Project: ${project.name}" | 
					
						
							|  |  |  | println "Description: ${project.description}" | 
					
						
							|  |  |  |         println "--------------------------" | 
					
						
							|  |  |  |         println "GroupId: $groupId" | 
					
						
							|  |  |  |         println "Version: $version (${isSnapshot ? 'snapshot' : 'release'})" | 
					
						
							|  |  |  |         println "" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | info.description 'Print some information about project parameters' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*=================================== | 
					
						
							|  |  |  |  *        Publishing | 
					
						
							|  |  |  |  *===================================*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | publishing { | 
					
						
							|  |  |  |     publications { | 
					
						
							|  |  |  |         mavenJava(MavenPublication) { | 
					
						
							|  |  |  |             groupId project.groupId | 
					
						
							|  |  |  |             pom.withXml { | 
					
						
							|  |  |  |                 asNode().appendNode('description', project.description) | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             from project.components.java | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     repositories { | 
					
						
							|  |  |  |         maven { | 
					
						
							|  |  |  |             url "https://cs.idc.ac.il/nexus/content/repositories/${project.isSnapshot ? 'snapshots' : 'releases'}" | 
					
						
							|  |  |  |             credentials { username  | 
					
						
							|  |  |  |                 password  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 username nexusUser | 
					
						
							|  |  |  |                 password nexusPassword  | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 |