-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter snap #57
Open
DiogoConstantino
wants to merge
3
commits into
InterruptorPt:master
Choose a base branch
from
DiogoConstantino:flutter-snap
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Flutter snap #57
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/bin/sh | ||
|
||
# This script will just issue the necessary commands for you to build the snap. | ||
# | ||
# Why is this script needed: | ||
# 1. The Flutter app code is not on the root directory of the repository | ||
# 2. It assists all users to generate a snap packge for the flutter app, even if | ||
# they don't know how to generate a snap package. | ||
# | ||
# What should users expect of it: | ||
# 1. It will only work on a system that is already snap enabled, it will fail | ||
# otherwise. And the user is expected to enable snap packages support by | ||
# him/herself. Details on how to do it can be found at: https://snapcraft.io/docs/installing-snapd | ||
# 2. If snapcraft is not installed it will be installed. | ||
|
||
|
||
# TODO: | ||
# 1. Output errros and warnings correctly to STDERR | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/erros/errors/ |
||
# 2. Refactor to use functions | ||
# X-1. Test!!! | ||
# X. Get more items for the TODO list and improve it | ||
|
||
# Possible exit status for the script: | ||
# 0 - Succeed generating packge | ||
# 1 - OS is currenlty not snap enabled | ||
# 2 - Snapcraft is not installed and failed to install | ||
# 3 - Failed changing into the directory that is the Flutter app base path | ||
# 4 - Snapcraft exited with a non 0 exit status | ||
|
||
echo "INFO: Checking if the Operating System is snap package enabled" | ||
which snap | ||
IS_SNAP_ENABLED=$? # if 0 yes 1 is no | ||
|
||
if [[ ${IS_SNAP_ENABLED} -eq 1 ]] | ||
then | ||
echo "ERROR: Your Operating System is not snap enabled." | ||
printf "WARN: To be able to generate a snap you need to have snap support and snapcraft installed.\nYou can learn how to enable snap packages support on your\nOperating System at: https://snapcraft.io/docs/installing-snapd\n\n" | ||
exit 1; | ||
fi | ||
|
||
|
||
which snapcraft | ||
IS_SNAPCRAFT_INSTALLED=$? | ||
|
||
if [[ ${IS_SNAPCRAFT_INSTALLED} -eq 1 ]] | ||
then | ||
echo "WARN: Snapcraft is not installed, will install now" | ||
sudo snap install snapcraft --classic | ||
INSTALATION_SUCCEED=$? | ||
if [[ ${INSTALATION_SUCCEED} -ne 0 ]] | ||
then | ||
echo "ERROR: Snapcraft installation failed!" | ||
echo "WARN: Stopping snap package generation procedure" | ||
exit 2 | ||
fi | ||
fi | ||
|
||
# make sure we are within the repository directory, otherwise guess it by the | ||
# path of $0 | ||
REPOSITORY_BASE_PATH=$(readlink ${0%$BASE}) | ||
|
||
# change directory into the Fluter app base path | ||
FLUTTER_APP_BASE_PATH=${REPOSITORY_BASE_PATH}/mobileapp | ||
if [[ -xd ${FLUTTER_APP_BASE_APP} ]] | ||
then | ||
cd ${FLUTTER_APP_BASE_APP} | ||
if [[ $? -ne 0 ]] | ||
then | ||
echo "ERROR: Failed changing directory into ${FLUTTER_APP_BASE_APP}" | ||
exit 3 | ||
fi | ||
fi | ||
|
||
# Generate the snap package | ||
snapcraft | ||
if [[ $? -ne 0]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/0]]/0 ]]/ |
||
then | ||
echo "ERROR: Failed generating snap package" | ||
exit 4 | ||
fi | ||
|
||
exit 0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mudar para
#!/bin/bash
isto usa bash built-ins como o
[[ ... ]]