Can I avoid having all my OSDI containers copied? - equinox

I'm running on a platform that has very limited disk space and I was looking at disk usage of OpenDaylight.
The biggest directories are the plugins and configuration/org.eclipse.osgi/bundles directories. The plugins directory is where all my bundles are, so I'm OK with it. But the configuration/org.eclipse.osgi/bundles directory seems to contain mostly copies of my bundles.
For example configuration/org.eclipse.osgi/bundles/117/1/bundlefile is an exact copy of plugins/org.opendaylight.controller.clustering.services-implementation-0.4.0.jar. That is a big waste of disk space.
I've tried to find a configuration option to disable that and found nothing. Is there something?
I've looked at the Equinox source code as well and didn't find anything. Can somebody point me to the location in the code where this is done? I'd like to disable that or at least replace it by a hard link.

After asking the nice people on the Equinox mailing list, I've got to those conclusions:
With Equinox and some other OSDI implementations, you can add a "reference:" in front of the bundle URLs to avoid useless copies (still have to copy the native libs embedded in the bundles).
OpenDaylight is using org.apache.felix.fileinstall to avoid having to specify all the bundles to load. It just loads all the bundles found in a directory. And FileInstall doesn't allow to add the "reference:" in front of the URLs.
My solution was to remove FileInstall from the loaded bundles and add all the bundles manually to the list with the "reference:" string added to the "file:" URLs.

Related

Pre-load content into Documents or Library directories from XCode

I am building an iPhone app that requires preloaded content. This content is presented so that it tests the user's knowledge, but is not modified by the user. The content consists of proprietary image files and pdf files.
From what I understand, the best practice would be to store this in the app's Library or Documents directories (please inform if this assumption is not correct). In a future version of the app I might want to upload additional (not replacement) content via API, but this is not part of the initial version.
I have seen many posts and tutorials regarding obtaining paths to the Documents and Library directories of an app, and reading/writing to them. This is all good and useful, but not what I am looking for here.
I would like to preload the content into the Documents and/or Library directories, for the simulator initially, to test app in simulator; and ultimately to the release version. I would have thought this would be possible to do from XCode without writing code.
I have not been able to find a solution to this on Stack Overflow or other places on the net. Any pointers, links, solutions are welcome. I am using XCode 10.3 with Swift 4.2.
See the File System Programming Guide: File System Basics, which shows us:
The “data container” (including the Documents and the various Library folders) is for content generated/saved by the app. When, in Xcode, you mark resources as being part of the target, that becomes part of the bundle, and your app can retrieve it from there at runtime.
Theoretically, yes, you could copy data from the bundle to the Documents and/or Library folders, but, yes, you would have do that programmatically. It seems a bit wasteful to have two copies of these resources on the device, but you can do whatever you want. Generally, though, resources included in the bundle would just be be opened directly from there at runtime, not copying it to the data container (except for those cases where you would need to change it, because bundle contents are read-only).
FYI, for additional information regarding the file system, see the iOS Storage Best Practices video.

How to explore NSBundle contents?

I've got NSBundle file named main.jsbundle packaged by react-native bundle, which tool I can use to explore it's contents? I can see that it got the minified js code inside, and also some sort of index at the beginning of file. I need to extract the js code in order to debug an issue.
NSBundle is a totally different thing – it is a native class representing an Apple format of packaging applications and frameworks, allowing to access and manipulate it from native code.
You are asking about a React Native bundle, which is quite a loose concept of a single file of minified JS code + an assets folder for images and data. You can actually de-minify the js-bundle using conventional tools such as uglify-js and try to inspect it.
You can also use sourcemaps produced by Metro, and maybe metro-symbolicate to understand how the minified code from the bundle maps to actual sources, although I can't recommend anything more specific without knowing the problem at hand. There is also no documentation for metro-symbolicate, meaning you'll have to grok its sources.
As #ivanmoskalev pointed out, this might not be necceserily NSBundle. Anyway, piping the file through strings outputs pretty much just the javascript part of the file, so that works for me.

Is there a way to add native rules to Bazel?

I would like a set of rules from my_package.bzl to be accessible to all BUILD files of a workspace without having to load my_package.bzl in the BUILD files. Basically I want the rules in the package to look like native rules. How can I achieve this?
I was thinking maybe there's a line I could add to one of the .bazelrcs or to the WORKSPACE file of the the project.
This can be achieved by adding a prelude_bazel file at //tools/build_rules:prelude_bazel (this must be a package, so tools/build_rules must contain a BUILD file).
This will be loaded and prepended to all BUILD files loaded by Bazel.
However, there are a few things to consider before going this route. It's currently undocumented, and while doing some searching to find any info on this feature, it's unclear if it will remain a part of Bazel.
It may also have performance / scaling problems. If the prelude were to change (or any of its dependencies), every BUILD file would have to be reloaded, and this may take some time depending on the size of the build graph.

iOS - missing Platform Libraries

First of all, I've never worked on iOS, so this may or may not be a stupid question, I don't know :)
I have an iOS App, and I need to run it.
In the 'Project Navigator' I have a folder/package called 'Reuse and Platform Libraries'. Inside, I have another four folders but 3 of them seem like missing.
I am not sure if this is the case. I've tried googling their name but without results so I assume they are not some open source libraries.
Can someone clear this up for me? Do I need to install some XCode packages?
Thanks!
I suggest you search the folder of the project for those files, sometimes when copying a project the paths get screwed up because they were set as absolute paths and not relative paths.
If you can't find the files, it's most likely that the library is a private one used by the previous developers, and usually kept out of the project folder so they probably forgot to send it along. I'd suggest simply asking them to send the files over :).
There is also a slight chance they are not needed to run the file, in which case, just deleting them from the sidebar should make the project run.

Can I use iphoneSetDoNotBackupFile on a folder of files rather than individual files?

Do you know if I can use this on a folder and all the files within that folder will not be backed up? (in other words a folder rather than a file) I have a lot of code written accessing PDF files within several folders located in the special path documents folder. It would be pretty easy for me to set the do not back up of each one of those 7 folders but would rather not set the do not back up on each one of the 300 files within those 7 folders.
The same PDF`s folders also exist on my web server and so they can be updated or replaced if needed from there in the event they get deleted. Do you think Apple would be OK with me leaving them in the Documents/PDFDIR folders and setting the do not back up of those (7) folders?
This question was asked in a private support context, however, I felt it was valuable to answer here for others.
Yes it is. This property is recursive. While it's not really a duplicate answer because it's about a different language there is this answer here that backs up my answer in objective-c.

Resources