mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2024-12-22 13:35:35 +01:00
removed ndk dependency
that should speed up build process
This commit is contained in:
parent
675949a528
commit
2b9def4c6b
@ -43,7 +43,6 @@ cache:
|
||||
|
||||
before_install:
|
||||
- ./travis/scripts/extract_private_build_config.sh
|
||||
- ./travis/scripts/install_android_ndk.sh
|
||||
- export PATH=$HOME/.local/bin:$PATH
|
||||
- pip install -r ./travis/configs/requirements.txt --user
|
||||
|
||||
|
@ -15,5 +15,4 @@
|
||||
# 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
|
||||
android.useDeprecatedNdk=true
|
||||
# org.gradle.parallel=true
|
@ -27,10 +27,6 @@ android {
|
||||
versionName "0.3.0"
|
||||
multiDexEnabled true
|
||||
|
||||
ndk {
|
||||
ldLibs 'log'
|
||||
}
|
||||
|
||||
buildConfigField 'boolean', 'ENABLE_MEDIA_VIEWER', 'Boolean.parseBoolean("true")'
|
||||
|
||||
}
|
||||
@ -111,6 +107,7 @@ dependencies {
|
||||
compile 'com.github.mariotaku:PickNCrop:0.9.2'
|
||||
compile 'com.github.mariotaku.RestFu:library:0.9.11'
|
||||
compile 'com.github.mariotaku.RestFu:okhttp:0.9.11'
|
||||
compile 'com.github.mariotaku:InetAddressJni:0.9.1'
|
||||
compile 'com.diogobernardino:williamchart:2.1'
|
||||
compile 'com.lnikkila:extendedtouchview:0.1.0'
|
||||
compile 'com.google.dagger:dagger:2.0.2'
|
||||
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* ====================================================================
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
package org.mariotaku.twidere.util.net;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
||||
/**
|
||||
* A collection of utilities relating to InetAddresses.
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public class InetAddressUtils {
|
||||
|
||||
static {
|
||||
System.loadLibrary("twidere");
|
||||
}
|
||||
|
||||
private InetAddressUtils() {
|
||||
throw new AssertionError("Trying to instantiate this class");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param input IP address in string
|
||||
* @return type corresponding to <sys/socket.h>
|
||||
*/
|
||||
public native static int getInetAddressType(final String input);
|
||||
|
||||
@Nullable
|
||||
public native static InetAddress getResolvedIPAddress(@Nullable final String host, @NonNull final String address);
|
||||
}
|
@ -22,6 +22,7 @@ package org.mariotaku.twidere.util.net;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.mariotaku.inetaddrjni.library.InetAddressUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
@ -33,6 +33,7 @@ import com.squareup.okhttp.Dns;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.mariotaku.inetaddrjni.library.InetAddressUtils;
|
||||
import org.mariotaku.twidere.BuildConfig;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.util.SharedPreferencesWrapper;
|
||||
|
@ -1,56 +0,0 @@
|
||||
#include <jni.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <string.h>
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_mariotaku_twidere_util_net_InetAddressUtils_getInetAddressType(JNIEnv *env, jclass type,
|
||||
jstring input_) {
|
||||
if (input_ == NULL) return AF_UNSPEC;
|
||||
const char *input = (*env)->GetStringUTFChars(env, input_, 0);
|
||||
|
||||
struct sockaddr addr;
|
||||
|
||||
int addr_type = AF_UNSPEC;
|
||||
if (inet_pton(AF_INET, input, &addr) > 0) {
|
||||
addr_type = AF_INET;
|
||||
} else if (inet_pton(AF_INET6, input, &addr) > 0) {
|
||||
addr_type = AF_INET6;
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars(env, input_, input);
|
||||
return addr_type;
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_mariotaku_twidere_util_net_InetAddressUtils_getResolvedIPAddress(JNIEnv *env, jclass type,
|
||||
jstring host_,
|
||||
jstring address_) {
|
||||
if (address_ == NULL) return NULL;
|
||||
|
||||
const char *address = (*env)->GetStringUTFChars(env, address_, 0);
|
||||
|
||||
jclass addressClass = (*env)->FindClass(env, "java/net/InetAddress");
|
||||
jmethodID getByAddressMethod = (*env)->GetStaticMethodID(env, addressClass, "getByAddress",
|
||||
"(Ljava/lang/String;[B)Ljava/net/InetAddress;");
|
||||
|
||||
void *bin_addr = malloc(16);
|
||||
memset(bin_addr, 0, 16);
|
||||
|
||||
jbyteArray data = NULL;
|
||||
if (inet_pton(AF_INET, address, bin_addr) > 0) {
|
||||
data = (*env)->NewByteArray(env, 4);
|
||||
(*env)->SetByteArrayRegion(env, data, 0, 4, (jbyte *) bin_addr);
|
||||
} else if (inet_pton(AF_INET6, address, bin_addr) > 0) {
|
||||
data = (*env)->NewByteArray(env, 16);
|
||||
(*env)->SetByteArrayRegion(env, data, 0, 16, (jbyte *) bin_addr);
|
||||
}
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, address_, address);
|
||||
free(bin_addr);
|
||||
|
||||
if (data) {
|
||||
return (*env)->CallStaticObjectMethod(env, addressClass, getByAddressMethod, host_, data);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user