[QBS] Platform probe procedure

BogDan bog_dan_ro at yahoo.com
Tue Mar 6 12:02:03 CET 2012


Hi André,

   The type name of is not important :), it can be renamed as you wish, I name it "combobox" because it was the first name which came in my head at that moment.  

As I said this is a proof of concept, and the idea behind it is important  ! :)


Cheers,
BogDan.

----- Original Message -----

> From: André Somers <andre at familiesomers.nl>
> To: qbs at qt-project.org
> Cc: 
> Sent: Tuesday, March 6, 2012 12:08 PM
> Subject: Re: [QBS] Platform probe procedure
> 
> Op 6-3-2012 10:50, BogDan schreef:
>>  Hello,
>> 
>>     I've check current "platform probe" procedure and I 
> don't find it very flexible, IMHO creating an application to probe a 
> platform is too complicated, as long as you have a very powerful scripting 
> language.  So, my proposal is to use QML to probe the platforms also.
>>  Because to probe for a platform you need some extra informations (e.g where 
> is the toolchain, etc.),  I tried to make it IDE friendly, meaning that the IDE 
> can create dynamic forms to collect all the informations needed to probe for 
> that platform.
>> 
>> 
>>  Here is a proof of concept android platform probe (I didn't check if 
> the syntax if is correct or not):
>> 
>>  //////////
>> 
>> 
>>  import qbs.base 1.0
>> 
>>  Platform {
>>       name: "android" // Name of the platform
>>       description: "Android O.S. support" // Description, used by 
> the IDE to show some info about the probe
>> 
>>       property var ndkPath
>>       PropertyOptions {
>>           name: "ndkPath" // Name of the property
>>           description: "Android NDK path" // The IDE will use this 
> information to fill a lable before the control
>>           type: "path" // the type is very important for IDE, in 
> this case the IDE will create a control which accepts only a path
>>           isValid: { // is this property valid ?  This info will be used by 
> the IDE to enable/disable any control which depends by this one (e.g. the 
> toolchain version should be disabled till this values will become true)
>>               if (!File.exists(ndkPath+'/toolchains') || 
> !File.exists(ndkPath+'/platforms'))
>>                   throw "Selected path doesn't seems to contains an 
> Android NDK"
>>               return true
>>           }
>>       }
>> 
>>       property var toolchainVersion
>>       PropertyOptions {
>>           Depends { name: "ndkPath" } // The IDE will use this 
> info to enable/dissble the control if the ndkPath is valid or not
>>           name: "toolchainVersion" // Name of the property
>>           description: "Please select the toolchain version" // 
> The IDE will use this information to fill the label before the control
>>           type: "combobox" // the IDE will create a combobox 
> control
>>           value: { // the IDE will fill the control (combobox) with these 
> values and it will use only one to set the property
>>               if (!ndkPath.isValid) // check if the ndkPath property is set 
> correctly
>>                   throw "Please select Android NDK path first"
>>               var versions
>>               var versionFiles = File.ls(ndkPath+'/toolchains/*') // 
> dir all the files from toolchains folder
>>               for (var ver in versionFiles)
>>               {
>>                   var match = /.*-(\d+.\d+.\d+)/(ver) // get the 
> version number, the files will have the following patter platform-abi-x.y.z 
> where x.y.z is the gcc version.
>>                   if (!versions.contains(match[1]))
>>                       versions.push(match[1])
>>               }
>>               return versions
>>           }
>> 
>>           isValid: { // check if the version is valid
>>               return ndkPath.isValid&&  
> toolchainVersion.value.contains(toolchainVersion)
>>           }
>>       }
>> 
>>       property bool isValid : false
>> 
>>       probe: {
>>           isValid = ndkPath.isValid&&  toolchainVersion.isValid
>>           return isValid
>>       }
>>  }
>> 
>> 
>>  //////////
>> 
>> 
> Disclaimer: I'm very new around here (following this more out of 
> interest than that I have technical knowhow to contribute), so forgive 
> me if I speak nonsense (but please do correct me).
> 
> I find that prescribing the IDE what control to use (type: "combobox") 
> 
> to make a selection a bit weird. Why don't you limit yourself to 
> describing that you have a list of options of which only one can be 
> chosen, and let the IDE figure out if it wants to use a combo box, a 
> list box, a spin control or whatever else is deemed appropriate by the IDE?
> 
> André
> 
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
> 



More information about the Qbs mailing list