Skip to content
Snippets Groups Projects
build.gradle 2.43 KiB
Newer Older
Eric Slenk's avatar
Eric Slenk committed
apply plugin: 'application'
apply plugin: 'osgi'
apply plugin: 'war'
apply plugin: 'eclipse'

sourceCompatibility = '1.8'
Eric Slenk's avatar
Eric Slenk committed


repositories {
	maven {
        url "http://repo.dotcms.com/artifactory/libs-release"
    }
}

dependencies {
    compile fileTree(dir: "${getFelixDirPath()}/load", include: '*.jar')
Eric Slenk's avatar
Eric Slenk committed
	compile (group: 'com.dotcms', name: 'dotcms', version: '3.3.2'){
		transitive = true
	}
	providedCompile "javax.servlet:servlet-api:2.5"
}

jar {
    manifest {
        name = 'Structural Integrity StructuresSnapshotServiceTool'
        instruction 'Bundle-Vendor', 'ANRTS Web Services'
        instruction 'Bundle-Description', 'Viewtool providing the Structural Integrity StructuresSnapshotService.'
        instruction 'Bundle-DocURL', ''
        instruction 'Bundle-Activator', "${applicationName}.Activator"
        instruction 'DynamicImport-Package', '*'
        instruction 'Import-Package', '' +
                'edu.msu.anr.osgi.structuralintegrity.service;version=1.1.0,' +
Eric Slenk's avatar
Eric Slenk committed
                '*;version=0'
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '1.8'
}

def getBundleName() {
    return project.properties.get("applicationName")
}

def getFelixDirPath() {
    def felixDirPath = System.getenv('FELIXDIR')
    if (felixDirPath == null) {
        throw new GradleException('Please set and export $FELIXDIR environment variable.')
    }

    def felixDir = file(felixDirPath)
    if (!felixDir.isDirectory()) {
        throw new GradleException('Unable to get directory ' + felixDir.absolutePath + '.')
    }

    return felixDir.absolutePath
}

def getUndeployedDir() {
    return fileTree(dir: "${getFelixDirPath()}/undeployed")
}

def getLoadDir() {
    return fileTree(dir: "${getFelixDirPath()}/load")
}

task deleteUndeployed(type: Delete) {
    delete getUndeployedDir().matching {
        include "${getBundleName()}-*.jar"
    }.getFiles()
}

task copyLoadedToUndeploy(type: Copy, dependsOn: [deleteUndeployed]) {
    from getLoadDir().getDir()
    into getUndeployedDir().getDir()
    include "**/${getBundleName()}-*.jar"
}

task deleteLoaded(type: Delete, dependsOn: [copyLoadedToUndeploy]) {
    delete getLoadDir().matching {
        include "${getBundleName()}-*.jar"
    }.getFiles()
}

task undeploy(dependsOn: [copyLoadedToUndeploy, deleteLoaded])

task load(type: Copy, dependsOn: [clean, jar, undeploy]) {
    from project.properties.get("libsDir")
    into getLoadDir().getDir()
    include "${getBundleName()}-*.jar"
}