Skip to content

Commit 5414b67

Browse files
committed
Update gradle, dependencies, NDK, buildTools, Java, compileSdk, and liblsl (1.16.2) to last versions. Rename sample app
1 parent e48402f commit 5414b67

File tree

2,146 files changed

+270
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,146 files changed

+270
-136
lines changed

.gitignore

100644100755
File mode changed.

LICENSE

100644100755
File mode changed.

README.md

100644100755
File mode changed.

app/.gitignore

100644100755
File mode changed.

app/build.gradle

100644100755
Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
//
22
// Uncomment the blocks "externalNativeBuild" for building the app with liblsl (LSL) from the source
3-
// code using CMake. Make sure you have liblsl's source code
3+
// code. Make sure you have liblsl's source code
44
// (https://github.com/sccn/liblsl/releases/latest -> Source code) on /app-root/liblsl or the path
55
// you specified on the block "externalNativeBuild.cmake" -> path "./liblsl-path/CMakeLists.txt"
6+
67
//
7-
// In case of an external CMake installation (https://cmake.org/download/ -> Binary distributions),
8-
// specify cmake.dir=path on local.properties, e.g. cmake.dir=/home/user/Android/SDK/cmake/3.18.0
9-
// Otherwise you can install CMake using Android Studio's menu via Tools -> SDK Manager -> SDK Tools
10-
// In case of external CMake installation, you will need the Ninja binary inside your cmake/bin
11-
// folder to make the build work: https://github.com/ninja-build/ninja/releases/latest
12-
//
13-
// Comment the "externalNativeBuild" blocks for building the app using the compiled library
8+
// Comment the "externalNativeBuild" blocks for building the app using the compiled native library
149
// (liblsl.so). Once the build succeeds, the library files (.so) are automatically copied inside
1510
// the folders:
1611
// /project-root/app/src/debug/jniLibs (for a debug build)
1712
// /project-root/app/src/main/jniLibs (for a release build)
13+
// Note: A backup of these prebuilt native libraries is on /project-root/libs/[debug/release]
14+
//
1815
// IMPORTANT to use LSL on your code:
1916
// - Take the the last version of LSL.java:
2017
// https://github.com/labstreaminglayer/liblsl-Java/blob/master/src/edu/ucsd/sccn/LSL.java
@@ -23,7 +20,7 @@
2320
// - Include the following permission on your AndroidManifest.xml:
2421
// <uses-permission android:name="android.permission.INTERNET" />
2522
// - Include the jna (Java Native Access) in your dependencies block. E.g.:
26-
// implementation 'net.java.dev.jna:jna:5.10.0@aar'
23+
// implementation 'net.java.dev.jna:jna:[latest-version]@aar'
2724
//
2825

