Skip to content

Commit

Permalink
Merge pull request #89 from matheus-corregiari/feature/new-modules
Browse files Browse the repository at this point in the history
[Feature] Exporting Splinter and creating modules Util and Storage
  • Loading branch information
matheus-corregiari authored Jun 13, 2024
2 parents f9c59f4 + 88d076f commit d4bda7f
Show file tree
Hide file tree
Showing 165 changed files with 1,860 additions and 1,314 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
alias(libraries.plugins.google.ksp) apply false
alias(libraries.plugins.jetbrains.kotlin) apply false
alias(libraries.plugins.jetbrains.multiplatform) apply false
alias(libraries.plugins.jetbrains.serialization) apply false
alias(libraries.plugins.dexcount) apply false
alias(libraries.plugins.detekt) apply false
// TODO Pedrinho, help me
Expand Down
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ org.gradle.jvmargs=-Xmx8192m -XX:+UseParallelGC -Dkotlin.daemon.jvm.options\="-X
org.gradle.parallel=true
org.gradle.warning.mode=none
org.gradle.configuration-cache=false
# Kotlin
kotlin.experimental.tryK2=false
#
#
#
Expand Down
5 changes: 1 addition & 4 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
# For Api 33
#distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.0-bin.zip
# For Api 34
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
33 changes: 19 additions & 14 deletions plugin/src/main/kotlin/com/toolkit/plugin/ToolkitPublishPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -167,31 +167,36 @@ internal class ToolkitPublishPlugin : Plugin<Project> {
}
}

val configList = listOf("implementation", "api").mapNotNull(configurations::findByName)
if (configList.isNotEmpty()) {
val mapOfConfigurations = mapOf(
"runtime" to "implementation",
"compile" to "api",
"provided" to "compileOnly"
).mapNotNull { (scope, configuration) ->
configurations.findByName(configuration)?.let { scope to it }
}.toMap()
if (mapOfConfigurations.isNotEmpty()) {
pom.withXml { xml ->
val dependencyNode: Node = xml.asNode().appendNode("dependencies")
configList.forEach { config ->
config.dependencies.forEach { dependencyNode.addDependency(it) }
mapOfConfigurations.forEach { (scope, configuration) ->
configuration.dependencies.forEach { dependencyNode.addDependency(it, scope) }
}
}
}
}

private fun Node.addDependency(dependency: Dependency) {
private fun Node.addDependency(dependency: Dependency, scope: String) {
val projectDependency =
DefaultGroovyMethods.getProperties(dependency)["dependencyProject"] as? Project

if (projectDependency != null) {
val publishExtension = projectDependency.publishing
publishExtension.publications.filterIsInstance(MavenPublication::class.java)
.onEach { pub ->
val node = appendNode("dependency")
node.appendNode("groupId", pub.groupId)
node.appendNode("artifactId", pub.artifactId)
node.appendNode("version", pub.version)
node.appendNode("scope", "runtime")
}
publishExtension.publications.filterIsInstance<MavenPublication>().onEach { pub ->
val node = appendNode("dependency")
node.appendNode("groupId", pub.groupId)
node.appendNode("artifactId", pub.artifactId)
node.appendNode("version", pub.version)
node.appendNode("scope", scope)
}
} else {
val group = dependency.group.takeIf { it.isNullOrBlank().not() }
val name = dependency.name.takeIf { it.isNullOrBlank().not() }
Expand All @@ -203,7 +208,7 @@ internal class ToolkitPublishPlugin : Plugin<Project> {
node.appendNode("groupId", group)
node.appendNode("artifactId", name)
node.appendNode("version", version)
node.appendNode("scope", "runtime")
node.appendNode("scope", scope)
}
}
}
17 changes: 0 additions & 17 deletions samples/foldable/build.gradle.kts

This file was deleted.

34 changes: 0 additions & 34 deletions samples/foldable/src/main/AndroidManifest.xml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit d4bda7f

Please sign in to comment.