Robotium : building test project using Ant when only apk file is available - ant

I have created an Android test project using Robotium. For my own android project, I build the project successfully using following commands :
android update test-project -m /home/jyoti/workspacetry/Puresms/ -p /home/jyoti/workspacetry/ExampleApplicationTesting/
ant clean debug
Next I have created project for a apk file whose project is not available. I changed package name and MainActivity name in both xml and java file of test project. I do want to compile the project in a script using ant. But android update command not working without complete project name to be tested.
So how can i create a test project of Robotium using ant when i only do have apk file of project to be tested.

Related

How to Generate Gradlew on to Jenkins?

How to generate gradlew file to Jenkins Android Project? My project is not Android Native. My project is Flutter.
I try to create CD with Jenkins and I got some errors.
this is my pipeline code (JenkinsFile)
stage('Build Release APK') {
sh "ls ./android"
sh "./android/gradlew clean assembleRelease"
}
ls output is,(There is not gradlew file)
ls ./android
app
build.gradle
gradle
gradle.properties
key.properties
settings.gradle
This is an error I got
./android/gradlew clean assembleRelease
/Users/donperera/.jenkins/workspace/demo#tmp/durable-b0592b49/script.sh: line 1: ./android/gradlew: No such file or directory
Is there any way to build apk/aap with Jenkins?
Is it possible to use this plugin? but I already added this one. But not in this my script. https://guides.gradle.org/executing-gradle-builds-on-jenkins/
gradlew or gradlew.bat is an executable of Gradle that can be used to execute gradle commands.
gradlew or gradlew.bat uses gradle/wrapper/gradle-wrapper.jar file for execution.
So there are 3 files in play:
gradlew for mac and linux
gradlew.bat for windows
gradle/wrapper/gradle-wrapper.jar
The thing here is, these files already exists when you create your flutter project. But these files are ignored by .gitignore of the project by default. so these files won't be available in your CI/CD server.
METHOD 1 [RECOMMENDED]
You don't need them to build your project when it is a flutter project. You need flutter SDK to be installed. You can use flutter SDK to build your project. Use following command for release build [you might need to set flutter SDK for your Jenkins server]:
flutter build apk --release
It will run assembleRelease internally and will generate your APK file.
METHOD 2 [NOT RECOMMENDED]
If you want to do it your way then you can add those 3 files to version control by removing their references from .gitignore file and push it to your repository. Then you'll have those file in your Jenkins workspace. You'll have to grant execution permissions to gradlew if you are on mac or linux which can be done by following command.
chmod +x ./gradlew
then you can use following command to build your app:
./gradlew clean assembleRelease
NOTICE: Method 2 is not recommended because when you run flutter commands, it sets some properties to gradle from pubspec.yaml file like version name, version code. So if you made changes to pubspec.yaml file and haven't run flutter command after that, then running gradlew directly won't include those changes. In this case, your apk might built with older version or might not even built as it reads version info from local.properties file which is auto-modified by flutter commands and it is excluded by default from version control. So, you'll also have to add local.properties file by removing its reference from .gitignore file which is very very dirty because it has location reference of android SDK and your server might not have android SDK on that location. Again you need to tackle that. so don't use this method.
You should not do that "on Jenkins". You should do that in your codebase. Execute the wrapper command (gradle wrapper), add wrapper files to Git, commit and push.

Apache Cordova iOS Remote Build

We have a project that is in it's early stages of creation in Visual Studio 2017 using Apache Cordova. The app builds and runs in web browsers, android simulators/devices and a macbook pro.
The macbook pro is not a viable solution so are trying to get the remote build working on a Mac Mini. No matter what we couldn't get this working so made the decision to wipe the Mac Mini and start from scratch. After a hard drive wipe and fresh install of osx Sierra we are still experiencing the same problem.
I've copied below the log that is produced upon build on the Mac. In the folder the log is created in if I navigate to platforms and then open up the xcode project and run that it runs fine on the mac. I'm at a loss as to why this can't be run from VS2017 through remote tools.
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "remote/plugins/cordova-plugin-inappbrowser"
Copying plugin "remote/plugins/cordova-plugin-inappbrowser" => "/Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/plugins/cordova-plugin-inappbrowser"
No scripts found for hook "after_plugin_add".
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "remote/plugins/cordova-plugin-whitelist"
Copying plugin "remote/plugins/cordova-plugin-whitelist" => "/Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/plugins/cordova-plugin-whitelist"
No scripts found for hook "after_plugin_add".
No scripts found for hook "before_plugin_add".
No version specified for cordova-plugin-vs-taco-support, retrieving version from config.xml
No version for cordova-plugin-vs-taco-support saved in config.xml
Attempting to use npm info for cordova-plugin-vs-taco-support to choose a compatible release
npm info for cordova-plugin-vs-taco-support did not contain any engine info. Fetching latest release
Calling plugman.fetch on plugin "cordova-plugin-vs-taco-support"
Fetching plugin "cordova-plugin-vs-taco-support" via npm
Copying plugin "/Users/macmini/.npm/cordova-plugin-vs-taco-support/0.2.3/package" => "/Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/plugins/cordova-plugin-vs-taco-support"
No scripts found for hook "after_plugin_add".
cordova platform add ios
Executing script found in plugin cordova-plugin-vs-taco-support for hook "before_platform_add": plugins/cordova-plugin-vs-taco-support/hooks/hook-execute-bit-fix.js
Executing script found in plugin cordova-plugin-vs-taco-support for hook "before_platform_add": plugins/cordova-plugin-vs-taco-support/hooks/hook-remove-plugin-json.js
No version supplied. Retrieving version from config.xml...
Adding ios project...
PlatformApi successfully found for platform ios
Creating Cordova project for the iOS platform:
Path: platforms/ios
Package: io.cordova.myappd7d4a1
Name: SeaComply.Cordova
Copying iOS template project to /Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/platforms/ios
iOS project created with cordova-ios#4.2.0
Checking for any plugins added to the project that have not been installed in ios platform
No differences found between plugins added to project and installed in ios platform. Continuing...
Generating platform-specific config.xml from defaults for iOS at /Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/platforms/ios/SeaComply.Cordova/config.xml
Merging project's config.xml into platform-specific iOS config.xml
Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www
mkdir platforms/ios/www/cordova-js-src
copy platforms/ios/platform_www/cordova-js-src/exec.js platforms/ios/www/cordova-js-src/exec.js (new file)
copy platforms/ios/platform_www/cordova-js-src/platform.js platforms/ios/www/cordova-js-src/platform.js (new file)
copy platforms/ios/platform_www/cordova.js platforms/ios/www/cordova.js (updated file)
copy www/css/index.css platforms/ios/www/css/index.css (updated file)
mkdir platforms/ios/www/dist
copy www/dist/674f50d287a8c48dc19ba404d20fe713.eot platforms/ios/www/dist/674f50d287a8c48dc19ba404d20fe713.eot (new file)
copy www/dist/89889688147bd7575d6327160d64e760.svg platforms/ios/www/dist/89889688147bd7575d6327160d64e760.svg (new file)
copy www/dist/912ec66d7572ff821749319396470bde.svg platforms/ios/www/dist/912ec66d7572ff821749319396470bde.svg (new file)
copy www/dist/b06871f281fee6b241d60582ae9369b9.ttf platforms/ios/www/dist/b06871f281fee6b241d60582ae9369b9.ttf (new file)
copy www/dist/main-client.js platforms/ios/www/dist/main-client.js (new file)
copy www/dist/main-client.js.map platforms/ios/www/dist/main-client.js.map (new file)
copy www/dist/vendor-manifest.json platforms/ios/www/dist/vendor-manifest.json (new file)
copy www/dist/vendor.css platforms/ios/www/dist/vendor.css (new file)
copy www/dist/vendor.css.map platforms/ios/www/dist/vendor.css.map (new file)
copy www/dist/vendor.js platforms/ios/www/dist/vendor.js (new file)
copy www/dist/vendor.js.map platforms/ios/www/dist/vendor.js.map (new file)
mkdir platforms/ios/www/images
copy www/images/cordova.png platforms/ios/www/images/cordova.png (new file)
rmdir platforms/ios/www/img (no source)
delete platforms/ios/www/img/logo.png (no source)
copy www/index.html platforms/ios/www/index.html (updated file)
rmdir platforms/ios/www/js (no source)
delete platforms/ios/www/js/index.js (no source)
mkdir platforms/ios/www/scripts
copy www/scripts/application.js platforms/ios/www/scripts/application.js (new file)
copy www/scripts/application.js.map platforms/ios/www/scripts/application.js.map (new file)
copy www/scripts/startup.js platforms/ios/www/scripts/startup.js (new file)
copy www/scripts/startup.js.map platforms/ios/www/scripts/startup.js.map (new file)
Wrote out iOS Bundle Identifier "io.cordova.myappd7d4a1" and iOS Bundle Version "1.0.0" to /Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/platforms/ios/SeaComply.Cordova/SeaComply.Cordova-Info.plist
iOS Product Name has not changed (still "SeaComply.Cordova")
Updating icons at platforms/ios/SeaComply.Cordova/Images.xcassets/AppIcon.appiconset/
copy res/icons/ios/icon-60.png platforms/ios/SeaComply.Cordova/Images.xcassets/AppIcon.appiconset/icon-60.png (new file)
Updating splash screens at platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/
copy res/screens/ios/screen-iphone-568h-2x.png platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/Default-568h#2x~iphone.png (updated file)
copy res/screens/ios/screen-iphone-portrait-667h.png platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/Default-667h.png (updated file)
copy res/screens/ios/screen-iphone-portrait-736h.png platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/Default-736h.png (updated file)
copy res/screens/ios/screen-iphone-landscape-736h.png platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.png (updated file)
copy res/screens/ios/screen-ipad-landscape-2x.png platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/Default-Landscape#2x~ipad.png (updated file)
copy res/screens/ios/screen-ipad-landscape.png platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png (updated file)
copy res/screens/ios/screen-ipad-portrait-2x.png platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/Default-Portrait#2x~ipad.png (updated file)
copy res/screens/ios/screen-ipad-portrait.png platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png (updated file)
copy res/screens/ios/screen-iphone-portrait-2x.png platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/Default#2x~iphone.png (updated file)
copy res/screens/ios/screen-iphone-portrait.png platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/Default~iphone.png (updated file)
Prepared iOS project successfully
Installing plugin "cordova-plugin-inappbrowser" following successful platform add of ios
Found variables for "cordova-plugin-inappbrowser". Processing as cli_variables.
Installing "cordova-plugin-inappbrowser" for ios
Running command: /Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/platforms/ios/cordova/version
Command finished with error code 0: /Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/platforms/ios/cordova/version
Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-inappbrowser on ios platform only.
No scripts found for hook "before_plugin_install".
Install start for "cordova-plugin-inappbrowser" on ios.
Beginning processing of action stack for ios project...
Action stack processing complete.
Install complete for cordova-plugin-inappbrowser on ios.
Finding scripts for "after_plugin_install" hook from plugin cordova-plugin-inappbrowser on ios platform only.
No scripts found for hook "after_plugin_install".
Installing plugin "cordova-plugin-vs-taco-support" following successful platform add of ios
Found variables for "cordova-plugin-vs-taco-support". Processing as cli_variables.
Installing "cordova-plugin-vs-taco-support" for ios
Running command: /Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/platforms/ios/cordova/version
Command finished with error code 0: /Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/platforms/ios/cordova/version
Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-vs-taco-support on ios platform only.
No scripts found for hook "before_plugin_install".
Install start for "cordova-plugin-vs-taco-support" on ios.
Beginning processing of action stack for ios project...
Action stack processing complete.
Install complete for cordova-plugin-vs-taco-support on ios.
Finding scripts for "after_plugin_install" hook from plugin cordova-plugin-vs-taco-support on ios platform only.
No scripts found for hook "after_plugin_install".
Installing plugin "cordova-plugin-whitelist" following successful platform add of ios
Found variables for "cordova-plugin-whitelist". Processing as cli_variables.
Installing "cordova-plugin-whitelist" for ios
Running command: /Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/platforms/ios/cordova/version
Command finished with error code 0: /Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/platforms/ios/cordova/version
Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-whitelist on ios platform only.
No scripts found for hook "before_plugin_install".
Install start for "cordova-plugin-whitelist" on ios.
Beginning processing of action stack for ios project...
Action stack processing complete.
Install complete for cordova-plugin-whitelist on ios.
Finding scripts for "after_plugin_install" hook from plugin cordova-plugin-whitelist on ios platform only.
No scripts found for hook "after_plugin_install".
Executing script found in plugin cordova-plugin-vs-taco-support for hook "before_prepare": plugins/cordova-plugin-vs-taco-support/hooks/hook-execute-bit-fix.js
Resolving module name for q => q
Executing script found in plugin cordova-plugin-vs-taco-support for hook "before_prepare": plugins/cordova-plugin-vs-taco-support/hooks/hook-res-native.js
Processing res/native for ios
Checking config.xml for saved platforms that haven't been added to the project
Checking for any plugins added to the project that have not been installed in ios platform
No differences found between plugins added to project and installed in ios platform. Continuing...
Generating platform-specific config.xml from defaults for iOS at /Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/platforms/ios/SeaComply.Cordova/config.xml
Merging project's config.xml into platform-specific iOS config.xml
Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www
copy platforms/ios/platform_www/cordova_plugins.js platforms/ios/www/cordova_plugins.js (updated file)
copy platforms/ios/platform_www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js platforms/ios/www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js (updated file)
Wrote out iOS Bundle Identifier "io.cordova.myappd7d4a1" and iOS Bundle Version "1.0.0" to /Users/macmini/.taco_home/remote-builds/taco-remote/builds/1794/cordovaApp/platforms/ios/SeaComply.Cordova/SeaComply.Cordova-Info.plist
iOS Product Name has not changed (still "SeaComply.Cordova")
Updating icons at platforms/ios/SeaComply.Cordova/Images.xcassets/AppIcon.appiconset/
Updating splash screens at platforms/ios/SeaComply.Cordova/Images.xcassets/LaunchImage.launchimage/
Prepared iOS project successfully
No scripts found for hook "after_prepare".
Checking config.xml for saved plugins that haven't been added to the project
Saving ios#4.2.0 into platforms.json
No scripts found for hook "after_platform_add".
Failed to build app for buildNumber 1794:
Thanks.

