/
build.gradle
106 lines (95 loc) · 2.72 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// To use, run:
// $ gradle updateDependencies
//
// This script downloads the embedding dependencies into a lib/ directory,
// extract jar files from AARs, so they can be used in gn.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:3.5.0"
}
}
plugins {
id "com.github.hierynomus.license-report" version "0.16.1"
}
def destinationDir = "lib"
allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: "com.android.application"
android {
compileSdkVersion 34
}
configurations {
embedding
}
println project.buildDir
// Configure the embedding dependencies.
// NB: '../../androidx/configure.gradle' is expected to resolve to the path
// 'src/flutter/tools/androidx', and '../../..' is expected to resolve to the
// path 'src/flutter'.
apply from: new File(rootDir, '../../androidx/configure.gradle').absolutePath;
configureEmbedderDependencies(new File(rootDir, '../../..')) { dependency ->
dependencies {
embedding "$dependency"
}
}
task updateDependencies() {
delete destinationDir
// Copy the dependencies from the compileOnly configuration into
// the destination directory.
copy {
from configurations.embedding
into destinationDir
}
doLast {
// Extract classes.jar from aar and rename it as the dependency name .jar
// since javac doesn't support AARs.
fileTree(destinationDir)
.filter { it.name.endsWith(".aar") }
.collect { aarDependency ->
def dependencyName = "${aarDependency.name.take(aarDependency.name.lastIndexOf('.'))}";
copy {
into destinationDir
from(zipTree(aarDependency)) {
include "classes.jar"
}
rename "classes.jar", "${dependencyName}.jar"
}
delete aarDependency
}
}
doLast {
fileTree(destinationDir)
.collect { dependency ->
println "\"//third_party/robolectric/lib/${dependency.name}\","
}
}
}
downloadLicenses {
ext.apacheTwo = license(
'The Apache License, Version 2.0',
'http://www.apache.org/licenses/LICENSE-2.0.txt',
)
aliases = [
(apacheTwo) : [
'The Apache Software License, Version 2.0',
'Apache 2',
'Apache License Version 2.0',
'Apache License, Version 2.0',
'Apache License 2.0',
license('Apache License', 'http://www.apache.org/licenses/LICENSE-2.0'),
license('Apache License, Version 2.0', 'http://opensource.org/licenses/Apache-2.0'),
],
]
dependencyConfiguration = 'embedding'
}