(chore): update codebase
This commit is contained in:
parent
fd15215f15
commit
4e8d46b20e
106 changed files with 29936 additions and 1023 deletions
|
|
@ -1,10 +1,13 @@
|
|||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.process.ExecOperations
|
||||
|
||||
open class BuildTask : DefaultTask() {
|
||||
@Input
|
||||
|
|
@ -14,6 +17,13 @@ open class BuildTask : DefaultTask() {
|
|||
@Input
|
||||
var release: Boolean? = null
|
||||
|
||||
@Internal
|
||||
var baseProjectDir: File? = null
|
||||
|
||||
@get:Inject
|
||||
protected open val execOperations: ExecOperations
|
||||
get() = throw UnsupportedOperationException("Gradle injects ExecOperations")
|
||||
|
||||
@TaskAction
|
||||
fun assemble() {
|
||||
val executable = """bun""";
|
||||
|
|
@ -48,15 +58,16 @@ open class BuildTask : DefaultTask() {
|
|||
val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null")
|
||||
val target = target ?: throw GradleException("target cannot be null")
|
||||
val release = release ?: throw GradleException("release cannot be null")
|
||||
val baseProjectDir = baseProjectDir ?: throw GradleException("baseProjectDir cannot be null")
|
||||
val args = listOf("tauri", "android", "android-studio-script");
|
||||
|
||||
project.exec {
|
||||
workingDir(File(project.projectDir, rootDirRel))
|
||||
execOperations.exec {
|
||||
workingDir(File(baseProjectDir, rootDirRel))
|
||||
executable(executable)
|
||||
args(args)
|
||||
if (project.logger.isEnabled(LogLevel.DEBUG)) {
|
||||
if (logger.isEnabled(LogLevel.DEBUG)) {
|
||||
args("-vv")
|
||||
} else if (project.logger.isEnabled(LogLevel.INFO)) {
|
||||
} else if (logger.isEnabled(LogLevel.INFO)) {
|
||||
args("-v")
|
||||
}
|
||||
if (release) {
|
||||
|
|
@ -65,4 +76,4 @@ open class BuildTask : DefaultTask() {
|
|||
args(listOf("--target", target))
|
||||
}.assertNormalExitValue()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ open class RustPlugin : Plugin<Project> {
|
|||
rootDirRel = config.rootDirRel
|
||||
target = targetName
|
||||
release = profile == "release"
|
||||
baseProjectDir = project.projectDir
|
||||
}
|
||||
|
||||
buildTask.dependsOn(targetBuildTask)
|
||||
|
|
@ -82,4 +83,4 @@ open class RustPlugin : Plugin<Project> {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue