How to build production environment with canary flags? - ember.js

I would like to use one of canary flags currently available in ember-data 2.4.0-beta.2. When I use ember serve it works as expected. But with ember build --prod it throws error on code that requires that flag. I assume I have to enable it somewhere but didn't have any luck finding any documentation for it.
// I added flag into environment and made sure that it is not overridden on production
EmberENV: {
FEATURES: {
'ds-references': true
}
},

It was bug that is fixed now. Fixup feature flagging infrastructure.

Related

Is there a way to set up Prettier to work without the plugin in VSCode

I want to set up prettier to run in the project without having to install the plugin or having to run prettier smth like this:
"prettier-watch": "onchange \"**/*\" -- prettier --write --ignore-unknown {{changed}}"
in the background. Any ideas?
Additionally- read about an option of setting .vscode/settings.json to
{ "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true }
to automatize the setup for newly onboarded developers but this still requires the plugin

Robolectric unit tests using legacy instead of binary resources only when running multi-module unit test run config

I have a multi-module android project. I have a bunch of unit tests in each module and I have always been able to run them all at once using a run configuration like this one:
Many of my tests use a base class that runs with RobolectricTestRunner. This base class looks like this:
#RunWith(RobolectricTestRunner::class)
#Config(application = AndroidTest.ApplicationStub::class,
manifest = Config.NONE,
sdk = [21])
abstract class AndroidTest {
#Suppress("LeakingThis")
#Rule #JvmField val injectMocks = InjectMocksRule.create(this#AndroidTest)
fun application(): Application = ApplicationProvider.getApplicationContext()
internal class ApplicationStub : Application()
}
**When running these tests using the above config, I get the error **
[Robolectric] NOTICE: legacy resources mode is deprecated; see http://robolectric.org/migrating/#migrating-to-40
This makes many of my tests fail with ResourceNotFoundException
However, when I run tests only in a specific module, everything passes. This is because Robolectric now uses Binary resources:
[Robolectric] sdk=21; resources=BINARY
I have followed the migration instructions in build.gradle files for each module, having added the following in each android block:
testOptions {
unitTests {
includeAndroidResources = true
returnDefaultValues = true
}
}
One clue I have found but have been unable to fix is this when I run the ALL UNIT TEST task:
WARNING: No manifest file found at build/intermediates/merged_manifests/debug/../../library_manifest/debug/AndroidManifest.xml.
Falling back to the Android OS resources only.
No such manifest file: build/intermediates/merged_manifests/debug/../../library_manifest/debug/AndroidManifest.xml
To remove this warning, annotate your test class with #Config(manifest=Config.NONE).
I have tried, as you have seen, to add the manifest=Config.NONE, which had no effect (and is now deprecated anyway).
Edit: Also tried android.enableUnitTestBinaryResources = true in settings.gradle, but this prevents the app from building due to it being a deprecated flag in the current gradle tools.
Thanks for any help provided!
So with the default unit test run platform being changed to Gradle in Android Studio, I managed to figure out a way to run unit tests in multiple modules all at once, circumventing the Robolectric bug.
First, go into run configurations and create a new Gradle Config.
Then, as the gradle project, select the top level project.
For arguments, use --tests "*"
And now for the gradle tasks, this is a little bit more error-prone. Here is an example of how I have it setup for my project:
:androidrma:cleanTestGoogleDebugUnitTest :androidrma:testGoogleDebugUnitTest
:calendar:cleanTestDebugUnitTest :calendar:testDebugUnitTest
:gamification:cleanTest :gamification:test
:player:cleanTest :player:test
:playlists:cleanTest :playlists:test
:sleepjournal:cleanTest :sleepjournal:test
:sound-content-filters:cleanTest :sound-content-filters:test
Please note that I inserted new lines between each module for more clarity here, in the tasks, just separate each entry with a space.
For your app module, in my case named androidrma, you must use your build variants name in the cleanTestUnitTest and testUnitTest , in my case being GoogleDebug.
If we look at the calendar module, it is an android module, , so it still operates with the same logic as the appModule.
However, if you look at player, playlists, sleepjournal, etc. those are pure kotlin modules. The tasks thus differ in their syntax.
Once you have entered all this information and everything is functioning, I recommend checking "store as project file" checkbox at the top right of the run config setup screen.
This works in Android Studio 4.2 as well as Arctic Fox, haven't tested on other versions.

ember-cli-eslint error build passes

In an Ember application, I'm trying to switch from jshint to eslint. I've followed the readme for https://github.com/ember-cli/ember-cli-eslint. Everything seems to work when I run "ember test", except when there is an eslint error the build will still pass. I see the eslint error in the console output, but the build will say "ok" when it is done and all the unit tests have passed. How do I get the build to fail if there is an eslint error?
It looks like the default approach to this changed in 1.5.0 of ember-cli-eslint as described in this issue and the corresponding PR: https://github.com/ember-cli/ember-cli-eslint/issues/66
Looks like you have the option of switching the testGenerator function around to one of your own choosing however, so you should've able to pass one in to replace the default behavior if you want to. Might make upgrades to the extension a bit more fragile though ...

asp.net 5 using DNX

I am running into an issue trying to include the following in the project.json:
"Microsoft.AspNet.Security.Cookies": "1.0.0-beta3",
It gives me the following error:
The dependency Microsoft.AspNet.Securitu.Cookies 1.0.0-beta3 in project TestApp does not support framework DNX, Version=v4.5.1
as well as:
The dependency Microsoft.AspNet.Securitu.Cookies 1.0.0-beta3 in project TestApp does not support framework DNXCore, Version=v5.0
These are my framworks specified:
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
And here is my complete list of dependencies:
"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Security.Cookies": "1.0.0-beta2",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta5",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
"Microsoft.Framework.Logging": "1.0.0-beta7",
"Microsoft.Framework.Logging.Console": "1.0.0-beta8",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final"
},
So the question is, if it is not supported "cookies" what can i use instead?, i have tried to look around but have not had any luck.
I want to add security to a small app i am building, any better suggestions would be much appreciated.
There are a few things incorrect about what you're doing:
You are mixing beta2, beta4, beta5, beta8, and rc1 packages. Since there's a lot of churn between releases, that's a recipe for disaster. Try to stick to a single release (rc1 is the latest stable).
Microsoft.AspNet.Security.* has been renamed. If you have other packages for which you cannot find the rc1 version, search the Announcements repo to see if they got renamed.

yocto - using gdb with externalsrc

We’re extending an existing Yocto project. We’d like to be able to selectively modify components of the project and build using the local modifications, then debug those modifications with gdb.
We’ve added these features to get gdb and the debug symbol packages into the image:
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-debug"
IMAGE_FEATURES = "ssh-server-openssh dbg-pkgs"
We’ve added these variables to build from the local component code:
INHERIT += "externalsrc"
EXTERNALSRC_pn-[component] = “[local source code path]/[component]”
All seems well, as the build succeeds and the component in the image reflects local code changes. However, the component source code never makes it into the image, so it can’t be referenced in gdb.
Is there a secret to using dbg-pkgs and EXTERNALSRC together?
I believe this was due to a bug that was resolved in the 2.1 release, though I never pinpointed which commit actually resolved the issue. There's a bugzilla entry covering the issue - if you are still experiencing this with 2.1 please do let me know.