How to install an updated version of a Dart package? - installation

When a new Dart package is published, how can I install the updated version?

The DartEditor calls pub get automatically when the file pubspec.yaml is updated.
You may call it manually (e.g. when you for example checked out a project from GitHub without modifying any file)
by using the context menu Pub Get in DartEditor on the file pubspec.yaml
by calling pub get on the command line in the package directory where the file pubspec.yaml is stored.
pub get downloads the package version noted in the file pubspec.lock (in the package root directory) or the most recent version that fulfills your version constraint (0.0.1 in your example could be any for 'most recent') if pubspec.lock doesn't exist. pub get/pub upgrade create the file pubspec.lock if it doesn't yet exist and save the versions of the downloaded packages it just downloaded.
Check for updated packages and download them using
context menu Pub Upgrade in DartEditor on the file pubspec.yaml
pub upgrade on the command line in the package directory where the file pubspec.yaml is stored.
pub upgrade downloads the most recent version that fulfills your version constraints and stores the downloaded version in the file pubspec.lock.
pub get/pub upgrade prefers stable releases (version numbers that don't contain a -) like 0.0.1 or 1.2.0+1 over pre-releases like 0.0.2-1 or 1.2.1-1 if any is available that fulfulls your version constraint.
If you want a pre-release you have to tighten the version constraint so that only the pre-release fulfills your constraints (like angular: '>=1.2.1')
pub upgrade may show an output like
analyzer 0.10.5 (9 newer versions available)
Which indicates that there are 9 prerelease builds available that are newer than the downloaded stable build.
The version constraint for your dependency needs to fulfill the version constraints of all your dependencies dependencies (E.g. if you add the dependencies observe and polymer where polymer depends on observe itself).
You can force pub get/pub upgrade to a version that violates your dependencies dependency by defining the dependency with a version constraint under dependencies_override: instead of dependencies: in pubspec.yaml.
You may also add dev_dependencies (e.g. unittest) which are only downloaded when they are defined in your package but ignored when they are only defined in one of your dependencies.
You see, this is an advanced topic even for seasoned Dart developers.

If you are a seasoned Dartisan, this question might seem so trivial to not be worth asking, but coming from a Java world (where my students and I are used to downloading .jars manually and then (sometimes) having to copy them over into our projects) it is a greenhorn question that is natural to ask. Here is the context: two days ago v0.9.5 of angular came out and so I made a mental note to upload the libraries in our local projects.
Well, it seems that all we need is an appropriately defined pubspec.yaml file, and the Dart pub package manager does the rest. In the Dart Editor, I guess that dependencies get updated on a project refresh or when it is (re-)built. In our projects we happened to have, e.g., a pubspec.yaml file like this:
name: angular_dart_demo
version: 0.0.1
dependencies:
angular: any
(as opposed to, say, angular: ">=0.9.0 <0.10.0") which allowed the Pub manager to go fetch the latest angular. Effortless. Nice.

Related

How to find go package version?

I am not using go modules. Have a bunch of packages present in my company's toolchain (i.e. I didn't install the packages and thus can't check my bash history for package version).
So the packages are present in $TOOLCHAIN_PATH/go/src. Is there any way I can find the version of a particular package.
If it helps, I want to find out the package version of crypto/tls.
I am not using go modules
So you are doing it wrong. It's 2021, you must use modules. Use modules.
I want to find out the package version of crypto/tls
This is a package of the stdlib which is shipped with your compiler and it is "unversioned" as a package. Run go version to see the version of your compiler/stdlib combination as a whole.

Unable to setup Gandalf Go

I am trying to setup Gandalf but when I do go get github.com/JumboInteractiveLimited/Gandalf I'm getting error
package github.com/jmartin82/mmock/definition: cannot find package "github.com/jmartin82/mmock/definition" in any of:
/usr/local/go/src/github.com/jmartin82/mmock/definition (from $GOROOT)
<My_Go_Path>/src/github.com/jmartin82/mmock/definition (from $GOPATH)
I'm using testing file from
This reached me via a GitHub Issue however I thought it best to mention it here for clarity.
Gandalf utilizes go modules to pin dependency versions, go get will download the latest version of a dependency rather than the version a project actually supports where as something like go mod download will respect the go.mod file and fetch the correct version. The mmock project has changed its package structure making newer versions of it not backwards compatible.
I recommend getting antiquated with go modules as they seem to be the way forward now and have been enabled by default in newer versions of the go compiler. If I remember correctly you may already have support for it you just need to set the environment variable GO111MODULE=on when dealing with projects that have a go.mod file.

Ask the developer for Microsoft.NET.Native.Runtime.2.1 package

I am trying to install the .appxbundle file,but it is showing
App Installer failed to install package dependencies. Ask the developer for Microsoft.NET.Native.Runtime.2.1 package.
I downgrade Microsoft.NETCore.UniversalWindowsPlatform to 6.0.1 then it is asking for
Microsoft.NET.Native.Runtime.2.0 package.
If I updated to latest version 6.2.8 it is asking for
Microsoft.NET.Native.Runtime.2.2 package.
Please help me for fix this.
Derive from this case reply, your current os miss
Microsoft.NET.Native.Runtime.2.0 package dependency. you could get them in the AppPackages folder where store the sideload package.
In the AppPackages sub folder we could find Dependencies folder then chose you want platform folder. You will find Dependencies package like following screenshot.
You could install them manually.

Building a React Native bridge but a file within the framework can't be found

I'm trying to build a React Native wrapper for the RichRelevance iOS SDK.
I've created the wrapper project and imported it into my React Native app. I'm using Cocoapods to add the RichRelevance SDK to the app
I'm now attempting to import the RichRelevance SDK into the wrapper project using:
#import <RichRelevanceSDK/RichRelevanceSDK.h>
The problem I have is that when the compiler attempts to compile the RichRelevanceSDK, it throws an error that one of the files is not found:
Line 63 is the original import that was written in the SDK. I added Line 62 to show that the file can be found if the type of import is changed. However, this isn't really an option since I don't want to modify the SDK (I don't own it).
In either type of import, I'm able to cmd+click the file and go to the definition. So XCode seems to know about the file. Additionally, I see the file in the Project browser under:
Pods -> Pods -> RichRelevanceSDK -> RCHImportable.h
The primary difference with this file is that, if I look in the file browser, that file is located in a sub-folder, relative to all of the other files in the SDK:
I'm hoping there's a way to change my wrapper project so that this file can be found, so I don't have to edit or fork the SDK files.
So far, I've attempted to update the various Search Paths in my wrapper project but with no luck. I've added the following two paths to all of the Search Paths:
UPDATE:
I was able to make some progress and I can now get it to compile.
I ended up:
cloning the SDK's repo to my computer
removing the SDK from the Podfile
adding the SDK's xcodeproj file to MyApp/Libraries
adding the SDK.framework file to MyApp -> Embedded Binaries
I can now import the SDK into my bridge module
I would still prefer to find a better way to do this though. This method either involves me committing the SDK to our repo or asking all of my colleagues to clone the repo to their machine. NPM can't seem to install the repo; my guess is this is due to the repo missing a package.json file
There does appear to be something wrong with the packaging, as the header in question would appear to be captured in the public_header_files glob in the Podspec.
However, I think more direct path is to simply include the RCHSDK.h file, as RCHSDK is the entrypoint to the SDK functions. The RichRelevanceSDK.h serves primarily as a shorthand for importing additional headers versus specifying them individually.
Alternatively, you can follow the instructions in Include of non-modular header inside framework module, this seemed to correct the issue in local tests.

How to uninstall old OSGI bundle version upon installation of a new version?

I am using the CQ Blueprints maven archetype for Adobe CQ to deploy OSGi bundles into CQ5.6.1. This archetype uses the Maven Sling Plugin to deploy the bundles by copying them into an install directory of my content repository.
I am changing the version numbers of my bundles upon every build using the maven versions plugin. Therefore, upon each deployment, a bundle jar with a new filename is installed, like commons-services-1.0.30.jar. My problem is, currently the older bundle versions, like commons-services-1.0.29.jar, are not removed upon installation of a newer version.
I would like to avoid old bundle versions piling up in my install folders. Therefore my question is: What is the best way to uninstall/delete these older versions upon installation of a new version?
Bundles piling up in an install folder are not really a problem - they will only use the space, but they are ignored by the Apache Sling OSGI installer that CQ uses to detect and install the bundles. The installer only considers the latest version of the bundle (based on its OSGi version header), and ignores older versions.
If you really want to remove the older bundle files, best is probably to create a small tool that finds them by walking the JCR tree under which they are installed (/apps I assume), and delete all but the latest version. If the bundle filenames consistently include the version number you can probably just sort their names with the right comparator and remove all but the last one. If you want to be really robust you'll need to read the bundle metadata to find out about its version number.
If you want to run your tool automatically at regular intervals you could register an OSGi EventHook to detect when new bundles are installed, and trigger a cleanup run when that happens.
Sorry if this sounds a bit complicated - but again leftover bundle files are not really problematic.
I solved the problem by configuring the filter.xml in my myproject-all module (see CQBlueprints description for the purpose of this module) to delete the contents of my bundle install folder. This way, old bundles are always deleted before new bundles are installed.
To delete the contents of my install folder, I added the following line to my filter.xml file:
<filter root="/apps/myapp/install">
use curl command to delete the specific bundle version.
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Edit: Removed purging as that was not applicable to the osgi bundle.

Resources