Skip to content

Commit

Permalink
Update gradle, dependencies, NDK, buildTools, Java, compileSdk, and l…
Browse files Browse the repository at this point in the history
…iblsl (1.16.2) to last versions. Rename sample app
  • Loading branch information
mvidaldp committed Aug 13, 2023
1 parent e48402f commit 5414b67
Show file tree
Hide file tree
Showing 2,146 changed files with 270 additions and 136 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified app/.gitignore
100644 → 100755
Empty file.
73 changes: 43 additions & 30 deletions app/build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
//
// Uncomment the blocks "externalNativeBuild" for building the app with liblsl (LSL) from the source
// code using CMake. Make sure you have liblsl's source code
// code. Make sure you have liblsl's source code
// (https://github.com/sccn/liblsl/releases/latest -> Source code) on /app-root/liblsl or the path
// you specified on the block "externalNativeBuild.cmake" -> path "./liblsl-path/CMakeLists.txt"

//
// In case of an external CMake installation (https://cmake.org/download/ -> Binary distributions),
// specify cmake.dir=path on local.properties, e.g. cmake.dir=/home/user/Android/SDK/cmake/3.18.0
// Otherwise you can install CMake using Android Studio's menu via Tools -> SDK Manager -> SDK Tools
// In case of external CMake installation, you will need the Ninja binary inside your cmake/bin
// folder to make the build work: https://github.com/ninja-build/ninja/releases/latest
//
// Comment the "externalNativeBuild" blocks for building the app using the compiled library
// Comment the "externalNativeBuild" blocks for building the app using the compiled native library
// (liblsl.so). Once the build succeeds, the library files (.so) are automatically copied inside
// the folders:
// /project-root/app/src/debug/jniLibs (for a debug build)
// /project-root/app/src/main/jniLibs (for a release build)
// Note: A backup of these prebuilt native libraries is on /project-root/libs/[debug/release]
//
// IMPORTANT to use LSL on your code:
// - Take the the last version of LSL.java:
// https://github.com/labstreaminglayer/liblsl-Java/blob/master/src/edu/ucsd/sccn/LSL.java
Expand All @@ -23,7 +20,7 @@
// - Include the following permission on your AndroidManifest.xml:
// <uses-permission android:name="android.permission.INTERNET" />
// - Include the jna (Java Native Access) in your dependencies block. E.g.:
// implementation 'net.java.dev.jna:jna:5.10.0@aar'
// implementation 'net.java.dev.jna:jna:[latest-version]@aar'
//

