Commit ba198072 by app_dev@sobot.com

智齿远程控制 安卓被控端sdk(使用的是第三方向日葵)

parents
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle/
build/
app/build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# Intellij
*.iml
.idea/
\ No newline at end of file
apply plugin: 'com.android.application'
static def releaseTime() {
return new Date().format("yyyyMMddHHmm", TimeZone.getDefault())//包含时分秒
}
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "com.sobot.sunlogin.screencapturesdk"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
sourceSets {
main {
jniLibs.srcDirs 'src/main/libs'
jni.srcDirs = [] // disable automatic ndk-build call
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "sobot_client-sdk-v1.0-${releaseTime()}.apk"
}
}
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
dexInProcess true
preDexLibraries false
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}
dependencies {
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
implementation 'com.google.zxing:core:3.3.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.alibaba.android:vlayout:1.2.19@aar'
implementation files('libs/screenserver-1.4.jar')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
runtimeOnly files('libs/supportlib.jar')
compileOnly files('libs/knoxsdk.jar')
implementation 'com.sobot.library:net:0.1'
implementation 'com.sobot.library:gson:0.1'
implementation 'com.squareup.okhttp3:okhttp:4.4.0'
}
repositories{
flatDir {
dirs 'libs'
}
}
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Android\android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.sobot.screencapturesdk">
<!-- android:sharedUserId="android.uid.system" -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.sec.MDM_REMOTE_CONTROL" />
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_REMOTE_CONTROL" />
<uses-permission android:name="android.permission.sec.MDM_HW_CONTROL" />
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_HW_CONTROL" />
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_CUSTOM_SYSTEM" />
<uses-permission android:name="com.sec.enterprise.knox.permission.CUSTOM_SYSTEM" />
<application
android:name=".application.SobotApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".activity.SobotSplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.SobotHomeActivity"
android:configChanges="orientation|keyboardHidden|screenLayout|screenSize|keyboard"
android:exported="true"
android:launchMode="singleInstance"
android:windowSoftInputMode="stateUnchanged">
<intent-filter>
<action android:name="com.sobot.cuptercontrol" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<service
android:name="com.oray.sunlogin.service.AdbSimpleIME"
android:label="ADB Simple Keyboard"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
<meta-data
android:name="android.view.im"
android:resource="@xml/methods" />
</service> <!-- Enable selective Knox permissions(optional) -->
<receiver
android:name="com.oray.sunlogin.receiver.KnoxAdminReceiver"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/device_admin_receiver" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
</application>
</manifest>
\ No newline at end of file
package com.sobot.screencapturesdk.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.sobot.screencapturesdk.R;
public class SobotSplashActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
startActivity(new Intent(SobotSplashActivity.this, SobotHomeActivity.class));
finish();
}
}
\ No newline at end of file
package com.sobot.screencapturesdk.application;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import com.sobot.network.apiUtils.SobotBaseUrl;
import com.sobot.network.apiUtils.SobotHttpUtils;
import com.sobot.network.http.log.SobotNetLogUtils;
public class SobotApp extends Application{
private static Context mContext;
@Override
public void onCreate() {
super.onCreate();
mContext = this;
SobotBaseUrl.setApi_Host("http://test.sobot.com");
SobotHttpUtils.init(this);
SobotNetLogUtils.setShowDebug(true);
//外部app启动 事例代码
// Intent intent=new Intent();
// intent.setAction("com.sobot.cuptercontrol");
// intent.putExtra("sessionId","02a22b62828d4f62bfc16c61285bd547");
// startActivity(intent);
}
public static Context getAppContext(){
return mContext;
}
}
package com.sobot.screencapturesdk.factory;
import android.content.Context;
import android.graphics.Point;
import com.oray.sunlogin.interfaces.IDisplayInfo;
import com.sobot.screencapturesdk.utils.DisplayUtils;
public class DisplayInfoFactory implements IDisplayInfo {
private Context context;
public DisplayInfoFactory(Context context) {
this.context = context;
}
/**
* 用户指定截屏的大小,可以自行修改
* 获取屏幕分辨率大小
* @return
*/
@Override
public Point getDisplaySize() {
// return new Point(720, 1280);
return DisplayUtils.getDisplaySize(context);
}
/**
* 用户实际屏幕的分辨
* 获取屏幕分辨率
* @return 屏幕分辨率
*/
@Override
public Point getScreenSize() {
return DisplayUtils.getScreenSize(context);
}
/**
* 获取屏幕方向
* @return 0 / 90 / 180 / 270
*/
@Override
public int getDisplayRotation() {
return DisplayUtils.getDisplayRotation(context);
}
@Override
public int getOrientation() {
return DisplayUtils.getDisplayRotation(context);
}
}
package com.sobot.screencapturesdk.module;
import java.io.Serializable;
public class SobotResultItemModule implements Serializable {
private String p2pAddress;
private String license;
public String getP2pAddress() {
return p2pAddress;
}
public void setP2pAddress(String p2pAddress) {
this.p2pAddress = p2pAddress;
}
public String getLicense() {
return license;
}
public void setLicense(String license) {
this.license = license;
}
@Override
public String toString() {
return "SobotResultItemModule{" +
"p2pAddress='" + p2pAddress + '\'' +
", license='" + license + '\'' +
'}';
}
}
package com.sobot.screencapturesdk.module;
import java.io.Serializable;
public class SobotResultModule implements Serializable {
private String retCode;
private String retMsg;
private SobotResultItemModule item;
public String getRetCode() {
return retCode;
}
public void setRetCode(String retCode) {
this.retCode = retCode;
}
public String getRetMsg() {
return retMsg;
}
public void setRetMsg(String retMsg) {
this.retMsg = retMsg;
}
public SobotResultItemModule getItem() {
return item;
}
public void setItem(SobotResultItemModule item) {
this.item = item;
}
@Override
public String toString() {
return "SobotResultModule{" +
"retCode='" + retCode + '\'' +
", retMsg='" + retMsg + '\'' +
", item=" + item +
'}';
}
}
package com.sobot.screencapturesdk.utils;
import android.content.Context;
import android.graphics.Point;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.Surface;
import android.view.WindowManager;
import java.lang.reflect.Method;
/**
* Created by Neo on 2017/2/9.
*/
public class DisplayUtils {
/**
* 获取屏幕分辨率
* @param context
* @return Point. x: Width y :Height
*/
public static Point getDisplaySize(Context context) {
Point point = getScreenSize(context);
if (null == point)
return new Point(720, 1280);
int width = point.x;
int height = point.y;
boolean b6 = (width % 6 == 0) && (height % 6 == 0);
boolean b4 = (width % 4 == 0) && (height % 4 == 0);
int displayW = width, displayH = height;
//调整显示图像大小
int minSize = Math.min(width, height);
if (minSize >= 1400) {
if (b6) {
displayW = width / 3;
displayH = height / 3;
} else if (b4) {
displayW = width / 2;
displayH = height / 2;
}
} else if (minSize >= 1080) {
if (b4) {
displayW = width / 2;
displayH = height / 2;
}
}
return new Point(displayW, displayH);
}
/**
* 获取当前屏幕旋转角度
*
* @param context 上下文Context
* @return 0表示是竖屏; 90表示是左横屏; 180表示是反向竖屏; 270表示是右横屏
*/
public static int getDisplayRotation(Context context) {
if (context == null) return 0;
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
if (null == windowManager) return 0;
int rotation = windowManager.getDefaultDisplay().getRotation();
switch (rotation) {
case Surface.ROTATION_0:
return 0;
case Surface.ROTATION_90:
return 90;
case Surface.ROTATION_180:
return 180;
case Surface.ROTATION_270:
return 270;
}
return 0;
}
/**
* 获取屏幕分辨率
* @param context
* @return Point. x: Width y :Height
*/
public static Point getScreenSize(Context context) {
if (context == null) return null;
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
if (wm == null) return null;
Display display = wm.getDefaultDisplay();
DisplayMetrics dm = new DisplayMetrics();
Class c;
try {
c = Class.forName("android.view.Display");
Method method = c.getMethod("getRealMetrics", DisplayMetrics.class);
method.invoke(display, dm);
int width = dm.widthPixels;
int height = dm.heightPixels;
return new Point(width, height);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
\ No newline at end of file
package com.sobot.screencapturesdk.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import com.sobot.screencapturesdk.R;
public class RoundProgressBar extends View {
private Paint mPaint;
/**
* 圆环的颜色
*/
private int roundColor;
/**
* 圆环进度的颜色
*/
private int roundProgressColor;
/**
* 圆环的宽度
*/
private float roundWidth;
/**
* 最大进度
*/
private long mMax;
/**
* 当前进度
*/
private long mProgress;
/**
* 进度的风格,实心或者空心
*/
private int style;
public static final int STROKE = 0;
public static final int FILL = 1;
private RectF mOval = new RectF();
private boolean mEnableProgress = false;
public RoundProgressBar(Context context) {
this(context, null);
}
public RoundProgressBar(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RoundProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mPaint = new Paint();
TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.RoundProgressBar);
// 获取自定义属性和默认值
roundColor = mTypedArray.getColor(R.styleable.RoundProgressBar_roundColor, Color.RED);
roundProgressColor = mTypedArray.getColor(R.styleable.RoundProgressBar_roundProgressColor, Color.RED);
roundWidth = mTypedArray.getDimension(R.styleable.RoundProgressBar_width, 5);
mMax = mTypedArray.getInteger(R.styleable.RoundProgressBar_max, 100);
mTypedArray.recycle();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!mEnableProgress) {
return;
}
// 准备画笔
mPaint.setColor(roundColor);
mPaint.setStrokeWidth(roundWidth);
mPaint.setAntiAlias(true);
// 绘制外层圆环
int centre = getWidth() / 2;
int radius = (int) (centre - roundWidth / 2);
// canvas.drawCircle(centre, centre, radius, mPaint);
// 画圆弧 ,画圆环的进度
mPaint.setColor(roundProgressColor);
mOval.set(centre - radius, centre - radius, centre + radius, centre + radius);
float progress = (float) mProgress / mMax;
switch (style) {
// LogUtils.i("STROKE>>> progress" + 360 * progress + "currentProgress>>>" + progress);
case STROKE:
mPaint.setStyle(Paint.Style.STROKE);
canvas.drawArc(mOval, -90, 360 * progress, false, mPaint); // 根据进度画圆弧
break;
case FILL:
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
if (mProgress != 0)
canvas.drawArc(mOval, -90, 360 * progress, true, mPaint); // 根据进度画圆弧
break;
}
}
public long getMax() {
return mMax;
}
/**
* 设置进度的最大值
*
* @param max
*/
public void setMax(long max) {
if (max < 0) {
throw new IllegalArgumentException("max not less than 0");
}
this.mMax = max;
}
/**
* 获取进度.需要同步
*
* @return 当前进度([0 - max])
*/
public long getProgress() {
return mProgress;
}
/**
* 设置进度, 进度应该为[0,max]
*
* @param progress
*/
public void setProgress(long progress) {
if (progress < 0) {
throw new IllegalArgumentException("progress not less than 0");
}
if (progress > mMax) {
progress = mMax;
invalidate();
} else {
this.mProgress = progress;
invalidate();
}
}
public int getRoundColor() {
return roundColor;
}
public void setRoundColor(int roundColor) {
this.roundColor = roundColor;
}
public int getRoundProgressColor() {
return roundProgressColor;
}
public void setRoundProgressColor(int roundProgressColor) {
this.roundProgressColor = roundProgressColor;
}
/**
* 设置是否绘制进度
*
* @param enable true 绘制进度
* @return always true.
*/
public boolean enableProgress(boolean enable) {
mEnableProgress = enable;
invalidate();
return true;
}
}
<?xml version="1.0" encoding="UTF-8"?><!--<layer-list xmlns:android="http://schemas.android.com/apk/res/android">--><!--&lt;!&ndash; 连框颜色值 &ndash;&gt;<item>--><!--<shape>--><!--<solid android:color="#ff0000" />--><!--</shape>--><!--</item>--><!--&lt;!&ndash; 主体背景颜色值 &ndash;&gt;--><!--<item android:bottom="3dp" android:right="3dp">--><!--<shape>--><!--<solid android:color="#ffffff" />-->
<!--<padding android:bottom="10dp"--><!--android:left="10dp"--><!--android:right="10dp"--><!--android:top="10dp" />--><!--</shape>--><!--</item>--><!--</layer-list>-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="#dedede" />
<stroke android:width="1dp" android:color="#bfbfbf"></stroke>
<!--android:endColor="#ffebd8" android:startColor="#f5fcff"-->
<!--<gradient android:angle="270" />-->
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="#fe7f05" />
<stroke android:width="1dp" android:color="#bfbfbf"></stroke>
<!--android:endColor="#ffebd8" android:startColor="#f5fcff"-->
<!--<gradient android:angle="270" />-->
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="#0f0" />
<stroke android:width="1dp" android:color="#bfbfbf"></stroke>
<!--android:endColor="#ece6e1" android:startColor="#fcfcfc"-->
<!--<gradient android:angle="270" />-->
</shape>
</item>
</selector>
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/aboutLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_timer"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:textSize="24sp" />
</LinearLayout>
<EditText
android:id="@+id/edit_sessionid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="340229f40dd34ad88e1c287d0b4b1f94"
android:hint="请输入sessionid" />
<TextView
android:id="@+id/tv_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="未连接" />
<TextView
android:id="@+id/tv_capture_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
<Button
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:background="@drawable/button_style"
android:text="开始登录" />
<Button
android:id="@+id/btn_logout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="15dp"
android:background="@drawable/button_style"
android:enabled="false"
android:text="注销当前登录" />
</LinearLayout>
</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sobot.screencapturesdk.activity.SobotSplashActivity">
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="text_color_9A">#9A9A9A</color>
<color name="text_color_33">#333333</color>
<color name="bg_f5">#E9EEF5</color>
<color name="bg_line_E8">#E8EAEE</color>
<color name="white">#FFFFFFFF</color>
</resources>
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
<resources>
<string name="app_name">智齿远程控制SDK</string>
<string name="connect_time">已经连接</string>
<string name="miao"></string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<declare-styleable name="RoundProgressBar">
<attr name="roundColor" format="color" />
<attr name="roundProgressColor" format="color" />
<attr name="width" format="dimension" />
<attr name="max" format="integer" />
<attr name="finishBackground" format="reference" />
<attr name="style">
<enum name="STROKE" value="0" />
<enum name="FILL" value="1" />
</attr>
</declare-styleable>
</resources>
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
</uses-policies>
</device-admin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<input-method xmlns:android="http://schemas.android.com/apk/res/android" >
</input-method>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<network-security-config >
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Wed Apr 21 11:22:00 CST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
include ':app'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment