mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
105 lines
3.2 KiB
Groovy
105 lines
3.2 KiB
Groovy
// 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.
|
|
def destinationDir = "lib"
|
|
|
|
buildscript {
|
|
repositories {
|
|
google()
|
|
jcenter()
|
|
}
|
|
dependencies {
|
|
classpath "com.android.tools.build:gradle:3.5.0"
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
google()
|
|
jcenter()
|
|
}
|
|
}
|
|
|
|
apply plugin: "com.android.application"
|
|
|
|
configurations {
|
|
// Use this configuration for dependencies required by the embedding.
|
|
embedding
|
|
// Use any of these configurations for dependencies required for testing the embedding.
|
|
embeddingTesting
|
|
embeddingTesting_v16
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion 30
|
|
|
|
dependencies {
|
|
embedding "androidx.annotation:annotation:1.1.0"
|
|
embedding "androidx.fragment:fragment:1.1.0"
|
|
|
|
def lifecycle_version = "2.2.0"
|
|
embedding "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
|
|
embedding "androidx.lifecycle:lifecycle-common:$lifecycle_version"
|
|
embedding "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
|
|
|
|
// Testing
|
|
// TODO(xster): remove these android-all compile time dependencies.
|
|
// Use https://github.com/robolectric/robolectric/blob/master/robolectric/src/main/java/org/robolectric/plugins/LegacyDependencyResolver.java#L24
|
|
// and specify them as runtime dependencies.
|
|
embeddingTesting "org.robolectric:android-all:9-robolectric-4913185-2"
|
|
// Get robolectric shadows for SDK=16 used by PlatformPluginTest.
|
|
embeddingTesting_v16 "org.robolectric:android-all:4.1.2_r1-robolectric-r1"
|
|
embeddingTesting "androidx.fragment:fragment-testing:1.1.0"
|
|
embeddingTesting "org.mockito:mockito-all:1.10.19"
|
|
embeddingTesting ("org.robolectric:robolectric:4.3") {
|
|
// org.hamcrest is added by org.mockito:mockito-all
|
|
exclude group: "org.hamcrest", module:"hamcrest-core"
|
|
}
|
|
embeddingTesting ("junit:junit:4.13") {
|
|
// org.hamcrest is added by org.mockito:mockito-all
|
|
exclude group: "org.hamcrest", module:"hamcrest-core"
|
|
}
|
|
}
|
|
}
|
|
|
|
task updateDependencies() {
|
|
delete destinationDir
|
|
// Copy the dependencies from the compileOnly configuration into
|
|
// the destination directory.
|
|
copy {
|
|
from configurations.embedding
|
|
from configurations.embeddingTesting
|
|
from configurations.embeddingTesting_v16
|
|
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}\","
|
|
}
|
|
}
|
|
}
|