Skip to content

[#5] Update project structure and gradle version #6

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

Merged
merged 1 commit into from
Dec 27, 2024
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
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

98 changes: 0 additions & 98 deletions README.md

This file was deleted.

54 changes: 35 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
buildscript {
val kotlinVersion by extra { "1.5.31" }
plugins {
`java-gradle-plugin`
`kotlin-dsl`
id("com.gradle.plugin-publish") version "1.3.0"
}

repositories {
google()
mavenCentral()
maven("https://plugins.gradle.org/m2/")
}
val pluginId = "io.github.MatrixDev.android-rust"

group = pluginId
version = "0.3.2"

gradlePlugin {
website = "https://github.com/MatrixDev/GradleAndroidRustPlugin"
vcsUrl = "https://github.com/MatrixDev/GradleAndroidRustPlugin.git"

dependencies {
classpath("com.android.tools.build:gradle:7.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
plugins {
create("AndroidRust") {
id = pluginId
implementationClass = "dev.matrix.agp.rust.AndroidRustPlugin"
displayName = "Plugin for building Rust with Cargo in Android projects"
description = "This plugin helps with building Rust JNI libraries with Cargo for use in Android projects."
}
}
}

allprojects {
publishing {
repositories {
google()
mavenCentral()
maven("https://plugins.gradle.org/m2/")
maven {
url = uri(layout.buildDirectory.dir("repo"))
}
}
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
rootProject.childProjects.forEach { project ->
delete(project.value.buildDir)
}
repositories {
mavenCentral()
google()
maven("https://plugins.gradle.org/m2/")
}

dependencies {
gradleApi()

implementation(libs.agp)
implementation(libs.agp.api)
}
7 changes: 4 additions & 3 deletions example/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("io.github.MatrixDev.android-rust")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.android.rust)
}

android {
namespace = "dev.matrix.rust"
compileSdk = 33
ndkVersion = "25.2.9519653"

Expand Down
32 changes: 5 additions & 27 deletions example/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,28 +1,6 @@
buildscript {
val kotlinVersion by extra { "1.7.0" }

repositories {
google()
mavenCentral()
}

dependencies {
classpath("com.android.tools.build:gradle:7.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("io.github.MatrixDev.android-rust:plugin:*")
}
}

allprojects {
repositories {
google()
mavenCentral()
}
}

task<Delete>("clean") {
delete(rootProject.buildDir)
rootProject.childProjects.values.forEach { project ->
delete(project.buildDir)
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.android.rust) apply false
}
31 changes: 31 additions & 0 deletions example/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[versions]
agp = "8.7.3"
kotlin = "2.0.0"
coreKtx = "1.15.0"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
lifecycleRuntimeKtx = "2.8.7"
activityCompose = "1.9.3"
composeBom = "2024.04.01"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
android-rust = { id = "io.github.MatrixDev.android-rust", version = "0.3.2" }
6 changes: 3 additions & 3 deletions example/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Jun 12 14:27:36 EEST 2022
#Wed Dec 04 11:21:35 EET 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
26 changes: 24 additions & 2 deletions example/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
rootProject.name = "android-rust-example"
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
google()
maven("https://plugins.gradle.org/m2/")
}
}

rootProject.name = "android-rust-example"
include(":app")

includeBuild("..") {
dependencySubstitution {
substitute(module("io.github.MatrixDev.android-rust:plugin")).using(project(":plugin"))
substitute(module("io.github.MatrixDev.android-rust:plugin"))
}
}
23 changes: 0 additions & 23 deletions gradle.properties

This file was deleted.

6 changes: 6 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[versions]
agp = "8.7.2"

[libraries]
agp = { module = "com.android.tools.build:gradle", version.ref = "agp" }
agp-api = { module = "com.android.tools.build:gradle-api", version.ref = "agp" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Jun 12 14:27:36 EEST 2022
#Wed Dec 04 11:21:35 EET 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading