How to Generate Gradlew on to Jenkins? - 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.

Related

Error when running "gans/experiments/emnist:run_experiments" using Bazel: The 'run' command is only supported from within a workspace

I failed running "bazel run tensorflow_federated/python/research/gans/experiments/emnist:run_experiments", which gives me the error: "The 'run' command is only supported from within a workspace (below a directory having a WORKSPACE file)."
Error Information
There is a WORKSPACE empty file in my "federated" git repo, and I run "touch WORKSPACE".
My git repo folder
My test of installation by running "python -c "import tensorflow_federated as tff; print(tff.federated_computation(lambda: 'Hello World')())" succeeds.
I can also run "bazel run tensorflow_federated/python/research/gans/experiments/emnist:train".
Here is my configuration:
Python 3.6.9
Tensorflow 2.2.0
Tensorflow-Federated 0.16.1
Bazel 3.4.1
I build the TensorFlow Federated python package from source using Bazel from this link: https://github.com/tensorflow/federated/blob/master/docs/install.md#build-the-tensorflow-federated-python-package-from-source
Just to check, did you follow the previous step describing how to download and cd into the tensorflow/federated project directory? It does appear to be necessary to be inside that directory when running the provided bazel command.

Is there an update all command for xcodebuild command line for a svn project?

Is there an update all command for xcodebuild command line for a svn project?
I am able to perform clean build and install and launch the app.
Is there a Xcode command line buildaction to perform update all so as to get the latest changes made in the source code, updated in my local workspace from svn.
You should check command list using command svn help.
Run command svn help in your terminal (mac app) and see available list of commands (Command list/code depends upon, type of SVN you've installed in your system. In general cases, all types of SVN has same commands but its better to check, available commands for your SVN)
If you've installed Apache - Subversion, then here are all available commands for it.
To update your svn files: Run command: svn update or svn up
Go to Your project from command line and type below command
svn update
this command will fetch all the changes done on svn server repository.

New to React and trying to compile an APK but failing

I'm trying to setup a build process that can run when our dev commits to the GitLab repository. I'm trying to get this thing to build the APK and the method that I'm using for this is suggested by this thread the error I'm getting is here which implies that the file aapt doesn't exist. Although investigating that path it most certainly exists so I have no idea what I'm doing wrong here.
The docker container that I'm using as a base is /runmymind/docker-android-sdk/:latest then I'm using this dockerfile at /chamunks/ReactNativeAndroid/
I'm not entirely certain how I'm failing at this as I've never compiled an android app before but this process being as crazy as it is makes me wonder how anyone ever builds an android app.
You can try deleting android/build and android/app/build directories and then call gradle to build and install the app.
For Debug you should call these in your project root directory;
(cd android/ && ./gradlew assembleDebug)
(cd android/ && ./gradlew installDebug)
For Release you should call these in your project root directory. This option needs a generated .keystore file. The produced .apk files are under android/app/build/outputs/apk path;
(cd android/ && ./gradlew assembleRelease)
(cd android/ && ./gradlew installRelease)
You might also try reinstalling your android-sdk. You might have a problem with version 23.0.3.

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

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.

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