How is the value of connection.project.dir being determined? - buildship

In org.eclipse.buildship.core.prefs (in the .settings folder) how is the value of the key connection.project.dir determined and how can I control what project buildship writes there?
I looked at this https://discuss.gradle.org/t/documentation-of-org-eclipse-buildship-core-prefs/18697 and it says that there is no documentation on the pref file.

Related

How to change Xcode project file and folder target membership and visibility using command line/bash script? [duplicate]

Is there a way to change file's target membership in Xcode project via command line?
Here's what I'm trying to do via Xcode's UI:
I also had to do this for CI. After lots of digging, I do not believe this is common enough for anyone to have written a tool to help with doing.
The only conclusion I came to was to edit the project.pbxproj file directly, which is never a great thing to do. None of the tools which claim to do this were of any help until I found this stackoverflow answer on editing the project.pbxproj file. Essentially, you can convert the project.pbxproj file into a JSON format using plutil -convert json project.pbxproj and use a JSON manipulation tool to make those files as headers then point them to be headers of whichever target you would like.
When converting the project.pbxproj into JSON format, be aware that Xcode will no longer be able to show you the project navigator for that project. It will still build and run, however, so this is really only useful if you're planning to do this right before building (such as for CI).
(EDIT: As of July 2022, Xcode will now properly read a JSON version of its .pbxproj to allow you to view your files in the project navigator. I'm not sure which version introduced this, but it is at least now possible with later versions of Xcode.)
The format project.pbxproj as JSON has nearly all the important data under the "objects" key. The file you want to be a header already has an entry with the key being the UUID for the file and a path value you can use to relate the UUID to your file. Here's an example of that format:
// UUID for your file
"65TYSSDXHSLP4UUOAD9D40C322AAGHM9": {
"path": "MyHeader.h", // Your file's name
"isa": "PBXFileReference",
"includeInIndex": "1",
"lastKnownFileType": "sourcecode.c.h",
"sourceTree": "<group>"
}
There's another entry to declare this file as a header, which has its own UUID and a reference to the UUID of your file:
// UUID for your file as a header
"YU3BSD39O9PT5RESDFV741D1": {
"isa": "PBXBuildFile",
"fileRef": "65TYSSDXHSLP4UUOAD9D40C322AAGHM9", // UUID for your file MyHeader.h
"settings": {
"ATTRIBUTES": [
"Public" // could also be Project or Private
]
}
}
Then finally, your target has a list of header files where you will want the UUID for the header reference to go.
"A82GAE9A5HUIO063IOPQAAQIUFGSNXZ": {
"isa": "PBXHeadersBuildPhase",
"buildActionMask": "2147483647",
"files": [
"YU3BSD39O9PT5RESDFV741D1" // UUID for your file as a header
],
"runOnlyForDeploymentPostprocessing": "0"
}
Again, changing the project.pbxproj file directly is never a great idea, but until there's a better tool for making these changes without using Xcode, it's the best I could find. If anyone else is aware of something I'm not, please let me know.

how to replicate "WEB-INF/resources/apps/xbl/orbeon/us-state"

I try replicate the example with file "zip-states.xpl" in diretory "WEB-INF\resources\apps\xforms-sandbox\services" and files directory /WEB-INF/resources/apps/xbl/orbeon/us-state.
In my case, the first file (zip-states.xpl),I changed the value from select="doc('/xbl/orbeon/us-state/states.xml')/states/state to select="doc('/xbl/orbeon/colombia/states.xml')/states/state.
After, I copied the files from "apps/xbl/orbeon/us-state" to "apps/xbl/orbeon/colombia", and change file name us-state.xbl to colombia.xbl
In file colombia.xbl, I changed value from "src="oxf:/xbl/orbeon/us-state/state.xml" to src="oxf:/xbl/orbeon/colombia/state.xml" and I go to the test form , but its not working.
I try created the same case, for change the value in state.xml for colombia states but in other file.
Please, I hope you can help me
Many thanks.

Using the FSharp.Configuration type provider

I'd like to the use app.config file of my F# to store versioning information. I discovered the FSharp.Configuration type provider which seemed like it'd be simple enough. However, I'm running in to an error I can't diagnose.
Below is a screen shot of a version.config file (identical to the one in the link above) and a scratch pad.
As you can see, calling Settings auto populates a drop-down of everything in the <appSettings> chunk of the config but when I try to run something,
I get an error saying that the thing I'm looking for can't be found in the <appSettings> section of the config file.
What's causing this error, especially considering that it clearly is finding it in the config file, given it's auto-populating? What can I do to prevent this from happening again?
You have bumped into this issue.
When you run the Configuration provider in FSI it will look not for the app's config file but FSI's config file. One way to get around this is by specifying the exe's config file explicitly. Here's an example:
open FSharp.Configuration
open System
type Settings = AppSettings<"app.config">
[<EntryPoint>]
let main argv =
let path = System.IO.Path.Combine [|__SOURCE_DIRECTORY__ ;"bin";"release";"ConfigApplication.exe" |]
Settings.SelectExecutableFile path
Settings.TestBool <- false // change a setting
printfn "%A" Settings.Test2 // read another setting
Console.ReadLine() |> ignore
0 // return an integer exit code
This will take the App.config file in the source directory, but use the ConfigApplication.exe.config file in the binaries directory.
If you just need to set the DB's connection string, it's actually easier, if the SQL type provider has a config setting parameter, just specify the config file there (and set it to Always copy in VS), if you add that to .gitignore you can have many different app.config files with different connection strings.
You could also use the YAML provider, it has two advantages, it's not XML and it's not an erasing type provider.

What tools support editing project.pbxproj files?

I want to edit project.pbxproj straight up using command line (for CI server script)
what tools can allow me to do this?
I used to use PlistBuddy to edit the output Info.plist; however, what i really want to do is to edit this user defined field, which is used in multiple places, and i really don't want to have to hunt that down in every plist location
project.pbxproj is an old-style ASCII property list file, too. So you can use /usr/libexec/PlistBuddy to edit it.
Print some User-Defined key's value like this,
# Get the key A83311AA20DA4A80004B8C0E in your project.pbxproj
# LZD_NOTIFICATION_SERVICE_BUNDLE_ID is defined by me,
# Replace key paths with your own.
/usr/libexec/PlistBuddy -c 'print :objects:A83311AA20DA4A80004B8C0E:buildSettings:LZD_NOTIFICATION_SERVICE_BUNDLE_ID' LAAppAdapter.xcodeproj/project.pbxproj
Set its value like this,
/usr/libexec/PlistBuddy -c 'set :objects:A83311AA20DA4A80004B8C0E:buildSettings:LZD_NOTIFICATION_SERVICE_BUNDLE_ID com.dawnsong.notification-service' LAAppAdapter.xcodeproj/project.pbxproj
UPDATE
PlistBuddy will automatically convert project.pbxproj into a xml-format plist file since macOS Catalina (or some earlier version). It's better to move the setting item into xcconfig file instead since xcconfig is much smaller and simpler than project.pbxproj and not easy to make mistakes when editing with perl script.
I know this has been answered for a while, but since the original question is about tools supporting the manipulation of .pbxproj files, and many other people may be looking for the same information, here's how I do it. It took me quite a while to figure this out because I was very unfamiliar with Xcode when I started attempting this, so I hope this saves others the hours of grief I had to put in.
You can use the plutil command to transform the .pbxproj file from the legacy .plist format into an XML or JSON format you will be able to manipulate more easily. I'm using JSON. To do so, just run:
plutil -convert json project.pbxproj
This will convert the format of project.pbxproj, but be aware that -contrary to common sense- the output won't be another file with a JSON extention such as project.json. What will happen is that project.pbxproj will be converted to JSON format, but retain it's cryptic .pbxproj extension. So even though the file's format has been changed, Xcode will still pick it up and use it in its new JSON format.
Then you can change project.pbxproj with ease using any JSON manipulation tool of your choosing. I'm using Groovy's JsonSlurper class in a Groovy script.
Note I also explored the XML option, but I found the project.pbxproj file in XML format to be cumbersome to parse. The elements are not properly nested to allow for traversing the tree with ease. It's plagued with:
<key>someKey</key>
<dict>
<!--More elements which provide configuration for the key above-->
</dict>
So it's positional in nature. You have to look for the key element corresponding to the setting you want to manipulate and then jump to the dict element just after it. Which means you have to mount the children of each XML element into an array, in order to index them.
Here are 3 open-source tools which implement .pbxproj file editing:
https://github.com/CocoaPods/Xcodeproj (Ruby based)
https://github.com/apache/cordova-node-xcode (NodeJS based)
https://github.com/kronenthaler/mod-pbxproj (Python based)
Personally, I made the best experience with the NodeJS based tool. So far it has covered all our needs reliably.
In the following is listed an example javascript file update-project.js which sets the developer team ID, app entitlements, adds a GoogleService-Info.plist file to the project and checks it as part of the build target. Take it as an inspiration and adapt the scripts and its paths to your needs:
const fs = require('fs')
const xcode = require('xcode')
if (process.argv.length !== 3) {
console.error("Please pass the development team ID as the first argument")
process.exit(1)
}
const developmentTeamId = process.argv[2]
const path = 'ios/App/App.xcodeproj/project.pbxproj'
const project = xcode.project(path)
project.parse(error => {
const targetKey = project.findTargetKey('App')
const appGroupKey = project.findPBXGroupKey({path: 'App'})
project.addBuildProperty('CODE_SIGN_ENTITLEMENTS', 'App/App.entitlements')
project.addBuildProperty('DEVELOPMENT_TEAM', developmentTeamId)
project.addFile('App.entitlements', appGroupKey)
project.removeFile('GoogleService-Info.plist', appGroupKey)
const f = project.addFile('GoogleService-Info.plist', appGroupKey, {target: targetKey})
f.uuid = project.generateUuid()
project.addToPbxBuildFileSection(f)
project.addToPbxResourcesBuildPhase(f)
fs.writeFileSync(path, project.writeSync())
})
Above script can be executed with
yarn run update-project <arguments...>
given that update-project is registered in package.json:
{
...,
"scripts": {
...
"update-project": "node update-project.js"
},
...
}

How to open source file in IDE on a certain line through command line

I'm just wondering if there is some IDE command line parameter which would open a source file on a specified line (in the current view) ?
I know this is probably too much to publish as a command line parameter, but it would be great for my Assert logging system; I would just create a link (label or something) and through this link open the file on the line where the assertion has happened.
The only thing I found is the registry entry (valid for Delphi 2007)
Key:
HKEY_CURRENT_USER\Software\Borland\BDS\5.0\Closed Files\
Value:
TSourceModule,'<FilePath>',0,<PositionX>,<PositionY>,<CursorX>,<CursorY>,0,0,,
Where:
<FilePath> - the full file path
<PositionX> - first visible char in horizontal scope
<PositionY> - first visible char in vertical scope
<CursorX> - cursor position in horizontal scope
<CursorY> - cursor position in vertical scope
The rest of this key value I don't know but it might be enough to create this key and open the file.
Thanks
Following discussion in the comments to the question, it appears that you would be satisfied with writing a small utility to generate a fake .dsk file (desktop file) and possibly a matching fake .dproj file (project file). The .dsk file would contain just enough information to trick the IDE into opening the required file and moving to the desired location within that file.

Resources