Skip to content

Commit

Permalink
Fix some build script issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
schwabe committed Jan 31, 2018
1 parent caf61e0 commit 7ff484b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
10 changes: 8 additions & 2 deletions main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ task ("generateOpenVPN3Swig" ,type:Exec) {
doFirst {
mkdir openvpn3SwigFiles
}
commandLine "swig", "-outdir", openvpn3SwigFiles, "-c++", "-java", "-package", "net.openvpn.ovpn3",
"-Isrc/main/cpp/openvpn3/client", "-Isrc/main/cpp/openvpn3/", "src/main/cpp/openvpn3/javacli/ovpncli.i"
commandLine "swig", "-outdir", openvpn3SwigFiles, "-outcurrentdir", "-c++", "-java", "-package", "net.openvpn.ovpn3",
"-Isrc/main/cpp/openvpn3/client", "-Isrc/main/cpp/openvpn3/",
"-o", "${openvpn3SwigFiles}/ovpncli_wrap.cxx", "-oh", "${openvpn3SwigFiles}/ovpncli_wrap.h",
"src/main/cpp/openvpn3/javacli/ovpncli.i"

}

android {
Expand Down Expand Up @@ -108,10 +111,13 @@ android {
productFlavors {
noovpn3 {
dimension "implementation"
buildConfigField 'boolean', 'openvpn3', 'false'
}

normal {
dimension "implementation"
buildConfigField 'boolean', 'openvpn3', 'true'

}

}
Expand Down
14 changes: 10 additions & 4 deletions main/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ include(openssl.cmake)
#-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/arne/software/icsopenvpn/main/build/intermediates/cmake/normal/debug/obj/arm64-v8a
if (NOT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} MATCHES "build/intermediates/cmake/.*noovpn3.*/")
add_subdirectory(mbedtls)
add_custom_command(OUTPUT "openvpn3/javacli/ovpncli_wrap.cxx"
COMMAND ${CMAKE_COMMAND} -E make_directory ovpn3/java/net/openvpn/ovpn3/
COMMAND swig -outdir ovpn3/java/net/openvpn/ovpn3/ -c++ -java -package net.openvpn.ovpn3 -I${CMAKE_SOURCE_DIR}/openvpn3/client -I${CMAKE_SOURCE_DIR}/openvpn3 ${CMAKE_SOURCE_DIR}/openvpn3/javacli/ovpncli.i)
add_custom_command(OUTPUT "ovpncli_wrap.cxx"
COMMAND ${CMAKE_COMMAND} -E make_directory ovpn3
COMMAND swig -outdir ovpn3
-c++
-java -package net.openvpn.ovpn3
-outcurrentdir
-I${CMAKE_SOURCE_DIR}/openvpn3/client
-I${CMAKE_SOURCE_DIR}/openvpn3
${CMAKE_SOURCE_DIR}/openvpn3/javacli/ovpncli.i)

set(ovpn3_SRCS
openvpn3/client/ovpncli.cpp
openvpn3/javacli/ovpncli_wrap.cxx)
ovpncli_wrap.cxx)

add_library(ovpn3 SHARED ${ovpn3_SRCS})

Expand Down
2 changes: 1 addition & 1 deletion main/src/main/java/de/blinkt/openvpn/VpnProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ private void moveOptionsToConnection() {
public static boolean doUseOpenVPN3(Context c) {
SharedPreferences prefs = Preferences.getDefaultSharedPreferences(c);
boolean useOpenVPN3 = prefs.getBoolean("ovpn3", false);
if ("noovpn3".equals(BuildConfig.FLAVOR))
if (!BuildConfig.openvpn3)
useOpenVPN3 = false;
return useOpenVPN3;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ public void onCreate(Bundle savedInstanceState) {
if(devHacks.getPreferenceCount()==0)
getPreferenceScreen().removePreference(devHacks);

if (!"ovpn3".equals(BuildConfig.FLAVOR)) {
if (!BuildConfig.openvpn3) {
PreferenceCategory appBehaviour = (PreferenceCategory) findPreference("app_behaviour");
appBehaviour.removePreference(findPreference("ovpn3"));
CheckBoxPreference ovpn3 = (CheckBoxPreference) findPreference("ovpn3");
ovpn3.setEnabled(false);
ovpn3.setChecked(false);
}


Expand Down

0 comments on commit 7ff484b

Please sign in to comment.