-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
181 lines (156 loc) · 5.07 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
plugins {
id "java"
id "maven"
id "signing"
id "maven-publish"
id 'org.cadixdev.licenser' version '0.5.0'
}
description = "Simple Neural Network Library"
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
license {
exclude("**/*.bin")
exclude("**/*.cu")
}
repositories {
jcenter()
maven { url "http://repo.maven.apache.org/maven2" }
}
def static getOsString() {
String vendor = System.getProperty("java.vendor")
if ("The Android Project" == vendor) {
return "android"
} else {
String osName = System.getProperty("os.name")
osName = osName.toLowerCase(Locale.ENGLISH)
if (osName.startsWith("windows")) {
return "windows"
} else if (osName.startsWith("mac os")) {
return "apple"
} else if (osName.startsWith("linux")) {
return "linux"
} else if (osName.startsWith("sun")) {
return "sun"
}
return "unknown"
}
}
def static getArchString() {
String osArch = System.getProperty("os.arch")
osArch = osArch.toLowerCase(Locale.ENGLISH)
if ("i386" == osArch || "x86" == osArch || "i686" == osArch) {
return "x86"
} else if (osArch.startsWith("amd64") || osArch.startsWith("x86_64")) {
return "x86_64"
} else if (osArch.startsWith("arm64")) {
return "arm64"
} else if (osArch.startsWith("arm")) {
return "arm"
} else if ("ppc" == osArch || "powerpc" == osArch) {
return "ppc"
} else if (osArch.startsWith("ppc")) {
return "ppc_64"
} else if (osArch.startsWith("sparc")) {
return "sparc"
} else if (osArch.startsWith("mips64")) {
return "mips64"
} else if (osArch.startsWith("mips")) {
return "mips"
} else if (osArch.contains("risc")) {
return "risc"
}
return "unknown"
}
def addJCudaDependecies(List<String> deps) {
def classifier = getOsString() + "-" + getArchString()
dependencies {
deps.each {
compile(group: 'org.jcuda', name: it, version: project.jcuda_version) {
transitive = false
}
compileOnly group: 'org.jcuda', name: "${it}-natives", classifier: classifier, version: project.jcuda_version
}
}
}
dependencies {
testCompile "org.processing:core:${project.processing_version}"
addJCudaDependecies(["jcuda", "jcurand"])
}
task examplesJar(type: Jar) {
classifier "examples"
dependsOn(jar)
from sourceSets.test.compileClasspath
}
task examplesSourceJar(type: Jar) {
classifier "examples-sources"
dependsOn(jar)
from sourceSets.test.allSource
}
task runJCuda(type: JavaExec) {
dependsOn(examplesJar)
classpath = sourceSets.test.runtimeClasspath
mainClass = "com.oroarmor.neural_network.numberID.NumberIDJCuda"
}
task sourceJar(type: Jar) {
classifier "sources"
from sourceSets.main.allJava
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives jar, sourceJar, javadocJar, examplesJar, examplesSourceJar
}
signing {
useGpgCmd()
sign configurations.archives
}
group = project.maven_group
archivesBaseName = project.archives_base_name
version = project.version
uploadArchives {
repositories {
mavenDeployer {
def ossrhUsername = "OroArmor"
def ossrhPassword = project.hasProperty("ossrhPassword") ? project.property("ossrhPassword") : System.getenv("OSSRH_PASSWORD")
beforeDeployment {
MavenDeployment deployment -> signing.signPom(deployment)
}
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name 'Neural Network Library'
packaging 'jar'
// optionally artifactId can be defined here
description 'A simple Java Neural Network Library'
url 'http://github.com/OroArmor/NeuralNetwork'
scm {
connection 'scm:git:git://github.com/OroArmor/NeuralNetwork.git'
developerConnection 'scm:git:ssh://github.com:OroArmor/NeuralNetwork.git'
url 'http://github.com/OroArmor/NeuralNetwork'
}
licenses {
license {
name 'MIT License'
url 'https://mit-license.org/'
}
}
developers {
developer {
id 'OroArmor'
name 'Eli Orona'
email '[email protected]'
url "oroarmor.com"
}
}
}
}
}
}