Run a bash file in XCode project at time of building it in XCode 5

I've a bash (.sh file) which contains some modification I want to do while building my XCode project . How can I run that .sh script at time of builing ?
1- In the project editor, select the target to which you want to add a run script build phase.
2- Click Build Phases at the top of the project editor.
3- Choose Editor > Add Build Phase > Add Run Script Build Phase.
4- Disclose the Run Script section in the project editor.
5- Configure the script in the Run Script template.
6- The screenshot shows a Run Script build phase that prints in the log navigator the name of the target being built.
You can use any of the shell languages available in your system.
Source: Apple documentation.
I hope that was helpful :)

Unable to compile / run run book-examples in eclipse

I am trying to run sample code "MyHierarchicalUI" from section 4.2 from "book of vaadin" and this code refers to TreeExample and TableExample classes which can be found at
http://dev.vaadin.com/svn/doc/book-examples/
I downloaded the book example code from mentioned svn link and imported it as existing eclipse project,however when I try to compile / run this project in eclipse I get the following error.
Errors occurred during the build.
Errors running builder 'Integrated External Tool Builder' on project 'book-examples'.
The file does not exist for the external tool named Copy sources.
The file does not exist for the external tool named Copy sources.
book-examples project is not valid vaadin project so can not be imported directly, we can not build it directly as vaadin project due to missing artifacts like ivy.xml and ivysettings.xml.
To use any code from book-examples project you will have to bring the code to your project manually (copy/paste), however a support ticker to make book-example project import-able / build-able and run-able has been created and can be tracked using this link Ticket # 13078.

