Qbs >= 1.8 new property override syntax fails for modules - qbs

I have an app with product myproduct, depending on custom module mymodule:
// myproduct.qbs
Product {
name: "myproduct"
Depends { name: "mymodule" }
}
// mymodule.qbs
Module {
name: "mymodule"
property string value: ""
validate: { if (value == "") throw "mymodule.value is not set!" }
}
With Qbs 1.7 and lower I could set this property externally with syntax:
qbs ... mymodule.value:"somevalue"
and it worked as expected. With qbs 1.8 and newer, this fails with error:
Property override key 'mymodule.value' not understood.
Please use one of the following:
projects.<project-name>.<property-name>:value
products.<product-name>.<property-name>:value
modules.<module-name>.<property-name>:value
products.<product-name>.<module-name>.<property-name>:value
But neither of those work (property value is left unchanged):
qbs ... modules.mymodule.value:"somevalue"
qbs ... products.myproduct.mymodule.value:"somevalue"
What am I missing? Or is this a qbs bug?
P.S. it works as expected with project.someproperty:"..."

Your example works fine for me. I suggest you file a bug report at bugreports.qt.io and attach a complete example project. We can then figure out what's the problem there.

Related

Xcode can't find my target's module after I changed the executable name in Package.swift

I wanted to change the name of the executable produced from my Swift Package Manager project. Following this answer, my Package.swift now looks like this:
let package = Package(
name: "Foo", // my package is called "Foo"...
products: [
// and I want my executable to be called "bar"
.executable(name: "bar", targets: ["Foo"])
],
targets: [
.executableTarget(
name: "Foo",
dependencies: []),
.testTarget(
name: "FooTests",
dependencies: ["Foo"]),
]
)
In main.swift in the "Foo" target, I have written a function to test in the "FooTests" target:
// in main.swift
func foo() -> Int {
1
}
// in FooTests.swift
import XCTest
#testable import Foo
final class FooTests: XCTestCase {
func testFoo() throws {
XCTAssertEqual(foo(), 1)
}
}
If I build the project by pressing command + B at this point, Xcode would complain that the module "Foo" cannot be found, highlighting the "#testable import" line in FooTests.swift. It also says that the foo method cannot be found in scope.
I'm quite confused. I've only changed the executable name, not the module name (which I think is the same as the target name).
I tried running this on the command line with swift test, and it works perfectly.
I've also tried #testable import bar (because I might as well), and the error message changes to:
Undefined symbol: bar.foo() -> Swift.Int
How can I fix this? I still want to use Xcode to test my project. After all, a big feature of XCTest is that it's nicely integrated with Xcode.
Note that I'm using Xcode 13.1 and I'm opening the Swift Package Manager project by opening the folder containing Package.swift with Xcode.

Is there a way to compare bundle identifiers without using a hardcoded string?

I'm working on a project where we have two different app versions that are being handled as different targets, both apps are very similar but they differ in some screens that have different elements. So we are retrieving the app bundle identifier and comparing it with a hardcoded string to decide the flows, I need help finding a way to avoid using a hardcoded value for the string that is used for comparison with the bundle identifier.
This is how we are retrieving the bundle identifier:
var appName: String { return stringValue(for: kCFBundleNameKey) }
This is how we are getting the target:
var currentTarget: Target {
return appName == "AppNumber1" ? .appnumber1 : .appnumber2
}
Target is an enum with 2 cases:
enum Target {
case appnumber1
case appnumber2
}
So what I would like to do is to avoid using the hardcoded string "AppNumber1" to compare with the bundle identifier. Is there any alternative?
If you use Xcode 10.3, you can define a unique Active Compilation Condition for each target (APPNUMBER1, APPNUMBER2) and then you can check in code what target is currently running. An example is shown below.
#if APPNUMBER1
//Code for "AppNumber1"
#elseif APPNUMBER2
//Code for "AppNumber2"
#endif

How to turn off global scope in XText 2.9?

someone knows how to turn off the global scope in XText 2.9? I want to turn off the global scope in order to only can access the elements of the files that I import. For example:
file1.mydsl:
element A(C){
;
}
subelement C{
;
}
file2.mydsl:
element B(C){
;
}
This should return an error in file2.mydsl because I haven't imported "file1.mydsl". I should add the line - import "file1.mydsl" - to avoid the error. How can I do that in Xtext 2.9? I have a working code that does what I want but the code uses Xtext 2.8 and doesn't work on 2.9 version.
hi you can still switch to importURI based scoping
https://bugs.eclipse.org/bugs/show_bug.cgi?id=491110
fragment = org.eclipse.xtext.generator.adapter.FragmentAdapter {
fragment = org.eclipse.xtext.generator.scoping.ImportURIScopingFragment {}
}
or simply by adding the bindings manually
class MyDslRuntimeModule extends AbstractMyDslRuntimeModule {
override bindIGlobalScopeProvider() {
importuriglobalscopeprovider
}
override configureIScopeProviderDelegate(Binder binder) {
binder.bind(IScopeProvider).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
.to(SimpleLocalScopeProvider);
}
}

How to use Aurelia third party plugin with without typescript definition file?

I am new to Aurelia and Typescript. I am trying to use a the aurelia-dialog plugin inside of my project. I have follow all the necessary steps and am getting an error "cannot find module "aurelia-dialog". The offending line is
import {DialogService, DialogController} from "aurelia-dialog";
I am pretty sure all of the config is set up correctly because this is my only error. I have
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-dialog');
Do I need to create a typescript definition file for this to work, if so how? Or am I missing something and this should work as-is?
Looks like the aurelia-dialog build hasn't been configured to produce TypeScript definition files yet. This will probably be added soon. In the meantime you could add an aurelia-dialog.d.ts file to your project with the following:
declare module 'aurelia-dialog' {
export class DialogService {
open(settings: any): Promise;
}
export class DialogController {
constructor(renderer, settings, resolve, reject);
ok(result: any): Promise<DialogResult>;
cancel(result: any): Promise<DialogResult>;
error(message): Promise<DialogResult>;
close(ok: boolean, result: any): Promise<DialogResult>;
settings: {lock: boolean, centerHorizontalOnly: boolean };
}
export class DialogResult {
wasCancelled: boolean;
output: any;
constructor(cancelled: boolean, result: any);
}
}

Eclipse+gtest compile c++ error:multiple definition of test

I have project like this:
When I try to compile this,get error:undefined reference to `Foo::Foo()'
I have compiled gtest 1.7 and gmock 1.7,and copied all libg* to /user/lib,and my build setting like this:
and project paths and symbols like this:
Update:
got a new error
undefined reference is a linker error, indicating the linker could not find implementation for the specific method.
try to add a implementation for you foo constructor in foo.h
Change:
virtual ~Foo();
Foo();
bool foo(void) { return true; }
To
virtual ~Foo();
Foo() {} //add default implementation
bool foo(void) { return true; }