I have following properties in gradle.properties file:
prop1=/a/b/c
prop2=abc.txt
How I can set
prop3=prop1/prop2 in gradle.properties?
enter code hereAny kind of help is highly appreciated.
Dynamic property evaluation is not possible within the gradle.properties file. However, you can do the evaluation of prop3 within your build.gradle file.
ext.prop3 = "${prop1}/${prop2}"
prop3 can then be used within your build script as a project property (like prop1 and prop2)
Related
I want to access a module description variable (a custom variable) while building an android module i.e. an executable or shared-library or prebuilt and based on its value do some extra processing on the executable or shared-lib or prebuilt.
Is there a way to do it?
Add the variable to the list of variables in clear_vars.mk , so that they get cleared when an Android.mk does include $(CLEAR_VARS)
I have a metamodel.ecore which I generate its Model Code from the genmodel file (Right click on metamodel.genmodel ==> Select Generate Model Code);
However, some additional files (plugin.xml, plugin.properties and build.properties) are created during code generation. Since I just need the model code for my special purpose (e.g. I don't want my current project to be converted to a plugin project), I want to prevent generating these files.
Any simple way to do that?
With the properties view opened, select the root element in your genmodel. You need to do the following changes in your genmodel:
Set All / Bundle Manifest to false. It will prevent MANIFEST.MF to be generated.
Set Model / Model Plug-in ID to empty string or use the button on the top right of the properties view named "Restore Default Value" to set it to null. It will prevent the generation of the files plugin.xml, plugin.properties and build.properties.
Set Template & Merge / Update Classpath to false. This one is optional but with your use case, you may want EMF to stop messing out with your .classpath file.
SoapUI provides a common syntax to dynamically insert properties in SOAP Request. In their documentation they explain how to access different properties depends on property scope:
#Project# - references a Project property
#TestSuite# - references a TestSuite property in the containing TestSuite
#TestCase# - references a TestCase property in the containing TestCase
#MockService# - references a MockService property in the containing MockService
#Global# - references a global property (optional)
#System# - references a system property
#Env# - references a environment variable
[TestStep name]# - references a TestStep property within the current TestCase
My problem is I want to access the name of the current testStep however documentation says that to access TestStep properties you need the name... There is another way to do so? like for example #TestCase#TestStep#Name. I know how to achieve this with groovy script but in my case I want to put the property directly on SOAP Request.
Thanks in advance
Finally I found the solution in the documentation, with '=' prefix it's possible to specify a groovy script and access to some context variables. In this context request variable is available and also its name property, so It's possible access to the current TestStep name with:
${=request.name}
Example below is grabbing the request from your TestCase and assigning a value to a specific element.
// get XMLHolder for request message def
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context);
// grabbing the specified request
def holder = groovyUtils.getXmlHolder("Specified#Request")
holder["//*:Password"] = 'password1';
For the example above you need to know the Xpath for your element.
Note, that this can be accomplished in several ways, but you specified doing in through groovy script. It can also be done through a #TestCase# property. Example:
<soapenv:Body>
<tns:AuthenticateUser>
<tns:Credentials>
<tns:IntegrationID>${IntegrationID}</tns:IntegrationID>
<tns:Username>${Username}</tns:Username>
<tns:Password>${Password}</tns:Password>
</tns:Credentials>
</tns:AuthenticateUser>
The msbuild contains output tag. It has avialable attributes: TaskParameter and PropertyName, ItemName.
How they can be used? What are they containing?
Please, can you help me to understand and give an example? For example you can use xmlpeek task with output tag inside.
(I read documentation on msdn but I still don't get it. :( )
The question has been answered, but I will follow up with an example.
In the MSBuild community task Time, an output parameter Month can be set to a property called
CurrentMonth as follows:
<Time>
<Output TaskParameter="Month" PropertyName="CurrentMonth" />
</Time>
In the MSBuild Community task time source code the property Month inside the Time class looks like this:
[Output]
public string Month
{
get { return month; }
}
All properties mapped with an [Output] attribute can be set as a task parameter and
assigned a MSBuild property name as specified above.
To read more about the Time task, a CHM file is available in the MSI file available at the following URL: http://msbuildtasks.tigris.org/
These are a way of passing values back from the task to the MSBuild script. It is basically a way of mapping a property in the compiled task code that has been decorated with the [Output] attribute back to a property in your MSBuild file. This page gives you more details about it: MSDN: Output Element (MSBuild). This article also has a good example of it in action: How to auto-increment assembly version using a custom MSBuild task
How can I control the name of the top directory of the maven module created by my maven archetype? Currently it creates a new folder named$artifactId. Or even more directly, is there a way that my archetype can create a folder named after the module's artifactId, but with dashes replaced by underscores?
The naming convention for artifactId's is to use dashes (hyphens). I don't think there is any way to make the module's directory named something other than the artifactId. That being said, it is onlvy convention, not a requirement, that your module be named the same as your artifactId. This means that after your project is generated, you could simply change either the artifactId or module folder name or both to whatever you want.
You can rename root folder by making an archetype-post-generate groovy script like :
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
Path projectPath = Paths.get(request.outputDirectory, request.artifactId)
// RENAME ROOT FOLDER INCLUDING A PREFIX FOR EXAMPLE
Files.move(projectPath, projectPath.resolveSibling("prefix-" + projectPath.toFile().getName()))
I got round this by adding a second required property to the archetype, and then using that in place of artifactId within the generated pom etc.
In archtype-metadata.xml:
<requiredProperties>
...
<requiredProperty key="projectCode"/>
</requiredProperties>
In pom.xml (and other substitutions):
<artifactId>${projectCode}</artifactId>
So the folder gets the name supplied for artifactId, but in the pom it is given the name supplied for projectCode.
Unfortunately you don't seem to be able to supply a default value for artifactId within archtype-metadata.xml (I always want the folder name to be the same).