apply plugin: 'com.android.application'
Expand All @@ -46,25 +43,24 @@ android {
keyPassword keystoreProperties['keyPassword']
}
}
compileSdk 31
compileSdk 33
defaultConfig {
minSdk 24
targetSdk 31
versionCode 1
versionName '1.16.0'
setProperty('archivesBaseName', "liblsl-android-builder-$versionName")
versionName '1.16.2'
setProperty('archivesBaseName', "LSLMarkersSenderExample-$versionName")
ndk {
// Specifies the ABI configurations of your native
// libraries Gradle should build and package with your app.
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
// externalNativeBuild.cmake {
// arguments "-DANDROID_CPP_FEATURES=rtti exceptions", "-DLSL_NO_FANCY_LIBNAME=1", "-DANDROID_PLATFORM=24"
// arguments "-DANDROID_CPP_FEATURES=rtti exceptions", "-DANDROID_PLATFORM=24"
// targets "lsl"
// }
}
// externalNativeBuild.cmake {
// path "./liblsl/CMakeLists.txt"
// path "../liblsl/CMakeLists.txt"
// }
buildTypes {
debug {
Expand All @@ -84,8 +80,8 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
packagingOptions {
jniLibs {
Expand All @@ -95,30 +91,47 @@ android {
pickFirsts += ['**/lib/**']
}
}
buildToolsVersion '32.0.0'
ndkVersion '23.1.7779620'
buildToolsVersion = '34.0.0'
ndkVersion '25.2.9519653'
namespace 'liblsl.android.builder'
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.android.material:material:1.5.0'
implementation 'net.java.dev.jna:jna:5.11.0@aar'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.9.0'
implementation 'net.java.dev.jna:jna:5.13.0@aar'
}

// copy native libraries to per project location
task copyDebugJniLibs(type: Copy) {
from 'build/intermediates/cmake/debug/obj'
tasks.register('copyDebugJniLibs', Copy) {
from '../app/build/intermediates/merged_native_libs/debug/out/lib'
into '../app/src/debug/jniLibs'
include('**/*.*')
exclude 'mips*', 'armeabi'
}
tasks.register('copyReleaseJniLibs', Copy) {
from '../app/build/intermediates/stripped_native_libs/release/out/lib'
into '../app/src/main/jniLibs'
include('**/*.*')
exclude 'mips*', 'armeabi'
}

// backup native libraries to per project location
tasks.register('backupDebugJniLibs', Copy) {
from '../app/src/debug/jniLibs'
into '../libs/debug'
include('**/*.*')
into 'src/debug/jniLibs'
}
task copyReleaseJniLibs(type: Copy) {
from 'build/intermediates/cmake/release/obj'
tasks.register('backupReleaseJniLibs', Copy) {
from '../app/src/main/jniLibs'
into '../libs/release'
include('**/*.*')
into 'src/main/jniLibs'
}

tasks.whenTaskAdded { task ->
tasks.configureEach { task ->
if (task.name == 'assembleDebug') task.finalizedBy('copyDebugJniLibs')
if (task.name == 'assembleRelease') task.finalizedBy('copyReleaseJniLibs')
if (task.name == 'copyDebugJniLibs') task.finalizedBy('backupDebugJniLibs')
if (task.name == 'copyReleaseJniLibs') task.finalizedBy('backupReleaseJniLibs')
}
Empty file modified app/consumer-rules.pro
100644 → 100755
Empty file.
20 changes: 20 additions & 0 deletions app/debug/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "liblsl.android.builder",
"variantName": "debug",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.16.2",
"outputFile": "LSLMarkersSenderExample-1.16.2-debug.apk"
}
],
"elementType": "File"
}
Empty file modified app/key.jks
100644 → 100755
Empty file.
Empty file modified app/proguard-rules.pro
100644 → 100755
Empty file.
20 changes: 20 additions & 0 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "liblsl.android.builder",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.16.2",
"outputFile": "LSLMarkersSenderExample-1.16.2-release.apk"
}
],
"elementType": "File"
}
Binary file not shown.
Binary file not shown.
Binary file added app/src/debug/jniLibs/x86/libjnidispatch.so
Binary file not shown.
Binary file added app/src/debug/jniLibs/x86_64/libjnidispatch.so
Binary file not shown.
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="liblsl.android.builder">
xmlns:tools="http://schemas.android.com/tools">

<!-- IMPORTANT: without this permission, LSL won't work. -->
<uses-permission android:name="android.permission.INTERNET" />
Expand Down
Empty file modified app/src/main/java/liblsl/android/builder/LSL.java
100644 → 100755
Empty file.
Empty file modified app/src/main/java/liblsl/android/builder/MainActivity.java
100644 → 100755
Empty file.
Binary file added app/src/main/jniLibs/arm64-v8a/libjnidispatch.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/arm64-v8a/liblsl.so
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/jniLibs/armeabi-v7a/liblsl.so
Binary file not shown.
Binary file added app/src/main/jniLibs/x86/libjnidispatch.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86/liblsl.so
Binary file not shown.
Binary file added app/src/main/jniLibs/x86_64/libjnidispatch.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86_64/liblsl.so
Binary file not shown.
Empty file modified app/src/main/res/layout/activity_main.xml
100644 → 100755
Empty file.
Empty file modified app/src/main/res/values/strings.xml
100644 → 100755
Empty file.
10 changes: 6 additions & 4 deletions build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.android.tools.build:gradle:8.1.0'
// classpath 'com.netflix.nebula:gradle-lint-plugin:latest.release' // not working gradle > 7

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -23,8 +23,10 @@ allprojects {

}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all,cast,deprecation,divzero,empty,fallthrough,finally,overrides,path,serial,unchecked"
tasks.withType(JavaCompile).tap {
configureEach {
options.compilerArgs << "-Xlint:all,cast,deprecation,divzero,empty,fallthrough,finally,overrides,path,serial,unchecked"
}
}
}
// plugin not working with gradle > 7
Expand All @@ -33,6 +35,6 @@ allprojects {
// add as many rules here as you'd like
}

task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
3 changes: 3 additions & 0 deletions gradle.properties
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=true
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
Expand Down
Empty file modified gradle/wrapper/gradle-wrapper.jar
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 20 18:26:02 CEST 2022
#Sun Aug 13 18:53:15 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Empty file modified gradlew.bat
100644 → 100755
Empty file.
Empty file modified keystore.properties
100644 → 100755
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/liblsl/.github/workflows/android.yml → liblsl/.github/workflows/android.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- {arch: "arm64-v8a"}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Configure CMake
run: |
Expand Down
22 changes: 15 additions & 7 deletions app/liblsl/.github/workflows/cppcmake.yml → liblsl/.github/workflows/cppcmake.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ on:
required: false
default: ''

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

