-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Hu Shenghao <[email protected]>
- Loading branch information
1 parent
02502f4
commit f29de25
Showing
4 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
build-logic/convention/src/main/kotlin/com/dede/android_eggs/tasks/UpdateChangelogsTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.dede.android_eggs.tasks | ||
|
||
import android | ||
import org.gradle.api.Action | ||
import org.gradle.api.Project | ||
import org.gradle.api.file.DirectoryProperty | ||
import org.gradle.api.file.FileCollection | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.Exec | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.OutputDirectory | ||
import org.gradle.internal.extensions.stdlib.capitalized | ||
import org.gradle.kotlin.dsl.assign | ||
import org.gradle.kotlin.dsl.register | ||
|
||
abstract class UpdateChangelogsTask : Exec() { | ||
|
||
companion object Register : Action<Project> { | ||
|
||
fun register(project: Project) { | ||
project.afterEvaluate(this) | ||
} | ||
|
||
override fun execute(project: Project) { | ||
with(project) { | ||
val task = tasks.register<UpdateChangelogsTask>("updateChangelogs") { | ||
workingDir("${rootDir.absolutePath}/script/changelogs") | ||
outputDir = file("${rootDir.absolutePath}/fastlane/metadata/android") | ||
observedFiles = files( | ||
"${rootDir.absolutePath}/CHANGELOG.md", | ||
"${rootDir.absolutePath}/CHANGELOG_zh.md" | ||
) | ||
group = "custom" | ||
} | ||
|
||
android.applicationVariants.forEach { variant -> | ||
val variantName = variant.name.capitalized() | ||
val assembleTask = tasks.findByName("assemble$variantName") | ||
assembleTask?.dependsOn(task) | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
@get:Input | ||
abstract val observedFiles: Property<FileCollection> | ||
|
||
@get:OutputDirectory | ||
abstract val outputDir: DirectoryProperty | ||
|
||
init { | ||
@Suppress("LeakingThis") | ||
commandLine("python3", "changelogs.py") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters