cronet: add build.gradle and script for Cronet deps

This commit is contained in:
Eric Gribkoff 2018-01-13 14:30:24 -08:00
parent 98aa69af72
commit c7a5bd7a5c
7 changed files with 91 additions and 0 deletions

View File

@ -65,6 +65,7 @@ $ VERSION_FILES=(
build.gradle
android-interop-testing/app/build.gradle
core/src/main/java/io/grpc/internal/GrpcUtil.java
cronet/build.gradle
examples/build.gradle
examples/pom.xml
examples/android/helloworld/app/build.gradle

1
cronet/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
libs/

View File

@ -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.

60
cronet/build.gradle Normal file
View File

@ -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"
}

6
cronet/cronet_deps.sh Executable file
View File

@ -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/

13
cronet/proguard-rules.pro vendored Normal file
View File

@ -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.**

View File

@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.grpc.cronet" />