Skip to content

Commit

Permalink
Github android testing #2
Browse files Browse the repository at this point in the history
  • Loading branch information
gershnik committed Nov 3, 2023
1 parent 710c9d7 commit ea7cbed
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'

- name: AVD cache
Expand Down
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ cmake_minimum_required(VERSION 3.16)
add_subdirectory("src/cpp" ${CMAKE_CURRENT_BINARY_DIR}/test)

add_custom_target(build-jnigen
COMMAND ./gradlew -Pcode.version=SNAPSHOT publishToMavenLocal
COMMAND ./gradlew --no-daemon -Pcode.version=SNAPSHOT publishToMavenLocal
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../jnigen
)

add_custom_target(test-jnigen ALL
COMMAND ./gradlew -Pcode.version=SNAPSHOT test
COMMAND ./gradlew --no-daemon -Pcode.version=SNAPSHOT test
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../jnigen
)

Expand Down
1 change: 1 addition & 0 deletions tests/android/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.cxx/
/app/libs/
6 changes: 4 additions & 2 deletions tests/android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ find_package (Python3 COMPONENTS Interpreter REQUIRED)

add_custom_target(javabuild
DEPENDS build-jnigen
COMMAND ${CMAKE_CURRENT_LIST_DIR}/gradlew -PbuildDir=${CMAKE_CURRENT_BINARY_DIR}/gradle :app:compileDebugJavaWithJavac
COMMAND ./gradlew --no-daemon -Porg.gradle.jvmargs='-Xmx2048m -Dfile.encoding=UTF-8' -Pandroid.useAndroidX=true
-PbuildDir=${CMAKE_CURRENT_BINARY_DIR}/gradle :app:compileDebugJavaWithJavac
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
)

Expand All @@ -30,7 +31,8 @@ add_custom_target(androidbuild ALL
DEPENDS javabuild smjnitests
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_LIST_DIR}/app/libs/${ANDROID_ABI}
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:smjnitests> ${CMAKE_CURRENT_LIST_DIR}/app/libs/${ANDROID_ABI}/$<TARGET_FILE_NAME:smjnitests>
COMMAND ${CMAKE_CURRENT_LIST_DIR}/gradlew -PbuildDir=${CMAKE_CURRENT_BINARY_DIR}/gradle :app:assembleDebug
COMMAND ./gradlew --no-daemon -Porg.gradle.jvmargs='-Xmx2048m -Dfile.encoding=UTF-8' -Pandroid.useAndroidX=true
-PbuildDir=${CMAKE_CURRENT_BINARY_DIR}/gradle :app:assembleDebug
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
)

Expand Down
Binary file removed tests/android/app/libs/x86_64/libsmjnitests.so
Binary file not shown.
3 changes: 1 addition & 2 deletions tests/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.smjni_test">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2023 SimpleJNI Contributors
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.
*/

package com.example.smjni_test;

import android.content.ContentProvider;
Expand Down
16 changes: 16 additions & 0 deletions tests/android/parse-output.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
# Copyright 2023 SmJNI Contributors
#
# 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 sys
import json

Expand Down
2 changes: 1 addition & 1 deletion tests/desktop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ find_package(Java COMPONENTS Development REQUIRED)

add_custom_target(javabuild
DEPENDS build-jnigen
COMMAND ${CMAKE_CURRENT_LIST_DIR}/gradlew -PbuildDir=${CMAKE_CURRENT_BINARY_DIR}/java assemble
COMMAND ./gradlew --no-daemon -PbuildDir=${CMAKE_CURRENT_BINARY_DIR}/java assemble
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
)

Expand Down

0 comments on commit ea7cbed

Please sign in to comment.