-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
189 lines (159 loc) · 4.16 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
* Source file provided under Apache License, Version 2.0, January 2004,
* http://www.apache.org/licenses/
* (c) Copyright DecisionBrain SAS 2016,2020
*/
group 'com.decisionbrain'
version '1.7.0'
apply plugin: 'java'
apply plugin: 'scala'
apply plugin: 'maven'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply from: 'gradle/cplex_plugin.gradle'
//
// DecisionBrain Nexus Repository for Jar files and Docker images
//
ext {
if (!project.hasProperty('NEXUS_URL'))
NEXUS_URL = "None"
if (!project.hasProperty('MAVEN_USER'))
MAVEN_USER= "None"
if (!project.hasProperty('MAVEN_PASSWORD'))
MAVEN_PASSWORD = "None"
}
println("Nexus URL: $NEXUS_URL")
println("Maven user: $MAVEN_USER")
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
task scaladocJar(type: Jar) {
archiveClassifier = 'scaladoc'
from scaladoc.destinationDir
}
apply plugin: 'maven-publish'
publishing {
publications {
library(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
artifact scaladocJar
}
}
repositories {
maven {
name = "Nexus"
url = "$NEXUS_URL/repository/" + (version.endsWith('SNAPSHOT') ? "snapshots" : "releases")
credentials {
username = "$MAVEN_USER"
password = "$MAVEN_PASSWORD"
}
}
// maven {
// name = "GitHubPackages"
// url = uri("https://maven.pkg.github.com/decisionbrain/cplex-scala")
// credentials {
// username = "$GITHUB_USER"
// password = "$GITHUB_PASSWORD"
// }
// }
}
}
//
// CPLEX Home
//
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileScala {
targetCompatibility = 1.8
}
project.ext.set("copyright", new File("copyright.txt").text)
repositories {
// HACK: if we ask Gradle to refresh the dependencies, don't look at local repo!
if (!gradle.startParameter.refreshDependencies) {
mavenLocal()
}
mavenCentral()
}
configurations.all {
// check for SNAPSHOT Updates every time instead of every 24h
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
// Custom sourceSets
sourceSets {
test {
scala {
srcDirs += 'src/examples/scala'
}
java {
srcDirs += 'src/examples/java'
}
}
}
eclipse {
classpath {
downloadSources=true
}
}
idea {
module {
downloadSources = true
}
}
javadoc {
doLast {
copy {
from "src"
include "**/doc-files/*.png"
into "$buildDir/docs/javadoc"
}
}
options.setHeader("<script type=\"text/javascript\" src=\"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML\"></script>")
options.showFromPrivate()
options.setBottom("$copyright")
}
scaladoc {
doLast {
copy {
from "src"
include "**/doc-files/*.png"
into "$buildDir/docs/scaladoc"
}
}
}
ext {
scalaVersion = '2.13.1'
scalaVersionShort = '2.13'
scalaTestVersion = '3.0.8'
}
dependencies {
compile fileTree(dir: cplexStudioHome + "/cpoptimizer/lib", include: ['*.jar'])
compile fileTree(dir: cplexStudioHome + "/cplex/lib", include: ['*.jar'])
compile 'org.slf4j:slf4j-api:1.7.10'
compile 'commons-lang:commons-lang:2.6'
compile("org.scala-lang:scala-library:$scalaVersion")
testCompile "org.hamcrest:hamcrest-core:1.3"
testCompile "org.hamcrest:hamcrest-library:1.3"
testCompile('org.mockito:mockito-all:1.9.5')
testCompile("junit:junit:4.12")
testCompile("org.scalatest:scalatest_$scalaVersionShort:$scalaTestVersion")
testCompile 'org.slf4j:slf4j-simple:1.7.10'
}
task listJars {
doLast {
configurations.compile.each { File file -> println file.name }
}
}
wrapper {
gradleVersion = '5.6.2'
description = 'Install Gradle Wrapper'
}