Verified Commit 94b747cd authored by Gigadoc 2's avatar Gigadoc 2

i cannot gradle

parent c5c7f473
plugins {
id 'com.github.johnrengelman.shadow' version '2.0.4'
id 'java'
}
......@@ -12,4 +11,46 @@ repositories {
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT'
compile 'info.faljse:SDNotify:1.1'
}
jar {
classifier = 'nodeps'
}
task fatJar(type: Jar) {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
task sourceJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task getSource(dependsOn: sourceJar) {
inputs.files configurations.runtime
outputs.dir "${buildDir}/sources"
doLast {
def componentIds = configurations.runtime.incoming.resolutionResult.allDependencies.collect { it.selected.id }
ArtifactResolutionResult result = dependencies.createArtifactResolutionQuery()
.forComponents(componentIds)
.withArtifacts(JvmLibrary, SourcesArtifact)
.execute()
def sourceArtifacts = []
result.resolvedComponents.each { ComponentArtifactsResult component ->
Set<ArtifactResult> sources = component.getArtifacts(SourcesArtifact)
println "Found ${sources.size()} sources for ${component.id}"
sources.each { ArtifactResult ar ->
if (ar instanceof ResolvedArtifactResult) {
sourceArtifacts << ar.file
}
}
}
copy {
from sourceArtifacts
into "${buildDir}/sources"
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment