Skip to content

Commit a0fc69b

Browse files
committed
refactor(share_plus): change android gradle from groovy to kotlin
1 parent 6427bc6 commit a0fc69b

10 files changed

Lines changed: 162 additions & 162 deletions

File tree

packages/share_plus/share_plus/android/build.gradle

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
group = "dev.fluttercommunity.plus.share"
2+
version = "1.0-SNAPSHOT"
3+
4+
buildscript {
5+
val kotlinVersion = "2.2.0"
6+
7+
repositories {
8+
google()
9+
mavenCentral()
10+
}
11+
12+
dependencies {
13+
classpath("com.android.tools.build:gradle:8.12.1")
14+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
15+
}
16+
}
17+
18+
allprojects {
19+
repositories {
20+
google()
21+
mavenCentral()
22+
}
23+
}
24+
25+
26+
plugins {
27+
id("com.android.library")
28+
id("kotlin-android")
29+
}
30+
31+
kotlin {
32+
compilerOptions {
33+
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
34+
}
35+
}
36+
37+
android {
38+
namespace = "dev.fluttercommunity.plus.share"
39+
compileSdk = flutter.compileSdkVersion
40+
41+
compileOptions {
42+
sourceCompatibility = JavaVersion.VERSION_17
43+
targetCompatibility = JavaVersion.VERSION_17
44+
}
45+
46+
defaultConfig {
47+
minSdk = 19
48+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
49+
}
50+
51+
lint {
52+
disable.add("InvalidPackage")
53+
}
54+
55+
dependencies {
56+
implementation("androidx.core:core-ktx:1.16.0")
57+
implementation("androidx.annotation:annotation:1.9.1")
58+
}
59+
}

packages/share_plus/share_plus/android/settings.gradle

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = "share_plus"

packages/share_plus/share_plus/example/android/app/build.gradle

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
plugins {
2+
id("com.android.application")
3+
id("dev.flutter.flutter-gradle-plugin")
4+
}
5+
6+
android {
7+
namespace = "io.flutter.plugins.shareexample"
8+
compileSdk = flutter.compileSdkVersion
9+
10+
compileOptions {
11+
sourceCompatibility = JavaVersion.VERSION_17
12+
targetCompatibility = JavaVersion.VERSION_17
13+
}
14+
15+
defaultConfig {
16+
applicationId = "io.flutter.plugins.shareexample"
17+
minSdk = flutter.minSdkVersion
18+
targetSdk = flutter.targetSdkVersion
19+
versionCode = flutter.versionCode
20+
versionName = flutter.versionName
21+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
22+
}
23+
24+
lint {
25+
disable.add("InvalidPackage")
26+
}
27+
28+
buildTypes {
29+
release {
30+
// Signing with the debug keys for now, so `flutter run --release` works.
31+
signingConfig = signingConfigs.getByName("debug")
32+
}
33+
}
34+
}
35+
36+
flutter {
37+
source = "../.."
38+
}
39+
40+
dependencies {
41+
testImplementation("junit:junit:4.13.2")
42+
androidTestImplementation("androidx.test:runner:1.2.0")
43+
androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0")
44+
}

packages/share_plus/share_plus/example/android/build.gradle

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
allprojects {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
}
6+
}
7+
8+
val newBuildDir: Directory =
9+
rootProject.layout.buildDirectory
10+
.dir("../../build")
11+
.get()
12+
rootProject.layout.buildDirectory.value(newBuildDir)
13+
14+
// Only redirect build directories for local subprojects (like :app or other local plugins).
15+
// This avoids "different roots" Gradle build errors on Windows when the project is on
16+
// a different drive (e.g., D:) than the Flutter Pub cache (typically on C:).
17+
// thrown by file_selector_android
18+
subprojects {
19+
val isLocalProject = project.projectDir.canonicalPath.startsWith(rootProject.projectDir.canonicalPath)
20+
if (isLocalProject) {
21+
val newSubProjectBuildDir: Directory = newBuildDir.dir(project.name)
22+
project.layout.buildDirectory.value(newSubProjectBuildDir)
23+
}
24+
}
25+
26+
subprojects {
27+
project.evaluationDependsOn(":app")
28+
}
29+
30+
tasks.register<Delete>("clean") {
31+
delete(rootProject.layout.buildDirectory)
32+
}

packages/share_plus/share_plus/example/android/settings.gradle

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
pluginManagement {
2+
val flutterSdkPath =
3+
run {
4+
val properties = java.util.Properties()
5+
file("local.properties").inputStream().use { properties.load(it) }
6+
val flutterSdkPath = properties.getProperty("flutter.sdk")
7+
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
8+
flutterSdkPath
9+
}
10+
11+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
12+
13+
repositories {
14+
google()
15+
mavenCentral()
16+
gradlePluginPortal()
17+
}
18+
}
19+
20+
plugins {
21+
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
22+
id("com.android.application") version "8.12.1" apply false
23+
id("org.jetbrains.kotlin.android") version "2.2.0" apply false
24+
}
25+
26+
include(":app")

0 commit comments

Comments
 (0)