-
Notifications
You must be signed in to change notification settings - Fork 45
/
build.gradle
155 lines (130 loc) · 4.71 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
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.2'
}
}
allprojects {
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
repositories {
google()
mavenCentral()
}
def mavsdk_server_release = "v2.12.8"
task extractMavsdkServer(type: Copy) {
mkdir project.buildDir.getAbsolutePath() + "/tmp"
def extractForArch = { arch ->
def archiveName = "mavsdk_server_android-" + arch + "_" + mavsdk_server_release + ".tar"
def archiveFile = new File(project.buildDir.getAbsolutePath() + "/tmp/" + archiveName)
def archiveUrl = "https://github.com/mavlink/MAVSDK/releases/download/" + mavsdk_server_release + "/mavsdk_server_android-" + arch + ".tar"
def destDir = project.projectDir.getAbsolutePath() + "/src/main/prebuiltLibs"
if (!archiveFile.exists()) {
project.logger.lifecycle("Downloading " + archiveFile.getName() + " into " + archiveFile.getAbsolutePath() + "...")
new URL(archiveUrl).withInputStream { i -> archiveFile.withOutputStream { it << i } }
} else {
project.logger.lifecycle("Archive already exists! Skipping download!")
}
project.logger.lifecycle("Extracting into " + destDir)
copy {
from tarTree(archiveFile)
eachFile({ file -> if (file.getName().endsWith(".so")) file.setMode(0755) })
into(destDir)
}
}
extractForArch("arm64")
extractForArch("arm")
extractForArch("x86")
extractForArch("x86_64")
}
build.dependsOn extractMavsdkServer
if (project.hasProperty('ossrhUsername')
&& project.hasProperty('ossrhPassword')) {
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
pom {
name = 'MAVSDK-Server'
packaging = 'aar'
description = 'MAVSDK server for Android.'
url = 'https://github.com/mavlink/MAVSDK-Java'
scm {
connection = 'scm:git:https://github.com/mavlink/MAVSDK-Java'
developerConnection = 'scm:git:https://github.com/mavlink/MAVSDK-Java'
url = 'https://github.com/mavlink/MAVSDK-Java'
}
licenses {
license {
name = 'BSD 3-Clause "New"'
url = 'https://opensource.org/licenses/BSD-3-Clause'
}
}
developers {
developer {
id = 'jonasvautherin'
name = 'Jonas Vautherin'
email = '[email protected]'
}
}
}
}
}
repositories {
maven {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
signing {
useGpgCmd()
sign publishing.publications.release
}
}
}
}
android {
compileSdkVersion 33
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
defaultConfig {
minSdkVersion 21
targetSdkVersion 33
archivesBaseName = 'mavsdk-server'
group = 'io.mavsdk'
versionCode 3
version '2.1.2'
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
}
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_shared"
}
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
publishing {
singleVariant('release') {
withSourcesJar()
withJavadocJar()
}
}
ndkVersion "25.1.8937393"
namespace 'io.mavsdk.mavsdkserver'
}