Added a shell script to generate the android agent MDM-297

revert-dabc3590
harshanL 10 years ago
parent 4c42f6c337
commit 7cbf71ddd7

@ -331,6 +331,12 @@
</outputDirectory> </outputDirectory>
<fileMode>755</fileMode> <fileMode>755</fileMode>
</file> </file>
<file>
<source>../tools/mdm-android-agent-archetype/android-agent.sh</source>
<outputDirectory>wso2mdm-${pom.version}/repository/tools
</outputDirectory>
<fileMode>755</fileMode>
</file>
<!-- <file> <!-- <file>
<source> <source>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading.xml ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading.xml

@ -1,18 +1,18 @@
Prerequisites Prerequisites
1. Apache maven 3.1.1 or higher 1. Apache maven 3.0.5 or higher & M2_HOME environment variable must be set
2. Apache Ant 1.9.3 or higher 2. Apache Ant 1.9.3 or higher
3. Android SDK (SDK 17 or higher) must be installed & ANDROID_HOME environment variable must be set 3. Android SDK (SDK 17 or higher) must be installed & ANDROID_HOME environment variable must be set
How to use MDM-Android-agent archetype How to use Generate a MDM-Android-agent project
1. Generate the mdm-android-agent project by executing android-agent.sh shell-script.
2. Provide the client-Key, client-Secret & target Android SDK version in the interactive mode.
3. Then the script will install the maven archetype to the local repository & generate a mdm-android-agent project with provided arguments.
4. Navigate to the created mdm-android-agent directory through the cmd.
5. Execute ant release / ant debug to generate the apk file
1. Install the archetype jar by executing the following command in the cmd.
mvn install:install-file -Dfile=<PATH_TO mdm-android-agent-archetype-1.0.0-SNAPSHOT.jar> -DgroupId=org.wso2.mdmserver -DartifactId=mdm-android-agent-archetype -Dversion=1.0.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
2. Execute the following command to generate a mdm-android-agent project. Use the generated client-key & client-secret for API subscription as the values for -DclientKey & -DclientSecret arguments. The default android target version used here is 17. If you need to change that please provide -Dplatform argument.
mvn archetype:generate -B -DarchetypeGroupId=org.wso2.mdmserver -DarchetypeArtifactId=mdm-android-agent-archetype -DarchetypeVersion=1.0.0-SNAPSHOT -DgroupId=org.wso2.carbon -DartifactId=mdm-android-agent -DclientKey=<YOUR_CLIENT_KEY> -DclientSecret=<YOUR_CLIENT_SECRET> -Dplatform=<TARGET_ANDROID_SDK_VERSION>
3. Navigate to the created cdm-android-agent directory through the cmd.
4. Execute ant release / ant debug to generate the apk file

@ -0,0 +1,88 @@
#!/bin/sh
#
# Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file except
# in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#
# Script to generate WSO2 MDM Android agent
#
clear
echo "Please provide the ClientKey: "
read clientKey
echo "Please provide the ClientSecret: "
read clientSecret
echo "Please provide the Target Android SDK Version: "
read targetSDK
# Default Target Android SDK version
DEFAULT_TARGET_SDK="17"
echo "************** Prerequisites verification started **************"
echo "Verifying the Apache Maven installation"
if [ -d "$M2_HOME" ];then
echo $M2_HOME
else
echo "Apache Maven is not installed in the system. Please install Apache Maven 3.0.5 or higher and set M2_HOME environment variable."
exit -1
fi
echo "Verifying the Android SDK installation"
if [ -d "$ANDROID_HOME" ];then
echo $ANDROID_HOME
else
echo "Android SDK is not installed in the system. Please install the Android SDK and set ANDROID_HOME environment variable."
exit -1
fi
echo "************** Prerequisites verification completed **************"
echo "************** Verifying the arguments **************"
if [ -n "$clientKey" ];then
echo "Setting the clientKey to $clientKey"
else
echo "Client-Key is not defined."
exit 1;
fi
if [ -n "$clientSecret" ];then
echo "Setting the clientSecret to $clientSecret"
else
echo "Client-Secret is not defined."
exit 1;
fi
if [ -n "$targetSDK" ];then
echo "Setting the target Android SDK to $targetSDK"
else
echo "Target Android SDK Version is not defined. Using the default target (17)."
targetSDK=$DEFAULT_TARGET_SDK
fi
echo "************** Argument verification completed **************"
echo "************** Installing WSO2 MDM Android Agent Archetype to the maven repo **************"
mvn install:install-file -Dfile=mdm-android-agent-archetype-1.0.0-SNAPSHOT.jar -DgroupId=org.wso2.mdmserver -DartifactId=mdm-android-agent-archetype -Dversion=1.0.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
echo "************** Generating WSO2 MDM Android agent project ***************"
mvn archetype:generate -B -DarchetypeGroupId=org.wso2.mdmserver -DarchetypeArtifactId=mdm-android-agent-archetype -DarchetypeVersion=1.0.0-SNAPSHOT -DgroupId=org.wso2.carbon -DartifactId=mdm-android-agent -DclientKey=$clientKey -DclientSecret=$clientSecret -Dplatform=$targetSDK
exit 0
Loading…
Cancel
Save