-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[tool] Add initial non-plugin package support for Kotlin Gradle #11127
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
base: main
Are you sure you want to change the base?
Changes from all commits
5597e93
f807372
9488d0e
ada6637
8c243e8
b9dd116
35c0280
eacde43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| allprojects { | ||
| repositories { | ||
| // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. | ||
| val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" | ||
| val artifactRepoUrl = System.getenv(artifactRepoKey) | ||
| if (artifactRepoUrl != null) { | ||
| println("Using artifact hub") | ||
| maven { | ||
| url = uri(artifactRepoUrl) | ||
| } | ||
| } | ||
| google() | ||
| mavenCentral() | ||
| } | ||
| } | ||
|
|
||
| val newBuildDir: Directory = | ||
| rootProject.layout.buildDirectory | ||
| .dir("../../build") | ||
| .get() | ||
| rootProject.layout.buildDirectory.value(newBuildDir) | ||
|
|
||
| subprojects { | ||
| val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) | ||
| project.layout.buildDirectory.value(newSubprojectBuildDir) | ||
|
Comment on lines
+17
to
+25
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm this all looks much nicer than what we have in the templates...
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah nice, yeah nevermind I was looking at what we generate for our own gradle files |
||
| } | ||
| subprojects { | ||
| project.evaluationDependsOn(":app") | ||
| } | ||
|
|
||
| tasks.register<Delete>("clean") { | ||
| delete(rootProject.layout.buildDirectory) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError | ||
| org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't see any reason not to just adopt the current template defaults here. |
||
| android.useAndroidX=true | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| pluginManagement { | ||
| val flutterSdkPath = | ||
| run { | ||
| val properties = java.util.Properties() | ||
| file("local.properties").inputStream().use { properties.load(it) } | ||
| val flutterSdkPath = properties.getProperty("flutter.sdk") | ||
| require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } | ||
| flutterSdkPath | ||
| } | ||
|
|
||
| includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") | ||
|
|
||
| repositories { | ||
| google() | ||
| mavenCentral() | ||
| gradlePluginPortal() | ||
| } | ||
| } | ||
|
|
||
| // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. | ||
| plugins { | ||
| id("dev.flutter.flutter-plugin-loader") version "1.0.0" | ||
| id("com.android.application") version "8.11.1" apply false | ||
| id("org.jetbrains.kotlin.android") version "2.2.20" apply false | ||
| id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" | ||
| } | ||
|
|
||
| include(":app") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conversion from Groovy was done by Gemini. It recommended the get-and-null-check pattern rather than a direct conversion of the check-for-key-then-read Groovy code, because this is null safe rather than requiring a force unwrap. That seemed entirely reasonable to me.
The
uripart I trusted it on 🤷🏻