1/*
2 * Copyright (C) 2017 The Android Open Source Project
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 *      http://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
17apply plugin: 'java'
18apply plugin: 'org.anarres.jarjar'
19apply plugin: 'maven'
20
21ext {
22    flatbuffersDir = '../../flatbuffers'
23}
24
25buildscript {
26    boolean unbundleBuild = (new File("unbundled-build")).exists()
27    repositories {
28        maven { url '../../../prebuilts/androidx/external' }
29        if (unbundleBuild) {
30            jcenter()
31        }
32    }
33
34    dependencies {
35        classpath 'org.anarres.jarjar:jarjar-gradle:1.0.1'
36    }
37}
38
39sourceSets {
40    main {
41        java.srcDirs = ['src/java']
42    }
43}
44
45compileJava {
46    sourceCompatibility = JavaVersion.VERSION_1_7
47    targetCompatibility = JavaVersion.VERSION_1_7
48}
49
50dependencies {
51    compile 'com.google.flatbuffers:flatbuffers-java:1.8.0'
52}
53
54jarjar.repackage('rename') {
55    destinationName "noto-emoji-compat-java.jar"
56    from 'com.google.flatbuffers:flatbuffers-java:1.8.0'
57    from files(sourceSets.main.output.classesDirs)
58    dependsOn sourceSets.main.output
59    classRename 'com.google.flatbuffers.**', 'androidx.text.emoji.flatbuffer.@1'
60}
61
62configurations {
63    parser
64}
65
66artifacts {
67    parser(rename.destinationPath) {
68        name 'noto-emoji-compat'
69        type 'jar'
70        builtBy rename
71    }
72}
73
74// The "javadoc" task is unused so we don't want it to appear in the output of `./gradlew tasks`
75// So, we set the group to null
76tasks["javadoc"].group = null
77