Skip to content

Commit

Permalink
0.0.6 (#5)
Browse files Browse the repository at this point in the history
* Fix api version retrieving

* Refactor mislocated components

* Fix exclude rules are not applied to runtime classpath issue
  • Loading branch information
vjh0107 authored Oct 12, 2024
1 parent e51de87 commit b9805ec
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kotlin.code.style=official

project.group=kr.junhyung
project.artifact=pluginjar
project.version=0.0.5
project.version=0.0.6

project.description=A Gradle plugin that streamlines the process of creating a plugin JAR.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package kr.junhyung.pluginjar.plugin

import kr.junhyung.pluginjar.core.PluginMeta
package kr.junhyung.pluginjar.core

interface PluginMetaPropertySource {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kr.junhyung.pluginjar.plugin.service
package kr.junhyung.pluginjar.core.service

import java.io.File

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package kr.junhyung.pluginjar.plugin.service
package kr.junhyung.pluginjar.core.service

import kr.junhyung.pluginjar.core.PluginMeta
import kr.junhyung.pluginjar.core.PluginMetaSerializer
import kr.junhyung.pluginjar.plugin.PluginMetaPropertySource
import kr.junhyung.pluginjar.core.PluginMetaPropertySource
import java.io.File

class SerializedPluginMetaService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import kr.junhyung.pluginjar.core.PluginMainClassResolver
import kr.junhyung.pluginjar.core.PluginMeta
import kr.junhyung.pluginjar.core.PluginMetaSerializer
import kr.junhyung.pluginjar.plugin.dsl.internal.runtimeClasspath
import kr.junhyung.pluginjar.plugin.service.PluginMetaService
import kr.junhyung.pluginjar.plugin.service.SerializedPluginMetaService
import kr.junhyung.pluginjar.core.service.PluginMetaService
import kr.junhyung.pluginjar.core.service.SerializedPluginMetaService
import org.gradle.api.GradleException
import org.gradle.api.Plugin
import org.gradle.api.Project
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kr.junhyung.pluginjar.plugin

import kr.junhyung.pluginjar.plugin.service.PluginMetaService
import kr.junhyung.pluginjar.core.service.PluginMetaService
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.DirectoryProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package kr.junhyung.pluginjar.plugin
import kr.junhyung.pluginjar.core.PluginMainClass
import kr.junhyung.pluginjar.core.PluginMainClassResolver
import kr.junhyung.pluginjar.core.PluginMeta
import kr.junhyung.pluginjar.core.PluginMetaPropertySource
import kr.junhyung.pluginjar.plugin.dsl.internal.compileClasspath
import kr.junhyung.pluginjar.plugin.dsl.internal.runtimeClasspath
import org.gradle.api.Project
Expand Down Expand Up @@ -66,7 +67,7 @@ class ProjectPluginMetaPropertySource(
.allDependencies
val implementation = compileClasspathDependencies.find { dependency ->
BukkitDependency.values().any { implementation ->
implementation.group == dependency.group && implementation.name == dependency.name
implementation.module.group == dependency.group && implementation.module.name == dependency.name
}
} ?: return null
val implementationVersion = implementation.version ?: return null
Expand Down Expand Up @@ -117,6 +118,7 @@ class ProjectPluginMetaPropertySource(
}
val result = mutableSetOf<String>()
collectDependencies(project, result)
applyExcludeRules(result)
return result.toList()
}

Expand All @@ -139,4 +141,11 @@ class ProjectPluginMetaPropertySource(
}
}
}

private fun applyExcludeRules(result: MutableSet<String>) {
project.configurations.runtimeClasspath.excludeRules.forEach {
result.removeIf { dependency -> dependency.startsWith("${it.group}:${it.module}") }
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ package kr.junhyung.pluginjar.plugin.dsl

import kr.junhyung.pluginjar.plugin.BukkitDependency
import kr.junhyung.pluginjar.plugin.BukkitVersion
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.internal.jvm.Jvm
import org.gradle.kotlin.dsl.getByType

fun DependencyHandler.spigot(version: String): Any {
return buildBukkitDependency(BukkitDependency.SPIGOT, version)
Expand Down

0 comments on commit b9805ec

Please sign in to comment.