don't go into android dir, copy results if not linking

Signed-off-by: Jakub Sokołowski <jakub@status.im>
Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Jakub Sokołowski 2019-08-26 12:56:55 -04:00 committed by Pedro Pombeiro
parent b0dc2dd4f5
commit 17407b3680
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
3 changed files with 44 additions and 38 deletions

View File

@ -20,7 +20,6 @@ def bundle() {
}
// The Nix script cannot access the user home directory, so best to copy the file to the Nix store and pass that to the Nix script
dir('android') {
withCredentials([
string(
credentialsId: 'android-keystore-pass',
@ -50,12 +49,12 @@ def bundle() {
sbox: [
env.STATUS_RELEASE_STORE_FILE
],
attr: "targets.mobile.android.release"
attr: 'targets.mobile.android.release',
link: false
)
}
}
/* because nix-build was run in `android` dir that's where `result` is */
def outApk = "android/result/app.apk"
def outApk = "result/app.apk"
def pkg = utils.pkgFilename(btype, 'apk')
/* rename for upload */
sh "cp ${outApk} ${pkg}"

View File

@ -59,7 +59,7 @@ def build(Map opts = [:]) {
opts.args = defaults.args + opts.args
opts.keep = (opts.keep + defaults.keep).unique()
return sh(
def resultPath = sh(
returnStdout: true,
script: """
set +x
@ -68,6 +68,10 @@ def build(Map opts = [:]) {
nix-build ${_getNixCommandArgs(opts, false)}
"""
).trim()
if (!opts.link) { /* if not linking, copy results */
sh "cp ${resultPath}/* ${env.WORKSPACE}/result/"
}
return resultPath
}
private makeNixBuildEnvFile(Map opts = [:]) {

View File

@ -2,6 +2,9 @@
set -e
gitRoot=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
resultPath="${gitRoot}/result/"
# cleanup for artifacts created during builds
function cleanup() {
# clear trapped signals
@ -24,9 +27,9 @@ trap cleanup EXIT ERR INT QUIT
function extractResults() {
local nixResultPath="$1"
echo "Saving build result: ${nixResultPath}"
mkdir -p result
cp -vfr ${nixResultPath}/* result/
chmod u+w -R result/
mkdir -p "${resultPath}"
cp -vfr ${nixResultPath}/* "${resultPath}"
chmod u+w -R "${resultPath}"
}
# Load Nix profile