Commit 5aa7caec authored by Ricki Hirner's avatar Ricki Hirner 🐑

First use of dav4android for resource detection

* replaced Apache httplib by gradle version because it will be removed completely anyway
parent 448e0529
[submodule "dav4android"]
path = dav4android
url = [email protected]:bitfireAT/dav4android.git
......@@ -9,13 +9,14 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
compileSdkVersion 23
buildToolsVersion '23.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "at.bitfire.davdroid"
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
}
buildTypes {
......@@ -66,11 +67,13 @@ dependencies {
// dnsjava for querying SRV/TXT records
compile 'dnsjava:dnsjava:2.1.7'
// HttpClient 4.3, Android flavour for WebDAV operations
//compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile project(':lib:httpclient-android')
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
//compile project(':lib:httpclient-android')
// SimpleXML for parsing and generating WebDAV messages
compile('org.simpleframework:simple-xml:2.7.1') {
exclude group: 'stax', module: 'stax-api'
exclude group: 'xpp3', module: 'xpp3'
}
compile project(':dav4android')
}
......@@ -12,10 +12,6 @@
android:versionCode="72" android:versionName="0.8.4.1"
android:installLocation="internalOnly">
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
......
......@@ -9,6 +9,9 @@ package at.bitfire.davdroid;
import net.fortuna.ical4j.model.property.ProdId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Constants {
public static final String
APP_VERSION = "0.8.4.1",
......@@ -18,4 +21,6 @@ public class Constants {
WEB_URL_VIEW_LOGS = "https://github.com/bitfireAT/davdroid/wiki/How-to-view-the-logs";
public static final ProdId ICAL_PRODID = new ProdId("-//bitfire web engineering//DAVdroid " + Constants.APP_VERSION + " (ical4j 2.0-beta1)//EN");
public static final Logger log = LoggerFactory.getLogger("DAVdroid");
}
......@@ -21,19 +21,18 @@ import android.view.ViewGroup;
import android.widget.Toast;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.http.HttpException;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.cert.CertPathValidatorException;
import at.bitfire.dav4android.exception.DavException;
import at.bitfire.dav4android.exception.HttpException;
import at.bitfire.davdroid.R;
import at.bitfire.davdroid.resource.DavResourceFinder;
import at.bitfire.davdroid.resource.LocalTaskList;
import at.bitfire.davdroid.resource.ServerInfo;
import at.bitfire.davdroid.webdav.DavException;
import lombok.Cleanup;
public class QueryServerDialogFragment extends DialogFragment implements LoaderCallbacks<ServerInfo> {
private static final String TAG = "davdroid.QueryServer";
......@@ -113,7 +112,7 @@ public class QueryServerDialogFragment extends DialogFragment implements LoaderC
);
try {
@Cleanup DavResourceFinder finder = new DavResourceFinder(context);
DavResourceFinder finder = new DavResourceFinder(context);
finder.findResources(serverInfo);
} catch (URISyntaxException e) {
serverInfo.setErrorMessage(getContext().getString(R.string.exception_uri_syntax, e.getMessage()));
......@@ -127,9 +126,9 @@ public class QueryServerDialogFragment extends DialogFragment implements LoaderC
Log.e(TAG, "HTTP error while querying server info", e);
serverInfo.setErrorMessage(getContext().getString(R.string.exception_http, e.getLocalizedMessage()));
} catch (DavException e) {
Log.e(TAG, "DAV error while querying server info", e);
serverInfo.setErrorMessage(getContext().getString(R.string.exception_incapable_resource, e.getLocalizedMessage()));
}
Log.e(TAG, "DAV error while querying server info", e);
serverInfo.setErrorMessage(getContext().getString(R.string.exception_incapable_resource, e.getLocalizedMessage()));
}
return serverInfo;
}
......
......@@ -12,13 +12,15 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url 'http://oss.sonatype.org/content/repositories/snapshots'
}
}
}
Subproject commit c8dffb7fa114a3ca46917ac18088cda981f0afd5
#
# Copyright (c) 2013 – 2015 Ricki Hirner (bitfire web engineering).
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0
# which accompanies this distribution, and is available at
# http://www.gnu.org/licenses/gpl.html
#
#Wed Apr 10 15:27:10 PDT 2013
#Fri Oct 09 23:40:23 CEST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-bin.zip
Building HttpComponents Client for Android
============================
(1) Requisites
--------------
Android SDK rev. 17 (4.2.2 or Jelly Bean MR1) or newer is required in order
to compile HttpClient for Android. Android SDK can be downloaded either separately
or bundled with Android Studio.
HttpClient for Android utilizes Gradle as a building and packaging tool.
Version 2.2.1 or later is recommended.
Gradle installation and configuration instructions can be found here:
http://www.gradle.org/
(2) Building artifacts
Set environmental variable ANDROID_HOME to the location of the Android SDK.
Execute the following command in order to build binary, source and javadoc artifacts.
gradle -q assemble
Please note that when building a release version (project version does not have
'-SNAPSHOT' qualifier) one must also provide signing key details in gradle.properties
file in order to be able to sign the artifacts and successfully build the release.
---
signing.keyId=AEAEAEAE
signing.secretKeyRingFile=~/.gnupg/secring.gpg
---
The artifacts can be found in the 'build/libs' folder
build/libs/httpclient-android-<VERSION>.jar
build/libs/httpclient-android-<VERSION>-javadoc.jar
build/libs/httpclient-android-<VERSION>-sources.jar
This diff is collapsed.
Apache HttpComponents HttpClient for Android
Copyright 2005-2014 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
This project contains annotations derived from JCIP-ANNOTATIONS
Copyright (c) 2005 Brian Goetz and Tim Peierls. See http://www.jcip.net
This project represents an effort to provide an implementation of Apache HttpClient, which can be
deployed on Google Android in parallel to the outdated version shipped with platform while
remaining partially API compatible with Apache HttpClient 4.3.
Background
----------
Google Android 1.0 was released with a pre-BETA snapshot of Apache HttpClient 4.0. To coincide with
the first Android release Apache HttpClient 4.0 APIs had to be frozen prematurely, while many of
interfaces and internal structures were still not fully worked out. As Apache HttpClient 4.0 was
maturing the project was expecting Google to incorporate the latest code improvements into their
code tree. Unfortunately it did not happen. Version of Apache HttpClient shipped with Android has
effectively became a fork. Eventually Google decided to discontinue further development of their
fork while refusing to upgrade to the stock version of Apache HttpClient citing compatibility
concerns as a reason for such decision. As a result those Android developers who would like to
continue using Apache HttpClient APIs on Android cannot take advantage of newer features, performance
improvements and bug fixes.
Apache HttpClient 4.3 port for Android is intended to remedy the situation by providing
official releases compatible with Google Android.
Differences with the stock version of Apache HttpClient
----------
(1) Compiled against HttpClient 4.0 APIs.
(2) Commons Logging replaced with Android Logging.
(3) Base64 implementation from Commons Codec replaced with Android Base64.
(4) Android default SSLSocketFactory used by for SSL/TLS connections.
Compatibility notes
----------
(1) HttpClient port for Android is compiled against the official Android SDK and is expected
to be fully compatible with any code consuming HttpClient services through its interface
(HttpClient) rather than the default implementation (DefaultHttpClient).
(2) Code compiled against stock versions of Apache HttpClient 4.3 is not fully compatible with
the HttpClient port for Android. Some of the implementation classes had to be copied (or shaded)
with different names in order to avoid conflicts with the older versions of the same classes
included in the Android runtime. One can increase compatibility with the stock version of
HttpClient by avoiding 'org.apache.http.**.*HC4' classes.
Release 4.3.5.1
-------------------
This release fixes a number of issues related to Android specific modifications made to
the original HttpClient 4.3.5 code used as a base for the Android port.
Please note that as of this release HttpClient disables all versions of SSL (including SSLv3)
in favor of the TLS protocol by default. Those users who wish to continue using SSLv3 need
to explicitly enable support for it.
Users of all versions of Apache HttpClient 4.3 port for Android are advised to upgrade.
Changelog
-------------------
* SSLv3 protocol is disabled by default
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1597] Hostname verifiers incorrectly reject certificates with empty attributes
in the certificate subject
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1591] Invoke Android specific SNI method via reflection
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1566] Fixed broken Base64 encoding in BasicScheme
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1554] RequestConfig has no effect when using Android HttpRequest classes.
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1555] SSL handshake timeout is always zero (infinite).
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1553] Fixed IllegalArgumentException in HttpClientBuilder.build() if system
properties are not used.
Contributed by Oleg Kalnichevski <olegk at apache.org>
/*
* ====================================================================
* 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/>.
*
*/
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'
repositories {
mavenCentral()
}
group = 'org.apache.httpcomponents'
version = HC_VER
ext.isRelease = !version.endsWith('-SNAPSHOT')
ext.inceptionYear = '1999'
android {
// SDK versions and compileOptions adapted to DAVdroid needs
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 22
}
/*compileOptions {
sourceCompatibility JavaVersion.VERSION_1_5
targetCompatibility JavaVersion.VERSION_1_5
}*/
}
configurations {
dist
}
signing {
required { isRelease }
}
ext.sharedManifest = manifest {
attributes (
'Specification-Title': "HttpComponents HttpClient for Android",
'Specification-Version': "$version",
'Specification-Vendor': "The Apache Software Foundation",
'Implementation-Title': "HttpComponents HttpClient for Android",
'Implementation-Version': "$version",
'Implementation-Vendor': "The Apache Software Foundation",
'Implementation-Vendor-Id': "org.apache",
'url': 'http://hc.apache.org/httpcomponents-client'
)
}
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name == 'release') {
task createAndroidJar(type: Jar) {
dependsOn variant.javaCompile
from variant.javaCompile.destinationDir
from 'NOTICE.txt'
from 'LICENSE.txt'
rename '(NOTICE|LICENSE).txt', 'META-INF/$1'
manifest {
from sharedManifest
}
}
task createAndroidSrcJar(type: Jar) {
dependsOn variant.javaCompile
from variant.javaCompile.source
from 'NOTICE.txt'
from 'LICENSE.txt'
rename '(NOTICE|LICENSE).txt', 'META-INF/$1'
classifier = 'sources'
manifest {
from sharedManifest
}
}
task createAndroidJavadoc(type: Javadoc) {
dependsOn variant.javaCompile
source = variant.javaCompile.source
classpath = files(android.plugin.bootClasspath, variant.javaCompile.classpath.files)
title "Apache HttpClient for Android $HC_VER API"
configure (options) {
docTitle "Apache HttpClient for Android $HC_VER API"
bottom "Copyright &copy; ${inceptionYear}-${Calendar.instance.get(Calendar.YEAR)} " +
"<a href=\"http://www.apache.org/\">The Apache Software Foundation</a>. " +
"All rights reserved."
}
}
task createAndroidJavadocJar(type: Jar) {
dependsOn createAndroidJavadoc
from createAndroidJavadoc.destinationDir
from 'NOTICE.txt'
from 'LICENSE.txt'
rename '(NOTICE|LICENSE).txt', 'META-INF/$1'
classifier = 'javadoc'
manifest {
from sharedManifest
}
}
artifacts {
dist createAndroidJar
dist createAndroidSrcJar
dist createAndroidJavadocJar
}
signing {
sign createAndroidJar
sign createAndroidSrcJar
sign createAndroidJavadocJar
}
artifacts {
tasks.withType(Sign) { Sign task ->
task.signatures.each { PublishArtifact artifact ->
dist artifact
}
}
}
}
}
// Deployment tasks
def askPassphrase = {
Console console = System.console()
if (console) {
String password = project.ext.has('signing.password') ? project.ext.'signing.password' : null
String keyId = project.ext.has('signing.keyId') ? project.ext.'signing.keyId' : null
if (keyId && !password) {
char[] raw = console.readPassword("\n> Please provide password for PGP key ${keyId}: ")
project.ext.'signing.password' = new String(raw)
}
}
}
def askCredentials(MavenDeployer mavenDeployer) {
Console console = System.console()
if (console) {
URL url = new URL(mavenDeployer.repository.url)
def auth = mavenDeployer.repository.authentication
if (auth) {
if (!auth.userName || auth.userName == '') {
String username = console.readLine("\n> Please enter user name for repository '${url}': ")
auth.userName = username
}
if (!auth.password || auth.password == '') {
char[] raw = console.readPassword("\n> Please enter password for repository '${url}': ")
auth.password = new String(raw)
}
}
}
}
project.ext.archiveSources = copySpec {
from (project.projectDir) {
include 'src/**'
include '*.txt'
include 'build.gradle'
include 'settings.gradle'
include 'gradle.properties'
}
}
task archiveSrcWin(type: Zip) {
with archiveSources
filter(['eol': org.apache.tools.ant.filters.FixCrLfFilter.CrLf.newInstance('crlf')],
org.apache.tools.ant.filters.FixCrLfFilter)
into "httpcomponents-client-android-$project.version"
classifier = 'src'
baseName = 'httpcomponents-client-android'
version = project.version
}
task archiveSrcUnix(type: Tar) {
with archiveSources
into "httpcomponents-client-android-$project.version"
filter(['eol': org.apache.tools.ant.filters.FixCrLfFilter.CrLf.newInstance('lf')],
org.apache.tools.ant.filters.FixCrLfFilter)
classifier = 'src'
baseName = 'httpcomponents-client-android'
version = project.version
extension = 'tar.gz'
compression = Compression.GZIP
}
task uploadDist(type: Upload) {