fastlane-plugin-android_sdk_update 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a19d6630882705ee00b402ab1b6ab2affa3f9195
4
+ data.tar.gz: 81e849a64bbd4cd6332a8f1b09c0aa89b5a63379
5
+ SHA512:
6
+ metadata.gz: 55f3614bae1815ba4aa45ff1cf1aa4a0d9d492f3d263cda04d69320a5d0e842d99cdf5a083777094f4a61e588e9e61515e3f305ff9fe67dd2680466ac1f1d895
7
+ data.tar.gz: bd2ada92b79919b102d3a7de416a9b7ebaec994c43bc92080b18e4cf6c05627f42bf058bef960daf41b0b72c6d8b87a679fd3f94fcc637c5fdb5f9ceab77f53e
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 NovaTec Consulting GmbH <info@novatec-gmbh.de>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # android_sdk_update plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-android_sdk_update)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-android_sdk_update`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin android_sdk_update
11
+ ```
12
+
13
+ ## About android_sdk_update
14
+
15
+ Install and update required Android-SDK packages:
16
+
17
+ * The Android-SDK will be installed with Homebrew/Linuxbrew.
18
+ * Updates for the specified packages will be automatically installed.
19
+
20
+ ## Example
21
+
22
+ ```ruby
23
+ # With defined 'gradle.properties'- instructions below
24
+ android_sdk_update(
25
+ additional_packages: ["extras;google;m2repository", "extras;android;m2repository"]
26
+ )
27
+
28
+ android_sdk_update(
29
+ compile_sdk_version: "25",
30
+ build_tools_version: "25.0.2",
31
+ additional_packages: ["extras;google;m2repository", "extras;android;m2repository"]
32
+ )
33
+ ```
34
+
35
+ ## Instructions for compile_sdk_version and build_tools_version
36
+
37
+ In order to reference the same *compileSdkVersion* and *buildToolsVersion* as defined in your build.gradle, we are using the 'gradle.properties'.
38
+
39
+ First we set these versions in the property file
40
+
41
+ **gradle.properties**
42
+
43
+ ```java
44
+ compile_sdk_version=25
45
+ build_tools_version=25.0.2
46
+ ```
47
+
48
+ Now we can reference them in our gradle project
49
+
50
+ **build.gradle**
51
+
52
+ ```groovy
53
+ android {
54
+ compileSdkVersion project.compile_sdk_version.toInteger()
55
+ buildToolsVersion project.build_tools_version
56
+ ...
57
+ }
58
+ ```
59
+
60
+ ## Run tests for this plugin
61
+
62
+ To run both the tests, and code style validation, run
63
+
64
+ ```
65
+ rake
66
+ ```
67
+
68
+ To automatically fix many of the styling issues, use
69
+ ```
70
+ rubocop -a
71
+ ```
72
+
73
+ ## Issues and Feedback
74
+
75
+ For any other issues and feedback about this plugin, please submit it to this repository.
76
+
77
+ ## Troubleshooting
78
+
79
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
80
+
81
+ ## Using _fastlane_ Plugins
82
+
83
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
84
+
85
+ ## About _fastlane_
86
+
87
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/android_sdk_update/version'
2
+
3
+ module Fastlane
4
+ module AndroidSdkUpdate
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::AndroidSdkUpdate.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,124 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ ANDROID_SDK_DIR = :ANDROID_SDK_DIR
5
+ end
6
+
7
+ class AndroidSdkUpdateAction < Action
8
+ def self.run(params)
9
+ # Install Android-SDK via brew
10
+ require 'fastlane/plugin/brew'
11
+ if FastlaneCore::Helper.mac?
12
+ Actions::BrewAction.run(command: "install Caskroom/cask/android-sdk")
13
+ elsif FastlaneCore::Helper.linux?
14
+ Actions::BrewAction.run(command: "install android-sdk")
15
+ else
16
+ UI.user_error! 'Your OS is currently not supported.'
17
+ end
18
+
19
+ require 'java-properties'
20
+ properties = File.exist?("#{Dir.pwd}/gradle.properties") ? JavaProperties.load("#{Dir.pwd}/gradle.properties") : {}
21
+ tools_version = params[:build_tools_version] || properties[:build_tools_version] || UI.user_error!('No build tools version defined.')
22
+ sdk_version = params[:compile_sdk_version] || properties[:compile_sdk_version] || UI.user_error!('No compile sdk version defined.')
23
+
24
+ # Determine SDK dir and the sdkmanager
25
+ sdk_path = File.realpath("../..", FastlaneCore::CommandExecutor.which("android"))
26
+ sdk_manager = File.expand_path("tools/bin/sdkmanager", sdk_path)
27
+ Actions.lane_context[SharedValues::ANDROID_SDK_DIR] = sdk_path
28
+
29
+ packages = params[:additional_packages]
30
+ packages << "platforms;android-#{sdk_version}"
31
+ packages << "build-tools;#{tools_version}"
32
+ packages << "tools"
33
+ packages << "platform-tools"
34
+
35
+ # Install Packagaes
36
+ UI.header("Install Android-SDK packages")
37
+
38
+ unless File.exist?(sdk_manager)
39
+ # In case an old SDK is installed without the sdkmanager
40
+ UI.important("Installed Android-SDK tools are outdated.")
41
+ Actions.sh "echo y | android update sdk --no-ui --all --filter tools"
42
+ end
43
+
44
+ packages.each { |package| UI.message("• #{package}") }
45
+ FastlaneCore::CommandExecutor.execute(command: "echo y | #{sdk_manager} '#{packages.join("' '")}'",
46
+ print_all: true,
47
+ print_command: false)
48
+
49
+ if params[:override_local_properties]
50
+ UI.message("Override local.properties")
51
+ JavaProperties.write({ :"sdk.dir" => sdk_path }, "#{Dir.pwd}/local.properties")
52
+ end
53
+ end
54
+
55
+ #####################################################
56
+ # @!group Documentation
57
+ #####################################################
58
+
59
+ def self.description
60
+ "Install and update required Android-SDK packages"
61
+ end
62
+
63
+ def self.details
64
+ [
65
+ "The initial Android-SDK will be installed with Homebrew/Linuxbrew.",
66
+ "Updates for the specified packages will be automatically installed.",
67
+ "Instructions to configure 'compile_sdk_version' and 'build_tools_version': https://github.com/NovaTecConsulting/fastlane-plugin-android_sdk_update"
68
+ ].join("\n")
69
+ end
70
+
71
+ def self.example_code
72
+ [
73
+ 'android_sdk_update(
74
+ additional_packages: ["extras;google;m2repository", "extras;android;m2repository"]
75
+ )',
76
+ 'android_sdk_update(
77
+ compile_sdk_version: "25",
78
+ build_tools_version: "25.0.2",
79
+ additional_packages: ["extras;google;m2repository", "extras;android;m2repository"]
80
+ )'
81
+ ]
82
+ end
83
+
84
+ def self.available_options
85
+ [
86
+ FastlaneCore::ConfigItem.new(key: :compile_sdk_version,
87
+ env_name: "FL_ANDROID_COMPILE_SDK_VERSION",
88
+ description: "Compile-SDK Version of the project. Can also defined in 'gradle.properties'",
89
+ optional: true),
90
+ FastlaneCore::ConfigItem.new(key: :build_tools_version,
91
+ env_name: "FL_ANDROID_BUILD_TOOLS_VERSION",
92
+ description: "Build-Tools Version of the project. Can also defined in 'gradle.properties'",
93
+ optional: true),
94
+ FastlaneCore::ConfigItem.new(key: :additional_packages,
95
+ description: "List with additional sdk packages. Examples:\n
96
+ • extras;google;m2repository
97
+ • extras;android;m2repository",
98
+ is_string: false,
99
+ optional: true,
100
+ default_value: []),
101
+ FastlaneCore::ConfigItem.new(key: :override_local_properties,
102
+ env_name: "FL_ANDROID_SDK_OVERRIDE_LOCAL_PROPERTIES",
103
+ description: "Set the sdk-dir in 'local.properties' so Gradle finds the Android home",
104
+ is_string: false,
105
+ default_value: true)
106
+ ]
107
+ end
108
+
109
+ def self.output
110
+ [
111
+ ['ANDROID_SDK_DIR', 'Path to the android sdk']
112
+ ]
113
+ end
114
+
115
+ def self.authors
116
+ ["Philipp Burgk", "Michael Ruhl"]
117
+ end
118
+
119
+ def self.is_supported?(platform)
120
+ platform == :android
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,12 @@
1
+ module Fastlane
2
+ module Helper
3
+ class AndroidSdkUpdateHelper
4
+ # class methods that you define here become available in your action
5
+ # as `Helper::AndroidSdkUpdateHelper.your_method`
6
+ #
7
+ def self.show_message
8
+ UI.message("Hello from the android_sdk_update plugin helper!")
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module AndroidSdkUpdate
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-android_sdk_update
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Philipp Burgk
8
+ - Michael Ruhl
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-04-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: java-properties
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 0.2.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.2.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: fastlane-plugin-brew
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.1.1
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.1.1
42
+ - !ruby/object:Gem::Dependency
43
+ name: pry
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: bundler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rake
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rubocop
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: fastlane
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 2.27.0
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 2.27.0
126
+ description:
127
+ email:
128
+ - philipp.burgk@novatec-gmbh.de
129
+ - michael.ruhl@novatec-gmbh.de
130
+ executables: []
131
+ extensions: []
132
+ extra_rdoc_files: []
133
+ files:
134
+ - LICENSE
135
+ - README.md
136
+ - lib/fastlane/plugin/android_sdk_update.rb
137
+ - lib/fastlane/plugin/android_sdk_update/actions/android_sdk_update_action.rb
138
+ - lib/fastlane/plugin/android_sdk_update/helper/android_sdk_update_helper.rb
139
+ - lib/fastlane/plugin/android_sdk_update/version.rb
140
+ homepage: https://github.com/NovaTecConsulting/fastlane-plugin-android_sdk_update
141
+ licenses:
142
+ - MIT
143
+ metadata: {}
144
+ post_install_message:
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ requirements: []
159
+ rubyforge_project:
160
+ rubygems_version: 2.6.10
161
+ signing_key:
162
+ specification_version: 4
163
+ summary: Install required Android-SDK packages
164
+ test_files: []