2926
apply plugin: 'com.android.application'
@@ -46,25 +43,24 @@ android {
4643
keyPassword keystoreProperties['keyPassword']
4744
}
4845
}
49-
compileSdk 31
46+
compileSdk 33
5047
defaultConfig {
5148
minSdk 24
52-
targetSdk 31
5349
versionCode 1
54-
versionName '1.16.0'
55-
setProperty('archivesBaseName', "liblsl-android-builder-$versionName")
50+
versionName '1.16.2'
51+
setProperty('archivesBaseName', "LSLMarkersSenderExample-$versionName")
5652
ndk {
5753
// Specifies the ABI configurations of your native
5854
// libraries Gradle should build and package with your app.
5955
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
6056
}
6157
// externalNativeBuild.cmake {
62-
// arguments "-DANDROID_CPP_FEATURES=rtti exceptions", "-DLSL_NO_FANCY_LIBNAME=1", "-DANDROID_PLATFORM=24"
58+
// arguments "-DANDROID_CPP_FEATURES=rtti exceptions", "-DANDROID_PLATFORM=24"
6359
// targets "lsl"
6460
// }
6561
}
6662
// externalNativeBuild.cmake {
67-
// path "./liblsl/CMakeLists.txt"
63+
// path "../liblsl/CMakeLists.txt"
6864
// }
6965
buildTypes {
7066
debug {
@@ -84,8 +80,8 @@ android {
8480
}
8581
}
8682
compileOptions {
87-
sourceCompatibility JavaVersion.VERSION_1_8
88-
targetCompatibility JavaVersion.VERSION_1_8
83+
sourceCompatibility JavaVersion.VERSION_11
84+
targetCompatibility JavaVersion.VERSION_11
8985
}
9086
packagingOptions {
9187
jniLibs {
@@ -95,30 +91,47 @@ android {
9591
pickFirsts += ['**/lib/**']
9692
}
9793
}
98-
buildToolsVersion '32.0.0'
99-
ndkVersion '23.1.7779620'
94+
buildToolsVersion = '34.0.0'
95+
ndkVersion '25.2.9519653'
96+
namespace 'liblsl.android.builder'
10097
}
10198

10299
dependencies {
103-
implementation 'androidx.appcompat:appcompat:1.4.1'
104-
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
105-
implementation 'com.google.android.material:material:1.5.0'
106-
implementation 'net.java.dev.jna:jna:5.11.0@aar'
100+
implementation 'androidx.appcompat:appcompat:1.6.1'
101+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
102+
implementation 'com.google.android.material:material:1.9.0'
103+
implementation 'net.java.dev.jna:jna:5.13.0@aar'
107104
}
108105

109106
// copy native libraries to per project location
110-
task copyDebugJniLibs(type: Copy) {
111-
from 'build/intermediates/cmake/debug/obj'
107+
tasks.register('copyDebugJniLibs', Copy) {
108+
from '../app/build/intermediates/merged_native_libs/debug/out/lib'
109+
into '../app/src/debug/jniLibs'
110+
include('**/*.*')
111+
exclude 'mips*', 'armeabi'
112+
}
113+
tasks.register('copyReleaseJniLibs', Copy) {
114+
from '../app/build/intermediates/stripped_native_libs/release/out/lib'
115+
into '../app/src/main/jniLibs'
116+
include('**/*.*')
117+
exclude 'mips*', 'armeabi'
118+
}
119+
120+
// backup native libraries to per project location
121+
tasks.register('backupDebugJniLibs', Copy) {
122+
from '../app/src/debug/jniLibs'
123+
into '../libs/debug'
112124
include('**/*.*')
113-
into 'src/debug/jniLibs'
114125
}
115-
task copyReleaseJniLibs(type: Copy) {
116-
from 'build/intermediates/cmake/release/obj'
126+
tasks.register('backupReleaseJniLibs', Copy) {
127+
from '../app/src/main/jniLibs'
128+
into '../libs/release'
117129
include('**/*.*')
118-
into 'src/main/jniLibs'
119130
}
120131

121-
tasks.whenTaskAdded { task ->
132+
tasks.configureEach { task ->
122133
if (task.name == 'assembleDebug') task.finalizedBy('copyDebugJniLibs')
123134
if (task.name == 'assembleRelease') task.finalizedBy('copyReleaseJniLibs')
135+
if (task.name == 'copyDebugJniLibs') task.finalizedBy('backupDebugJniLibs')
136+
if (task.name == 'copyReleaseJniLibs') task.finalizedBy('backupReleaseJniLibs')
124137
}

app/consumer-rules.pro

100644100755
File mode changed.

app/debug/output-metadata.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": 3,
3+
"artifactType": {
4+
"type": "APK",
5+
"kind": "Directory"
6+
},
7+
"applicationId": "liblsl.android.builder",
8+
"variantName": "debug",
9+
"elements": [
10+
{
11+
"type": "SINGLE",
12+
"filters": [],
13+
"attributes": [],
14+
"versionCode": 1,
15+
"versionName": "1.16.2",
16+
"outputFile": "LSLMarkersSenderExample-1.16.2-debug.apk"
17+
}
18+
],
19+
"elementType": "File"
20+
}

app/key.jks

100644100755
File mode changed.

app/proguard-rules.pro

100644100755
File mode changed.

app/release/output-metadata.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": 3,
3+
"artifactType": {
4+
"type": "APK",
5+
"kind": "Directory"
6+
},
7+
"applicationId": "liblsl.android.builder",
8+
"variantName": "release",
9+
"elements": [
10+
{
11+
"type": "SINGLE",
12+
"filters": [],
13+
"attributes": [],
14+
"versionCode": 1,
15+
"versionName": "1.16.2",
16+
"outputFile": "LSLMarkersSenderExample-1.16.2-release.apk"
17+
}
18+
],
19+
"elementType": "File"
20+
}
Binary file not shown.
Binary file not shown.
109 KB
Binary file not shown.
106 KB
Binary file not shown.

app/src/main/AndroidManifest.xml

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
package="liblsl.android.builder">
3+
xmlns:tools="http://schemas.android.com/tools">
54

65
<!-- IMPORTANT: without this permission, LSL won't work. -->
76
<uses-permission android:name="android.permission.INTERNET" />

app/src/main/java/liblsl/android/builder/LSL.java

100644100755
File mode changed.

app/src/main/java/liblsl/android/builder/MainActivity.java

100644100755
File mode changed.
Binary file not shown.
-16.1 MB
Binary file not shown.
Binary file not shown.
-12.7 MB
Binary file not shown.
109 KB
Binary file not shown.

app/src/main/jniLibs/x86/liblsl.so

-13.1 MB
Binary file not shown.
106 KB
Binary file not shown.

app/src/main/jniLibs/x86_64/liblsl.so

-15.3 MB
Binary file not shown.

app/src/main/res/layout/activity_main.xml

100644100755
File mode changed.

app/src/main/res/values/strings.xml

100644100755
File mode changed.

build.gradle

100644100755
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
mavenCentral()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:7.1.3'
8+
classpath 'com.android.tools.build:gradle:8.1.0'
99
// classpath 'com.netflix.nebula:gradle-lint-plugin:latest.release' // not working gradle > 7
1010

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

2424
}
2525
gradle.projectsEvaluated {
26-
tasks.withType(JavaCompile) {
27-
options.compilerArgs << "-Xlint:all,cast,deprecation,divzero,empty,fallthrough,finally,overrides,path,serial,unchecked"
26+
tasks.withType(JavaCompile).tap {
27+
configureEach {
28+
options.compilerArgs << "-Xlint:all,cast,deprecation,divzero,empty,fallthrough,finally,overrides,path,serial,unchecked"
29+
}
2830
}
2931
}
3032
// plugin not working with gradle > 7
@@ -33,6 +35,6 @@ allprojects {
3335
// add as many rules here as you'd like
3436
}
3537

36-
task clean(type: Delete) {
38+
tasks.register('clean', Delete) {
3739
delete rootProject.buildDir
3840
}

gradle.properties

100644100755
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
# http://www.gradle.org/docs/current/userguide/build_environment.html
77
# Specifies the JVM arguments used for the daemon process.
88
# The setting is particularly useful for tweaking memory settings.
9+
android.defaults.buildfeatures.buildconfig=true
910
android.enableJetifier=true
11+
android.nonFinalResIds=false
12+
android.nonTransitiveRClass=false
1013
android.useAndroidX=true
1114
org.gradle.jvmargs=-Xmx1536m
1215
# When configured, Gradle will run in incubating parallel mode.

gradle/wrapper/gradle-wrapper.jar

100644100755
File mode changed.

gradle/wrapper/gradle-wrapper.properties

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Apr 20 18:26:02 CEST 2022
1+
#Sun Aug 13 18:53:15 CEST 2023
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
43
distributionPath=wrapper/dists
5-
zipStorePath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
65
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

gradlew.bat

100644100755
File mode changed.

keystore.properties

100644100755
File mode changed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

app/liblsl/.github/workflows/android.yml renamed to liblsl/.github/workflows/android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- {arch: "arm64-v8a"}
3030

3131
steps:
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v3
3333

3434
- name: Configure CMake
3535
run: |

app/liblsl/.github/workflows/cppcmake.yml renamed to liblsl/.github/workflows/cppcmake.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ on:
1919
required: false
2020
default: ''
2121

22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
24+
cancel-in-progress: true
25+
2226
defaults:
2327
run:
2428
shell: bash
2529

26-
2730
jobs:
2831
build:
2932
name: ${{ matrix.config.name }}
@@ -34,25 +37,30 @@ jobs:
3437
config:
3538
- {name: "ubuntu-20.04", os: "ubuntu-20.04", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF"}
3639
- {name: "ubuntu-18.04", os: "ubuntu-latest", docker: "ubuntu:18.04" }
40+
- {name: "ubuntu-22.04", os: "ubuntu-22.04", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF" }
3741
- {name: "windows-x64", os: "windows-2019", cmake_extra: "-T v140,host=x86"}
3842
- {name: "windows-32", os: "windows-2019", cmake_extra: "-T v140,host=x86 -A Win32"}
3943
- {name: "macOS-latest", os: "macOS-latest"}
4044

4145
# runs all steps in the container configured in config.docker or as subprocesses when empty
4246
container: ${{ matrix.config.docker }}
4347
steps:
44-
- uses: actions/checkout@v2
48+
- uses: actions/checkout@v3
4549
- name: set up build environment in container
4650
run: |
51+
set -x
4752
apt update
48-
apt install -y --no-install-recommends g++ git python3-pip ninja-build file dpkg-dev lsb-release sudo curl
49-
python3 -m pip install cmake
53+
apt install -y --no-install-recommends g++ git ninja-build file dpkg-dev lsb-release sudo curl
54+
if [[ "${{ matrix.config.name }}" = "ubuntu-18.04" ]]; then
55+
curl -sSkL https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-linux-x86_64.tar.gz | \
56+
tar -xzf - -C /usr --strip-components=1
57+
else apt install -y --no-install-recommends cmake libpugixml-dev
58+
fi
5059
if: ${{ matrix.config.docker }}
51-
5260
- name: Configure CMake
5361
run: |
54-
if [[ "${{ matrix.config.os }}" == "ubuntu-20.04" ]]; then
55-
sudo apt-get install libpugixml-dev
62+
if [[ "${{ matrix.config.name }}" = ubuntu-2* ]]; then
63+
sudo apt-get install -y --no-install-recommends libpugixml-dev
5664
fi
5765
cmake --version
5866
cmake -S . -B build \

app/liblsl/.github/workflows/mingw_static.yml renamed to liblsl/.github/workflows/mingw_static.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
- '.github/workflows/mingw_static.yml'
1111
pull_request:
1212

13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
1317
jobs:
1418
build:
1519
name: MinGW batteries-included
@@ -20,7 +24,7 @@ jobs:
2024
shell: 'msys2 {0}'
2125

2226
steps:
23-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v3
2428
- uses: msys2/setup-msys2@v2
2529
with:
2630
release: false

app/liblsl/.github/workflows/sanitize.yml renamed to liblsl/.github/workflows/sanitize.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,39 @@ on:
1111
description: 'Sanitizer to run'
1212
required: true
1313
default: 'address'
14+
# caution: memory sanitizer is currently broken with Catch
1415
options: ['address', 'thread', 'memory', 'undefined']
1516
type: choice
1617

1718
defaults:
1819
run:
1920
shell: bash
2021

22+
env:
23+
LLVM_VERSION: 15
24+
2125
jobs:
2226
build:
2327
name: "${{ github.event.inputs.sanitizer }}"
2428
runs-on: 'ubuntu-latest'
2529

2630
steps:
27-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v3
2832
- name: Install build toolchain
2933
run: |
30-
wget https://apt.llvm.org/llvm-snapshot.gpg.key
31-
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
34+
curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/llvm.gpg
35+
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-$LLVM_VERSION main" | sudo tee /etc/apt/sources.list.d/llvm.list
3236
sudo apt update
33-
sudo apt install -y libpugixml-dev clang-13 gdb
37+
sudo apt install -y libpugixml-dev clang-$LLVM_VERSION gdb
3438
- name: Configure CMake
3539
run: |
3640
# linking a C++ library to a C program fails with ubsan enabled; disable lslver for this run
3741
sed -i -e'/lslver/d' CMakeLists.txt
3842
cmake --version
3943
cmake -S . -B build \
4044
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
41-
-DCMAKE_C_COMPILER=clang-13 \
42-
-DCMAKE_{CXX_COMPILER,LINKER}=clang++-13 \
45+
-DCMAKE_C_COMPILER=clang-$LLVM_VERSION \
46+
-DCMAKE_{CXX_COMPILER,LINKER}=clang++-$LLVM_VERSION \
4347
-DCMAKE_{C,CXX,EXE_LINKER,SHARED_LINKER}_FLAGS="-fsanitize=${{ github.event.inputs.sanitizer }}" \
4448
-DLSL_COMFY_DEFAULTS=ON \
4549
-DLSL_UNITTESTS=ON \
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
/build*/
2+
/install/
3+
/package/
24
/CMakeLists.txt.user
35
/CMakeLists.json
46
/CMakeSettings.json
57
/docs/liblsl_*
68
/docs/_build
79
/.vs/
10+
/.cache/
811
.DS_Store
912
/out/
1013
# CLion
1114
.idea/
12-
/cmake-build-*/
15+
/cmake-build-*/
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)