Reduce number of gradle files

This commit is contained in:
Bradley Austin Davis 2017-11-26 18:31:25 -08:00 committed by Brad Davis
parent ddc2548c53
commit 9293391297
9 changed files with 114 additions and 283 deletions

View file

@ -3,9 +3,10 @@ setup_hifi_library()
link_hifi_libraries(shared networking gl gpu gpu-gles image fbx render-utils physics) link_hifi_libraries(shared networking gl gpu gpu-gles image fbx render-utils physics)
target_opengl() target_opengl()
target_link_libraries(native-lib android log m) target_link_libraries(native-lib android log m)
set(GVR_ROOT "${HIFI_ANDROID_PRECOMPILED}/gvr/gvr-android-sdk-1.101.0/") set(GVR_ROOT "${HIFI_ANDROID_PRECOMPILED}/gvr/gvr-android-sdk-1.101.0/")
target_include_directories(native-lib PRIVATE "${GVR_ROOT}/libraries/headers") target_include_directories(native-lib PRIVATE "${GVR_ROOT}/libraries/headers")
target_link_libraries(native-lib "${HIFI_ANDROID_PRECOMPILED}/jni/arm64-v8a/libgvr.so") target_link_libraries(native-lib "${GVR_ROOT}/libraries/libgvr.so")
# finished libraries # finished libraries
# core -> qt # core -> qt

View file

@ -8,6 +8,10 @@ buildscript {
} }
} }
plugins {
id 'de.undercouch.download' version '3.3.0'
}
allprojects { allprojects {
repositories { repositories {
jcenter() jcenter()
@ -15,42 +19,126 @@ allprojects {
} }
} }
task setupDependencies(type: Copy) {
from HIFI_ANDROID_PRECOMPILED + '/jni/arm64-v8a' def baseFolder = new File(HIFI_ANDROID_PRECOMPILED)
into 'app/src/main/jniLibs/arm64-v8a' def jniFolder = new File('app/src/main/jniLibs/arm64-v8a')
import org.apache.tools.ant.taskdefs.condition.Os
def baseUrl = 'https://hifi-public.s3.amazonaws.com/austin/android/'
def qtFile='qt-5.9.3_linux_armv8-libcpp.tgz'
if (Os.isFamily(Os.FAMILY_MAC)) {
qtFile = 'qt-5.9.3_osx_armv8-libcpp.tgz'
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
qtFile = 'qt-5.9.3_win_armv8-libcpp.tgz'
} }
apply from: 'setupQt.gradle' def packages = [
setupDependencies.dependsOn setupQt qt: [ file: qtFile, sharedLibFolder: '', includeLibs: ['lib/*.so', 'plugins/*/*.so'] ],
bullet: [ file: 'bullet-2.83_armv8-libcpp.tgz' ],
draco: [ file: 'draco_armv8-libcpp.tgz' ],
gvr: [ file: 'gvrsdk_v1.101.0.tgz' ],
openssl: [ file: 'openssl-1.1.0g_armv8.tgz'],
polyvox: [ file: 'polyvox_armv8-libcpp.tgz', sharedLibFolder: 'lib', includeLibs: ['Release/libPolyVoxCore.so', 'libPolyVoxUtil.so'] ],
tbb: [ file: 'tbb-2018_U1_armv8_libcpp.tgz', sharedLibFolder: 'lib/release', includeLibs: ['libtbb.so', 'libtbbmalloc.so'] ]
]
apply from: 'setupScribe.gradle' task downloadDependencies {
setupDependencies.dependsOn setupScribe doLast {
packages.each { entry ->
def filename = entry.value['file'];
def url = baseUrl + filename;
download {
src url
dest new File(baseFolder, filename)
onlyIfNewer true
}
}
}
}
apply from: 'setupOpenSSL.gradle' task extractDependencies(dependsOn: downloadDependencies) {
setupDependencies.dependsOn setupOpenSSL doLast {
packages.each { entry ->
def folder = entry.key;
def filename = entry.value['file'];
def localFile = new File(HIFI_ANDROID_PRECOMPILED, filename)
def localFolder = new File(HIFI_ANDROID_PRECOMPILED, folder)
copy {
from tarTree(resources.gzip(localFile))
into localFolder
}
}
}
}
apply from: 'setupTBB.gradle' task copyDependencies(dependsOn: extractDependencies) {
setupDependencies.dependsOn setupTBB doLast {
packages.each { entry ->
def packageName = entry.key
def currentPackage = entry.value;
if (currentPackage.containsKey('sharedLibFolder')) {
def localFolder = new File(baseFolder, packageName + '/' + currentPackage['sharedLibFolder'])
def tree = fileTree(localFolder);
if (currentPackage.containsKey('includeLibs')) {
currentPackage['includeLibs'].each { includeSpec -> tree.include includeSpec }
}
tree.visit { element ->
if (!element.file.isDirectory()) {
copy { from element.file; into jniFolder }
}
}
}
}
}
}
apply from: 'setupGVR.gradle' task setupScribe(type: Exec) {
setupDependencies.dependsOn setupGVR def scribeFile='scribe_linux_x86_64'
def scribeLocalFile='scribe'
if (Os.isFamily(Os.FAMILY_MAC)) {
scribeFile = 'scribe_osx_x86_64'
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
scribeFile = 'scribe_win32_x86_64.exe'
scribeLocalFile = 'scribe.exe'
}
apply from: 'setupDraco.gradle' doFirst {
setupDependencies.dependsOn setupDraco download {
src baseUrl + scribeFile
dest new File(baseFolder, scribeLocalFile)
onlyIfNewer true
}
}
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'chmod', 'a+x', HIFI_ANDROID_PRECOMPILED + '/' + scribeLocalFile
}
}
apply from: 'setupBullet.gradle' task setupDependencies(dependsOn: [setupScribe, copyDependencies]) {
setupDependencies.dependsOn setupBullet doLast {
def gvrLibFolder = new File(HIFI_ANDROID_PRECOMPILED, 'gvr/gvr-android-sdk-1.101.0/libraries');
apply from: 'setupPolyvox.gradle' zipTree(new File(HIFI_ANDROID_PRECOMPILED, 'gvr/gvr-android-sdk-1.101.0/libraries/sdk-audio-1.101.0.aar')).visit { element ->
setupDependencies.dependsOn setupPolyvox if (element.file.toString().endsWith('arm64-v8a/libgvr_audio.so')) {
copy { from element.file; into gvrLibFolder }
task copyDependencies(type: Copy) { }
from HIFI_ANDROID_PRECOMPILED + '/jni/arm64-v8a' }
into 'app/src/main/jniLibs/arm64-v8a' zipTree(new File(HIFI_ANDROID_PRECOMPILED, 'gvr/gvr-android-sdk-1.101.0/libraries/sdk-base-1.101.0.aar')).visit { element ->
if (element.file.toString().endsWith('arm64-v8a/libgvr.so')) {
copy { from element.file; into gvrLibFolder }
}
}
fileTree(gvrLibFolder).visit { element ->
if (element.file.toString().endsWith('.so')) {
copy { from element.file; into jniFolder }
}
}
}
} }
task cleanDependencies(type: Delete) { task cleanDependencies(type: Delete) {
delete HIFI_ANDROID_PRECOMPILED delete HIFI_ANDROID_PRECOMPILED
delete 'app/src/main/jniLibs/arm64-v8a'
} }
task clean(type: Delete) { task clean(type: Delete) {

View file

@ -1,26 +0,0 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'de.undercouch:gradle-download-task:3.3.0'
}
}
def file='bullet-2.83_armv8-libcpp.tgz '
def url='https://hifi-public.s3.amazonaws.com/austin/android/' + file
def destFile = new File(HIFI_ANDROID_PRECOMPILED, file)
task downloadBullet(type: de.undercouch.gradle.tasks.download.Download) {
src url
dest destFile
}
task extractBullet(dependsOn: downloadBullet, type: Copy) {
from tarTree(resources.gzip(destFile))
into new File(HIFI_ANDROID_PRECOMPILED, 'bullet')
}
task setupBullet(dependsOn: extractBullet) { }

View file

@ -1,26 +0,0 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'de.undercouch:gradle-download-task:3.3.0'
}
}
def file='draco_armv8-libcpp.tgz'
def url='https://hifi-public.s3.amazonaws.com/austin/android/' + file
def destFile = new File(HIFI_ANDROID_PRECOMPILED, file)
task downloadDraco(type: de.undercouch.gradle.tasks.download.Download) {
src url
dest destFile
}
task extractDraco(dependsOn: downloadDraco, type: Copy) {
from tarTree(resources.gzip(destFile))
into new File(HIFI_ANDROID_PRECOMPILED, 'draco')
}
task setupDraco(dependsOn: extractDraco) { }

View file

@ -1,26 +0,0 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'de.undercouch:gradle-download-task:3.3.0'
}
}
def file='openssl-1.1.0g_armv8.tgz'
def url='https://hifi-public.s3.amazonaws.com/austin/android/' + file
def destFile = new File(HIFI_ANDROID_PRECOMPILED, file)
task downloadOpenSSL(type: de.undercouch.gradle.tasks.download.Download) {
src url
dest destFile
}
task extractOpenSSL(dependsOn: downloadOpenSSL, type: Copy) {
from tarTree(resources.gzip(destFile))
into new File(HIFI_ANDROID_PRECOMPILED, 'openssl')
}
task setupOpenSSL(dependsOn: extractOpenSSL) { }

View file

