flutter create . is failing with "You must specify a --flavor option" - flutter-web

I have an existing app I'm developing on mac and need to build a web version. As part of the flow for updating my app for the web, I type flutter create . from the project directory. When I do I get the error
The Xcode project defines schemes: dev, preprod, prod
You must specify a --flavor option to select one of the available schemes.
but flutter create does not have a --flavor option, so I'm stuck. :/
EDIT:
I ran flutter create . -v and got the output below
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -list
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Information about project "Runner":
Targets:
Runner
Build Configurations:
Debug-prod
Debug-preprod
Debug-dev
Release-prod
Release-preprod
Release-dev
Profile-prod
Profile-preprod
Profile-dev
If no build configuration is specified and -scheme is not passed then "Release-prod" is used.
Schemes:
dev
preprod
prod
[ +9 ms] The Xcode project defines schemes: dev, preprod, prod
[ +15 ms] "flutter create" took 1,798ms.
[ +5 ms] You must specify a --flavor option to select one of the available schemes.
So, I duplicated one of my schemes and named it Release-prod and ran the command again. I got the same error, but with Release-prod now listed. I then went into Xcode and disable all but one scheme, but am getting the same error with all three schemes listed. Is there somewhere else I can disable them? I'd rather not delete them.

flutter create --platforms=windows,macos,linux (flavor name)

Related

Is there a Uno-Platform head for a WinUI(xaml) and net7.0 desktop linux based app?

These are all the heads created when you run the following general command to create a new uno app "MyApp":
dotnet new unoapp -o MyApp --vscode
MyApp
MyApp.Base
MyApp.Mobile
MyApp.Server
MyApp.Skia.Gtk
MyApp.Skia.Linux.FrameBuffer
MyApp.Skia.WPF
MyApp.Wasm
MyApp.Windows
I want to try a UWP, now WinUI3 style app for desktop linux. The only "head" that I see with a similar App.xaml.cs structure is the MyApp.Base "head". The 'MyApp' head above is the shared code part right?
Also,when I run the following creating the app:
dotnet new unoapp -o MyApp -mobile=false --skia-wpf=false --skia-linux-fb=false --skia-gtk=false -wasm=false --vscode
I get the following heads:
MyApp
MyApp.Base
MyApp.Skia.WPF
MyApp.Windows
But in my launch.json I have these two configuration sets:
"name": "Debug (Chrome, WebAssembly)",
"name": "Skia.GTK (Debug)",
What am I missing?
I don't see an auto Add Configuration option for linux with a xaml window UI?
You should be able to select linux when creating a new project.
Screenshot taken from https://platform.uno/docs/articles/getting-started-tutorial-1.html.
If you do it from dotnet new, don't remove the linux options.
Remove the following arguments from your command --skia-linux-fb=false --skia-gtk=false.
About the solution structure for code sharing, know that the project template recently changed to move away from Shared Projects. The new structure uses a multi-targeted library. Here's the blog post about it: https://platform.uno/blog/uno-platform-4-7-new-project-template-performance-improvements-and-more/

Buildpacks: Is there any way to change the default location '/workspace' where all the source code gets copied during 'pack build' command

Buildpacks: Is there any way to change the default location '/workspace' where all the source code gets copied during 'pack build' command.
Referring to : https://buildpacks.io/
Example , this command "pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:bionic" will create a runnable image which will have '/workspace' location hosting all your app code.
I actually don't think this is possible as it looks like "workspace" is hard coded in the pack code.
However the Cloud Native Buildpacks lifecycle does allow the app directory to be specified, so maybe that is a feature that could be added.

gcloud app deploy does not remove previous versions

