Skip to content

Commit f445165

Browse files
authored
[#5] Update project structure and gradle version (#6)
1 parent 96802df commit f445165

29 files changed

+316
-385
lines changed

LICENSE

-21
This file was deleted.

README.md

-98
This file was deleted.

build.gradle.kts

+35-19
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,45 @@
1-
buildscript {
2-
val kotlinVersion by extra { "1.5.31" }
1+
plugins {
2+
`java-gradle-plugin`
3+
`kotlin-dsl`
4+
id("com.gradle.plugin-publish") version "1.3.0"
5+
}
36

4-
repositories {
5-
google()
6-
mavenCentral()
7-
maven("https://plugins.gradle.org/m2/")
8-
}
7+
val pluginId = "io.github.MatrixDev.android-rust"
8+
9+
group = pluginId
10+
version = "0.3.2"
11+
12+
gradlePlugin {
13+
website = "https://github.com/MatrixDev/GradleAndroidRustPlugin"
14+
vcsUrl = "https://github.com/MatrixDev/GradleAndroidRustPlugin.git"
915

10-
dependencies {
11-
classpath("com.android.tools.build:gradle:7.2.2")
12-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
16+
plugins {
17+
create("AndroidRust") {
18+
id = pluginId
19+
implementationClass = "dev.matrix.agp.rust.AndroidRustPlugin"
20+
displayName = "Plugin for building Rust with Cargo in Android projects"
21+
description = "This plugin helps with building Rust JNI libraries with Cargo for use in Android projects."
22+
}
1323
}
1424
}
1525

16-
allprojects {
26+
publishing {
1727
repositories {
18-
google()
19-
mavenCentral()
20-
maven("https://plugins.gradle.org/m2/")
28+
maven {
29+
url = uri(layout.buildDirectory.dir("repo"))
30+
}
2131
}
2232
}
2333

24-
tasks.register("clean", Delete::class) {
25-
delete(rootProject.buildDir)
26-
rootProject.childProjects.forEach { project ->
27-
delete(project.value.buildDir)
28-
}
34+
repositories {
35+
mavenCentral()
36+
google()
37+
maven("https://plugins.gradle.org/m2/")
38+
}
39+
40+
dependencies {
41+
gradleApi()
42+
43+
implementation(libs.agp)
44+
implementation(libs.agp.api)
2945
}

example/app/build.gradle.kts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
plugins {
2-
id("com.android.application")
3-
id("org.jetbrains.kotlin.android")
4-
id("io.github.MatrixDev.android-rust")
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
alias(libs.plugins.android.rust)
55
}
66

77
android {
8+
namespace = "dev.matrix.rust"
89
compileSdk = 33
910
ndkVersion = "25.2.9519653"
1011

example/build.gradle.kts

+5-27
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,6 @@
1-
buildscript {
2-
val kotlinVersion by extra { "1.7.0" }
3-
4-
repositories {
5-
google()
6-
mavenCentral()
7-
}
8-
9-
dependencies {
10-
classpath("com.android.tools.build:gradle:7.2.2")
11-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
12-
classpath("io.github.MatrixDev.android-rust:plugin:*")
13-
}
14-
}
15-
16-
allprojects {
17-
repositories {
18-
google()
19-
mavenCentral()
20-
}
21-
}
22-
23-
task<Delete>("clean") {
24-
delete(rootProject.buildDir)
25-
rootProject.childProjects.values.forEach { project ->
26-
delete(project.buildDir)
27-
}
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
plugins {
3+
alias(libs.plugins.android.application) apply false
4+
alias(libs.plugins.kotlin.android) apply false
5+
alias(libs.plugins.android.rust) apply false
286
}

example/gradle/libs.versions.toml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[versions]
2+
agp = "8.7.3"
3+
kotlin = "2.0.0"
4+
coreKtx = "1.15.0"
5+
junit = "4.13.2"
6+
junitVersion = "1.1.5"
7+
espressoCore = "3.5.1"
8+
lifecycleRuntimeKtx = "2.8.7"
9+
activityCompose = "1.9.3"
10+
composeBom = "2024.04.01"
11+
12+
[libraries]
13+
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
14+
junit = { group = "junit", name = "junit", version.ref = "junit" }
15+
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
16+
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
17+
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
18+
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
19+
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
20+
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
21+
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
22+
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
23+
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
24+
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
25+
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
26+
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
27+
28+
[plugins]
29+
android-application = { id = "com.android.application", version.ref = "agp" }
30+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
31+
android-rust = { id = "io.github.MatrixDev.android-rust", version = "0.3.2" }
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sun Jun 12 14:27:36 EEST 2022
1+
#Wed Dec 04 11:21:35 EET 2024
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
43
distributionPath=wrapper/dists
5-
zipStorePath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
65
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

example/settings.gradle.kts

+24-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
1-
rootProject.name = "android-rust-example"
1+
pluginManagement {
2+
repositories {
3+
google {
4+
content {
5+
includeGroupByRegex("com\\.android.*")
6+
includeGroupByRegex("com\\.google.*")
7+
includeGroupByRegex("androidx.*")
8+
}
9+
}
10+
mavenCentral()
11+
gradlePluginPortal()
12+
}
13+
}
214

15+
dependencyResolutionManagement {
16+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
17+
repositories {
18+
mavenCentral()
19+
google()
20+
maven("https://plugins.gradle.org/m2/")
21+
}
22+
}
23+
24+
rootProject.name = "android-rust-example"
325
include(":app")
426

527
includeBuild("..") {
628
dependencySubstitution {
7-
substitute(module("io.github.MatrixDev.android-rust:plugin")).using(project(":plugin"))
29+
substitute(module("io.github.MatrixDev.android-rust:plugin"))
830
}
931
}

gradle.properties

-23
This file was deleted.

gradle/libs.versions.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[versions]
2+
agp = "8.7.2"
3+
4+
[libraries]
5+
agp = { module = "com.android.tools.build:gradle", version.ref = "agp" }
6+
agp-api = { module = "com.android.tools.build:gradle-api", version.ref = "agp" }

gradle/wrapper/gradle-wrapper.jar

-15.3 KB
Binary file not shown.
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sun Jun 12 14:27:36 EEST 2022
1+
#Wed Dec 04 11:21:35 EET 2024
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
43
distributionPath=wrapper/dists
5-
zipStorePath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
65
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)