Skip to content

Commit

Permalink
Add gradle task for production dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
loremattei committed Nov 27, 2019
1 parent b8e888e commit fe6be7d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
BUNDLE_PATH: "vendor/bundle"
BUNDLE_RETRY: "3"
BUNDLE_JOBS: "3"
BUNDLE_WITHOUT: "screenshots"
64 changes: 64 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,67 @@ ext {
daggerVersion = '2.22.1'
fluxCVersion = '1.5.1'
}

task checkBundler(type:Exec) {
doFirst {
println "Check Bundler"
}

workingDir = './'
executable "sh"
args "-c", "if ! type 'bundle' > /dev/null; then gem install bundler; fi"

//store the output instead of printing to the console:
standardOutput = new ByteArrayOutputStream()

//extension method checkBundler.output() can be used to obtain the output:
ext.output = {
return standardOutput.toString()
}
}

task checkBundle(type:Exec, dependsOn:checkBundler) {
doFirst {
println "Check Bundle"
}

workingDir = './'
executable "sh"
args "-c", "bundle check --path=\${BUNDLE_PATH:-vendor/bundle} > /dev/null || bundle install --jobs=3 --retry=3 --path=\${BUNDLE_PATH:-vendor/bundle}"

//store the output instead of printing to the console:
standardOutput = new ByteArrayOutputStream()

//extension method checkBundle.output() can be used to obtain the output:
ext.output = {
return standardOutput.toString()
}
}

task applyCredentials(type:Exec, dependsOn:checkBundle) {
doFirst {
println "Apply credentials for this branch"
}

workingDir = './'
executable "sh"
args "-c", "FASTLANE_SKIP_UPDATE_CHECK=1 FASTLANE_ENV_PRINTER=1 bundle exec fastlane run configure_apply force:true"

//store the output instead of printing to the console:
standardOutput = new ByteArrayOutputStream()

//extension method checkBundle.output() can be used to obtain the output:
ext.output = {
return standardOutput.toString()
}
}


tasks.register("prodDeps") {
group = 'Onboarding'
description = 'Install dependencies for production builds'
dependsOn applyCredentials
doLast {
println("Done")
}
}

1 comment on commit fe6be7d

@abdi5
Copy link

@abdi5 abdi5 commented on fe6be7d Feb 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.