I am running a Node.js app on Google App Engine, using the following command to deploy my code:
gcloud app deploy --stop-previous-version
My desired behavior is for all instances running previous versions to be terminated, but they always seem to stick around. Is there something I'm missing?
I realize they are not receiving traffic, but I am still paying for them and they cause some background telemetry noise. Is there a better way of running this command?
Example output of the gcloud app instances list:
As you can see I have two different versions running.
We accidentally blew through our free Google App Engine credit in less than 30 days because of an errant flexible instance that wasn't cleared by subsequent deployments. When we pinpointed it as the cause it had scaled up to four simultaneous instances that were basically idling away.
tl;dr: Use the --version flag when deploying to specify a version name. An existing instance with the same version will be
replaced then next time you deploy.
That led me down the rabbit hole that is --stop-previous-version. Here's what I've found out so far:
--stop-previous-version doesn't seem to be supported anymore. It's mentioned under Flags on the gcloud app deploy reference page, but if you look at the top of the page where all the flags are listed, it's nowhere to be found.
I tried deploying with that flag set to see what would happen but it seemingly had no effect. A new version was still created, and I still had to go in and manually delete the old instance.
There's an open Github issue on the gcloud-maven-plugin repo that specifically calls this out as an issue with that plugin but the issue has been seemingly ignored.
At this point our best bet at this point is to add --version=staging or whatever to gcloud deploy app. The reference docs for that flag seem to indicate that that it'll replace an existing instance that shares that "version":
--version=VERSION, -v VERSION
The version of the app that will be created or replaced by this deployment. If you do not specify a version, one will be generated for you.
(emphasis mine)
Additionally, Google's own reference documentation on app.yaml (the link's for the Python docs but it's still relevant) specifically calls out the --version flag as the "preferred" way to specify a version when deploying:
The recommended approach is to remove the version element from your app.yaml file and instead, use a command-line flag to specify your version ID
As far as I can tell, for Standard Environment with automatic scaling at least, it is normal for old versions to remain "serving", though they should hopefully have zero instances (even if your scaling configuration specifies a nonzero minimum). At least that's what I've seen. I think (I hope) that those old "serving" instances won't result in any charges, since billing is per instance.
I know most of the above answers are for Flexible Environment, but I thought I'd include this here for people who are wondering.
(And it would be great if someone from Google could confirm.)
I had same problem as OP. Using the flex environment (some of this also applies to standard environment) with Docker (runtime: custom in app.yaml) I've finally solved this! I tried a lot of things and I'm not sure which one fixed it (or whether it was a combination) so I'll list the things I did here, the most likely solutions being listed first.
SOLUTION 1) Ensure that cloud storage deletes old versions
What does cloud storage have to do with anything? (I hear you ask)
Well there's a little tooltip (Google Cloud Platform Web UI (GCP) > App Engine > Versions > Size) that when you hover over it says:
(Google App Engine) Flexible environment code is stored and billed from Google Cloud Storage ... yada yada yada
So based on this info and this answer I visited GCP > Cloud Storage > Browser and found my storage bucket AND a load of other storage buckets I didn't know existed. It turns out that some of the buckets store cached cloud functions code, some store cached docker images and some store other cached code/stuff (you can tell which is which by browsing the buckets).
So I added a deletion policy to all the buckets (except the cloud functions bucket) as follows:
Go to GCP > Cloud Storage > Browser and click the link (for the relevant bucket) in the Lifecycle Rules column > Click ADD A RULE > THEN:
For SELECT ACTION choose "Delete Object" and click continue
For SELECT OBJECT choose "Number of newer versions" and enter 1 in the input
Click CREATE
This will return you to the table view and you should now see the rule in the lifecycle rules column.
REPEAT this process for all relevant buckets (the relevant buckets were described earlier).
THEN delete the contents of the relevant buckets. WARNING: Some buckets warn you NOT to delete the bucket itself, only the contents!
Now re-deploy and your latest version should now get deployed and hopefully you will never have this problem again!
SOLUTION 2) Use deploy flags
I added these flags
gcloud app deploy --quiet --promote --stop-previous-version
This probably doesn't help since these flags seem to be the default but worth adding just in case.
Note that for the standard environment only (I heard on the grapevine) you can also use the --no-cache flag which might help but with flex, this flag caused the deployment to fail (when I tried).
SOLUTION 3)
This probably does not help at all, but I added:
COPY app.yaml .
to the Dockerfile
TIP 1)
This is probably more of a helpful / useful debug approach than a fix.
Visit GCP > App Engine > Versions
This shows all versions of your app (1 per deployment) and it also shows which version each instance is running (instances are configured in app.yaml).
Make sure all instances are running the latest version. This should happen by default. Probably worth deleting old versions.
You can determine your version from the gcloud app deploy logs (at the start of the logs) but it seems that the versions are listed by order of deployment anyway (most recent at top).
TIP 2)
Visit GCP > App Engine > Instances
SSH into an instance. This is just a matter of clicking a few buttons (see screenshot below). Once you have SSH'd in run:
docker exec -it gaeapp /bin/bash
Which will get you into the docker container running your code. Now you can browse around to make sure it has your latest code.
Well I think my answer is long enough now. If this helps, don't thank me, J-ES-US is the one you should thank ;) I belong to Him ^^
Google may have updated their documentation cited in #IAmKale's answer
Note that if the version is running on an instance of an auto-scaled service, using --stop-previous-version will not work and the previous version will continue to run because auto-scaled service instances are always running.
Seems like that flag only works with manually scaled services.
This is a supplementary and optional answer in addition to my other main answer.
I am now, in addition to my other answer, auto incrementing version manually on deploy using a script.
My script contents are below.
Basically, the script auto increments version every time you deploy. I am using node.js so the script uses npm version to bump the version but this line could easily be tweaked to whatever language you use.
The script requires a clean git working directory for deployment.
The script assumes that when the version is bumped, this will result in file changes (e.g. changes to package.json version) that need pushing.
The script essentially tries to find your SSH key and if it finds it then it starts an SSH agent and uses your SSH key to git commit and git push the file changes. Else it just does a git commit without a push.
It then does a deploy using the --version flag ... --version="${deployVer}"
Thought this might help someone, especially since the top answer talks a lot about using the --version flag on a deploy.
#!/usr/bin/env bash
projectName="vehicle-damage-inspector-app-engine"
# Find SSH key
sshFile1=~/.ssh/id_ed25519
sshFile2=~/Desktop/.ssh/id_ed25519
sshFile3=~/.ssh/id_rsa
sshFile4=~/Desktop/.ssh/id_rsa
if [ -f "${sshFile1}" ]; then
sshFile="${sshFile1}"
elif [ -f "${sshFile2}" ]; then
sshFile="${sshFile2}"
elif [ -f "${sshFile3}" ]; then
sshFile="${sshFile3}"
elif [ -f "${sshFile4}" ]; then
sshFile="${sshFile4}"
fi
# If SSH key found then fire up SSH agent
if [ -n "${sshFile}" ]; then
pub=$(cat "${sshFile}.pub")
for i in ${pub}; do email="${i}"; done
name="Auto Deploy ${projectName}"
git config --global user.email "${email}"
git config --global user.name "${name}"
echo "Git SSH key = ${sshFile}"
echo "Git email = ${email}"
echo "Git name = ${name}"
eval "$(ssh-agent -s)"
ssh-add "${sshFile}" &>/dev/null
sshKeyAdded=true
fi
# Bump version and git commit (and git push if SSH key added) and deploy
if [ -z "$(git status --porcelain)" ]; then
echo "Working directory clean"
echo "Bumping patch version"
ver=$(npm version patch --no-git-tag-version)
git add -A
git commit -m "${projectName} version ${ver}"
if [ -n "${sshKeyAdded}" ]; then
echo ">>>>> Bumped patch version to ${ver} with git commit and git push"
git push
else
echo ">>>>> Bumped patch version to ${ver} with git commit only, please git push manually"
fi
deployVer="${ver//"."/"-"}"
gcloud app deploy --quiet --promote --stop-previous-version --version="${deployVer}"
else
echo "Working directory unclean, please commit changes"
fi
For node.js users if you call the script deploy.sh you should add:
"deploy": "sh deploy.sh"
In your package.json scripts and deploy with npm run deploy

"The directory name /app/Views/ is invalid" on ASP.NET Core deployment using docker

I followed this article to setup a performant ASP.NET Core deployment using Docker. This works until I try to start the container using docker run which calls dotnet MyAppName.dll There I got an exception, that the View path is not existing:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: The directory name /app/Views/ is invalid.
And thats true, cause in the folder created by dotnet publish area only dll files and no View folder:
user#server:/etc/jenkins/workspace/App# ll publish-output | grep View
-rwxr--r-- 1 root root 237K Aug 31 19:26 Microsoft.AspNetCore.Mvc.ViewFeatures.dll
I cant understand this, cause the View folder is included in the publishOptions like wwwroot too, which is also missing:
"publishOptions": {
"include": [
"wwwroot",
"Views/**/*.cshtml",
"Areas/**/*.cshtml"
]
},
I also tried "Views" instead of "Views/**/*.cshtml" but not working. In my understanding, those publishOptions should result in copying those folders to the publishing-directory when using dotnet publish.
What am I doing wrong?
I'm using the microsoft/aspnetcore-build:1.0.1 image for building and microsoft/aspnetcore:1.0.1 for starting the app like recommended as best practice in the article.
UPDATE
Seems to be a problem on linux only. My Win10 development machine works fine, there I get any view-folders published from the main app and areas as expected.
UPDATE #2 Using the examples on the aspnetcore-build repo on the docker hub, its not working too.
UPDATE #3 I created a new ASP.NET Core MVC project on my Windows 10 development machine using Visual Studio, then transferred it to the linux box: Not working, the views are missing.
UPDATE #4 Created a new app using dotnet new -t web directly on the linux box: Works like expected!
UPDATE #5 I ran dotnet new -t web on the Windows machine, moved the created folder to the linux server: Not working - Strange...
The problem was a missing space in the documentation before the dot, which should refer the current folder.
Wrong (1:1 copy from the description of the docker image)
RUN dotnet publish --output /out/. --configuration Release
Correct
RUN dotnet publish --output /out/ . --configuration Release
Here is the space missing: --output /out/{Space}.

