-
-
Notifications
You must be signed in to change notification settings - Fork 988
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: Move from extras #366
Closed
Closed
Changes from all commits
Commits
Show all changes
4 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,42 @@ | ||
{ | ||
"homepage": "https://flutter.dev/", | ||
"description": "Google’s mobile app SDK for crafting high-quality native interfaces on iOS and Android in record time. ", | ||
"version": "1.7.8+hotfix.4", | ||
"license": "BSD-3-Clause", | ||
"url": [ | ||
"https://storage.googleapis.com/flutter_infra/releases/stable/windows/flutter_windows_v1.7.8+hotfix.4-stable.zip", | ||
"https://raw.githubusercontent.com/ScoopInstaller/Main/master/scripts/flutter-dev-setup.ps1" | ||
], | ||
"hash": [ | ||
"d2488e0744b8c59216cf4be0dc5d19364ed72d70f6101c392125207b8328accf", | ||
"bbd8dd269dd70d97e0224025281e55b7e2e32364d5c47e082ca7f45e33d1a613" | ||
], | ||
"depends": "android-sdk", | ||
"extract_dir": "flutter", | ||
"bin": "bin\\flutter.bat", | ||
"env_add_path": "bin\\cache\\dart-sdk", | ||
"post_install": [ | ||
"& \"$dir\\flutter-dev-setup.ps1\"", | ||
"Write-Host 'Some licenses need to be accepted before developing. We recommend you do so by running ''flutter doctor --android-licenses''.' -ForegroundColor Yellow", | ||
"flutter doctor" | ||
], | ||
"checkver": { | ||
"url": "https://storage.googleapis.com/flutter_infra/releases/releases_windows.json", | ||
"jsonpath": "$.releases[?(@.hash == $.current_release.stable && @.channel == 'stable')].version", | ||
"regex": "v(.+)" | ||
}, | ||
"autoupdate": { | ||
"url": "https://storage.googleapis.com/flutter_infra/releases/stable/windows/flutter_windows_v$version-stable.zip", | ||
"hash": { | ||
"url": "https://storage.googleapis.com/flutter_infra/releases/releases_windows.json", | ||
"jsonpath": "$.releases[?(@.archive =~ /.*$basename/)].sha256" | ||
} | ||
}, | ||
"suggest": { | ||
"Visual Studio Code with Flutter Extension": [ | ||
"vscode", | ||
"vscode-portable" | ||
], | ||
"Android Studio with Flutter Extension": "android-studio" | ||
} | ||
} |
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,169 @@ | ||
#requires -version 2 | ||
<# | ||
.SYNOPSIS | ||
This script assists in installing the required build-tools and platform SDKs to get started | ||
with Flutter development on an Android Phone. | ||
.DESCRIPTION | ||
This script assists in installing the required build-tools and platform SDKs to get started | ||
with Flutter development on an Android Phone. It detects whether any SDKs are installed and | ||
prompts to install them if not. | ||
.INPUTS | ||
None | ||
.OUTPUTS | ||
None | ||
.NOTES | ||
Version: 1.0 | ||
Author: Ardelean Călin | ||
Creation Date: 14 July 2018 | ||
Purpose/Change: Initial script development | ||
#> | ||
|
||
|
||
# Gets the installed packages list from sdkmanager | ||
function get-installed { | ||
param ( | ||
[Object]$sdkmanager_output | ||
) | ||
|
||
$flag_start = 0 | ||
$installed_items = @() | ||
|
||
ForEach ($line in $sdkmanager_output) { | ||
if ($flag_start -eq 1) { | ||
$match = [regex]::Match($line.Trim(), "^(\S*)\s+\|\s+\d+.*") | ||
if ($match.Success -eq $true) { | ||
$installed_items += $match.Groups[1].Value | ||
} | ||
} | ||
|
||
if ($line.ToLower().Contains("installed packages")) { | ||
$flag_start = 1 | ||
} | ||
elseif ($line.ToLower().Contains("available packages")) { | ||
$flag_start = 0 | ||
break | ||
} | ||
} | ||
|
||
$installed_items | ||
} | ||
|
||
# Finds the latest reference to 'build-tools' that is not a release canditate. | ||
# This results in the latest released build-tools version. | ||
function get-latest-buildtools { | ||
param ( | ||
[Object]$sdkmanager_output | ||
) | ||
|
||
$latest_buildtools = "" | ||
|
||
ForEach ($line in $sdkmanager_output) { | ||
$build_tools = [regex]::Match($line.Trim(), "^(build-tools;\d+\.\d+\.\d)(?!-rc.*).*") | ||
if ($build_tools.Success -eq $true) { | ||
$latest_buildtools = $build_tools.Groups[1].Value | ||
} | ||
} | ||
|
||
$latest_buildtools | ||
} | ||
|
||
# Gets available platforms from sdkmanager | ||
function get-platforms { | ||
param ( | ||
[Object]$sdkmanager_output | ||
) | ||
|
||
$platforms = @() | ||
ForEach ($line in $sdkmanager_output) { | ||
$match = [regex]::Match($line.Trim(), "^(platforms;android-\d+).*") | ||
if ($match.Success -eq $true) { | ||
$platforms += $match.Groups[1].Value | ||
} | ||
} | ||
|
||
$platforms | ||
} | ||
|
||
# Check internet conenction first and only continue on success | ||
$connection = Test-NetConnection | ||
|
||
if ($connection.PingSucceeded -eq $false) { | ||
$scriptName = $MyInvocation.MyCommand.Name | ||
Write-Host "$scriptName could not connect to the internet. Please connect to the internet and try again, or install flutter requirements manually." -ForegroundColor Yellow | ||
exit 1 | ||
} | ||
|
||
# Check if sdkmanager exists and in path. Program cannot continue without it | ||
Get-Command "sdkmanager" -ErrorAction SilentlyContinue -ErrorVariable err | Out-Null | ||
if ($err.Count -eq $true) { | ||
Write-Host "Could not find 'sdkmanager' in PATH. Make sure you have android-sdk installed." -ForegroundColor Red | ||
exit 2 | ||
} | ||
|
||
# Runs sdkmanager with the --list argument to see what is installed on the system | ||
# and what needs to be installed. | ||
$sdkout = sdkmanager.bat --list | ||
|
||
|
||
$installed_items = get-installed $sdkout | ||
$latest_buildtools = get-latest-buildtools $sdkout | ||
# Get the platforms and sort them by API Level (which is the number in eg. platforms;android-21) | ||
$platforms = (get-platforms $sdkout) | Sort-Object -Property @{ | ||
Expression = { | ||
$x = $_[($_.IndexOf("-") + 1)..$_.length] -Join "" | ||
[int]$x | ||
} | ||
} | Get-Unique | ||
|
||
# Check if we have at least one valid platform | ||
$platform_installed = ($installed_items | % {$_.Contains("platforms;")}).Contains($true) | ||
# Check if we have at least one valid version of buildtools | ||
# TODO: Maybe in the future suggest installing the latest version | ||
$buildtools_installed = ($installed_items | % {$_.Contains("build-tools;")}).Contains($true) | ||
|
||
|
||
# No build-tools detected, so we install them | ||
if ($buildtools_installed -eq $false) { | ||
Write-Host "No build-tools detected. Installing the latest version... ($latest_buildtools)" -ForegroundColor Yellow | ||
sdkmanager.bat "$latest_buildtools" | ||
} | ||
|
||
# No platform SDK detected, so we install one from the available ones | ||
if ($platform_installed -eq $false) { | ||
Write-Host "Available platforms:" | ||
|
||
$i = 1 | ||
Write-Host (($platforms | % {$platform = $platforms[$i - 1]; "[$i] $platform"; $i++}) -Join "`n") | ||
|
||
Write-Host "For a list of platforms and what they mean, see: https://developer.android.com/about/dashboards/" -ForegroundColor Yellow | ||
$i-- | ||
Write-Host "No platform detected. Please select a platform to install [Default: $i]: " -ForegroundColor Yellow -NoNewline | ||
|
||
# Prompts the user to give a valid number and not try to break the program | ||
do { | ||
try { | ||
$numOk = $true | ||
$value = Read-host | ||
if ($value) { | ||
$api_level = [int]$value | ||
} | ||
else { | ||
$api_level = 22 | ||
break | ||
} | ||
} | ||
catch { | ||
$numOK = $false | ||
Write-Host $"Invalid number format, please try again: " -NoNewline | ||
} | ||
} | ||
until (($api_level -ge 1 -and $api_level -lt $platforms.Length) -and $numOK) | ||
|
||
$platform = $platforms[$api_level - 1] | ||
Write-Host "Platform $platform selected. Installing..." | ||
|
||
sdkmanager.bat $platform | ||
} | ||
|
||
# Done. We should be able to develop for Android now. | ||
Write-Host "All required dependencies for Android Development are installed." -ForegroundColor Green |
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.
This script could be rewritten to follow core format. But as it is work it is OK for moving.