mirror of
https://github.com/tadfisher/gradle2nix.git
synced 2026-01-11 15:30:38 -05:00
Remove okio dependency from plugin
This commit is contained in:
@@ -30,7 +30,6 @@ dependencies {
|
||||
compileOnly("org.gradle:gradle-tooling-api:${gradle.gradleVersion}")
|
||||
implementation("org.apache.maven:maven-model:latest.release")
|
||||
implementation("org.apache.maven:maven-model-builder:latest.release")
|
||||
implementation("com.squareup.okio:okio:latest.release")
|
||||
|
||||
compatTestImplementation(embeddedKotlin("stdlib-jdk8"))
|
||||
compatTestImplementation(embeddedKotlin("test-junit5"))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# This is a Gradle generated file for dependency locking.
|
||||
# Manual edits can break the build and are not advised.
|
||||
# This file is expected to be part of source control.
|
||||
com.squareup.okio:okio:2.2.2
|
||||
org.apache.commons:commons-lang3:3.8.1
|
||||
org.apache.maven:maven-artifact:3.6.1
|
||||
org.apache.maven:maven-builder-support:3.6.1
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# This is a Gradle generated file for dependency locking.
|
||||
# Manual edits can break the build and are not advised.
|
||||
# This file is expected to be part of source control.
|
||||
com.squareup.okio:okio:2.2.2
|
||||
org.apache.commons:commons-lang3:3.8.1
|
||||
org.apache.maven:maven-artifact:3.6.1
|
||||
org.apache.maven:maven-builder-support:3.6.1
|
||||
@@ -10,6 +9,3 @@ org.apache.maven:maven-model:3.6.1
|
||||
org.codehaus.plexus:plexus-component-annotations:1.7.1
|
||||
org.codehaus.plexus:plexus-interpolation:1.25
|
||||
org.codehaus.plexus:plexus-utils:3.2.0
|
||||
org.jetbrains.kotlin:kotlin-stdlib-common:1.2.60
|
||||
org.jetbrains.kotlin:kotlin-stdlib:1.2.60
|
||||
org.jetbrains:annotations:13.0
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# This is a Gradle generated file for dependency locking.
|
||||
# Manual edits can break the build and are not advised.
|
||||
# This file is expected to be part of source control.
|
||||
com.squareup.okio:okio:2.2.2
|
||||
org.apache.commons:commons-lang3:3.8.1
|
||||
org.apache.maven:maven-artifact:3.6.1
|
||||
org.apache.maven:maven-builder-support:3.6.1
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# This is a Gradle generated file for dependency locking.
|
||||
# Manual edits can break the build and are not advised.
|
||||
# This file is expected to be part of source control.
|
||||
com.squareup.okio:okio:2.2.2
|
||||
org.apache.commons:commons-lang3:3.8.1
|
||||
org.apache.maven:maven-artifact:3.6.1
|
||||
org.apache.maven:maven-builder-support:3.6.1
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.nixos.gradle2nix
|
||||
|
||||
import okio.*
|
||||
import org.apache.maven.model.Parent
|
||||
import org.apache.maven.model.Repository
|
||||
import org.apache.maven.model.building.DefaultModelBuilderFactory
|
||||
@@ -21,6 +20,7 @@ import org.gradle.maven.MavenPomArtifact
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
import java.net.URI
|
||||
import java.security.MessageDigest
|
||||
|
||||
internal class DependencyResolver(
|
||||
private val configurations: ConfigurationContainer,
|
||||
@@ -153,11 +153,14 @@ private class MavenPomResolver(
|
||||
override fun addRepository(repository: Repository, replace: Boolean) {}
|
||||
}
|
||||
|
||||
private fun sha256(file: File): String {
|
||||
val hashSource = HashingSource.sha256(file.source())
|
||||
val hash: ByteString = hashSource.buffer().use { source ->
|
||||
source.readAll(blackholeSink())
|
||||
hashSource.hash
|
||||
}
|
||||
return hash.base64()
|
||||
private val HEX = "0123456789ABCDEF"
|
||||
|
||||
private fun sha256(file: File): String = buildString {
|
||||
MessageDigest.getInstance("SHA-256").digest(file.readBytes())
|
||||
.asSequence()
|
||||
.map { it.toInt() }
|
||||
.forEach {
|
||||
append(HEX[it shr 4 and 0x0f])
|
||||
append(HEX[it and 0x0f])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.nixos.gradle2nix
|
||||
|
||||
import okio.buffer
|
||||
import okio.source
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
||||
@@ -140,9 +138,7 @@ private fun Project.projectDependencies(explicitConfigurations: List<String>): D
|
||||
private fun fetchDistSha256(url: String): String {
|
||||
return URL("$url.sha256").openConnection().run {
|
||||
connect()
|
||||
getInputStream().source().buffer().use { source ->
|
||||
source.readUtf8()
|
||||
}
|
||||
getInputStream().reader().use { it.readText() }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user