-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
85 lines (70 loc) · 3.14 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* Copyright 2019 Hewlett Packard Enterprise Development LP
*/
import org.gradle.plugins.ide.eclipse.model.Library
import org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "application"
apply from: "dependencies.gradle"
// SAP Host runs JAVA 7. Compile the agent for Java 7
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
// Use 'mavenCentral' for resolving your dependencies.
mavenCentral()
}
mainClassName = "com.nimblestorage.npm.agent.resource.AgentService"
applicationName = 'nimble-sap-agent'
distributions {
main {
baseName = 'nimble-sap-agent'
// Copy the configuration xml and README file into the deliverable
contents {
from ('sap-hana-backup-agent-config.xml') {
into 'bin'
}
from 'README-INSTALL.txt'
}
}
}
startScripts {
// Add the SAP JDB DRIVER JAR to the classpath. On the SAP host, the path to JAR will bet set using the environment variable - $SAP_JDBC_DRIVER
classpath += files('$SAP_JDBC_DRIVER')
doLast {
// Modify the start script to refer to the path directly instead of prefixing it with $APP_HOME/lib
def unixScriptFile = file getUnixScript()
unixScriptFile.text = unixScriptFile.text.replace('$APP_HOME/lib/$SAP_JDBC_DRIVER', '$SAP_JDBC_DRIVER')
// Delete the windows script file. We do not need it on the SAP host
delete getWindowsScript()
}
}
eclipse {
project {
comment = "Nimble SAP Agent"
name = "$project.name"
}
classpath {
defaultOutputDir = file("build/classes/main")
containers "org.eclipse.jdt.junit.JUNIT_CONTAINER/4"
file {
beforeMerged { classpath ->
classpath.entries.clear()
}
whenMerged { classpath ->
classpath.entries.findAll { it.kind == "src" && it.path ==~ "src/main/.*" }.each { it.output = "build/classes/main" }
classpath.entries.findAll { it.kind == "src" && it.path ==~ "src/test/.*" }.each { it.output = "build/classes/test" }
classpath.entries.findAll { it.kind == "src" && it.path ==~ "src/integration/.*" }.each { it.output = "build/classes/integration" }
// remove project dependencies and libraries as generated by gradle, except for integration classes
classpath.entries.findAll { it.class == ProjectDependency && it.kind == "src" }.each { classpath.entries.remove(it) }
classpath.entries.findAll { it.kind == "lib" && it.path !=~ ".*/build/classes/integration" }.each { classpath.entries.remove(it) }
// add testRuntime dependencies (this includes compile and testCompile dependencies)
configurations.testRuntime.findAll { !(it.path.replaceAll(($/\\/$),"/") ==~ ".*/build/resources/integration") }.each {
Library library = new Library(new FileReferenceFactory().fromFile(it))
classpath.entries.add(library)
}
}
}
}
}
tasks.eclipseClasspath.dependsOn(cleanEclipse)