t3chb0t
t3chb0t

Reputation: 18724

Copy files into release distributable directory

I need my Jetpack Compose application to be able to execute some PowerShell scripts that I keep in the ps1 directory in the project root directory. I build it with the createReleaseDistributable task and zip it manually before uploading it. The self-contained release of my app is created here:

..\MyApp\build\compose\binaries\main-release\app\MyApp-v1.2.3

This directory contains the app and the runtime directories and MyApp.exe.

Now, I would like to copy the ps1 directory into that release:

..\MyApp\build\compose\binaries\main-release\app\MyApp-v1.2.3\app\resources\ps1

Assuming this would be the right place to keep such files. Anyways, I cannot figure out what variable stores the path to that release directory or how to build it.

I've got a copy task to test it. It works by copying the files into the dummy ps2 directory, but this is not where I want them to be, obviously.

tasks.register("copyPs1") {
    doLast {
        copy {
            from("${layout.projectDirectory}/ps1")          
            // this is obviously wrong -->
            into("${layout.projectDirectory}/ps2")
            // should be more like this -->
            into("${SOME_RELEASE_DIR_VARIABLE}/resources/ps1")
            include("*.ps1")
        }
    }
}

Do you know what do I need to use in the into path so that all files are copied there?


Update:

I now use this into path as a workaround:

into("${layout.buildDirectory.get().asFile}/compose/binaries/main-release/app/MyApp-v${version}/app/resources/ps1")

The task is then bound to compileKotlin:

tasks {
    compileKotlin {
        dependsOn("copyPs1")
    }
}

The hardcoded path doesn't feel right though.

Upvotes: 1

Views: 29

Answers (0)

Related Questions