defaults:
run:
shell: bash


jobs:
build:
name: ${{ matrix.config.name }}
Expand All @@ -34,25 +37,30 @@ jobs:
config:
- {name: "ubuntu-20.04", os: "ubuntu-20.04", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF"}
- {name: "ubuntu-18.04", os: "ubuntu-latest", docker: "ubuntu:18.04" }
- {name: "ubuntu-22.04", os: "ubuntu-22.04", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF" }
- {name: "windows-x64", os: "windows-2019", cmake_extra: "-T v140,host=x86"}
- {name: "windows-32", os: "windows-2019", cmake_extra: "-T v140,host=x86 -A Win32"}
- {name: "macOS-latest", os: "macOS-latest"}

# runs all steps in the container configured in config.docker or as subprocesses when empty
container: ${{ matrix.config.docker }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: set up build environment in container
run: |
set -x
apt update
apt install -y --no-install-recommends g++ git python3-pip ninja-build file dpkg-dev lsb-release sudo curl
python3 -m pip install cmake
apt install -y --no-install-recommends g++ git ninja-build file dpkg-dev lsb-release sudo curl
if [[ "${{ matrix.config.name }}" = "ubuntu-18.04" ]]; then
curl -sSkL https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-linux-x86_64.tar.gz | \
tar -xzf - -C /usr --strip-components=1
else apt install -y --no-install-recommends cmake libpugixml-dev
fi
if: ${{ matrix.config.docker }}

- name: Configure CMake
run: |
if [[ "${{ matrix.config.os }}" == "ubuntu-20.04" ]]; then
sudo apt-get install libpugixml-dev
if [[ "${{ matrix.config.name }}" = ubuntu-2* ]]; then
sudo apt-get install -y --no-install-recommends libpugixml-dev
fi
cmake --version
cmake -S . -B build \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
- '.github/workflows/mingw_static.yml'
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: MinGW batteries-included
Expand All @@ -20,7 +24,7 @@ jobs:
shell: 'msys2 {0}'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
release: false
Expand Down
16 changes: 10 additions & 6 deletions app/liblsl/.github/workflows/sanitize.yml → liblsl/.github/workflows/sanitize.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,39 @@ on:
description: 'Sanitizer to run'
required: true
default: 'address'
# caution: memory sanitizer is currently broken with Catch
options: ['address', 'thread', 'memory', 'undefined']
type: choice

defaults:
run:
shell: bash

env:
LLVM_VERSION: 15

jobs:
build:
name: "${{ github.event.inputs.sanitizer }}"
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install build toolchain
run: |
wget https://apt.llvm.org/llvm-snapshot.gpg.key
echo "deb [signed-by=$PWD/llvm-snapshot.gpg.key] http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" | sudo tee /etc/apt/sources.list.d/llvm.list
curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/llvm.gpg
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-$LLVM_VERSION main" | sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt update
sudo apt install -y libpugixml-dev clang-13 gdb
sudo apt install -y libpugixml-dev clang-$LLVM_VERSION gdb
- name: Configure CMake
run: |
# linking a C++ library to a C program fails with ubsan enabled; disable lslver for this run
sed -i -e'/lslver/d' CMakeLists.txt
cmake --version
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=clang-13 \
-DCMAKE_{CXX_COMPILER,LINKER}=clang++-13 \
-DCMAKE_C_COMPILER=clang-$LLVM_VERSION \
-DCMAKE_{CXX_COMPILER,LINKER}=clang++-$LLVM_VERSION \
-DCMAKE_{C,CXX,EXE_LINKER,SHARED_LINKER}_FLAGS="-fsanitize=${{ github.event.inputs.sanitizer }}" \
-DLSL_COMFY_DEFAULTS=ON \
-DLSL_UNITTESTS=ON \
Expand Down
5 changes: 4 additions & 1 deletion app/liblsl/.gitignore → liblsl/.gitignore
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/build*/
/install/
/package/
/CMakeLists.txt.user
/CMakeLists.json
/CMakeSettings.json
/docs/liblsl_*
/docs/_build
/.vs/
/.cache/
.DS_Store
/out/
# CLion
.idea/
/cmake-build-*/
/cmake-build-*/
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5414b67

Please sign in to comment.