TFS Workspace and Workfold conflicting on Linux with hosted TFS (VisualStudio.com)

I'm trying to figure out how to connect to TFS and get code stored on the hosted TFS (ie - visualstudio.com) down to my linux web server.
I have installed the TFS command-line client (tf.exe)
i run the following command:
$ tf workspace -new "My - Workspace" -collection:https://me.visualstudio.com/DefaultCollection -login:user,pass
then, i list the workspaces:
$ tf workspaces
Collection: https://gotmike.visualstudio.com/DefaultCollection/
Workspace Owner Computer Comment
-------------------- ----------- ------------------ -------------
My - Workspace My Name ip-xxx-xxx-xxx-xxx
all seems good...
then, i try to run workfold...
$ tf workfold -map -login:user,pass -server:http://me.visualstudio.com -workspace:"My - Workspace" '$/My - Workspace/My - Workspace' '/home/me/test'
An argument error occurred: The workspace 'My - Workspace' could not be found.
how can it not be found if it's showing up in the list? what am i doing wrong?
The /server flag is deprecated and should not be used against recent servers (those that have "project collections", like Visual Studio Online.) Instead use the /collection flag, like you did in the first example. The workspace should then be able to be found in the specified project collection.
For example:
tf workfold -map -login:user,pass -collection:https://me.visualstudio.com/DefaultCollection -workspace:"My - Workspace" '$/My - Workspace/My - Workspace' '/home/me/test'

Resources