1// Copyright (c) 2017 Google, Inc.
2//
3// This software is provided 'as-is', without any express or implied
4// warranty.  In no event will the authors be held liable for any damages
5// arising from the use of this software.
6// Permission is granted to anyone to use this software for any purpose,
7// including commercial applications, and to alter it and redistribute it
8// freely, subject to the following restrictions:
9// 1. The origin of this software must not be misrepresented; you must not
10// claim that you wrote the original software. If you use this software
11// in a product, an acknowledgment in the product documentation would be
12// appreciated but is not required.
13// 2. Altered source versions must be plainly marked as such, and must not be
14// misrepresented as being the original software.
15// 3. This notice may not be removed or altered from any source distribution.
16
17buildscript {
18  repositories {
19    jcenter()
20  }
21  dependencies {
22    classpath 'com.android.tools.build:gradle:2.3.0'
23  }
24}
25
26allprojects {
27  repositories {
28    jcenter()
29  }
30}
31
32apply plugin: 'com.android.application'
33
34android {
35  compileSdkVersion 25
36  buildToolsVersion '25.0.2'
37
38  sourceSets {
39    main {
40      manifest.srcFile 'AndroidManifest.xml'
41      res.srcDirs = ['res']
42    }
43  }
44
45  externalNativeBuild {
46    ndkBuild {
47      path "jni/Android.mk"
48    }
49  }
50
51  defaultConfig {
52    applicationId 'com.samples.FlatBufferSample'
53    // This is the platform API where NativeActivity was introduced.
54    minSdkVersion 9
55    targetSdkVersion 25
56    versionCode 1
57    versionName "1.0"
58
59    buildTypes {
60      release {
61        minifyEnabled false
62      }
63    }
64
65    externalNativeBuild {
66      ndkBuild {
67        targets "FlatBufferSample"
68        arguments "-j" + Runtime.getRuntime().availableProcessors()
69        abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
70      }
71    }
72  }
73
74  lintOptions {
75    abortOnError false
76  }
77
78  // Build with each STL variant.
79  productFlavors {
80    stlport {
81      applicationIdSuffix ".stlport"
82      versionNameSuffix "-stlport"
83      externalNativeBuild {
84        ndkBuild {
85          arguments "APP_STL=stlport_static"
86        }
87      }
88    }
89    gnustl {
90      applicationIdSuffix ".gnustl"
91      versionNameSuffix "-gnustl"
92      externalNativeBuild {
93        ndkBuild {
94          arguments "APP_STL=gnustl_static"
95        }
96      }
97    }
98    libcpp {
99      applicationIdSuffix ".libcpp"
100      versionNameSuffix "-libcpp"
101      externalNativeBuild {
102        ndkBuild {
103          arguments "APP_STL=c++_static"
104        }
105      }
106    }
107  }
108}
109