Gradle Command Line Properties - android

If I am using gradle command line to run our Android Espresso test cases like this:
./gradlew pixel4api31DebugAndroidTest
-Pandroid.testInstrumentationRunnerArguments.class=com.aaa.bbb.Suites.CITestSuite
-Pandroid.experimental.androidTest.numManagedDeviceShards=2
Where can I find documentation on what other possible options exist? i.e
Instead of numManagedDeviceShards, what other options exist that I could pass via command line?
-Pandroid.experimental.androidTest. whatElseCanGoHere
or
-Pandroid.testInstrumentationRunnerArguments. whatElseCanGoHere

Related

Delphi 11: Find correct toolsversion for MSBuild programmatically

We're upgrading to Delphi 11.1 from 10.4.
We have a few scripts which build and deploy Android projects. They assemble an msbuild command that looked like this:
msbuild someproject.dproj /v:q /p:Platform=Android /t:Build;Deploy /p:Config=Release /p:BT_BuildType=AppStore
With 11.1, this throws an error message:
C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\CodeGear.Common.Targets(940,7): error MSB4036: The "XmlPeek" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v2.0.50727" directory. [someproject.dproj]
Now, C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\rsvars.bat, which is used by all of our build scripts, explicitly sets the .NET framework as below:
#SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v4.0.30319
#SET FrameworkVersion=v4.5
After some research, I hit on the idea of adding a toolsversion parameter to the msbuild command as below, and this worked:
msbuild someproject.dproj /v:q /p:Platform=Android /t:Build;Deploy /p:Config=Release /p:BT_BuildType=AppStore /toolsversion:4.0
This is all well and good, but I would prefer not to hard-code the toolsversion number in the script(s).
Is there a way I can programmatically obtain the correct value of the toolsversion that Delphi itself is using when it generates builds, etc.?
I assume that just finding the highest .NET version installed will not suffice (and even then, one has to "translate" that to a toolsversion). It has to marry up with whatever Delphi is doing (e.g., in the CodeGear.Common.Targets file referenced in the original error message).
This is a bug in Delphi 11.1 that has at least 3 bug reports: RSP-37855, RSP-38466, and RSP-38467.
You can add /tv:4.0 to your MSBuild command line, or modify the first line in the .dproj file to:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0" DefaultTargets="Build">
Assuming that rsvars.bat has been run,
FOR %%v IN ("%frameworkdir%") DO SET "toolsversion=%%~nv"
ECHO msbuild ...blah... /toolsversion:%toolsversion:~1%
The variable frameworkdir will be set by rsvars.bat. The for command parses its value (eg. C:\Windows\Microsoft.NET\Framework\v4.0.30319 as though it is a filename, and picks v4.0 as the "filename" (~n modifier [filename] of the metavariable %%v)
Then use the value assigned to toolsversion, starting at character 1 (where the first character is "character 0")
--- Given more info in comment
FOR %%v IN ("%frameworkdir%") DO ECHO %%~nxv|FINDSTR /R ".*\..*\.">nul&IF ERRORLEVEL 1 (SET "toolsversion=%%~nxv") ELSE SET "toolsversion=%%~nv"
Oh ye of little faith :)

appcelerator titanium_prep.macos Android module build failure on Mac OSX

I am attempting to build a CommonJS module in Appcelerator Studio.
Following this recipe:
File > New > New Mobile Module Project
Set the project name to be testmodule
Leave the location as default
Set the Module Id to au.com.test.testmodule
Set the Titanium SDK Version to 5.3.1.GA
Set the Deployment Targets to Android
Click Next and then Finish
This will create a new module called testmodule.
Under this folder there is a one called assets, create a new file in there called au.com.test.testmodule.js. This will mark the module as a CommonJS module.
In this file just create an empty function and export it
function test() {
Ti.API.debug('test');
}
module.exports = test;
From the command line type:
ant
This will attempt to build the module.
In output you will see the ant target js.compile and this will have an error message
[exec] [DEBUG] "/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/5.3.1.GA/android/titanium_prep.macos" au.com.example.testmodule /testmodule/android/build/generated/js au.com.example.testmodule.js
[exec] [ERROR] Not enough arguments.
[exec] [ERROR] Unabled to prepare JavaScript for packaging. Error code 1.
[exec] Result: 1
Running ant like the following:
ant -debug -logfile build.log
The problem seems to be an executable called titanium_prep.macos.
If you run the command
"/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/5.3.1.GA/android/titanium_prep.macos" au.com.example.testmodule /testmodule/android/build/generated/js au.com.mobilogica.testmodule.js
It will give the error Not enough arguments. If you add one more parameter of anything, it will run without giving that message.
Of course being that the parameter is bogus, it will not generate the correct code.
It seems like titanium_prep.macos requires 4 parameters, but right now only three are being passed in.
au.com.example.testmodule
/testmodule/android/build/generated/js
au.com.example.testmodule.js
System:
Mac OSX 10.10.5
XCode 6.1
Appcelerator CLI 5.4.0
Appcelerator SDK 5.3.1
If you generate the example same module with 3.5.1.GA it works.
I have tried this in the 4.4 series of SDKs as well and have the same problem.

