diff --git a/.gitignore b/.gitignore index 59abb83..bb8fb54 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,6 @@ /*.iml app/app.iml .ruby-version +.classpath +.project .settings -app/.settings diff --git a/Jenkinsfile b/Jenkinsfile index dda3eae..7c140d1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -67,7 +67,7 @@ JAVA_HOME: '/usr/java/latest', ANDROID_HOME: '/opt/android/sdk', GRADLE_USER_HOME: '/opt/android/gradle', - GRADLE_OPTS: '-XX:MaxMetaspaceSize=128m -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -Dme.jenkins', + GRADLE_OPTS: '-XX:MaxMetaspaceSize=256m -Xmx1792m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -Dme.jenkins -Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy=in-process', GOOGLE_API_CID: 'dappre-google-api', ], noIndex: '(.+_.+|production)', // Avoid automatic indexing for release and private branches @@ -209,7 +209,10 @@ if ( !lazyConfig.env.DRYRUN ) { withCredentials([file(credentialsId: env.GOOGLE_API_CID, variable: 'GOOGLE_API_FILE')]) { sh('cp $GOOGLE_API_FILE ~/GoogleAPICredentials.json') - fastLane('android', 'beta', '', 'rh-ruby24') + def currentVersion = androidVersion() + withEnv(["VERSION=${currentVersion.string}-${currentVersion.number}"],) { + fastLane('android', 'beta', '', 'rh-ruby24') + } } } }, @@ -256,7 +259,10 @@ if ( !lazyConfig.env.DRYRUN ) { withCredentials([file(credentialsId: env.GOOGLE_API_CID, variable: 'GOOGLE_API_FILE')]) { sh('cp $GOOGLE_API_FILE ~/GoogleAPICredentials.json') - fastLane('android', 'production', '', 'rh-ruby24') + def currentVersion = androidVersion() + withEnv(["VERSION=${currentVersion.string}-${currentVersion.number}"],) { + fastLane('android', 'production', '', 'rh-ruby24') + } } } }, diff --git a/docker-compose.yml b/docker-compose.yml index aa08d07..95e5caa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,11 @@ resources: limits: cpus: '1.5' - memory: 1280M + memory: 2560M + environment: + - JAVA_HOME=/usr/java/latest + - ANDROID_HOME=/opt/android/sdk + - GRADLE_OPTS=-XX:MaxMetaspaceSize=256m -Xmx1792m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -Dme.jenkins -Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy=in-process networks: bridge: diff --git a/fastlane/Fastfile b/fastlane/Fastfile index dfa59ee..b1bd5e6 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,7 +17,7 @@ platform :android do - desc "Extract Application Id from gradle file" + # Extract Application Id from gradle file def get_application_id(flavor = nil, path = '../app/build.gradle', constant_name = 'applicationId') application_id = nil application_id_suffix = nil @@ -82,7 +82,7 @@ return "#{application_id}#{application_id_suffix}" end - desc "Define flavor name for deploy branch" + # Define flavor name for deploy branch def getFlavorName(options) flavor = nil if options and options[:fl_branch] and ! options[:fl_branch][/.*_.*/] @@ -104,22 +104,36 @@ return flavor end - desc "Define package name for a branch" + # Define package name for a branch def getPackageName(options = nil) return get_application_id(getFlavorName(options)) end + # Extract version_name from environment var named VERSION + def getVersionName(options = nil) + version_name = ENV['VERSION'] ? ENV['VERSION'].split('-')[0] : nil + return version_name + end + + # Extract version_code from environment var named VERSION + def getVersionCode(options = nil) + version_code = ENV['VERSION'] ? ENV['VERSION'].split('-')[1] : nil + return version_code + end + before_all do |lane, options| # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..." end desc "Display infos about the app" lane :info do |options| + UI.message("App version name = #{getVersionName()}") + UI.message("App version number = #{getVersionCode()}") UI.message("App Flavor = #{getFlavorName(options)}") UI.message("App ID = #{getPackageName(options)}") end - desc "Runs all the tests" + desc "Run all the tests" lane :test do |options| gradle( task: "test", @@ -230,7 +244,6 @@ skip_upload_images: false, skip_upload_screenshots: false, package_name: "#{getPackageName(options)}", - version_code: lane_context[SharedValues::VERSION_CODE], ) end @@ -244,7 +257,7 @@ skip_upload_images: true, skip_upload_screenshots: true, package_name: "#{getPackageName(options)}", - version_code: lane_context[SharedValues::VERSION_CODE], + version_code: getVersionCode(), ) end @@ -258,7 +271,7 @@ skip_upload_images: true, skip_upload_screenshots: true, package_name: "#{getPackageName(options)}", - version_code: lane_context[SharedValues::VERSION_CODE], + version_code: getVersionCode(), ) end diff --git a/gradle.properties b/gradle.properties index 9ca4480..af40687 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,9 +26,15 @@ #-Duser.variant \ #-Dme.jenkins +#android.enableJetifier=true +#android.useAndroidX=true +#kotlin.incremental=true +#kapt.incremental.apt=true +#android.databinding.incremental=true +#android.enableR8=true # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects org.gradle.parallel=true -org.gradle.daemon=false +org.gradle.daemon=true org.gradle.caching=true