This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Break project up into Java and Android build/test.
- Loading branch information
Showing
102 changed files
with
470 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/build | ||
build | ||
/obj | ||
*.iml | ||
.gradle | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:1.0.0' | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'maven' | ||
apply plugin: 'signing' | ||
|
||
archivesBaseName = "axolotl-android" | ||
version = version_number | ||
group = group_info | ||
|
||
android { | ||
compileSdkVersion 21 | ||
buildToolsVersion "21.1.2" | ||
|
||
sourceSets { | ||
androidTest { | ||
java.srcDirs = ['src/androidTest/java', project(':tests').file('src/main/java')] | ||
} | ||
} | ||
|
||
libraryVariants.all { variant -> | ||
variant.outputs.each { output -> | ||
def outputFile = output.outputFile | ||
if (outputFile != null && outputFile.name.endsWith('.aar')) { | ||
def fileName = "${archivesBaseName}-${version}.aar" | ||
output.outputFile = new File(outputFile.parent, fileName) | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
|
||
dependencies { | ||
compile "org.whispersystems:curve25519-android:${curve25519_version}" | ||
compile (project(':java')) { | ||
exclude group: 'org.whispersystems', module: 'curve25519-java' | ||
} | ||
} | ||
|
||
signing { | ||
required { has("release") && gradle.taskGraph.hasTask("uploadArchives") } | ||
sign configurations.archives | ||
} | ||
|
||
uploadArchives { | ||
configuration = configurations.archives | ||
repositories.mavenDeployer { | ||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
|
||
repository(url: sonatypeRepo) { | ||
authentication(userName: whisperSonatypeUsername, password: whisperSonatypePassword) | ||
} | ||
|
||
pom.project { | ||
name 'axolotl-android' | ||
packaging 'aar' | ||
description 'Axolotl library for Android' | ||
url 'https://github.com/WhisperSystems/libaxolotl-android' | ||
|
||
scm { | ||
url 'scm:git@github.com:WhisperSystems/libaxolotl-android.git' | ||
connection 'scm:git@github.com:WhisperSystems/libaxolotl-android.git' | ||
developerConnection 'scm:git@github.com:WhisperSystems/libaxolotl-android.git' | ||
} | ||
|
||
developers { | ||
developer { | ||
name 'Moxie Marlinspike' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task installArchives(type: Upload) { | ||
description "Installs the artifacts to the local Maven repository." | ||
configuration = configurations['archives'] | ||
repositories { | ||
mavenDeployer { | ||
repository url: "file://${System.properties['user.home']}/.m2/repository" | ||
} | ||
} | ||
} | ||
|
26 changes: 26 additions & 0 deletions
26
android/src/androidTest/java/org/whispersystems/libaxolotl/CurveTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.whispersystems.libaxolotl; | ||
|
||
import junit.framework.TestCase; | ||
|
||
import org.whispersystems.libaxolotl.ecc.Curve; | ||
import org.whispersystems.libaxolotl.ecc.ECKeyPair; | ||
|
||
public class CurveTest extends TestCase { | ||
|
||
public void testPureJava() { | ||
assertTrue(Curve.isNative()); | ||
} | ||
|
||
public void testSignatureOverflow() throws InvalidKeyException { | ||
ECKeyPair keys = Curve.generateKeyPair(); | ||
byte[] message = new byte[4096]; | ||
|
||
try { | ||
byte[] signature = Curve.calculateSignature(keys.getPrivateKey(), message); | ||
throw new InvalidKeyException("Should have asserted!"); | ||
} catch (AssertionError e) { | ||
// Success! | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="org.whispersystems.libaxolotl"> | ||
</manifest> |
24 changes: 24 additions & 0 deletions
24
android/src/main/java/org/whispersystems/libaxolotl/util/AndroidAxolotlLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.whispersystems.libaxolotl.util; | ||
|
||
import android.util.Log; | ||
import android.util.SparseIntArray; | ||
|
||
import org.whispersystems.libaxolotl.logging.AxolotlLogger; | ||
|
||
public class AndroidAxolotlLogger implements AxolotlLogger { | ||
|
||
private static final SparseIntArray PRIORITY_MAP = new SparseIntArray(5) {{ | ||
put(AxolotlLogger.INFO, Log.INFO); | ||
put(AxolotlLogger.ASSERT, Log.ASSERT); | ||
put(AxolotlLogger.DEBUG, Log.DEBUG); | ||
put(AxolotlLogger.VERBOSE, Log.VERBOSE); | ||
put(AxolotlLogger.WARN, Log.WARN); | ||
|
||
}}; | ||
|
||
@Override | ||
public void log(int priority, String tag, String message) { | ||
int androidPriority = PRIORITY_MAP.get(priority, Log.WARN); | ||
Log.println(androidPriority, tag, message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,19 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:1.0.0' | ||
classpath files('libs/gradle-witness.jar') | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'witness' | ||
apply plugin: 'maven' | ||
apply plugin: 'signing' | ||
|
||
archivesBaseName = "axolotl-android" | ||
version = "1.0.0" | ||
group = "org.whispersystems" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compile 'com.google.protobuf:protobuf-java:2.5.0' | ||
} | ||
|
||
dependencyVerification { | ||
verify = [ | ||
'com.google.protobuf:protobuf-java:e0c1c64575c005601725e7c6a02cebf9e1285e888f756b2a1d73ffa8d725cc74', | ||
] | ||
} | ||
|
||
android { | ||
compileSdkVersion 21 | ||
buildToolsVersion '21.1.1' | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_7 | ||
targetCompatibility JavaVersion.VERSION_1_7 | ||
} | ||
|
||
android { | ||
sourceSets { | ||
main { | ||
jniLibs.srcDirs = ['libs'] | ||
} | ||
} | ||
} | ||
|
||
libraryVariants.all { variant -> | ||
variant.outputs.each { output -> | ||
def outputFile = output.outputFile | ||
if (outputFile != null && outputFile.name.endsWith('.aar')) { | ||
def fileName = "${archivesBaseName}-${version}.aar" | ||
output.outputFile = new File(outputFile.parent, fileName) | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
required { has("release") && gradle.taskGraph.hasTask("uploadArchives") } | ||
sign configurations.archives | ||
} | ||
|
||
uploadArchives { | ||
configuration = configurations.archives | ||
repositories.mavenDeployer { | ||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
subprojects { | ||
apply plugin: 'witness' | ||
|
||
repository(url: sonatypeRepo) { | ||
authentication(userName: whisperSonatypeUsername, password: whisperSonatypePassword) | ||
} | ||
|
||
pom.project { | ||
name 'axolotl-android' | ||
packaging 'aar' | ||
description 'Axolotl encryption library for Android' | ||
url 'https://github.com/WhisperSystems/libaxolotl-android' | ||
|
||
scm { | ||
url 'scm:git@github.com:WhisperSystems/libaxolotl-android.git' | ||
connection 'scm:git@github.com:WhisperSystems/libaxolotl-android.git' | ||
developerConnection 'scm:git@github.com:WhisperSystems/libaxolotl-android.git' | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'GPLv3' | ||
url 'https://www.gnu.org/licenses/gpl-3.0.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
name 'Moxie Marlinspike' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
ext.version_number = "1.0.1" | ||
ext.group_info = "org.whispersystems" | ||
ext.curve25519_version = "0.1.3" | ||
|
||
tasks.whenTaskAdded { task -> | ||
if (task.name.equals("lint")) { | ||
task.enabled = false | ||
dependencyVerification { | ||
verify = [ | ||
'com.google.protobuf:protobuf-java:e0c1c64575c005601725e7c6a02cebf9e1285e888f756b2a1d73ffa8d725cc74', | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
apply plugin: 'java' | ||
apply plugin: 'maven' | ||
apply plugin: 'signing' | ||
|
||
sourceCompatibility = 1.7 | ||
archivesBaseName = "axolotl-java" | ||
version = version_number | ||
group = group_info | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
|
||
sourceSets { | ||
test { | ||
java { | ||
srcDirs = ['src/test/java/', project(':tests').file('src/main/java')] | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile "org.whispersystems:curve25519-java:${curve25519_version}" | ||
compile 'com.google.protobuf:protobuf-java:2.5.0' | ||
|
||
testCompile ('junit:junit:3.8.2') | ||
} | ||
|
||
|
||
test { | ||
testLogging { | ||
events 'passed' | ||
showStandardStreams = true | ||
} | ||
|
||
include 'org/whispersystems/**' | ||
} | ||
|
||
signing { | ||
required { has("release") && gradle.taskGraph.hasTask("uploadArchives") } | ||
sign configurations.archives | ||
} | ||
|
||
uploadArchives { | ||
configuration = configurations.archives | ||
repositories.mavenDeployer { | ||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
|
||
repository(url: sonatypeRepo) { | ||
authentication(userName: whisperSonatypeUsername, password: whisperSonatypePassword) | ||
} | ||
|
||
pom.project { | ||
name 'axolotl-java' | ||
packaging 'jar' | ||
description 'Axolotl library for Java' | ||
url 'https://github.com/WhisperSystems/libaxolotl-android' | ||
|
||
scm { | ||
url 'scm:git@github.com:WhisperSystems/libaxolotl-android.git' | ||
connection 'scm:git@github.com:WhisperSystems/libaxolotl-android.git' | ||
developerConnection 'scm:git@github.com:WhisperSystems/libaxolotl-android.git' | ||
} | ||
|
||
developers { | ||
developer { | ||
name 'Moxie Marlinspike' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task installArchives(type: Upload) { | ||
description "Installs the artifacts to the local Maven repository." | ||
configuration = configurations['archives'] | ||
repositories { | ||
mavenDeployer { | ||
repository url: "file://${System.properties['user.home']}/.m2/repository" | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...persystems/libaxolotl/SessionBuilder.java → ...persystems/libaxolotl/SessionBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.