Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions vendor/gradle-app/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import groovy.xml.XmlSlurper
import org.apache.commons.io.FileUtils

import javax.inject.Inject
import org.gradle.process.ExecOperations
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
Expand All @@ -44,7 +45,10 @@ apply plugin: "com.android.application"
apply from: "gradle-helpers/BuildToolTask.gradle"
apply from: "gradle-helpers/CustomExecutionLogger.gradle"
apply from: "gradle-helpers/AnalyticsCollector.gradle"
apply plugin: 'kotlin-android'
// AGP 9+ ships built-in Kotlin support; applying kotlin-android there fails
if (com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.split('\\.')[0] as int < 9) {
apply plugin: 'kotlin-android'
}
apply plugin: 'kotlin-parcelize'

def onlyX86 = project.hasProperty("onlyX86")
Expand Down Expand Up @@ -753,15 +757,16 @@ allprojects {
def artifactType = Attribute.of('artifactType', String)
android.applicationVariants.configureEach { variant ->
if (variant.buildType.name == buildType) {
variant.getCompileClasspath(null).each { fileDependency ->
processJar(fileDependency, jars)
def compileClasspath = variant.getCompileClasspath(null)
compileClasspath.each { fileDependency ->
processJar(fileDependency, jars, compileClasspath)
}
}
}
}
}

def processJar(File jar, jars) {
def processJar(File jar, jars, compileClasspath) {
if (!jars.contains(jar)) {
jars.add(jar)
def destDir = md5(jar.path)
Expand All @@ -774,7 +779,9 @@ def processJar(File jar, jars) {
// This is crucial for cloud builds because they are different
// on each incremental build (as each time the gradle user home
// directory is a randomly generated string)
cleanupAllJars.inputs.files jar
// filter() keeps the task dependencies of the classpath (e.g. generated R.jar)
def jarFiles = compileClasspath.filter { it == jar }
cleanupAllJars.inputs.files jarFiles

task "${taskName}"(type: WorkerTask) {
dependsOn cleanupAllJars
Expand All @@ -785,7 +792,7 @@ def processJar(File jar, jars) {
// fails due to missing JARs
runSbg.dependsOn it

inputs.files jar
inputs.files jarFiles
outputs.dir outputDir

doLast {
Expand Down Expand Up @@ -1201,7 +1208,8 @@ task buildMetadata(type: BuildToolTask) {
def validateSigningTaskName = "validateSigning${buildTypeName}"
def validateSigningTask = tasks.findByName(validateSigningTaskName)

if (validateSigningTask) {
// only the variant being built: other variants (e.g. release in a debug run) may have no keystore
if (validateSigningTask && variant.buildType.name == project.selectedBuildType) {
dependsOn validateSigningTask
}

Expand Down Expand Up @@ -1626,6 +1634,11 @@ def resolveNodePath = { ->
project.hasProperty("nodePath") ? nodePath as String : "node"
}

interface InjectedExecOps {
@Inject
ExecOperations getExecOps()
}

task compileBytecode {
// No inputs/outputs declared on purpose: the task is cheap and idempotent
// (it skips files that are already bytecode) and must re-run whenever the
Expand Down Expand Up @@ -1668,7 +1681,7 @@ task compileBytecode {
}
// The driver prints its own "[bytecode] ... compiled N file(s)" summary to
// stdout, which surfaces in the build log below.
exec {
project.objects.newInstance(InjectedExecOps).execOps.exec {
commandLine cmd
}
outLogger.withStyle(Style.SuccessHeader).println "\t + [bytecode] done."
Expand Down
2 changes: 1 addition & 1 deletion vendor/gradle-app/app/gradle-helpers/BuildToolTask.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import static org.gradle.internal.logging.text.StyledTextOutput.Style

class BuildToolTask extends JavaExec {
abstract class BuildToolTask extends JavaExec {
void setOutputs(def logger) {
def logFile = new File("$workingDir/${name}.log")
if(logFile.exists()) {
Expand Down
7 changes: 4 additions & 3 deletions vendor/gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import static org.gradle.internal.logging.text.StyledTextOutput.Style
import java.nio.file.Paths

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
// AGP 9+ ships built-in Kotlin support; applying kotlin-android there fails
if (com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.split('\\.')[0] as int < 9) {
apply plugin: 'kotlin-android'
}
apply plugin: 'kotlin-parcelize'

def loadPropertyFile = { path ->
Expand Down Expand Up @@ -241,7 +244,6 @@ buildscript {
dependencies {
classpath "com.android.tools.build:gradle:$androidBuildToolsVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.codehaus.groovy:groovy-all:3.0.8"
}

}
Expand All @@ -265,7 +267,6 @@ allprojects {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
if (pluginDependencies.size() > 0) {
flatDir {
dirs pluginDependencies
Expand Down
Loading