|
| 1 | +/* |
| 2 | + * Copyright 2018 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +apply plugin: 'com.android.application' |
| 18 | + |
| 19 | +android { |
| 20 | + compileSdkVersion 27 |
| 21 | + defaultConfig { |
| 22 | + applicationId "com.google.cloud.examples.dlp" |
| 23 | + minSdkVersion 24 |
| 24 | + targetSdkVersion 27 |
| 25 | + versionCode 1 |
| 26 | + versionName "1.0" |
| 27 | + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" |
| 28 | + javaCompileOptions { |
| 29 | + annotationProcessorOptions { |
| 30 | + includeCompileClasspath false |
| 31 | + } |
| 32 | + } |
| 33 | + } |
| 34 | + buildTypes { |
| 35 | + release { |
| 36 | + minifyEnabled false |
| 37 | + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 38 | + } |
| 39 | + } |
| 40 | + dataBinding { |
| 41 | + enabled = true |
| 42 | + } |
| 43 | + compileOptions { |
| 44 | + targetCompatibility 1.8 |
| 45 | + sourceCompatibility 1.8 |
| 46 | + } |
| 47 | + // exclude files that are not needed from the cloud client libraries |
| 48 | + packagingOptions { |
| 49 | + exclude 'META-INF/DEPENDENCIES' |
| 50 | + exclude 'META-INF/LICENSE' |
| 51 | + exclude 'META-INF/LICENSE.txt' |
| 52 | + exclude 'META-INF/license.txt' |
| 53 | + exclude 'META-INF/NOTICE' |
| 54 | + exclude 'META-INF/NOTICE.txt' |
| 55 | + exclude 'META-INF/notice.txt' |
| 56 | + exclude 'META-INF/ASL2.0' |
| 57 | + exclude 'META-INF/INDEX.LIST' |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | +dependencies { |
| 62 | + implementation fileTree(dir: 'libs', include: ['*.jar']) |
| 63 | + implementation 'com.android.support:appcompat-v7:27.1.1' |
| 64 | + |
| 65 | + // include the DLP client library |
| 66 | + implementation 'io.grpc:grpc-okhttp:1.10.0' |
| 67 | + implementation 'com.google.cloud:google-cloud-dlp:0.50.0-beta' |
| 68 | + |
| 69 | + testImplementation 'junit:junit:4.12' |
| 70 | + androidTestImplementation 'com.android.support.test:runner:1.0.2' |
| 71 | + androidTestImplementation 'com.android.support.test:rules:1.0.2' |
| 72 | + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' |
| 73 | +} |
| 74 | + |
| 75 | +task copySecretKey(type: Copy) { |
| 76 | + File secretKey = file "$System.env.GOOGLE_APPLICATION_CREDENTIALS" |
| 77 | + from secretKey.getParent() |
| 78 | + include secretKey.getName() |
| 79 | + into 'src/main/res/raw' |
| 80 | + rename secretKey.getName(), "credential.json" |
| 81 | +} |
| 82 | +preBuild.dependsOn(copySecretKey) |
0 commit comments