@ -1,38 +0,0 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'de.undercouch:gradle-download-task:3.3.0'
}
}
def file='polyvox_armv8-libcpp.tgz'
def url='https://hifi-public.s3.amazonaws.com/austin/android/' + file
def destFile = new File(HIFI_ANDROID_PRECOMPILED, file)
task downloadPolyvox(type: de.undercouch.gradle.tasks.download.Download) {
src url
dest destFile
}
task extractPolyvox(dependsOn: downloadPolyvox, type: Copy) {
from tarTree(resources.gzip(destFile))
into new File(HIFI_ANDROID_PRECOMPILED, 'polyvox')
}
task copyPolyvoxCore(dependsOn: extractPolyvox, type: Copy) {
from HIFI_ANDROID_PRECOMPILED + '/polyvox/lib/Release'
include 'libPolyVoxCore.so'
into HIFI_ANDROID_PRECOMPILED + '/jni/arm64-v8a'
}
task copyPolyvoxUtil(dependsOn: extractPolyvox, type: Copy) {
from HIFI_ANDROID_PRECOMPILED + '/polyvox/lib'
include 'libPolyVoxUtil.so'
into HIFI_ANDROID_PRECOMPILED + '/jni/arm64-v8a'
}
task setupPolyvox(dependsOn: [copyPolyvoxCore, copyPolyvoxUtil]) { }

View file

@ -1,72 +0,0 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'de.undercouch:gradle-download-task:3.3.0'
}
}
import org.apache.tools.ant.taskdefs.condition.Os
def file='qt-5.9.3_linux_armv8-libcpp.tgz'
if (Os.isFamily(Os.FAMILY_MAC)) {
file = 'qt-5.9.3_osx_armv8-libcpp.tgz'
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
file = 'qt-5.9.3_win_armv8-libcpp.tgz'
}
def url='https://hifi-public.s3.amazonaws.com/austin/android/' + file
def destFile = new File(HIFI_ANDROID_PRECOMPILED, file)
task downloadQt(type: de.undercouch.gradle.tasks.download.Download) {
src url
dest destFile
}
task extractQt(dependsOn: downloadQt, type: Copy) {
from tarTree(resources.gzip(destFile))
into new File(HIFI_ANDROID_PRECOMPILED, 'qt')
}
task copyQtJars(dependsOn: extractQt, type: Copy) {
from HIFI_ANDROID_PRECOMPILED + '/qt/jar'
include '*.jar'
into HIFI_ANDROID_PRECOMPILED + '/jar'
}
task copyQtLibs(dependsOn: extractQt, type: Copy) {
from HIFI_ANDROID_PRECOMPILED + '/qt/lib'
include 'libQt5AndroidExtras.so'
include 'libQt5Concurrent.so'
include 'libQt5Core.so'
include 'libQt5Gamepad.so'
include 'libQt5Gui.so'
include 'libQt5MultimediaQuick_p.so'
include 'libQt5Multimedia.so'
include 'libQt5Network.so'
include 'libQt5OpenGL.so'
include 'libQt5Qml.so'
include 'libQt5QuickControls2.so'
include 'libQt5QuickParticles.so'
include 'libQt5Quick.so'
include 'libQt5QuickTemplates2.so'
include 'libQt5QuickWidgets.so'
include 'libQt5Script.so'
include 'libQt5ScriptTools.so'
include 'libQt5Scxml.so'
include 'libQt5Svg.so'
include 'libQt5WebChannel.so'
include 'libQt5WebSockets.so'
include 'libQt5WebView.so'
include 'libQt5Widgets.so'
include 'libQt5XmlPatterns.so'
include 'libQt5Xml.so'
into HIFI_ANDROID_PRECOMPILED + '/jni/arm64-v8a'
}
task setupQt(dependsOn: [copyQtLibs, copyQtJars]) {
}

View file

@ -1,39 +0,0 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'de.undercouch:gradle-download-task:3.3.0'
}
}
import org.apache.tools.ant.taskdefs.condition.Os
def file='scribe_linux_x86_64'
def localFile='scribe'
if (Os.isFamily(Os.FAMILY_MAC)) {
file = 'scribe_osx_x86_64'
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
file = 'scribe_win32_x86_64.exe'
localFile = 'scribe.exe'
}
def url='https://hifi-public.s3.amazonaws.com/austin/android/' + file
def destFile = new File(HIFI_ANDROID_PRECOMPILED, localFile)
task filepermission(type: Exec) {
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'chmod', '700', '<file_path>'
}
}
task downloadScribe(type: de.undercouch.gradle.tasks.download.Download) {
src url
dest destFile
}
task setupScribe(dependsOn: downloadScribe, type: Exec) {
commandLine 'chmod', 'a+x', destFile
}

View file

@ -1,31 +0,0 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'de.undercouch:gradle-download-task:3.3.0'
}
}
def file='tbb-2018_U1_armv8_libcpp.tgz'
def url='https://hifi-public.s3.amazonaws.com/austin/android/' + file
def destFile = new File(HIFI_ANDROID_PRECOMPILED, file)
task downloadTBB(type: de.undercouch.gradle.tasks.download.Download) {
src url
dest destFile
}
task extractTBB(dependsOn: downloadTBB, type: Copy) {
from tarTree(resources.gzip(destFile))
into new File(HIFI_ANDROID_PRECOMPILED, 'tbb')
}
task setupTBB(dependsOn: extractTBB, type: Copy) {
from HIFI_ANDROID_PRECOMPILED + '/tbb/lib/release'
include 'libtbb.so'
include 'libtbbmalloc.so'
into HIFI_ANDROID_PRECOMPILED + '/jni/arm64-v8a/'
}