Android Studio-Gradle issue-.bin file error

i see "Error:C:\Documents and Settings\Student.gradle\daemon\2.8\registry.bin (The process cannot access the file because it is being used by another process)" in android studio...how to solve it...
Test this method .
You use a proxy like freegate
Run cmd and goto to main folder project .
And run this code gradlew -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8580
proxyPort=Your used proxy

Unity command line arguments for android and iOS

Please pardon my ignorance, relatively new to working with Unity3D. I am working on automating Unity3d builds from the command line.
I am looking for command line arguments to build apk & xcode project.
Unity's documentation does mention arguments to build a standalone Mac OSX player (-buildOSXPlayer) and a standalone Windows player (-buildWindowsPlayer) but not for android and iOS.
Any help would be really appreciated. Thanks.
Start with Unity's own documentation for command line builds for iOS and android.
For example, put this script in your Assets/Editor folder:
// C# example
using UnityEditor;
class Autobuilder
{
[MenuItem ("File/AutoBuilder/iOS")]
static void PerformBuild ()
{
string[] scenes = { "Assets/MyScene.unity" };
string buildPath = "../../../Build/iOS";
// Create build folder if not yet exists
Directory.CreateDirectory(buildPath);
BuildPipeline.BuildPlayer(scenes, buildPath, BuildTarget.iOS, BuildOptions.Development);
}
}
You can actually run this script in the Unity application by going to File -> Autobuilder -> iOS
To run on command line, it looks something like this:
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -executeMethod Autobuilder.PerformBuild -email me#email.com -password myPassword
Of course, you're going to want to check the debug log for any errors:
Mac OS X ~/Library/Logs/Unity/Editor.log
Windows XP C:\Documents and Settings\username\Local Settings\Application Data_\Unity\Editor\Editor.log
Windows Vista/7 C:\Users\username\AppData\Local\Unity\Editor\Editor.log
The -executeMethod command line parameter is a very simple option to invoke any function in any of your scripts - which you can then use to do pretty much anything, including firing off an Android build.

Is it possible to simply compile an Emma instrumented APK using Android build.xml and not run any tests

I know of
ant coverage
However that does a few things, it compiles with emma instrumentation, installs, and runs the test apk. I don't want it to run the test suite through ant with coverage because I need to run it with some extra hooks, and I don't want to run the large test suite twice. So far I have tried this
Target_Project/build.properties
emma.enabled=true
Test_Project/build.properties
emma.enabled=true
Then in in a shell I execute this.
Target_Project$ ant debug
Target_Project$ adb install bin/Target_Project-debug.apk
Target_Project$ cd ../Test_Project/
Test_Project$ ant debug
Test_Project$ adb install bin/Test_Project-debug.apk
Test_Project$ adb shell am instrument -e coverage true -e coverageFile /sdcard/myFile.ec -w com.my_app.testproject/android.test.InstrumentationTestRunner
The response is
Error: Failed to generate emma coverage. Is emma jar on classpath?
So is there a trick to getting the apk to build with the emma libs? I tried invoking the targets created in the sdk xml templates but they are "private." Is there something I am missing?
Well for anyone interested. The SDK documentation is completely busted (surprising I know). Basically you have to do this,
take the base build.xml generated by android create-project and change the tag
<setup/>
and change it to
<setup import="false"/>
Now the documentation will tell you to copy from SDK/platform-/templates/android_rules.xml and place that into your build.xml ...
THIS IS WRONG and horribly unmaintained. This rules file isn't used by anything. What is used are the rules inside of SDK/tools/ant/. Grab the appropriate file for your type of project (library for a library project, test for a test project, or vanilla for a regualr project) with the latest _r and
copy the contents of it's root node into your build.xml. Insert it after the setup tag. If you don't use the files inside the ant directory, you will not be able to compile project libraries through the ant script. I was so glad they maintained documentation on how to do this.
Now you can change whatever you like in the build file to match your build needs. In which case I just made install-helper call my wrapper around adb which returns interpreted resultcodes.
// coverage.py
development\testrunner\coverage.py
def TestDeviceCoverageSupport(adb):
"""Check if device has support for generating code coverage metrics.
This tries to dump emma help information on device, a response containing
help information will indicate that emma is already on system class path.
Returns:
True if device can support code coverage. False otherwise.
"""
try:
output = adb.SendShellCommand("exec app_process / emma -h")
if output.find('emma usage:') == 0:
return True
except errors.AbortError:
pass
return False
adb shell exec app_process / eamm -h
build core images
http://duykham.blogspot.com/2009/09/how-to-get-emma-code-coverage-of.html

Categories

Resources