diff options
author | Eric Gribkoff <ericgribkoff@google.com> | 2018-01-13 14:30:24 -0800 |
---|---|---|
committer | Eric Gribkoff <ericgribkoff@google.com> | 2018-01-16 09:16:04 -0800 |
commit | c7a5bd7a5c69f95a562dd335b3747c07bf0d328e (patch) | |
tree | d40d408309436ecd77dd872b74b924f1c358115d /cronet | |
parent | 98aa69af7295df22fde75dbfbf05728f0562200e (diff) | |
download | grpc-grpc-java-c7a5bd7a5c69f95a562dd335b3747c07bf0d328e.tar.gz |
cronet: add build.gradle and script for Cronet deps
Diffstat (limited to 'cronet')
-rw-r--r-- | cronet/.gitignore | 1 | ||||
-rw-r--r-- | cronet/README.md | 8 | ||||
-rw-r--r-- | cronet/build.gradle | 60 | ||||
-rwxr-xr-x | cronet/cronet_deps.sh | 6 | ||||
-rw-r--r-- | cronet/proguard-rules.pro | 13 | ||||
-rw-r--r-- | cronet/src/main/AndroidManifest.xml | 2 |
6 files changed, 90 insertions, 0 deletions
diff --git a/cronet/.gitignore b/cronet/.gitignore new file mode 100644 index 000000000..2fd4c3b35 --- /dev/null +++ b/cronet/.gitignore @@ -0,0 +1 @@ +libs/ diff --git a/cronet/README.md b/cronet/README.md index 1103f31f6..d0304aaf3 100644 --- a/cronet/README.md +++ b/cronet/README.md @@ -44,3 +44,11 @@ ExperimentalCronetEngine engine = new ExperimentalCronetEngine.Builder(context /* Android Context */).build(); ManagedChannel channel = CronetChannelBuilder.forAddress("localhost", 8080, engine).build(); ``` + +## Running the tests with Gradle + +To run the gRPC Cronet tests with the included `gradle.build` file, you will +need to first download the Cronet jars and place them in the `libs/` directory. +The included script, `cronet_deps.sh`, will do this automatically but requires +the [gsutil](https://cloud.google.com/storage/docs/gsutil) tool to access files +from Google Cloud Storage. diff --git a/cronet/build.gradle b/cronet/build.gradle new file mode 100644 index 000000000..9a3e43a9d --- /dev/null +++ b/cronet/build.gradle @@ -0,0 +1,60 @@ +apply plugin: 'com.android.library' + +description = "gRPC: Cronet Android" + +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + jcenter() + mavenLocal() + } +} + +android { + compileSdkVersion 27 + defaultConfig { + minSdkVersion 14 + targetSdkVersion 27 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + debug { + minifyEnabled false + } + release { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + testOptions { + unitTests { + includeAndroidResources = true + } + } + lintOptions { + disable 'InvalidPackage' + } +} + +dependencies { + implementation 'io.grpc:grpc-core:1.10.0-SNAPSHOT' // CURRENT_GRPC_VERSION + testImplementation 'io.grpc:grpc-testing:1.10.0-SNAPSHOT' // CURRENT_GRPC_VERSION + + implementation files('libs/cronet_api.jar') + implementation files('libs/cronet_impl_common_java.jar') + + testImplementation 'junit:junit:4.12' + testImplementation 'org.mockito:mockito-core:1.10.19' + testImplementation "org.robolectric:robolectric:3.5.1" +} diff --git a/cronet/cronet_deps.sh b/cronet/cronet_deps.sh new file mode 100755 index 000000000..952f80b1c --- /dev/null +++ b/cronet/cronet_deps.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +mkdir libs +gsutil cp gs://chromium-cronet/android/64.0.3254.0/Release/cronet/cronet_api.jar libs/ +gsutil cp gs://chromium-cronet/android/64.0.3254.0/Release/cronet/cronet_impl_common_java.jar \ + libs/ diff --git a/cronet/proguard-rules.pro b/cronet/proguard-rules.pro new file mode 100644 index 000000000..b671e77af --- /dev/null +++ b/cronet/proguard-rules.pro @@ -0,0 +1,13 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in $ANDROID_HOME/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +-dontwarn org.chromium.** +-dontnote org.chromium.** diff --git a/cronet/src/main/AndroidManifest.xml b/cronet/src/main/AndroidManifest.xml new file mode 100644 index 000000000..5b77412a8 --- /dev/null +++ b/cronet/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="io.grpc.cronet" /> |