How do you build Xalan-C with Visual Studio 2010?

I can not find proof that it's possible. After 40 hours of driving myself to insanity, I'm left with a situation where I cannot build the Localization project that supposedly builds a header file needed by the poorly named AllInOne project (which builds Xalan-C.lib, natch).
This library is software malpractice writ-large, I am desperate for an answer because it is a dependency in another library that I have no alternative to using.
I have managed to build Xalan-C version 1.11, compatible with the latest version of Xerces-C (v3.1.1), in Visual Studio 2010. I don't know if it is possible with earlier versions, however these are the steps I followed in order to build with version 1.11:
Xerces-C has to be built as a dynamic library to obtain the xerces-c_3_1D.dll file which MsgCreator.exe is dependent on.
Clone the github repository to obtain the source code of Xalan-C version 1.11.
Set the environment variables XERCESCROOT and XALANCROOT in windows (not in Visual Studio).
XERCESCROOT The Xerces-C/C++ installation directory
XALANCROOT The Xalan-C/C++ source directory
Open the Xalan-C solution in VS2010 and build the MsgCreator project.
Copy the xerces-c_3_1D.dll file from the Xerces-C build and place it in the Xalan-C build folder, the same folder where MsgCreator.exe is located.
Now it is possible to generate the "missing" header files (LocalMsgIndex.hpp and LocalMsgData.hpp) that are needed to build the "AllInOne" project.
Run MsgCreator.exe in cmd with the provided path to XalanMsg_en_US.xlf which is located in $(XALANCROOT)\src\xalanc\NLS\en_US and what method to use when building the locale messages.
MsgCreator.exe $(XALANCROOT)\src\xalanc\NLS\en_US\XalanMsg_en_US.xlf -TYPE=inmem
(I used -TYPE=inmem, but check to see what method is best suited for your solution)
The header files are now generated and located in the build directory (where MsgCreator.exe resides). Copy or move them to $(XALANCROOT)\src and they should now be able to be located.
Now build the XalanMsgLib project.
And the last thing to do before the final build is to handle the including of afxres.h in the AllInOne.rc file (located in $(XALANCROOT)\Projects\Win32\Res\AllInOne). Visual Studio Express edition does not contain the MFC library which contains the afxres.h header. I simply changed it to #include "windows.h" instead.
And now it should be possible to build "AllInOne" successfully.
I struggled with this also and this is my recipe (VS2015 but look up the cmake docs for other IDEs)
Note I was specifically targeting xerces 3.2.3 and xalan 1.12. Use git tag to get the versions you need
git clone https://github.com/apache/xerces-c.git
cd xerces-c
git checkout v3.2.3
mkdir build
cd build
cmake .. -BVS2015 -G "Visual Studio 14 2015" -A x64 -DCMAKE_BUILD_TYPE=Debug
cd VS2015
devenv xerces-c.sln /Build Debug /Project ALL_BUILD
Because I use this with another build process that expects things in a certain way:
(assume you set up a target dir env called XERCESBUILD with bin/lib child dirs)
copy src\Debug\*.dll %XERCESBUILD%\bin
copy src\Debug\*.lib %XERCESBUILD%\lib
Then for xalan
git clone https://github.com/apache/xalan-c
cd xalan-c
git checkout Xalan-C_1_12_0
mkdir build
cd build
set PATH=%PATH%;%XERCESBUILD%\bin
cmake .. -BVS2015 -G "Visual Studio 14 2015" -A x64 -DCMAKE_PREFIX_PATH=%JBCRELEASEDIR% -DXALAN_DEBUG=1 -DCMAKE_BUILD_TYPE=Debug -DXerce
sC_LIBRARY_DEBUG=%XERCESBUILD%\lib\xerces-c_3D.lib
cd VS2015
devenv xalan-c.sln /Build Debug /Project ALL_BUILD
Note the xerces-c_3D.lib is specifically the Debug build so remove the D when doing the Release build.

Resources