-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
110 lines (94 loc) · 3.66 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
/*
Copyright 2014-2016 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import org.moe.prebuilts.Script
apply plugin: 'base'
version '1.10.0'
allprojects {
repositories {
mavenCentral()
}
}
ext {
external = [:]
external.prebuilts = file('../../prebuilts').absolutePath
}
/*
* PROJECT: moe/natj/natj
*/
ext {
external.natj = [:]
external.natj.root = file('../natj/natj').absolutePath
external.natj.jar = file("${external.natj.root}/build/libs/natj-1.1.5.jar")
external.natj.sources = file("${external.natj.root}/src/main/java")
external.natj.jnipath = file("${external.natj.root}/natj-mac/build/xcode/Release")
}
for (target in [[name: 'ios', outputs: ["${external.natj.root}/natj-ios/build/xcode/Release-iphoneos/libnatj.a",
"${external.natj.root}/natj-ios/build/xcode/Release-iphonesimulator/libnatj.a"]],
[name: 'mac', outputs: ["${external.natj.root}/natj-mac/build/xcode/Release/libnatj.dylib"]],
[name: 'win', outputs: ["${external.natj.root}/natj-win/build/Release-Win64/natj.dll"]],
[name: 'api', outputs: [external.natj.jar.absolutePath], task: 'jar']]) {
external.natj[target.name] = target.outputs.collect { file(it) }
task("build_ext_natj_${target.name}", type: Exec) {
workingDir external.natj.root
executable './gradlew'
if (target.task != null) {
args "${target.task}"
} else {
args ":natj-${target.name}:build"
}
def log = file("build/ext_natj_${target.name}.log")
mkdir log.parentFile
FileOutputStream ostream = new FileOutputStream(log);
setErrorOutput(ostream)
setStandardOutput(ostream)
}
task("ext_natj_${target.name}") {
if (project.hasProperty('moe.external.rebuild.natj') ||
target.outputs.findAll() { !file(it).exists() }.size() > 0 ||
!external.natj.jar.exists()) {
dependsOn "build_ext_natj_${target.name}"
}
}
}
def createBrewCheckExecTask(def execname) {
tasks.create("check_exec_${execname}", Script) {
workDir '.'
failureMessage """
Error: ${execname} is not installed, please run `brew install ${execname}` to install.
"""
exec 'which', execname
}
}
def createCheckExecTask(def execname, def failmsg) {
tasks.create("check_exec_${execname}", Script) {
workDir '.'
failureMessage failmsg
exec 'which', execname
}
}
tasks.check {
dependsOn createBrewCheckExecTask('autogen')
dependsOn createBrewCheckExecTask('autoconf')
dependsOn createBrewCheckExecTask('automake')
dependsOn createBrewCheckExecTask('libtool')
dependsOn createBrewCheckExecTask('pkg-config')
dependsOn createBrewCheckExecTask('wget')
dependsOn createBrewCheckExecTask('cloog')
dependsOn createBrewCheckExecTask('cmake')
dependsOn createBrewCheckExecTask('gpg')
dependsOn createBrewCheckExecTask('ant')
dependsOn createCheckExecTask('premake5', """
Error: premake5 is not installed, please run the following to install:
brew install file://${file('dependencies/premake5.rb').absolutePath}
""")
}