apply plugin: 'java'
repositories{
  mavenCentral()
}

sourceCompatibility = 1.6
jar {
    manifest {
        attributes("Implementation-Title": "Writer2xhtml",
                   "Implementation-Version": "0.1.2",
		   "Main-Class" : "writer2latex.Application",
		   "Class-Path" : "jasp.jar parser.jar")
    }
}
configurations{
bundledLibs
}
dependencies{
bundledLibs 'org.libreoffice:jurt:5.3.2'
bundledLibs 'org.libreoffice:juh:5.3.2'
bundledLibs 'org.libreoffice:ridl:5.3.2'
bundledLibs 'org.libreoffice:unoil:5.3.2'
bundledLibs 'org.jbibtex:jbibtex:1.0.15'
bundledLibs 'org.json:json:20140107'
compile 'junit:junit:4.12'
bundledLibs files('idl')
configurations.compile.extendsFrom(configurations.bundledLibs)
}
jar {
    from {
            configurations.bundledLibs.collect { it.isDirectory() ? it : zipTree(it) }
    }
    from('src/main/java') {
        include '**/*.properties'
        include '**/*.xml'
        exclude '**/*Test.class'
        exclude '**/AllTests.class'
        exclude 'org/openoffice/**/*'
    }
}
task xhtml(type: Jar) {
    manifest {
        attributes("Implementation-Title": "Writer2xhtml",
                   "Implementation-Version": "0.1.2",
		   "Built-By": "litvinovg",
                   "RegistrationClassName" : "org.openoffice.da.comp.writer2xhtml.W2XRegistration",
                   "Class-Path" : "jasp.jar parser.jar")
    }
    baseName = "writer2xhtml-filter"
    from { 
	configurations.bundledLibs.collect { 
	    it.isDirectory() ? it : zipTree(it) 
	} 
    }
    from sourceSets.main.output 
        exclude '**/*Test.class'
        exclude '**/AllTests.class'
        include 'org/openoffice/da/comp/wl2common/**/*.class'
        include 'org/openoffice/da/comp/writer2xhtml/**/*.class'
        include 'org/openoffice/da/comp/wl2common/**/*.properties'
	include 'writer2latex/api/**/*.class'
	include 'writer2latex/base/**/*.class'
	include 'writer2latex/epub/**/*.class'
	include 'writer2latex/office/**/*.class'
	include 'writer2latex/util/**/*.class'
	include 'writer2latex/xhtml/**/*.class'
	include 'writer2latex/xhtml/**/*.xml'
	include 'writer2latex/xmerge/**/*.class'
	include 'writer2latex/latex/StarMathConverter.class'
	include 'writer2latex/latex/CharClasses.class'
	include 'writer2latex/latex/Token.class'
	include 'writer2latex/latex/TGroup.class'
	include 'writer2latex/latex/SmTokenTableEntry.class'
	include 'writer2latex/latex/SmTokenTable.class'
	include 'writer2latex/latex/SmToken.class'
	include 'writer2latex/latex/LaTeXDocumentPortion.class'
	include 'writer2latex/latex/LaTeXConfig.class'
	include 'writer2latex/latex/util/HeadingMap.class'
	include 'writer2latex/latex/util/StyleMap.class'
	include 'writer2latex/latex/i18n/*.class'
    from 'src/main/java'
	include 'writer2latex/xhtml/**/*.properties'
	include 'writer2latex/xhtml/**/**/*.properties'
    from sourceSets.main.output
    include 'org/**/*'
    
    
   
}
task oxt(type: Zip){
    dependsOn xhtml
    archiveName 'writer2paginatedhtml.oxt'
    from 'src/main/oxt/writer2xhtml' 
    include '*' 
    include '**' 
    from 'build/libs/writer2xhtml-filter.jar'
    include '*' 
    from 'src/main/idl/writer2xhtml'
    include 'writer2xhtml.rdb' 
}
