Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps and make task output dirs unique per task #77

Merged
merged 37 commits into from
May 21, 2021
Merged

Conversation

ZacSweers
Copy link
Collaborator

@ZacSweers ZacSweers commented Mar 7, 2021

Resolves #76 and also starts testing against gradle/agp 7. This entails:

  • Dropping AGP 4.1.x support
  • Removing our zipflinger copy (this is what most of the line diff is! Don't be intimidated)
  • Simplifying task file output names
  • Testing on JDK 11
  • Testing against AGP 7.x

@ZacSweers ZacSweers requested a review from jschear March 7, 2021 20:26
@ZacSweers ZacSweers changed the title Update deps and make task outputs unique per task Update deps and make task output dirs unique per task Mar 7, 2021
ZacSweers added 3 commits May 15, 2021 13:36
Too annoying to maintain and it isn't supported in AGP 7 anymore
@ZacSweers
Copy link
Collaborator Author

Honestly I have no idea how android testing is considered a production-ready tool

}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
@Suppress("SuspiciousCollectionReassignment")
freeCompilerArgs += listOf("-progressive")
// Because Gradle's Kotlin handling is stupid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:D

listOf(
"--keeprules",
androidJar.get().asFile.absolutePath,
appTargetJar.get().asFile.absolutePath,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly surprised you haven't created a getAsFile() extension function yet 😏

.flatMap { it.walkTopDown() }
.filterNot { it.isDirectory }
.joinToString("\n") {
"# Source: ${it.absolutePath}\n${it.readText()}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough about what his is doing to know whether it's correct, but my inner linter is complaining about absolutePath.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is just a diagnostic and never used as a task input or anything

val diagnosticOutputDir = layout.buildDirectory.dir(
"$INTERMEDIATES_DIR/l8-diagnostics/$taskName")
.forUseAtConfigurationTime()
.get()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use .get().asFile on this? Seems like it's more useful as a DirectoryProperty. On line 160 below, you could use that API to create a new file.

(My inner linter flags all usages of java.io.File)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if you try to resolve it as a directory property, gradle complains about it not existing :|. I can try again in a follow up but this was seemingly necessary

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:stare:

k, sounds good

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if something is eagerly triggering the configuration of the L8DexDesugarLibTask, at which point this file won't exist? 🤷

throw new IllegalStateException("L8 diagnostic rules include the main variant's R8-generated rules, see ${diagnosticFilePath}")
if (verifyL8) {
tasks.withType(L8DexDesugarLibTask)
.matching { it.name == "l8DexDesugarLibExternalStagingAndroidTest" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that matching {} will realize these tasks (because name isn't available on the TaskProvider... I think) -- ah, but this is in a sample.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name exists on taskprovider!

Copy link
Contributor

@autonomousapps autonomousapps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ZacSweers ZacSweers merged commit 8161b1e into main May 21, 2021
@ZacSweers ZacSweers deleted the z/moreUpdates branch May 21, 2021 00:59
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.5.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0")
implementation("com.android:zipflinger:4.2.1")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer shading this? 🆒

val diagnosticOutputDir = layout.buildDirectory.dir(
"$INTERMEDIATES_DIR/l8-diagnostics/$taskName")
.forUseAtConfigurationTime()
.get()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if something is eagerly triggering the configuration of the L8DexDesugarLibTask, at which point this file won't exist? 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gradle cache issue
3 participants