Skip to content
Snippets Groups Projects
Select Git revision
  • 9f21bc6de668ae11feb6a19e878c3194bce43766
  • master default protected
  • 3.8.0
  • 3.7.0
  • 3.6.0
  • 3.5.0
  • 3.4.0
  • 3.3.0
  • 3.2.1
  • 3.2.0
10 results

build.gradle

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    tycho_build.gradle 24.61 KiB
    /*
    	Build Script can be executed via 'gradle install'
    	Build Script Dependencies can be downloaded via 'gradle collectDepenencies'
    	Executing the Build Script and download Dependencies can be executed via 'gradle completeInstall'
     	For a complete classPath Refresh please execute 'gradle deleteFromClassPath setClassPath'	
    	Pom Generation can be executed via gradle deploy
    	
    	If you have a product definition please add a buildProduct = true to your main build.gradle script
    
    */
    
    
    apply plugin: 'base'
    
    import groovy.io.FileType
    project.ext.tychoVersion = "0.15.0"
    
    try{
    	excludeFromTychoBuild = excludeFromTychoBuild
    }catch(MissingPropertyException e){
    	project.ext.excludeFromTychoBuild = []
    }
    
    try{
    	excludeFromClassPath = excludeFromClassPath
    }catch(MissingPropertyException e){
    	project.ext.excludeFromClassPath = []
    }
    
    
    try{
    	workspacePath = workspacePath
    }catch(MissingPropertyException e){
    	project.ext.workspacePath = ""
    }
    
    
    try{
    	dependencyFolder = dependencyFolder
    }catch(MissingPropertyException e){
    	project.ext.dependencyFolder = "lib/dependencies/"			// Folder in each subproject where 
    }
    
    try{
    	groupID = groupID
    }catch(MissingPropertyException e){
    	
    	// workspace nach releng durchsuchen
    	def folderNames = []
    	def folders = []
    	println "folders:"
    	new File(workspacePath+".").listFiles().each{ dir ->  
    	    if( dir.isDirectory() ) folders <<  dir.getName()
    	}  
    
    	folders.each(){ it ->
    		it = (String)it.replaceFirst(/\.\//, "")
    		if( !( ( it ==~ /\..+/ ) || (it ==~ /.*.repository/) || (it ==~ /.*.parent/) ) ) folderNames << it			// subProjects eventuell unnötig settings.gradle datei stattdessen benutzen
    	}
    
    	
    	project.ext.groupID = "group"
    	for( int  i = 0; i < folderNames.size(); i++ ){
    		
    		if( folderNames[i] ==~ /.*\.[rR]eleng/ ){
    			groupID = folderNames[i]
    			groupID = groupID.replace( ".releng", "")
    			groupID = groupID.replace( ".Releng", "")
    		}
    	}
    	
    }
    
    
    try{
    	features = features
    }catch(MissingPropertyException e){
    	
    	project.ext.features = []
    	for( int i = 0; i < subprojects.name.size(); i++ ){
    		if( subprojects.name[i] ==~ /.*\.[fF]eature/ ){
    			features.add( subprojects.name[i] )
    		}
    	}
    	
    }
    
    
    try{
    	repositoryName = repositoryName
    }catch(MissingPropertyException e){
    	project.ext.repositoryName = groupID+".repository"
    }
    
    try{
    	parentID = parentID
    }catch(MissingPropertyException e){
    	project.ext.parentID = groupID+".parent"
    }
    
    Boolean noDescriptions = false					// in case of using own CategoryDescription Map
    
    try{
    	categoryDescriptions = categoryDescriptions
    }catch(MissingPropertyException e){
    	project.ext.categoryDescriptions = [ [:],[:] ]		// label and descriptions of the features
    	noDescriptions = true
    }							// 	categoryDescriptions	=	[["feature": "labelName","feature2": "label"],["feature": "featureDescription","feature2": "feature2Description"]]		// label and descriptions of the features
    
    try{
    	targetRepositories = targetRepositories
    }catch(MissingPropertyException e){
    	project.ext.targetRepositories = ["http://download.eclipse.org/releases/indigo/"]
    }
    
    try{
    	buildProduct = buildProduct
    	
    }catch(MissingPropertyException e){
    	project.ext.buildProduct = false
    }
    
    
    
    def projects(int i){
    	return  subprojects.name[i]
    }
    //	returns the name of a subproject listed in the settings.gradle file
    
    
    def numberOfProjects(){
    	return subprojects.name.size()
    }
    //	returns the number of projects listed in the settings.gradle file
    //
    
    
    
    
    /* 		--		Return ParentId			--		*/
    
    def parentId(){
    	return parentID
    }
    /*
    *	This is the project of the parent Pom
    *	The Tycho Maven Build is triggered from
    *	this project's pom
    */
    
    
    
    /*	--			Return Group Id			--		*/
    def groupId(){
    	return groupID
    }
    
    /*
    *	This Group ID will be used in every sub project
    */
    
    def addLibToCP(def project, def libPar){
    	
    	def filePar = new File(workspacePath+project+"/.classpath")
    	boolean notYetAdded = true	
    	filePar.eachLine{ line ->
    		def pattern = ".*${dependencyFolder}${libPar}.*"
    		if(line ==~ /${pattern}/){
    			notYetAdded = false
    		}
    		
    	}
    	if(notYetAdded){
    		File newCP = new File(workspacePath+project+'/.cp') 
    		filePar.eachLine{ line ->
    
    			 if(line ==~ /.*<\/classpath>.*/){
    				
    				String entry = '\t<classpathentry exported="true" kind="lib" path="'+dependencyFolder+libPar+'"/>'+'\n</classpath>\n'
    				line = line.replaceAll(/<\/classpath>/, entry)
    				println project + " : "+ libPar +" added to classpath"
    				newCP << line
    			}else{
    				newCP << line+"\n"
    			}
    		}
    		filePar.delete()
    		newCP.renameTo(workspacePath+project+'/.classpath')
    	}else{
    		println project + " : "+ libPar +" classpath entry already present"
    	}
    	
    }
    // Add certain Jar to Library
    
    
    def deleteLibFromCP(def project){
    	
    	def filePar = new File(workspacePath+project+"/.classpath")
    	boolean deleteCP = false
    	def newCP = new File(workspacePath+project+'/cp')
    	def pattern = ".*${dependencyFolder}[^<].*/>"
    
    	filePar.eachLine{ line ->
    	
    		if(line ==~ /\n(\ |\t)*/) line = line.replaceAll(/\n(\ |\t)*/, '')		// delete empty lines
    		if(line ==~ /${pattern}/){
    			deleteCP = true 
    			def pattern2 =  '(\\ |\\t)*<classpathentry exported="true" kind="lib" path="'+dependencyFolder+"[^<].*"+'"/>(\\ |\\t)*'
    			line = line.replaceAll(/${pattern2}/, '')
    			newCP << line
    		}else{
    			newCP << line+"\n"
    		}
    	}
    	if(!deleteCP){
    		println project + " : no dependencies from "+ dependencyFolder+" found in classpath file! "
    		newCP.delete()
    	}else{
    		filePar.delete()
    		newCP.renameTo(workspacePath+project+'/.classpath')	
    		println workspacePath+project+'/.classpath' +"!"
    	}
    }
    // deletes whole DependenciesLibrary Folder
    
    
    def addRunTimeLib( String libPar, String projectPar){
    	
    	def mf = new File(projectPar+"/META-INF/MANIFEST.MF")
    	def newMf = new File(projectPar+"/MF")
    	newMf.delete()
    	mf.eachLine{ line ->
    		if(line ==~ /.*Bundle-ClassPath:.*\.jar.*/){
    
    			libsInLine = line.replaceAll(/[\ \t]*Bundle-ClassPath:[\ \t]*/, '')
    			line = line.replaceFirst(/[^\ \t]*\.jar[\ \,]*/, dependencyFolder+libPar+",\n "+libsInLine)		// /[^\ \t]*.\.jar[\ \,]*/
    		}else{
    			if(line ==~ /.*Bundle-ClassPath: \.[\ \t]*/){
    				line = line+",\n "+dependencyFolder+libPar
    			}else{
    				if( line ==~ /.*Bundle-ClassPath: \.\,[\ \t]*/ ){
    					line = line+"\n "+dependencyFolder+libPar+","
    				}
    			}
    		}
    		
    		newMf << line+"\n"
    	}
    	mf.delete()
    	newMf.renameTo(projectPar+"/META-INF/MANIFEST.MF")
    	
    	
    } // Adds a Library to the current Bundle-ClassPath of the Manifest file
    
    
    def createRunTimeLib(String libPar, String projectPar){
    	def mf = new File(projectPar+"/META-INF/MANIFEST.MF")
    	mf << "Bundle-ClassPath: lib/dependencies/"+libPar
    } // Creates a Bundle-ClassPath Section in the Manifest file
    
    def boolean checkForRunTimeLibs(String projectPar){
    	boolean returnBool = false
    	def mf = new File(projectPar+"/META-INF/MANIFEST.MF")
    		mf.eachLine{ line ->
    			if(line ==~ /.*Bundle-ClassPath:.*/){
    				returnBool = true
    			}
    		}
    		return returnBool
    } // checks for a Bundle-ClassPath section in the Manifest file
    
    
    def boolean checkRunTimeLib(String libPar, String projectPar){								// checks if lib is in RunTimeLibrary present and 
    	def mf = new File(projectPar+"/META-INF/MANIFEST.MF")									// changes reference if necessary
    	def newMf = new File(projectPar+"/MF")
    	newMf.delete()
    	boolean returnBool = false
    	boolean changed = false
    		mf.eachLine{ line ->
    			if(line ==~ /.*${libPar}.*/){
    				if( !( line ==~ /.*(\ |\t)*${dependencyFolder}${libPar}(\ |\t)*.*/ ) ){			//if lib is already referenced
    					line = line.replaceFirst( /[^\ \t]*${libPar}/, dependencyFolder+libPar ) 		// reference lib from dependencyFolder	
    					changed = true
    					println line
    					println "yolo  ${libPar}\n"
    				}
    				returnBool = true
    			}
    			
    			newMf << line+"\n"
    		}
    		if(changed){
    			mf.delete()
    			newMf.renameTo(projectPar+"/META-INF/MANIFEST.MF")
    		}else{
    			newMf.delete()
    		}
    		return returnBool
    	
    }// checks if lib is already present in Manifest file
    // if lib is present but is referenced from another folder than dependencyFolder the library from dependencyFolder will be referenced
    
    /////////////////////////////////////////////////////////////////////////////////////////
    //		--	!!! 				DEFINING SUB PROJECTS 							!!!	-- //
    /////////////////////////////////////////////////////////////////////////////////////////
    
    subprojects {
    	
    	apply plugin: 'base'
    	apply plugin: 'java'
    //	apply plugin: 'eclipse'
    	
    	task deleteArtifacts(type: Delete) {
      		delete 'target','pom.xml'
    	}
    	
    	/////				Copy Dependencies into subprojects DependencyFolder 				///// 
    	task collectDependencies(type: Copy) {
    
    		   	from configurations.compile
    			from configurations.runtime
    	   	
    			into "${dependencyFolder}" 	
    			
    	}
    	
    	task setClassPath(dependsOn: 'collectDependencies')<<{
    		
    		description = "\tAdds all your Dependencies from your local lib folder in each project to it's classpath"
    		if( excludeFromClassPath.every{ it != project.name }){
    			def dependencyList = []
    			try{
    				def dir = new File(workspacePath+project.name+"/"+dependencyFolder).eachFile() { file->  		
    			    	if( !(file.getName() ==~/.*\.txt/) ){
    						dependencyList << file.getName()  
    					}
    				}
    	
    				if(features.every{ it != project.name }){	
    					boolean BundleClassPathPresent = checkForRunTimeLibs(project.name)
    					for(int icp = 0; icp < dependencyList.size; icp++){
    						addLibToCP(project.name, dependencyList[icp])	//Adds Lib to .classPath file
    					
    						if(!BundleClassPathPresent){					// Adds Lib to Manifest File
    							createRunTimeLib(dependencyList[icp], project.name)
    							BundleClassPathPresent = true
    						}else{
    							if(!checkRunTimeLib(dependencyList[icp], project.name)){		// if library not present add it to RunTimeLibrary
    								addRunTimeLib( dependencyList[icp], project.name)
    							}
    						}
    					}
    					/*dependencyList.each{ dep->
    					println project.name+": "+ dep	// could still be usefull for debugging, that's why it's not deleted
    					}*/	
    			}
    			def warningReadMe = new File(workspacePath+project.name+"/"+dependencyFolder+"_README.txt")
    			warningReadMe.delete()
    			warningReadMe << "Do Not Remove any Jars/Libraries in this Folder!\nThis folder contains all of your dependencies defined in your gradle script.\n"
    			warningReadMe << "Removing or renaming any of these files will result in an Error in your .classpath file\n"
    			warningReadMe << "If any error concerning missing dependencies should occur please run 'gradle deleteFromClassPath setClassPath' in your workspace folder from your shell."
    			
    			
    			}catch(Exception e){
    				println project.name+" has no dependencies in '${dependencyFolder}' defined: Classpath will not be changed"
    			}
    		}// if exclude projectAbfrage
    		
    	}// setClassPath
    	
    	
    	task deleteFromClassPath()<<{		
    		
    		description = "\tDeletes all your Dependencies located in your local lib folder from each project's classpath"
    		
    		try{
    			
    			boolean depsDelete = false
    			def depsFolder = new File(workspacePath+project.name+'/'+dependencyFolder)
    			if(depsFolder.exists()) depsDelete = true
    			depsFolder.deleteDir()
    
    			if(features.every{ it != project.name } && depsDelete){	
    				deleteLibFromCP(project.name)
    			}
    	
    		}catch(Exception e){
    			println project.name+" has no dependencies in '${dependencyFolder}' defined: Classpath will not be changed"
    		}
    			
    	}
    	
    	/////---- 			For a complete classPath Refresh please execute 'gradle deleteFromClassPath setClassPath'				----///////
    
    	////////////////////////////////////////////////////////////////////////////////////////////	
    	
    	task deploy() <<{
    		description = "\tGenerating the Tycho Poms. Please remember to add a '.qualifier' to the version numbers!"
    
    		String 	versionNumber = 'Version Number Error:\tcheck Manifest for Bundle-Version Number and make sure to add a ".qualifier" to the version numbers!\n'
    		String 	artifactId = 'Could not find Bundle-SymbolicName in Manifest.file'
    
    		
    		/* -- In case of changed Manifest File in Eclipse:
    		*	
    		*	Version Numbers of the projects are collected via 
    		*	regular expressions in the Manifest.MF File.  
    		*	versionnumber of the projects are equal to their
    		*	Bundle-Version Number
    		*/
    		
    		
    		if(features.every{ it != project.name }){		// Generating Poms for sub projects except features
    			def content = new File(workspacePath+"${project.name}/META-INF/MANIFEST.MF").getText("UTF-8") 
    
    	 		def printFileLine = { 
    				if(  it ==~ /Bundle-Version.+qualifier/ ){
    					 versionNumber = it.substring(16) // possibile error: cuts off first 16 chars 
    			
    					/*	Version Number is taken from Bundle-Version in Manifest.MF
    					*	If there is no Bundle-Version or the versionnumber needs to
    					*	be taken from a different key word, please change the
    					*	regular expression and the substring above
    					*/	
    				}
    		
    				if(  it ==~ /Bundle-SymbolicName:.+/ ){
    					artifactId = it
    					artifactId = artifactId.replace("Bundle-SymbolicName:", '');
    					artifactId = artifactId.replace(";",'')
    					artifactId = artifactId.replace(" ",'')
    					artifactId = artifactId.replace("singleton:=true",'')
    				}
    				/*	Artifact ID is taken from Bundle-SymbolicName minus the
    				*	16 chars ';singleton:=true'
    				*/
    			}
    	
    			content.eachLine( printFileLine )
    	
    			println artifactId
    			println "\t"+versionNumber
    	
    			def f = new File(workspacePath+artifactId+'/pom.xml') 
    			f.delete()
    		
    			// 			---- 			Test Cases					 ------ 				//
    
    			if( project.name ==~ /.*\.[tT]ests*/){
    					
    				f << start()+elder()+testArtifact(artifactId, versionNumber)+end()
    			}else{
    				
    			// ---- 				Normal Plugin 				-----						//
    				f << start()+elder()+artifact(artifactId, versionNumber)+end()
    				/*	
    				*	old pom.xml files are deleted and replaced by new auto generated Tycho pom.xml files
    				*/
    			}
    		}else{	//  end  of { if subprojects aren't a feature } Block
    	
    //		--		Features 					--			//
    	
    			if(features.any{ it == project.name } ){
    			
    				def parsedXml = new XmlParser().parse(workspacePath+"${project.name}/feature.xml")
    
    				artifactId   = parsedXml.attribute("id")
    				versionNumber = parsedXml.attribute("version")
    
    				println artifactId
    				println "\t"+versionNumber
    
    				def f = new File(workspacePath+artifactId+'/pom.xml') 
    				f.delete()
    				f << feature(artifactId, versionNumber)				
    			}
    		}
    	}//deploy
    
    	
    }// defining subprojects
    
    
    clean {
    	dependsOn += subprojects.deleteArtifacts
    }
    
    task createParent() << {
    	//		---------				 define Parent 				---------		//
    		
    	new File(workspacePath+"${parentID}").mkdir() 			
    	String versionNumber 	=	'1.0.0.qualifier'
    	String artifactId 		=	parentId()
    
    	def f = new File(workspacePath+artifactId+'/pom.xml') 
    	f.delete()
    	f << parentPom(artifactId)
    	for(int i = 0; i < targetRepositories.size(); i++){
    		f << repos(targetRepositories[i], i)
    	}
    	f << endRepos()
    	f << moduleStart()
    	for(int i = 0; i < numberOfProjects(); i++){
    		
    		if( excludeFromTychoBuild.every{ it != projects(i) } ){
    		
    			f << module(projects(i))
    		}
    	}
    	f << module(repositoryName)
    	f << endParent()
    
    }
    
    task createRepository() << {
    
    	//			------------	 	define Repository			---------		//
    						
    	new File(workspacePath+"${repositoryName}").mkdir() 
    				
    	String versionNumber 	=	'1.0.0.qualifier'
    	String artifactId		=	repositoryName
    	String featureVersionNumber = '1.0.0.qualifier'
    	String featureArtifactId
    	def f = new File(workspacePath+artifactId+'/category.xml') 
    	f.delete()
    	f << categoryHead()
    	for(int i = 0; i < features.size(); i++){
    		
    		def parsedXml = new XmlParser().parse("${workspacePath}${features[i]}/feature.xml")
    		
    		featureVersionNumber  = parsedXml.attribute("version")
    		featureArtifactId  = parsedXml.attribute("id")
    		
    		if(noDescriptions){
    			categoryDescriptions[0].put( features[i], parsedXml.attribute("label") )
    			categoryDescriptions[1].put( features[i], parsedXml.description.text() )
    		}
    		f << categoryFeatures(featureArtifactId.replace(workspacePath,''), featureVersionNumber)
    	}// for
    			
    	for( int i = 0; i < features.size(); i++ ){
    	
    		if(noDescriptions){
    			f << categoryDescription(features[i], categoryDescriptions[0][features[i]] ,categoryDescriptions[1][features[i]] )
    			//						featureName,			label,							description
    		}else{
    			f << categoryDescription(features[i], categoryDescriptions[features[i]][0] ,categoryDescriptions[features[i]][1])
    		}
    	}//for
    				
    	f << categoryEnd()
    				
    	def pom = new File(workspacePath+artifactId+'/pom.xml') 
    	pom.delete()
    	pom << reposi()
    }// end of repository definition
    	
    
    task createPoms(dependsOn: [createParent, createRepository, subprojects.deploy])
    
    
    task install(dependsOn: [createPoms] , type:Exec) {
    	description = "\tExecutes a 'mvn install' of the parent pom.xml and auto-generates Tycho Poms"	
    	commandLine 'mvn', 'install', '-f', workspacePath+parentID+'/pom.xml'
    }
    
    task completeInstall(dependsOn: [subprojects.collectDependencies, createPoms], type:Exec ){
    	
    	description = "\tCopies dependencies into dependencyFolder of each subproject and executes a 'mvn install' of the parent pom.xml and auto-generates Tycho Poms"
    	commandLine 'mvn', 'install', '-f', workspacePath+parentID+'/pom.xml'
    }
    
    task tycho(dependsOn: [createPoms] , type:Exec) {
    	description = "\tExecutes a 'mvn install' of the parent pom.xml and auto-generates Tycho Poms"	
    	commandLine 'mvn', 'install', '-f', workspacePath+parentID+'/pom.xml'
    }
    
    
    //---     Defining Tycho POM parts			--//
    
    
        def artifact(artifactId,versionNumber) { """
    		<groupId>${groupId()}</groupId>
    		<artifactId>${artifactId}</artifactId>
    		<version>${versionNumber}</version>
    		<packaging>eclipse-plugin</packaging>
    	""" }
    	
        def testArtifact(artifactId,versionNumber) { """
    		<groupId>${groupId()}</groupId>
    		<artifactId>${artifactId}</artifactId>
    		<version>${versionNumber}</version>
    		<packaging>eclipse-test-plugin</packaging>
    	""" }
    	
    			
    	def start() { """<?xml version="1.0" encoding="UTF-8"?>
    	<project
    		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    		<modelVersion>4.0.0</modelVersion>
    	"""}
    	
    	
    	def elder() {"""
    		<parent>
    			<groupId>${groupId()}</groupId>
    			<artifactId>${parentId()}</artifactId>
    			<version>1.0.0.qualifier</version>
    			<relativePath>../${parentId()}/pom.xml</relativePath>
    		</parent>
    	"""}
    
    
    	def end() {"""
    	</project>
    	"""}
    	
    // 				--	defining Parent Pom				--				//
    
    
    
    
    def parentPom(artifactId) { """<?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    	
    	<groupId>${groupId()}</groupId>
      	<artifactId>${artifactId}</artifactId>
      	<version>1.0.0.qualifier</version>
      
    	<packaging>pom</packaging>
    
    	<!-- this is the parent POM from which all modules inherit common settings -->
    	<properties>
    		<tycho-version>${tychoVersion}</tycho-version>
    	</properties>
    
       <repositories>
    	<!-- configure p2 repository to resolve against -->  
        
    
    """}
    
    
    def repos(String targetRepo, int i) {"""
    	
    	<repository>
    	  <id>targetRepository${i}</id>
    	  <layout>p2</layout>
    	  <url>${targetRepo}</url>
    	</repository>
    
    """}
    
    
    
    def endRepos() {"""
      </repositories> 
    
    	<build>
    		<plugins>
    			<plugin>
    				<!-- enable tycho build extension -->
    				<groupId>org.eclipse.tycho</groupId>
    				<artifactId>tycho-maven-plugin</artifactId>
    				<version>${tychoVersion}</version>
    				<extensions>true</extensions>
    			</plugin>
    		</plugins>
    	</build>
    """}
    
    def moduleStart(){"""
    	<!-- the modules that should be built together -->
    	<modules>
    	"""}
    
    //for(int i = 0; i < numberOfProjects(); i++)
    
    def module(String project){"""		<module>../${project}</module>
    """}
    
    	
    
    def endParent() {"""
    	</modules>
    </project>
    	"""}
    	
    // end of defining parent pom.xml
    
    // repository Pom
    def reposi() { """
    <?xml version="1.0" encoding="UTF-8"?>
      <project
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <modelVersion>4.0.0</modelVersion>
        <parent>
          <groupId>${groupID}</groupId>
          <artifactId>${parentID}</artifactId>
          <version>1.0.0.qualifier</version>
          <relativePath>../${parentID}/pom.xml</relativePath>
        </parent>
    
        
        <groupId>${groupID}</groupId>
        <artifactId>${repositoryName}</artifactId>
        <version>1.0.0.qualifier</version>
        <packaging>eclipse-repository</packaging>
    	
    	${reposiBuildStep()} 
    </project>
    """}
    
    def String reposiBuildStep(){
    	
    	if( buildProduct != false ){
    		return	"""
    		    <build>
    		  <plugins>
    		    <plugin>
    		      <groupId>org.eclipse.tycho</groupId>
    		      <artifactId>tycho-p2-director-plugin</artifactId>
    		      <version>\${tycho-version}</version>
    		      <executions>
    		        <execution>
    		          <!-- (optional) install the product for all configured os/ws/arch environments using p2 director -->
    		          <id>materialize-products</id>
    		          <goals>
    		            <goal>materialize-products</goal>
    		          </goals>
    		        </execution>
    
    			 		<execution>
    			            <!-- (optional) create product zips (one per os/ws/arch) -->
    			            <id>archive-products</id>
    			            <goals>
    			              <goal>archive-products</goal>
    			            </goals>
    			          </execution>
    
    				</executions>
    		    </plugin>
    		  </plugins>
    		</build>
    		"""
    	}else{
    		return "\n"
    	}
    }
    
    
    // creates a category in 
    def categoryHead() { """<?xml version="1.0" encoding="UTF-8"?>
    <site>
    
    """}
    	
    def categoryFeatures(artifactId, versionNumber){"""
    	<feature url="features/${artifactId}_${versionNumber}.jar" id="${artifactId}" version="${versionNumber}">
    		<category name="${artifactId}.category"/>
    	</feature>
    """}
    
    def categoryDescription(artifactId, categoryName, categorydescription){"""
    <category-def name="${artifactId}.category" label="${categoryName}">
          <description>
    ${categorydescription}
          </description>
       </category-def>
    """}
    
    def categoryEnd(){"""
    </site>
    """}
    // end of category definition
    
    // feature pom
    def feature(artifactId, versionNumber) { """
    <?xml version="1.0" encoding="UTF-8"?>
    	<project
    		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    		<modelVersion>4.0.0</modelVersion>
    		<parent>
    			<groupId>${groupId()}</groupId>
    			<artifactId>${parentId()}</artifactId>
    			<version>1.0.0.qualifier</version>
    			<relativePath>../${parentId()}/pom.xml</relativePath>
    		</parent>
    		<groupId>${groupId()}</groupId>
    		<artifactId>${artifactId}</artifactId>
    		<version>${versionNumber}</version>
    		<packaging>eclipse-feature</packaging>
    	</project>
    """}
    // end of feature pom
    
    
    // 						-------- 					In case you want to generate the product definition  					 ------ 			//
    /*
    
    def productXML(){
    """
    <?xml version="1.0" encoding="UTF-8"?>
    <?pde version="3.5"?>
    
    <product name="${groupID}.product" uid="${groupID}" id="${groupID}.product" application="${product}" version="1.0.0.qualifier" useFeatures="true" includeLaunchers="true">
    
       <configIni use="default">
       </configIni>
    
       <launcherArgs>
          <programArgs>-consoleLog</programArgs>
          <vmArgs>-Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgs>
          <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
       </launcherArgs>
    
       <plugins>
         
       </plugins>
    	<features>
    """+listProductFeature()+"""
       	<feature id="org.eclipse.rcp" version="3.7.2.v20120120-1424-9DB5FmnFq5JCf1UA38R-kz0S0272"/>
    	</features>  
       <configurations>
          <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
          <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
          <plugin id="org.eclipse.osgi" autoStart="true" startLevel="-1" />
       </configurations>
    
    </product>
    
    
    """
    
    /*
    """
    <?xml version="1.0" encoding="UTF-8"?>
    <?pde version="3.5"?>
    
    <product name="de.prob.product" uid="de.prob" id="de.prob.standalone.product" application="de.prob.standalone.application" version="1.0.0.qualifier" useFeatures="true" includeLaunchers="true">
    
       <configIni use="default">
       </configIni>
    
       <launcherArgs>
          <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
       </launcherArgs>
    
       <plugins>
       </plugins>
    
    
    </product>
    
    
    """*/
    
    /*
    
         <feature id="birkhoff.feature" version="1.0.0.qualifier"/>
        
    
    */	
    /*
    }
    
    def String listProductFeatures(){
    	String returnString = ""
    	for(int i = 0; i < features.size(); i++){
    		
    		returnString +=  '\n\t\t<feature id="${features[i]}" version="1.0.0.qualifier"/>'
    		
    	}
    	return returnString
    	
    }
    */
    
    //	Build Script can be executed via gradle install
    // 	For a complete classPath Refresh please execute 'gradle deleteFromClassPath setClassPath'	
    //	Pom Generation can be executed via gradle deploy