aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMax Liu <maliu@mozilla.com>2019-11-12 16:05:34 +0800
committerRoger Chuang <lchuang@mozilla.com>2019-11-26 19:13:11 +0800
commitaf652ebfd1860845a0a35e4df62d3ada5aba5a5e (patch)
tree984455830dda2ea132b059556b01f9a929e0a0ac
parentImport libwg and redirect dependency to it (diff)
downloadwireguard-android-af652ebfd1860845a0a35e4df62d3ada5aba5a5e.tar.xz
wireguard-android-af652ebfd1860845a0a35e4df62d3ada5aba5a5e.zip
Extract modules
Signed-off-by: Roger Chuang <lchuang@mozilla.com>
-rw-r--r--app/build.gradle20
-rw-r--r--build.gradle17
-rw-r--r--config/build.gradle46
-rw-r--r--config/consumer-rules.pro0
-rw-r--r--config/proguard-rules.pro21
-rw-r--r--config/src/main/AndroidManifest.xml7
-rw-r--r--config/src/main/java/com/wireguard/config/Attribute.java (renamed from app/src/main/java/com/wireguard/config/Attribute.java)0
-rw-r--r--config/src/main/java/com/wireguard/config/BadConfigException.java (renamed from app/src/main/java/com/wireguard/config/BadConfigException.java)0
-rw-r--r--config/src/main/java/com/wireguard/config/Config.java (renamed from app/src/main/java/com/wireguard/config/Config.java)0
-rw-r--r--config/src/main/java/com/wireguard/config/InetAddresses.java (renamed from app/src/main/java/com/wireguard/config/InetAddresses.java)0
-rw-r--r--config/src/main/java/com/wireguard/config/InetEndpoint.java (renamed from app/src/main/java/com/wireguard/config/InetEndpoint.java)0
-rw-r--r--config/src/main/java/com/wireguard/config/InetNetwork.java (renamed from app/src/main/java/com/wireguard/config/InetNetwork.java)0
-rw-r--r--config/src/main/java/com/wireguard/config/Interface.java (renamed from app/src/main/java/com/wireguard/config/Interface.java)0
-rw-r--r--config/src/main/java/com/wireguard/config/ParseException.java (renamed from app/src/main/java/com/wireguard/config/ParseException.java)0
-rw-r--r--config/src/main/java/com/wireguard/config/Peer.java (renamed from app/src/main/java/com/wireguard/config/Peer.java)2
-rw-r--r--crypto/build.gradle36
-rw-r--r--crypto/consumer-rules.pro0
-rw-r--r--crypto/proguard-rules.pro21
-rw-r--r--crypto/src/main/AndroidManifest.xml7
-rw-r--r--crypto/src/main/java/com/wireguard/crypto/Curve25519.java (renamed from app/src/main/java/com/wireguard/crypto/Curve25519.java)0
-rw-r--r--crypto/src/main/java/com/wireguard/crypto/Key.java (renamed from app/src/main/java/com/wireguard/crypto/Key.java)0
-rw-r--r--crypto/src/main/java/com/wireguard/crypto/KeyFormatException.java (renamed from app/src/main/java/com/wireguard/crypto/KeyFormatException.java)0
-rw-r--r--crypto/src/main/java/com/wireguard/crypto/KeyPair.java (renamed from app/src/main/java/com/wireguard/crypto/KeyPair.java)0
-rw-r--r--libwg/build.gradle4
-rw-r--r--settings.gradle3
-rw-r--r--utility/build.gradle36
-rw-r--r--utility/consumer-rules.pro0
-rw-r--r--utility/proguard-rules.pro21
-rw-r--r--utility/src/main/AndroidManifest.xml7
-rw-r--r--utility/src/main/java/com/wireguard/util/Keyed.java (renamed from app/src/main/java/com/wireguard/util/Keyed.java)0
-rw-r--r--utility/src/main/java/com/wireguard/util/KeyedList.java (renamed from app/src/main/java/com/wireguard/util/KeyedList.java)0
-rw-r--r--utility/src/main/java/com/wireguard/util/NonNullForAll.java (renamed from app/src/main/java/com/wireguard/util/NonNullForAll.java)0
-rw-r--r--utility/src/main/java/com/wireguard/util/SortedKeyedList.java (renamed from app/src/main/java/com/wireguard/util/SortedKeyedList.java)0
33 files changed, 228 insertions, 20 deletions
diff --git a/app/build.gradle b/app/build.gradle
index c4c465de..ea81de62 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -61,25 +61,11 @@ android {
}
}
-ext {
- annotationsVersion = '1.1.0'
- appcompatVersion = '1.1.0'
- cardviewVersion = '1.0.0'
- databindingVersion = '3.5.0'
- materialComponentsVersion = '1.0.0'
- jsr305Version = '3.0.2'
- preferenceVersion = '1.1.0'
- streamsupportVersion = '1.7.1'
- threetenabpVersion = '1.2.1'
- // ZXING switched minSdk to 24 so we cannot upgrade to 4.0.2 without following suit.
- // If you choose to upgrade to minSDK 24 then you should also disable Jetifier from
- // gradle.properties.
- zxingEmbeddedVersion = '3.6.0'
- eddsaVersion = '0.3.0'
-}
-
dependencies {
+ implementation project(':config')
implementation project(':libwg')
+ implementation project(':utility')
+ implementation project(':crypto')
implementation "androidx.annotation:annotation:$annotationsVersion"
implementation "androidx.appcompat:appcompat:$appcompatVersion"
diff --git a/build.gradle b/build.gradle
index 125c4525..c0de4349 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,6 +5,23 @@ allprojects {
}
}
+ext {
+ annotationsVersion = '1.1.0'
+ appcompatVersion = '1.1.0'
+ cardviewVersion = '1.0.0'
+ databindingVersion = '3.5.0'
+ materialComponentsVersion = '1.0.0'
+ jsr305Version = '3.0.2'
+ preferenceVersion = '1.1.0'
+ streamsupportVersion = '1.7.1'
+ threetenabpVersion = '1.2.1'
+ // ZXING switched minSdk to 24 so we cannot upgrade to 4.0.2 without following suit.
+ // If you choose to upgrade to minSDK 24 then you should also disable Jetifier from
+ // gradle.properties.
+ zxingEmbeddedVersion = '3.6.0'
+ eddsaVersion = '0.3.0'
+}
+
buildscript {
ext.kotlin_version = '1.3.50'
diff --git a/config/build.gradle b/config/build.gradle
new file mode 100644
index 00000000..7e1f1e01
--- /dev/null
+++ b/config/build.gradle
@@ -0,0 +1,46 @@
+/*
+ * Copyright © 2019 WireGuard LLC. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 29
+ buildToolsVersion "29.0.2"
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ defaultConfig {
+ minSdkVersion 19
+ targetSdkVersion 29
+ consumerProguardFiles 'consumer-rules.pro'
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+}
+
+dependencies {
+ implementation project(":crypto")
+ implementation project(":utility")
+
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation "androidx.annotation:annotation:$annotationsVersion"
+ implementation "androidx.appcompat:appcompat:$appcompatVersion"
+ implementation 'androidx.core:core-ktx:1.1.0'
+
+ implementation "com.jakewharton.threetenabp:threetenabp:$threetenabpVersion"
+ implementation "net.sourceforge.streamsupport:android-retrofuture:$streamsupportVersion"
+ implementation "com.google.code.findbugs:jsr305:$jsr305Version"
+}
diff --git a/config/consumer-rules.pro b/config/consumer-rules.pro
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/config/consumer-rules.pro
diff --git a/config/proguard-rules.pro b/config/proguard-rules.pro
new file mode 100644
index 00000000..f1b42451
--- /dev/null
+++ b/config/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/config/src/main/AndroidManifest.xml b/config/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..f49264ea
--- /dev/null
+++ b/config/src/main/AndroidManifest.xml
@@ -0,0 +1,7 @@
+<!--
+ ~ Copyright © 2019 WireGuard LLC. All Rights Reserved.
+ ~ SPDX-License-Identifier: Apache-2.0
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.wireguard.config" />
diff --git a/app/src/main/java/com/wireguard/config/Attribute.java b/config/src/main/java/com/wireguard/config/Attribute.java
index 375acc42..375acc42 100644
--- a/app/src/main/java/com/wireguard/config/Attribute.java
+++ b/config/src/main/java/com/wireguard/config/Attribute.java
diff --git a/app/src/main/java/com/wireguard/config/BadConfigException.java b/config/src/main/java/com/wireguard/config/BadConfigException.java
index 6d41b065..6d41b065 100644
--- a/app/src/main/java/com/wireguard/config/BadConfigException.java
+++ b/config/src/main/java/com/wireguard/config/BadConfigException.java
diff --git a/app/src/main/java/com/wireguard/config/Config.java b/config/src/main/java/com/wireguard/config/Config.java
index 62651b08..62651b08 100644
--- a/app/src/main/java/com/wireguard/config/Config.java
+++ b/config/src/main/java/com/wireguard/config/Config.java
diff --git a/app/src/main/java/com/wireguard/config/InetAddresses.java b/config/src/main/java/com/wireguard/config/InetAddresses.java
index d24c5716..d24c5716 100644
--- a/app/src/main/java/com/wireguard/config/InetAddresses.java
+++ b/config/src/main/java/com/wireguard/config/InetAddresses.java
diff --git a/app/src/main/java/com/wireguard/config/InetEndpoint.java b/config/src/main/java/com/wireguard/config/InetEndpoint.java
index a442258e..a442258e 100644
--- a/app/src/main/java/com/wireguard/config/InetEndpoint.java
+++ b/config/src/main/java/com/wireguard/config/InetEndpoint.java
diff --git a/app/src/main/java/com/wireguard/config/InetNetwork.java b/config/src/main/java/com/wireguard/config/InetNetwork.java
index f89322fd..f89322fd 100644
--- a/app/src/main/java/com/wireguard/config/InetNetwork.java
+++ b/config/src/main/java/com/wireguard/config/InetNetwork.java
diff --git a/app/src/main/java/com/wireguard/config/Interface.java b/config/src/main/java/com/wireguard/config/Interface.java
index 54944424..54944424 100644
--- a/app/src/main/java/com/wireguard/config/Interface.java
+++ b/config/src/main/java/com/wireguard/config/Interface.java
diff --git a/app/src/main/java/com/wireguard/config/ParseException.java b/config/src/main/java/com/wireguard/config/ParseException.java
index c79d1fa1..c79d1fa1 100644
--- a/app/src/main/java/com/wireguard/config/ParseException.java
+++ b/config/src/main/java/com/wireguard/config/ParseException.java
diff --git a/app/src/main/java/com/wireguard/config/Peer.java b/config/src/main/java/com/wireguard/config/Peer.java
index 37fcfa69..1890c544 100644
--- a/app/src/main/java/com/wireguard/config/Peer.java
+++ b/config/src/main/java/com/wireguard/config/Peer.java
@@ -1,5 +1,5 @@
/*
- * Copyright © 2017-2019 WireGuard LLC. All Rights Reserved.
+ * Copyright © 2019 WireGuard LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
diff --git a/crypto/build.gradle b/crypto/build.gradle
new file mode 100644
index 00000000..52f15f2e
--- /dev/null
+++ b/crypto/build.gradle
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2019 WireGuard LLC. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 29
+ buildToolsVersion "29.0.2"
+
+ defaultConfig {
+ minSdkVersion 14
+ targetSdkVersion 29
+
+ consumerProguardFiles 'consumer-rules.pro'
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+}
+
+dependencies {
+ implementation project(":utility")
+
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.core:core-ktx:1.1.0'
+}
diff --git a/crypto/consumer-rules.pro b/crypto/consumer-rules.pro
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/crypto/consumer-rules.pro
diff --git a/crypto/proguard-rules.pro b/crypto/proguard-rules.pro
new file mode 100644
index 00000000..f1b42451
--- /dev/null
+++ b/crypto/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/crypto/src/main/AndroidManifest.xml b/crypto/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..f176c159
--- /dev/null
+++ b/crypto/src/main/AndroidManifest.xml
@@ -0,0 +1,7 @@
+<!--
+ ~ Copyright © 2019 WireGuard LLC. All Rights Reserved.
+ ~ SPDX-License-Identifier: Apache-2.0
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.wireguard.crypto" />
diff --git a/app/src/main/java/com/wireguard/crypto/Curve25519.java b/crypto/src/main/java/com/wireguard/crypto/Curve25519.java
index 5622fc5f..5622fc5f 100644
--- a/app/src/main/java/com/wireguard/crypto/Curve25519.java
+++ b/crypto/src/main/java/com/wireguard/crypto/Curve25519.java
diff --git a/app/src/main/java/com/wireguard/crypto/Key.java b/crypto/src/main/java/com/wireguard/crypto/Key.java
index 6648a5f3..6648a5f3 100644
--- a/app/src/main/java/com/wireguard/crypto/Key.java
+++ b/crypto/src/main/java/com/wireguard/crypto/Key.java
diff --git a/app/src/main/java/com/wireguard/crypto/KeyFormatException.java b/crypto/src/main/java/com/wireguard/crypto/KeyFormatException.java
index 5818b4d4..5818b4d4 100644
--- a/app/src/main/java/com/wireguard/crypto/KeyFormatException.java
+++ b/crypto/src/main/java/com/wireguard/crypto/KeyFormatException.java
diff --git a/app/src/main/java/com/wireguard/crypto/KeyPair.java b/crypto/src/main/java/com/wireguard/crypto/KeyPair.java
index f8238e91..f8238e91 100644
--- a/app/src/main/java/com/wireguard/crypto/KeyPair.java
+++ b/crypto/src/main/java/com/wireguard/crypto/KeyPair.java
diff --git a/libwg/build.gradle b/libwg/build.gradle
index 7457573c..843a0d6c 100644
--- a/libwg/build.gradle
+++ b/libwg/build.gradle
@@ -11,7 +11,6 @@ android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
-
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
@@ -32,5 +31,6 @@ android {
}
dependencies {
-
+ implementation "androidx.annotation:annotation:$annotationsVersion"
+ implementation "androidx.appcompat:appcompat:$appcompatVersion"
}
diff --git a/settings.gradle b/settings.gradle
index ba5f5dd7..e821e7df 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,5 @@
include ':app'
include ':libwg'
+include ':config'
+include ':crypto'
+include ':utility'
diff --git a/utility/build.gradle b/utility/build.gradle
new file mode 100644
index 00000000..f4b4e209
--- /dev/null
+++ b/utility/build.gradle
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2019 WireGuard LLC. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 29
+ buildToolsVersion "29.0.2"
+
+ defaultConfig {
+ minSdkVersion 14
+ targetSdkVersion 29
+
+ consumerProguardFiles 'consumer-rules.pro'
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+}
+
+dependencies {
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.core:core-ktx:1.1.0'
+
+ implementation "com.google.code.findbugs:jsr305:$jsr305Version"
+}
diff --git a/utility/consumer-rules.pro b/utility/consumer-rules.pro
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/utility/consumer-rules.pro
diff --git a/utility/proguard-rules.pro b/utility/proguard-rules.pro
new file mode 100644
index 00000000..f1b42451
--- /dev/null
+++ b/utility/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/utility/src/main/AndroidManifest.xml b/utility/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..01cfcfc2
--- /dev/null
+++ b/utility/src/main/AndroidManifest.xml
@@ -0,0 +1,7 @@
+<!--
+ ~ Copyright © 2019 WireGuard LLC. All Rights Reserved.
+ ~ SPDX-License-Identifier: Apache-2.0
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.wireguard.util" />
diff --git a/app/src/main/java/com/wireguard/util/Keyed.java b/utility/src/main/java/com/wireguard/util/Keyed.java
index f31a43a2..f31a43a2 100644
--- a/app/src/main/java/com/wireguard/util/Keyed.java
+++ b/utility/src/main/java/com/wireguard/util/Keyed.java
diff --git a/app/src/main/java/com/wireguard/util/KeyedList.java b/utility/src/main/java/com/wireguard/util/KeyedList.java
index c116c1da..c116c1da 100644
--- a/app/src/main/java/com/wireguard/util/KeyedList.java
+++ b/utility/src/main/java/com/wireguard/util/KeyedList.java
diff --git a/app/src/main/java/com/wireguard/util/NonNullForAll.java b/utility/src/main/java/com/wireguard/util/NonNullForAll.java
index f179fa49..f179fa49 100644
--- a/app/src/main/java/com/wireguard/util/NonNullForAll.java
+++ b/utility/src/main/java/com/wireguard/util/NonNullForAll.java
diff --git a/app/src/main/java/com/wireguard/util/SortedKeyedList.java b/utility/src/main/java/com/wireguard/util/SortedKeyedList.java
index b144fc85..b144fc85 100644
--- a/app/src/main/java/com/wireguard/util/SortedKeyedList.java
+++ b/utility/src/main/java/com/wireguard/util/SortedKeyedList.java