summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStevenWdV <stevenwdv@gmail.com>2022-02-09 00:40:38 +0100
committerStevenWdV <stevenwdv@gmail.com>2022-02-09 00:40:38 +0100
commit2aad9b6ae61337ef94b05adc377a9ad2cbaa8eb8 (patch)
tree022c006cfac7a60fd0ab8896fac3991cf34b8fce
parentb60ecf2fe5ddfe506e02093286b3931873187e91 (diff)
Add Android wrapper, remove plain Java Maven wrapper.
Fix some overrides in Makefiles.
-rw-r--r--.github/workflows/test.yml1
-rw-r--r--.gitignore4
-rw-r--r--README.md7
-rw-r--r--exports/Makefile7
-rw-r--r--exports/common.mk6
-rw-r--r--wrappers/csharp/Makefile2
-rw-r--r--wrappers/java-android/.gitignore9
-rw-r--r--wrappers/java-android/Makefile31
-rw-r--r--wrappers/java-android/README.md84
-rw-r--r--wrappers/java-android/build.gradle23
-rw-r--r--wrappers/java-android/gradle.properties24
-rw-r--r--wrappers/java-android/gradle/wrapper/gradle-wrapper.jarbin0 -> 59536 bytes
-rw-r--r--wrappers/java-android/gradle/wrapper/gradle-wrapper.properties5
-rw-r--r--wrappers/java-android/gradlew234
-rw-r--r--wrappers/java-android/gradlew.bat89
-rw-r--r--wrappers/java-android/lib/.gitignore2
-rw-r--r--wrappers/java-android/lib/CMakeLists.txt38
-rw-r--r--wrappers/java-android/lib/build.gradle107
-rw-r--r--wrappers/java-android/lib/consumer-rules.pro0
-rw-r--r--wrappers/java-android/lib/proguard-rules.pro21
-rw-r--r--wrappers/java-android/lib/src/main/AndroidManifest.xml4
-rw-r--r--wrappers/java-android/lib/src/test/java/org/eduvpn/common/VerifyTests.java77
-rw-r--r--wrappers/java-android/settings.gradle9
-rw-r--r--wrappers/java/.gitignore1
-rw-r--r--wrappers/java/Makefile16
-rw-r--r--wrappers/java/README.md34
-rw-r--r--wrappers/java/pom.xml106
-rw-r--r--wrappers/java/src/test/java/nl/eduvpn/common/VerifyTests.java77
-rw-r--r--wrappers/php/Makefile9
-rw-r--r--wrappers/php/src/Discovery.php4
-rw-r--r--wrappers/python/.gitignore1
-rw-r--r--wrappers/python/Makefile7
-rw-r--r--wrappers/python/eduvpncommon/discovery.py2
-rw-r--r--wrappers/swift/Makefile2
34 files changed, 793 insertions, 250 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index f405945..426370a 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -30,6 +30,7 @@ jobs:
with:
distribution: temurin
java-version: 11
+ - uses: android-actions/setup-android@v2
- uses: slashmo/install-swift@v0.1.0
with:
version: 5.5
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2ce1749
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+.vs/
+*.iml
+.idea/
+.DS_Store
diff --git a/README.md b/README.md
index 268cb76..a002f39 100644
--- a/README.md
+++ b/README.md
@@ -85,9 +85,12 @@ make test
Clean built libraries and wrapper builds:
```shell
-make clean -j
+make -j clean
```
+Usually you won't need to do this, as changes in the library should automatically be incorporated in wrappers.
+Specify `CLEAN_ALL=1` to also remove downloaded dependencies for some wrappers.
+
Take a look at `wrappers/<lang>/README.md` for descriptions per wrapper.
## Structure
@@ -95,4 +98,4 @@ Take a look at `wrappers/<lang>/README.md` for descriptions per wrapper.
- `verify.go`: main API
- `verify_test.go` and `test_data/`: tests for API
- `exports/`: C API interface
-- `wrappers/`: Wrappers per language, more will be added
+- `wrappers/`: Wrappers per language
diff --git a/exports/Makefile b/exports/Makefile
index cfb9604..3dcf2f0 100644
--- a/exports/Makefile
+++ b/exports/Makefile
@@ -1,14 +1,17 @@
-.PHONY: build copy-to clean
+.PHONY: build clean
include common.mk
ifeq ($(LIB_SUFFIX),.so)
# Add SONAME as cgo does not currently do this. Mostly for Android, see https://stackoverflow.com/a/48291044
-export CGO_LDFLAGS := $(CGO_LDFLAGS) -Wl,-soname,$(LIB_FILE)
+export override CGO_LDFLAGS += -Wl,-soname,$(LIB_FILE)
endif
# Creates targets like 'lib/linux/amd64/libeduvpn_common.so'
build: lib/$(GOOS)/$(GOARCH)/$(LIB_FILE)
+ifdef COPY_LIB_TO
+ install $< -Dt $(COPY_LIB_TO)
+endif
# Build shared library and remove lib prefix (if any) from header name
# GOOS and GOARCH envvars are set by common.mk
diff --git a/exports/common.mk b/exports/common.mk
index f2757c2..bc5a3d6 100644
--- a/exports/common.mk
+++ b/exports/common.mk
@@ -23,7 +23,7 @@ LIB_NAME ?= eduvpn_common
# Library file name
LIB_FILE ?= $(LIB_PREFIX)$(LIB_NAME)$(LIB_SUFFIX)
-# Get exports/ directory when included from a wrapper
+# Get relative exports/ directory when included from a wrapper
EXPORTS_PATH = $(dir $(lastword $(MAKEFILE_LIST)))
# Remove trailing slash
EXPORTS_PATH := $(EXPORTS_PATH:/=)
@@ -38,7 +38,9 @@ else
export LD_LIBRARY_PATH := $(abspath $(EXPORTS_LIB_SUBFOLDER_PATH)):$(LD_LIBRARY_PATH)
endif
-.try_build_lib:
+.try-build-lib:
ifneq ($(wildcard $(EXPORTS_PATH)/Makefile),)
$(MAKE) -C $(EXPORTS_PATH)
+else
+$(info Skipping building library as exports/Makefile was not found)
endif
diff --git a/wrappers/csharp/Makefile b/wrappers/csharp/Makefile
index e120c7a..187ddbd 100644
--- a/wrappers/csharp/Makefile
+++ b/wrappers/csharp/Makefile
@@ -12,7 +12,7 @@ build:
pack:
dotnet pack EduVpnCommon.csproj --configuration Release
-test: .try_build_lib
+test: .try-build-lib
dotnet test
clean:
diff --git a/wrappers/java-android/.gitignore b/wrappers/java-android/.gitignore
new file mode 100644
index 0000000..41445b2
--- /dev/null
+++ b/wrappers/java-android/.gitignore
@@ -0,0 +1,9 @@
+*.iml
+.gradle/
+.idea/
+/build/
+/captures/
+.cxx/
+.externalNativeBuild/
+CMakeFiles/
+local.properties
diff --git a/wrappers/java-android/Makefile b/wrappers/java-android/Makefile
new file mode 100644
index 0000000..d249a50
--- /dev/null
+++ b/wrappers/java-android/Makefile
@@ -0,0 +1,31 @@
+.PHONY: build test android-test clean
+
+EXPORTS_PATH ?= ../../exports
+include $(EXPORTS_PATH)/common.mk
+
+ifeq ($(NO_DAEMON),1)
+override GRADLE_FLAGS += --no-daemon
+endif
+
+build:
+ ./gradlew $(GRADLE_FLAGS) assembleRelease
+
+# Unit tests use library for desktop OS platform, so we still need .try-build-lib for this
+# The unit tests find this library through the library path set in common.mk
+unit-test: .try-build-lib
+ ./gradlew $(GRADLE_FLAGS) test
+
+android-test:
+ ./gradlew $(GRADLE_FLAGS) pixel2DebugAndroidTest
+
+connected-android-test:
+ ./gradlew $(GRADLE_FLAGS) connectedAndroidTest
+
+test: .try-build-lib
+ ./gradlew $(GRADLE_FLAGS) test pixel2DebugAndroidTest
+
+clean:
+ rm -rf lib/build lib/.cxx lib/CMakeFiles lib/src/test/resources/*
+ifeq ($(CLEAN_ALL),1)
+ rm -rf .gradle/
+endif
diff --git a/wrappers/java-android/README.md b/wrappers/java-android/README.md
new file mode 100644
index 0000000..50e56fb
--- /dev/null
+++ b/wrappers/java-android/README.md
@@ -0,0 +1,84 @@
+# Android (Java) wrapper
+
+## Requirements
+
+You will need to install the JDK compatible with Gradle and the Android Gradle plugin. Gradle specifies
+a [maximum supported JDK version](https://docs.gradle.org/current/userguide/compatibility.html), while the Android
+Gradle plugin specifies a [minimum supported JDK version](https://developer.android.com/studio/releases/gradle-plugin) (
+see 'Compatibility' table for the right Gradle version). Additionally, the Android Gradle plugin requires
+a [certain Gradle version range](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle). Lastly, (
+older versions of) Android Studio and especially IntelliJ Ultimate may not support some newer Android Gradle plugin
+versions.
+
+If you see `Unsupported class file major version xx` then Gradle wants you to use an older Java version. If you
+see `Android Gradle plugin requires Java xx to run.` then the Android Gradle plugin wants you to use a newer Java
+version.
+
+See the [list of Gradle releases](https://github.com/gradle/gradle/releases)
+and [list of Android Gradle plugin releases](https://maven.google.com/web/?q=com.android.tools.build#com.android.tools.build:gradle)
+.
+
+Versions are managed per project by the Gradle wrapper (see `gradle*` files). Run `./gradlew --version` to get the
+project Gradle version. Look at the dependencies in `/build.gradle` for the current Android Gradle plugin version. This
+means that you do not need to install Gradle separately yourself.
+
+Currently, versions are Gradle 7.0.2 and Android Gradle plugin 7.0.4, which means you have to install a **JDK with a
+version between 11 and 16**. If desired, these can be upgraded to e.g. 7.4 and 7.1.1 respectively without problems, but
+as mentioned, IDE support may be limited with newer versions. The Gradle wrapper may be updated using
+e.g. `./gradlew wrapper --gradle-version 7.4`. After that, the Android Gradle plugin may be updated by changing the
+version in `/build.gradle`.
+
+You will also need the Android SDK, which comes with [Android Studio](https://developer.android.com/studio/).
+
+## Build & test
+
+Build AAR (Gradle will also run unit tests):
+
+```shell
+make
+```
+
+This will build an AAR in `lib/build/outputs/aar`, which will include the shared Go library for all Android
+architectures, which it will build using the Android NDK via CMake, which calls `make` with the right compiler.
+
+Run unit tests without an Android emulator:
+
+```shell
+make unit-test
+```
+
+This will build the library for your current desktop OS and use that.
+
+Run Android instrumented tests on a new emulator:
+
+```shell
+make android-test
+```
+
+This uses [Gradle managed virtual devices](https://developer.android.com/studio/preview/features#gmd). This feature is
+enabled in `gradle.properties`. It is normal that tests that pass are not logged.
+
+Run Android instrumented tests on an already running emulator:
+
+```shell
+make connected-android-test
+```
+
+This will be faster when used multiple times, as the emulator is reused.
+
+Run both unit tests and Android instrumented tests on a new emulator:
+
+```shell
+make test
+```
+
+For all commands you can specify options to pass to Gradle via `GRADLE_FLAGS=`. Specify `NO_DAEMON=1` to
+add `--no-daemon`.
+
+## Notes
+
+The same Java code is used for the Android instrumented tests as for the unit tests. Both use Java resources that are
+copied from the `../../test_data` folder by Gradle.
+
+This library uses JNA, not JNI. Hence, there is no C wrapper. The library is dynamically opened with `dlopen`
+via `libjnidispatch.so` which comes with the JNA AAR.
diff --git a/wrappers/java-android/build.gradle b/wrappers/java-android/build.gradle
new file mode 100644
index 0000000..c9f995e
--- /dev/null
+++ b/wrappers/java-android/build.gradle
@@ -0,0 +1,23 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ repositories {
+ google()
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:7.0.4'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ tasks.withType(JavaCompile) {
+ options.deprecation = true
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/wrappers/java-android/gradle.properties b/wrappers/java-android/gradle.properties
new file mode 100644
index 0000000..4b5f10f
--- /dev/null
+++ b/wrappers/java-android/gradle.properties
@@ -0,0 +1,24 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# 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.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
+# Enable all warnings
+org.gradle.warning.mode=all
+# Enable Gradle managed devices for older Android plugin versions
+android.experimental.androidTest.useUnifiedTestPlatform=true
+# To test with ATD images (but native stuff seems to malfunction?): android.sdk.channel=3
diff --git a/wrappers/java-android/gradle/wrapper/gradle-wrapper.jar b/wrappers/java-android/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..7454180
--- /dev/null
+++ b/wrappers/java-android/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/wrappers/java-android/gradle/wrapper/gradle-wrapper.properties b/wrappers/java-android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..0f80bbf
--- /dev/null
+++ b/wrappers/java-android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/wrappers/java-android/gradlew b/wrappers/java-android/gradlew
new file mode 100644
index 0000000..1b6c787
--- /dev/null
+++ b/wrappers/java-android/gradlew
@@ -0,0 +1,234 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# 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
+#
+# https://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.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+
+APP_NAME="Gradle"
+APP_BASE_NAME=${0##*/}
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/wrappers/java-android/gradlew.bat b/wrappers/java-android/gradlew.bat
new file mode 100644
index 0000000..107acd3
--- /dev/null
+++ b/wrappers/java-android/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/wrappers/java-android/lib/.gitignore b/wrappers/java-android/lib/.gitignore
new file mode 100644
index 0000000..1ac6136
--- /dev/null
+++ b/wrappers/java-android/lib/.gitignore
@@ -0,0 +1,2 @@
+/build
+/src/test/resources/*
diff --git a/wrappers/java-android/lib/CMakeLists.txt b/wrappers/java-android/lib/CMakeLists.txt
new file mode 100644
index 0000000..9bea062
--- /dev/null
+++ b/wrappers/java-android/lib/CMakeLists.txt
@@ -0,0 +1,38 @@
+cmake_minimum_required(VERSION 3.18.1)
+project(eduvpn_common)
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+
+# Android -> Go architecture map
+set(arch_map_x86 386)
+set(arch_map_x86_64 amd64)
+set(arch_map_arm arm)
+set(arch_map_arm64 arm64)
+
+set(GOARCH ${arch_map_${ANDROID_ARCH_NAME}})
+
+find_program(MAKE_EXECUTABLE
+ NAMES gmake mingw32-make make
+ NAMES_PER_DIR
+ DOC "GNU Make"
+ REQUIRED
+)
+
+# Inspired by https://github.com/WireGuard/wireguard-android/blob/1.0.20211029/tunnel/tools/CMakeLists.txt
+
+# --target has to be specified to compiler & linker as e.g. ANDROID_C_COMPILER may just be 'clang' without prefixes
+# CGO_CPPFLAGS are concatenated to CGO_CFLAGS and CGO_CXXFLAGS
+add_custom_target(shared-lib
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../../exports"
+ COMMENT "Building shared library for ${ANDROID_LLVM_TRIPLE}"
+ VERBATIM
+ COMMAND ${MAKE_EXECUTABLE}
+ GOOS=android GOARCH=${GOARCH}
+ CC=${ANDROID_C_COMPILER} CXX=${ANDROID_CXX_COMPILER}
+ CGO_CPPFLAGS=--target=${ANDROID_LLVM_TRIPLE} CGO_CFLAGS=${CMAKE_C_FLAGS} CGO_CXXFLAGS=${CMAKE_CXX_FLAGS}
+ CGO_LDFLAGS=${CMAKE_SHARED_LINKER_FLAGS}\ --target=${ANDROID_LLVM_TRIPLE}
+ COPY_LIB_TO=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+
+# Note about COPY_LIB_TO: this is an easy cross-platform alternative to calling `cp`
+# file(COPY ...) does not work since it runs at the configure stage...
diff --git a/wrappers/java-android/lib/build.gradle b/wrappers/java-android/lib/build.gradle
new file mode 100644
index 0000000..be666aa
--- /dev/null
+++ b/wrappers/java-android/lib/build.gradle
@@ -0,0 +1,107 @@
+import com.android.build.api.dsl.ManagedVirtualDevice
+
+plugins {
+ id 'com.android.library' // Build AAR
+}
+
+android {
+ compileSdk 31
+
+ defaultConfig {
+ minSdk 21
+ targetSdk 31
+ versionCode 1
+ versionName '1.0'
+
+ testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
+
+ consumerProguardFiles 'consumer-rules.pro'
+
+ externalNativeBuild {
+ cmake {
+ // Specify which target we want to build
+ targets 'shared-lib'
+ }
+ }
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ // Support Java 8+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ externalNativeBuild {
+ cmake {
+ version '3.18.1' // See cmake_minimum_required in CMakeLists.txt
+ path 'CMakeLists.txt'
+ }
+ }
+
+ sourceSets {
+ androidTest {
+ // Use same sources & resources for Android instrumented tests as unit tests
+ java.srcDirs = sourceSets.test.java.srcDirs
+ resources.srcDirs = sourceSets.test.resources.srcDirs
+ }
+ }
+
+ task copyTestData(type: Copy, description: 'Copy test_data to test resources') {
+ from('../../../test_data') {
+ exclude '**/*.py', '**/*.sh'
+ }
+ into sourceSets.test.resources.srcDirs[0].toPath().resolve('org/eduvpn/common')
+ }
+
+ // Copy test_data to Java resources before these are processed
+ // (.named does not find all tasks. Task names were obtained with com.dorongold.task-tree plugin)
+ tasks.matching { t ->
+ t.name in [
+ 'processDebugUnitTestJavaRes', 'processReleaseUnitTestJavaRes',
+ 'processDebugAndroidTestJavaRes', 'processReleaseAndroidTestJavaRes']
+ }.all {
+ dependsOn copyTestData
+ }
+
+ // Do not cache unit test results as the shared library may have changed
+ tasks.matching { t -> t.name in ['testDebugUnitTest', 'testReleaseUnitTest'] }.all {
+ outputs.upToDateWhen { false }
+ }
+
+ testOptions {
+ // Display full exceptions and passed tests for unit tests
+ unitTests.all {
+ testLogging {
+ events 'passed', 'skipped', 'failed'
+ exceptionFormat 'full'
+ }
+ }
+
+ devices {
+ pixel2(ManagedVirtualDevice) {
+ device = 'Pixel 2'
+ apiLevel = 30
+ systemImageSource = 'aosp'
+ abi = 'x86_64'
+ }
+ }
+ }
+}
+
+dependencies {
+ implementation 'net.java.dev.jna:jna:5.10.0@aar'
+
+ testImplementation 'commons-io:commons-io:2.11.0'
+ testImplementation 'net.java.dev.jna:jna:5.10.0' // Include jnidispatch library in unit tests
+ testImplementation 'junit:junit:4.+'
+
+ androidTestImplementation 'commons-io:commons-io:2.11.0'
+ androidTestImplementation 'androidx.test:runner:1.4.0'
+}
diff --git a/wrappers/java-android/lib/consumer-rules.pro b/wrappers/java-android/lib/consumer-rules.pro
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/wrappers/java-android/lib/consumer-rules.pro
diff --git a/wrappers/java-android/lib/proguard-rules.pro b/wrappers/java-android/lib/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/wrappers/java-android/lib/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/wrappers/java-android/lib/src/main/AndroidManifest.xml b/wrappers/java-android/lib/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..5a49838
--- /dev/null
+++ b/wrappers/java-android/lib/src/main/AndroidManifest.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest package="org.eduvpn.common">
+
+</manifest>
diff --git a/wrappers/java-android/lib/src/test/java/org/eduvpn/common/VerifyTests.java b/wrappers/java-android/lib/src/test/java/org/eduvpn/common/VerifyTests.java
new file mode 100644
index 0000000..a73ac75
--- /dev/null
+++ b/wrappers/java-android/lib/src/test/java/org/eduvpn/common/VerifyTests.java
@@ -0,0 +1,77 @@
+package org.eduvpn.common;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class VerifyTests {
+ private static byte[] readAll(String resource) throws IOException {
+ try (InputStream stream = VerifyTests.class.getResourceAsStream(resource)) {
+ return IOUtils.toByteArray(stream);
+ }
+ }
+
+ @SuppressWarnings("OptionalGetWithoutIsPresent")
+ @BeforeClass
+ public static void oneTimeSetup() throws IOException {
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(
+ VerifyTests.class.getResourceAsStream("public.key")))) {
+ Discovery.insecureTestingSetExtraKey(reader.lines().reduce((a, b) -> b).get());
+ }
+ }
+
+ @Test
+ public void testValid() throws IOException, VerifyException {
+ Discovery.verify(
+ readAll("server_list.json.minisig"),
+ readAll("server_list.json"),
+ "server_list.json",
+ 0
+ );
+ }
+
+ @Test(expected = InvalidSignatureException.class)
+ public void testInvalidSignature() throws IOException, VerifyException {
+ Discovery.verify(
+ readAll("random.txt"),
+ readAll("server_list.json"),
+ "server_list.json",
+ 0
+ );
+ }
+
+ @Test(expected = InvalidSignatureUnknownKeyException.class)
+ public void testWrongKey() throws IOException, VerifyException {
+ Discovery.verify(
+ readAll("server_list.json.wrong_key.minisig"),
+ readAll("server_list.json"),
+ "server_list.json",
+ 0
+ );
+ }
+
+ @Test(expected = SignatureTooOldException.class)
+ public void testOldSignature() throws IOException, VerifyException {
+ Discovery.verify(
+ readAll("server_list.json.minisig"),
+ readAll("server_list.json"),
+ "server_list.json",
+ Long.MAX_VALUE
+ );
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testUnknownExpectedFile() throws IOException, VerifyException {
+ Discovery.verify(
+ readAll("other_list.json.minisig"),
+ readAll("other_list.json"),
+ "other_list.json",
+ 0
+ );
+ }
+}
diff --git a/wrappers/java-android/settings.gradle b/wrappers/java-android/settings.gradle
new file mode 100644
index 0000000..b603bb3
--- /dev/null
+++ b/wrappers/java-android/settings.gradle
@@ -0,0 +1,9 @@
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+rootProject.name = 'eduvpn_common'
+include ':lib'
diff --git a/wrappers/java/.gitignore b/wrappers/java/.gitignore
deleted file mode 100644
index b83d222..0000000
--- a/wrappers/java/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target/
diff --git a/wrappers/java/Makefile b/wrappers/java/Makefile
deleted file mode 100644
index ebb8103..0000000
--- a/wrappers/java/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-.PHONY: build pack test clean
-
-EXPORTS_PATH ?= ../../exports
-include $(EXPORTS_PATH)/common.mk
-
-build:
- mvn --no-transfer-progress compile -DEXPORTS_LIB_PATH="$(EXPORTS_LIB_PATH)"
-
-pack:
- mvn --no-transfer-progress package -DEXPORTS_LIB_PATH="$(EXPORTS_LIB_PATH)"
-
-test: .try_build_lib
- mvn --no-transfer-progress test -DEXPORTS_LIB_PATH="$(EXPORTS_LIB_PATH)"
-
-clean:
- rm -rf target/
diff --git a/wrappers/java/README.md b/wrappers/java/README.md
deleted file mode 100644
index e19075b..0000000
--- a/wrappers/java/README.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# Java wrapper
-
-## Requirements
-
-You will need to install JDK 8 or later ([Adoptium](https://adoptium.net/)
-or [Oracle](https://www.oracle.com/java/technologies/downloads/)). To easily compile the project, you should
-download [Maven](https://maven.apache.org/).
-
-## Build & test
-
-First build the shared Go library. Next:
-
-Build `EduVpnCommon`:
-
-```shell
-make
-```
-
-Build as JAR, including shared Go library:
-
-```shell
-make pack
-```
-
-The JAR will include all versions of the library that are built in the `exports` folder.
-
-If you do not build this as part of the full repository, specify `EXPORTS_PATH="path/to/exports-folder"`
-when calling make. This folder must contain `common.mk` and the `lib/` folder with built libraries.
-
-Test:
-
-```shell
-make test
-```
diff --git a/wrappers/java/pom.xml b/wrappers/java/pom.xml
deleted file mode 100644
index 520bd34..0000000
--- a/wrappers/java/pom.xml
+++ /dev/null
@@ -1,106 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>nl.eduvpn.common</groupId>
- <version>0.1.0</version>
- <packaging>jar</packaging>
-
- <artifactId>eduvpncommon</artifactId>
- <name>eduVPN common library</name>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
-
- <EXPORTS_LIB_PATH>../../exports/lib</EXPORTS_LIB_PATH>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>net.java.dev.jna</groupId>
- <artifactId>jna</artifactId>
- <version>5.10.0</version>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>5.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>5.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <resources>
- <!-- See com.sun.jna.Platform#getNativeLibraryResourcePrefix -->
-
- <resource>
- <directory>${EXPORTS_LIB_PATH}/linux/amd64</directory>
- <includes>
- <include>*.so</include>
- </includes>
- <targetPath>linux-x86-64</targetPath>
- </resource>
- <resource>
- <directory>${EXPORTS_LIB_PATH}/linux/arm</directory>
- <includes>
- <include>*.so</include>
- </includes>
- <targetPath>linux-arm</targetPath>
- </resource>
- <resource>
- <directory>${EXPORTS_LIB_PATH}/linux/arm64</directory>
- <includes>
- <include>*.so</include>
- </includes>
- <targetPath>linux-arm64</targetPath>
- </resource>
-
- <resource>
- <directory>${EXPORTS_LIB_PATH}/windows/amd64</directory>
- <includes>
- <include>*.dll</include>
- </includes>
- <targetPath>win32-x86-64</targetPath>
- </resource>
- <resource>
- <directory>${EXPORTS_LIB_PATH}/windows/386</directory>
- <includes>
- <include>*.dll</include>
- </includes>
- <targetPath>win32-x86</targetPath>
- </resource>
- <resource>
- <directory>${EXPORTS_LIB_PATH}/windows/arm</directory>
- <includes>
- <include>*.dll</include>
- </includes>
- <targetPath>win32-arm</targetPath>
- </resource>
- <resource>
- <directory>${EXPORTS_LIB_PATH}/windows/arm64</directory>
- <includes>
- <include>*.dll</include>
- </includes>
- <targetPath>win32-arm64</targetPath>
- </resource>
- </resources>
-
- <plugins>
- <plugin>
- <!-- Test adapter -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.22.1</version>
- </plugin>
- </plugins>
- </build>
-</project>
-
diff --git a/wrappers/java/src/test/java/nl/eduvpn/common/VerifyTests.java b/wrappers/java/src/test/java/nl/eduvpn/common/VerifyTests.java
deleted file mode 100644
index a82c019..0000000
--- a/wrappers/java/src/test/java/nl/eduvpn/common/VerifyTests.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package nl.eduvpn.common;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.time.Instant;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-class VerifyTests {
- private static final Path testDataDir = Paths.get("../../test_data");
-
- @SuppressWarnings("OptionalGetWithoutIsPresent")
- @BeforeAll
- static void oneTimeSetup() throws IOException {
- Discovery.insecureTestingSetExtraKey(Files.lines(testDataDir.resolve("public.key")).reduce((a, b) -> b).get());
- }
-
- @Test
- void testValid() {
- assertDoesNotThrow(() ->
- Discovery.verify(
- Files.readAllBytes(testDataDir.resolve("server_list.json.minisig")),
- Files.readAllBytes(testDataDir.resolve("server_list.json")),
- "server_list.json",
- Instant.EPOCH
- ));
- }
-
- @Test
- void testInvalidSignature() {
- assertThrows(InvalidSignatureException.class, () ->
- Discovery.verify(
- Files.readAllBytes(testDataDir.resolve("random.txt")),
- Files.readAllBytes(testDataDir.resolve("server_list.json")),
- "server_list.json",
- Instant.EPOCH
- ));
- }
-
- @Test
- void testWrongKey() {
- assertThrows(InvalidSignatureUnknownKeyException.class, () ->
- Discovery.verify(
- Files.readAllBytes(testDataDir.resolve("server_list.json.wrong_key.minisig")),
- Files.readAllBytes(testDataDir.resolve("server_list.json")),
- "server_list.json",
- Instant.EPOCH
- ));
- }
-
- @Test
- void testOldSignature() {
- assertThrows(SignatureTooOldException.class, () ->
- Discovery.verify(
- Files.readAllBytes(testDataDir.resolve("server_list.json.minisig")),
- Files.readAllBytes(testDataDir.resolve("server_list.json")),
- "server_list.json",
- Instant.MAX
- ));
- }
-
- @Test
- void testUnknownExpectedFile() {
- assertThrows(IllegalArgumentException.class, () ->
- Discovery.verify(
- Files.readAllBytes(testDataDir.resolve("other_list.json.minisig")),
- Files.readAllBytes(testDataDir.resolve("other_list.json")),
- "other_list.json",
- Instant.EPOCH
- ));
- }
-}
diff --git a/wrappers/php/Makefile b/wrappers/php/Makefile
index 5384d92..f24eee7 100644
--- a/wrappers/php/Makefile
+++ b/wrappers/php/Makefile
@@ -10,12 +10,12 @@ ifeq ($(COPY_LIB),1)
COPY_LIB_DIR ?= lib
endif
ifneq ($(COPY_LIB_DIR),)
-COPY_LIB_DIR := $(COPY_LIB_DIR)/
+override COPY_LIB_DIR := $(COPY_LIB_DIR)/
endif
# Strip / replace elements confusing PHP's limited C parser: __SIZE_TYPE__, _Complex, extern "C"
# Also add FFI_LIB library name, see https://www.php.net/manual/en/ffi.load
-install-header: .try_build_lib
+install-header: .try-build-lib
mkdir -p src/headers
sed --null-data \
-e 's/DO NOT EDIT/Modified for PHP/' \
@@ -47,4 +47,7 @@ install-dev-dependencies:
$(COMPOSER) check-platform-reqs
clean:
- rm -rf vendor/ .phpunit* src/headers/*.h lib/*
+ rm -rf .phpunit* src/headers/*.h lib/*
+ifeq ($(CLEAN_ALL),1)
+ rm -rf vendor/
+endif
diff --git a/wrappers/php/src/Discovery.php b/wrappers/php/src/Discovery.php
index 322d621..99464f9 100644
--- a/wrappers/php/src/Discovery.php
+++ b/wrappers/php/src/Discovery.php
@@ -32,8 +32,8 @@ final class Discovery
* @param string $signedJson Signed .json file contents.
* @param string $expectedFileName The file type to be verified, one of "server_list.json" or
* "organization_list.json".
- * @param int $minSignTime Minimum time for signature. Should be set to at least the time of the previous
- * signature.
+ * @param int $minSignTime Minimum time for signature (UNIX timestamp, seconds). Should be set to at least
+ * the time of the previous signature.
* @return void
* @throws InvalidArgumentException If expectedFileName is not one of the allowed values.
* @throws VerifyException If signature verification fails.
diff --git a/wrappers/python/.gitignore b/wrappers/python/.gitignore
index aec5943..5f1f002 100644
--- a/wrappers/python/.gitignore
+++ b/wrappers/python/.gitignore
@@ -3,3 +3,4 @@
*.egg-info/
/eduvpncommon/lib/*
__pycache__/
+venv/
diff --git a/wrappers/python/Makefile b/wrappers/python/Makefile
index f46f06d..fd81cd9 100644
--- a/wrappers/python/Makefile
+++ b/wrappers/python/Makefile
@@ -4,17 +4,20 @@ EXPORTS_PATH ?= ../../exports
include $(EXPORTS_PATH)/common.mk
ifdef PLAT_NAME
-SETUP_ARGS += --plat-name=$(PLAT_NAME)
+override SETUP_ARGS += --plat-name=$(PLAT_NAME)
endif
# Build for current platform only
pack:
./setup.py bdist_wheel $(SETUP_ARGS) --exports-lib-path="$(EXPORTS_LIB_PATH)"
-test: .try_build_lib
+test: .try-build-lib
install "$(EXPORTS_LIB_SUBFOLDER_PATH)/$(LIB_FILE)" -Dt "eduvpncommon/lib"
python3 -m unittest test_discovery
rm eduvpncommon/lib/*
clean:
rm -rf build/ dist/ *.egg-info/ lib/*
+ifeq ($(CLEAN_ALL),1)
+ rm -rf venv/
+endif
diff --git a/wrappers/python/eduvpncommon/discovery.py b/wrappers/python/eduvpncommon/discovery.py
index f22df58..50bcc9e 100644
--- a/wrappers/python/eduvpncommon/discovery.py
+++ b/wrappers/python/eduvpncommon/discovery.py
@@ -71,7 +71,7 @@ def verify(signature: bytes, signed_json: bytes, expected_file_name: str, min_si
:param signature: .minisig signature file contents.
:param signed_json: Signed .json file contents.
:param expected_file_name: The file type to be verified, one of "server_list.json" or "organization_list.json".
- :param min_sign_time: Minimum time for signature. Should be set to at least the time of the previous signature.
+ :param min_sign_time: Minimum time for signature (UNIX timestamp, seconds). Should be set to at least the time of the previous signature.
:raises VerifyException: If signature verification fails or expectedFileName is not one of the allowed values.
"""
diff --git a/wrappers/swift/Makefile b/wrappers/swift/Makefile
index 6dca0ef..08171b6 100644
--- a/wrappers/swift/Makefile
+++ b/wrappers/swift/Makefile
@@ -15,7 +15,7 @@ build: install-header
test: install-header
$(SWIFT) test --parallel -Xlinker -L"$(EXPORTS_LIB_SUBFOLDER_PATH)"
-install-header: .try_build_lib
+install-header: .try-build-lib
install "$(EXPORTS_LIB_SUBFOLDER_PATH)/$(LIB_NAME).h" -Dt CEduVpnCommon/Sources/CEduVpnCommon/Headers # Copy header for modulemap
clean: