first work version

This commit is contained in:
Andrei Yankovich 2019-12-30 13:33:56 +03:00
parent 1f973b55db
commit 38630515fe
4 changed files with 72 additions and 115 deletions

128
README.md
View File

@ -1,87 +1,57 @@
<h1 align="center">
<img src="https://avatars1.githubusercontent.com/u/29598503?v=3&s=256" alt="[Project]">
<br />
[Project]
</h1>
# Android SDK in SNAP-STORE
<p align="center"><b>This is the snap for [Project]</b>, <i>“Single-line elevator pitch for your amazing snap”</i>. It works on Ubuntu, Fedora, Debian, and other major Linux
distributions.</p>
## Description
<!-- Uncomment and modify this when you are provided a build status badge
<p align="center">
<a href="https://build.snapcraft.io/user/snapcrafters/fork-and-rename-me"><img src="https://build.snapcraft.io/badge/snapcrafters/fork-and-rename-me.svg" alt="Snap Status"></a>
</p>
-->
This is snap version of console sdk manager for Android. For more information about sdkmanager see official google [documentation](git@github.com:EndrII/sdkmanager-android.git)
### sdkmanager
<!-- Uncomment and modify this when you have a screenshot
![my-snap-name](screenshot.png?raw=true "my-snap-name")
-->
The sdkmanager is a command line tool that allows you to view, install, update, and uninstall packages for the Android SDK. If you're using Android Studio, then you do not need to use this tool and you can instead manage your SDK packages from the IDE.
The sdkmanager tool is provided in the Android SDK Tools package (25.2.3 and higher) and is located in android_sdk/tools/bin/.
#### Usage:
All SKD files location in the snap home folder:
```
~/snap/android-sdk/current/AndroidSDK
```
You can use the sdkmanager to perform the following tasks.
List installed and available packages
sdkmanager --list [options]
Install packages
sdkmanager packages [options]
The packages argument is an SDK-style path as shown with the --list command, wrapped in quotes (for example, "build-tools;29.0.0" or "platforms;android-28"). You can pass multiple package paths, separated with a space, but they must each be wrapped in their own set of quotes.
For example, here's how to install the latest platform tools (which includes adb and fastboot) and the SDK tools for API level 28:
sdkmanager "platform-tools" "platforms;android-28"
Alternatively, you can pass a text file that specifies all packages:
sdkmanager --package_file=package_file [options]
The package_file argument is the location of a text file in which each line is an SDK-style path of a package to install (without quotes).
To uninstall, simply add the --uninstall flag:
sdkmanager --uninstall packages [options]
sdkmanager --uninstall --package_file=package_file [options]
Update all installed packages
sdkmanager --update [options]
Options
The following table lists the available options for the above commands.
Option Description
--sdk_root=path Use the specified SDK path instead of the SDK containing this tool
--channel=channel_id Include packages in channels up to channel_id. Available channels are:
0 (Stable), 1 (Beta), 2 (Dev), and 3 (Canary).
--include_obsolete Include obsolete packages in the package listing or package updates. For use with --list and --update only.
--no_https Force all connections to use HTTP rather than HTTPS.
--verbose Verbose output mode. Errors, warnings and informational messages are printed.
--proxy={http | socks} Connect via a proxy of the given type: either http for high level protocols such as HTTP or FTP, or socks for a SOCKS (V4 or V5) proxy.
--proxy_host={IP_address | DNS_address} IP or DNS address of the proxy to use.
--proxy_port=port_number Proxy port number to connect to.
<p align="center">Published for <img src="https://raw.githubusercontent.com/anythingcodes/slack-emoji-for-techies/gh-pages/emoji/tux.png" align="top" width="24" /> with 💝 by Snapcrafters</p>
## Install
sudo snap install my-snap-name
sudo snap install android-sdk
snap connect android-sdk:android-config
<!-- Uncomment and modify this when your snap is available on the store
[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-white.svg)](https://snapcraft.io/my-snap-name)
-->
([Don't have snapd installed?](https://snapcraft.io/docs/core/install))
## Remaining tasks
<!-- Uncomment and modify this when you have a screenshot
![my-snap-name](screenshot.png?raw=true "my-snap-name")
-->
Snapcrafters ([join us](https://forum.snapcraft.io/t/join-snapcrafters/1325))
are working to land snap install documentation and
the [snapcraft.yaml](https://github.com/snapcrafters/fork-and-rename-me/blob/master/snap/snapcraft.yaml)
upstream so [Project] can authoritatively publish future releases.
- [x] Fork the [Snapcrafters template](https://github.com/snapcrafters/fork-and-rename-me) repository to your own GitHub account.
- If you have already forked the Snapcrafter template to your account and want to create another snap, you'll need to use GitHub's [Import repository](https://github.com/new/import) feature because you can only fork a repository once.
- [ ] Rename the forked Snapcrafters template repository
- [ ] Update the description of the repository
- [ ] Update logos and references to `[Project]` and `[my-snap-name]`
- [ ] Create a snap that runs in `devmode`
- [ ] Register the snap in the store, **using the preferred upstream name**
- [ ] Add a screenshot to this `README.md`
- [ ] Publish the `devmode` snap in the Snap store edge channel
- [ ] Add install instructions to this `README.md`
- [ ] Update snap store metadata, icons and screenshots
- [ ] Convert the snap to `strict` confinement, or `classic` confinement if it qualifies
- [ ] Publish the confined snap in the Snap store beta channel
- [ ] Update the install instructions in this `README.md`
- [ ] Post a call for testing on the [Snapcraft Forum](https://forum.snapcraft.io) - [link]()
- [ ] Make a post in the [Snapcraft Forum](https://forum.snapcraft.io) asking for a transfer of the snap name from you to snapcrafters - [link]()
- [ ] Ask a [Snapcrafters admin](https://github.com/orgs/snapcrafters/people?query=%20role%3Aowner) to fork your repo into github.com/snapcrafters, and configure the repo for automatic publishing into edge on commit
- [ ] Add the provided Snapcraft build badge to this `README.md`
- [ ] Publish the snap in the Snap store stable channel
- [ ] Update the install instructions in this `README.md`
- [ ] Post an announcement in the [Snapcraft Forum](https://forum.snapcraft.io) - [link]()
- [ ] Submit a pull request or patch upstream that adds snap install documentation - [link]()
- [ ] Submit a pull request or patch upstream that adds the `snapcraft.yaml` and any required assets/launchers - [link]()
- [ ] Add upstream contact information to the `README.md`
- If upstream accept the PR:
- [ ] Request upstream create a Snap store account
- [ ] Contact the Snap Advocacy team to request the snap be transferred to upstream
- [ ] Ask the Snap Advocacy team to celebrate the snap - [link]()
If you have any questions, [post in the Snapcraft forum](https://forum.snapcraft.io).
<!--
## The Snapcrafters
| [![Your Name](https://gravatar.com/avatar/bc0bced65e963eb5c3a16cab8b004431/?s=128)](https://github.com/yourname/) |
| :---: |
| [Your Name](https://github.com/yourname/) |
-->
<!-- Uncomment and modify this when you have upstream contacts
## Upstream
| [![Upstream Name](https://gravatar.com/avatar/bc0bced65e963eb5c3a16cab8b004431?s=128)](https://github.com/upstreamname) |
| :---: |
| [Upstream Name](https://github.com/upstreamname) |
-->
## Build
sudo snap install snapcraft --classic
snapcraft

View File

@ -1,9 +1,9 @@
#!/bin/bash
chmod 777 "$SNAP/tools/bin/sdkmanager"
SDK_ROOT=$HOME/AndroidSDK
export JAVA_HOME="$SNAP/usr/lib/jvm/java-8-openjdk-amd64"
for var in "$@"
do
if [[ $var == *"--sdk_root"* ]]; then

View File

@ -2,39 +2,7 @@ name: android-sdk # you probably want to 'snapcraft register <name>'
version: '1.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: The package contains android sdkmanager. # 79 char long summary
description: |
This is snap version of console sdk manager for Android. For more information about sdkmanager see official google documentation git@github.com:EndrII/sdkmanager-android.git. |
sdkmanager |
The sdkmanager is a command line tool that allows you to view, install, update, and uninstall packages for the Android SDK. If you're using Android Studio, then you do not need to use this tool and you can instead manage your SDK packages from the IDE. |
The sdkmanager tool is provided in the Android SDK Tools package (25.2.3 and higher) and is located in android_sdk/tools/bin/. |
Usage |
You can use the sdkmanager to perform the following tasks. |
List installed and available packages |
sdkmanager --list [options] |
Install packages |
sdkmanager packages [options] |
The packages argument is an SDK-style path as shown with the --list command, wrapped in quotes (for example, "build-tools;29.0.0" or "platforms;android-28"). You can pass multiple package paths, separated with a space, but they must each be wrapped in their own set of quotes. |
For example, here's how to install the latest platform tools (which includes adb and fastboot) and the SDK tools for API level 28: |
sdkmanager "platform-tools" "platforms;android-28" |
Alternatively, you can pass a text file that specifies all packages: |
sdkmanager --package_file=package_file [options] |
The package_file argument is the location of a text file in which each line is an SDK-style path of a package to install (without quotes). |
To uninstall, simply add the --uninstall flag: |
sdkmanager --uninstall packages [options] |
sdkmanager --uninstall --package_file=package_file [options] |
Update all installed packages |
sdkmanager --update [options] |
Options |
The following table lists the available options for the above commands. |
Option Description |
--sdk_root=path Use the specified SDK path instead of the SDK containing this tool |
--channel=channel_id Include packages in channels up to channel_id. Available channels are: |
0 (Stable), 1 (Beta), 2 (Dev), and 3 (Canary). |
--include_obsolete Include obsolete packages in the package listing or package updates. For use with --list and --update only. |
--no_https Force all connections to use HTTP rather than HTTPS. |
--verbose Verbose output mode. Errors, warnings and informational messages are printed.|
--proxy={http | socks} Connect via a proxy of the given type: either http for high level protocols such as HTTP or FTP, or socks for a SOCKS (V4 or V5) proxy. |
--proxy_host={IP_address | DNS_address} IP or DNS address of the proxy to use. |
--proxy_port=port_number Proxy port number to connect to. |
This is snap version of console sdk manager for Android. For more information about sdkmanager see official google documentation git@github.com:EndrII/sdkmanager-android.git.
grade: stable
confinement: strict
@ -44,7 +12,7 @@ parts:
android-sdk:
# See 'snapcraft plugins'
plugin: dump
source: source
source: https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
stage-packages:
- libfreetype6
- libpng16-16
@ -55,6 +23,10 @@ parts:
- ca-certificates
- ca-certificates-java
- openjdk-8-jre-headless
override-stage: |
snapcraftctl stage
chmod 777 -R "$SNAPCRAFT_STAGE/tools"
after:
- android-sdk-wraper
@ -65,13 +37,25 @@ parts:
source: scripts
plugs:
android-config:
interface: personal-files
read:
- $HOME/.android
write:
- $HOME/.android
apps:
android-sdk:
command: start.sh
plugs:
- home
- removable-media
- network
- android-config
environment:
PATH: '$SNAP:$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH'
LD_LIBRARY_PATH: '$SNAP_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu'

3
snapcraft.sh Normal file → Executable file
View File

@ -2,6 +2,9 @@
BASE_DIR=$(dirname "$(readlink -f "$0")")
rm -f "$BASE_DIR/temp.zip"
rm -rdf "$BASE_DIR/source"
curl https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip --output "$BASE_DIR/temp.zip"
mkdir -p "$BASE_DIR/source"