Skip to content
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

Add sha1 to updater.json #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies {
implementation("com.github.Aliucord.jadx:jadx-core:1a213e978d")
implementation("com.github.Aliucord.jadx:jadx-dex-input:1a213e978d")
implementation("com.github.js6pak:jadb:fix-modified-time-SNAPSHOT")
implementation("commons-codec:commons-codec:1.15")
}

gradlePlugin {
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/com/aliucord/gradle/entities/UpdateInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ data class UpdateInfo(
var version: String? = null,
var build: String? = null,
var changelog: String? = null,
var changelogMedia: String? = null
var changelogMedia: String? = null,
var sha1: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ import groovy.json.JsonBuilder
import groovy.json.JsonGenerator
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.AbstractCopyTask
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import org.apache.commons.codec.digest.DigestUtils

abstract class GenerateUpdaterJsonTask : DefaultTask() {
@get:OutputFile
Expand All @@ -39,12 +41,15 @@ abstract class GenerateUpdaterJsonTask : DefaultTask() {
continue
}

val task = aliucord.project.tasks.getByName("make") as AbstractCopyTask

map[subproject.name] = UpdateInfo(
aliucord.minimumDiscordVersion.orNull ?: aliucord.discord?.version,
subproject.version.toString(),
aliucord.buildUrl.orNull,
aliucord.changelog.orNull,
aliucord.changelogMedia.orNull
aliucord.changelogMedia.orNull,
DigestUtils.sha1Hex(task.outputs.files.singleFile.readBytes())
)
}

Expand Down
6 changes: 4 additions & 2 deletions src/main/kotlin/com/aliucord/gradle/task/Tasks.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fun registerTasks(project: Project) {
}

project.afterEvaluate {
project.tasks.register(
val make = project.tasks.register(
"make",
if (extension.projectType.get() == ProjectType.INJECTOR) Copy::class.java else Zip::class.java
)
Expand Down Expand Up @@ -133,7 +133,9 @@ fun registerTasks(project: Project) {

project.tasks.register("deployWithAdb", DeployWithAdbTask::class.java) {
it.group = TASK_GROUP
it.dependsOn("make")
it.dependsOn(make)
}

project.rootProject.tasks.getByName("generateUpdaterJson").dependsOn(make)
}
}