move AccService-Library to plugin repo
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion '23.0.2'
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 23
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="keepass2android.softkeyboard">
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-sdk android:targetSdkVersion="14" android:minSdkVersion="14"/>
|
||||
|
||||
<application
|
||||
android:killAfterRestore="false">
|
||||
|
||||
|
||||
<!--service android:name="keepass2android.autofill.AutoFillService"
|
||||
android:enabled="true"
|
||||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
|
||||
<intent-filter>
|
||||
<action android:name="android.accessibilityservice.AccessibilityService" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.accessibilityservice"
|
||||
android:resource="@xml/accserviceconfig" />
|
||||
</service-->
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -1,442 +0,0 @@
|
||||
package keepass2android.autofill;
|
||||
|
||||
import android.accessibilityservice.AccessibilityService;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import keepass2android.kbbridge.KeyboardData;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Philipp on 25.01.2016.
|
||||
*/
|
||||
public class AutoFillService extends AccessibilityService {
|
||||
|
||||
|
||||
private static boolean _hasUsedData = true;
|
||||
private static String _lastSearchUrl;
|
||||
private static final String _logTag = "KP2AAF";
|
||||
private static boolean _isRunning;
|
||||
|
||||
private final int autoFillNotificationId = 798810;
|
||||
private final String androidAppPrefix = "androidapp://";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
_isRunning = true;
|
||||
android.util.Log.d(_logTag, "OnCreate");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
_isRunning = false;
|
||||
}
|
||||
|
||||
interface NodeCondition
|
||||
{
|
||||
boolean check(AccessibilityNodeInfo n);
|
||||
}
|
||||
|
||||
class WindowIdCondition implements NodeCondition
|
||||
{
|
||||
private int id;
|
||||
|
||||
public WindowIdCondition(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean check(AccessibilityNodeInfo n) {
|
||||
return n.getWindowId() == id;
|
||||
}
|
||||
}
|
||||
|
||||
boolean isLauncherPackage(CharSequence packageName)
|
||||
{
|
||||
return "com.android.systemui".equals(packageName)
|
||||
|| "com.android.launcher3".equals(packageName);
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
class SystemUiCondition implements NodeCondition
|
||||
{
|
||||
@Override
|
||||
public boolean check(AccessibilityNodeInfo n) {
|
||||
return (n.getViewIdResourceName() != null) && (
|
||||
(n.getViewIdResourceName().startsWith("com.android.systemui")) || (n.getViewIdResourceName().startsWith("com.android.launcher3")));
|
||||
}
|
||||
}
|
||||
|
||||
private class PasswordFieldCondition implements NodeCondition {
|
||||
@Override
|
||||
public boolean check(AccessibilityNodeInfo n) {
|
||||
return n.isPassword();
|
||||
}
|
||||
}
|
||||
|
||||
private class EditTextCondition implements NodeCondition {
|
||||
@Override
|
||||
public boolean check(AccessibilityNodeInfo n) {
|
||||
//it seems like n.Editable is not a good check as this is false for some fields which are actually editable, at least in tests with Chrome.
|
||||
return (n.getClassName() != null) && (n.getClassName().toString().toLowerCase().contains("edittext"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isAvailable()
|
||||
{
|
||||
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);
|
||||
}
|
||||
|
||||
public static boolean isRunning()
|
||||
{
|
||||
return _isRunning;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccessibilityEvent(AccessibilityEvent event) {
|
||||
android.util.Log.d(_logTag, "OnAccEvent");
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
|
||||
{
|
||||
android.util.Log.d(_logTag, "AndroidVersion not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
handleAccessibilityEvent(event);
|
||||
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
private void handleAccessibilityEvent(AccessibilityEvent event) {
|
||||
try
|
||||
{
|
||||
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
|
||||
|| event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)
|
||||
{
|
||||
CharSequence packageName = event.getPackageName();
|
||||
android.util.Log.d(_logTag, "event: " + event.getEventType() + ", package = " + packageName);
|
||||
if ( isLauncherPackage(event.getPackageName()) )
|
||||
{
|
||||
android.util.Log.d(_logTag, "return.");
|
||||
return; //avoid that the notification is cancelled when pulling down notif drawer
|
||||
}
|
||||
else
|
||||
{
|
||||
android.util.Log.d(_logTag, "event package is no launcher");
|
||||
}
|
||||
|
||||
if ((packageName != null)
|
||||
&& (packageName.toString().startsWith("keepass2android.")))
|
||||
{
|
||||
android.util.Log.d(_logTag, "don't autofill kp2a.");
|
||||
return;
|
||||
}
|
||||
|
||||
AccessibilityNodeInfo root = getRootInActiveWindow();
|
||||
|
||||
if ( isLauncherPackage(root.getPackageName()) )
|
||||
{
|
||||
android.util.Log.d(_logTag, "return, root is from launcher.");
|
||||
return; //avoid that the notification is cancelled when pulling down notif drawer
|
||||
}
|
||||
else
|
||||
{
|
||||
android.util.Log.d(_logTag, "root package is no launcher");
|
||||
}
|
||||
|
||||
int eventWindowId = event.getWindowId();
|
||||
if ((ExistsNodeOrChildren(root, new WindowIdCondition(eventWindowId)) && !ExistsNodeOrChildren(root, new SystemUiCondition())))
|
||||
{
|
||||
boolean cancelNotification = true;
|
||||
|
||||
String url = androidAppPrefix + root.getPackageName();
|
||||
|
||||
if ( "com.android.chrome".equals(root.getPackageName()) )
|
||||
{
|
||||
List<AccessibilityNodeInfo> urlFields = root.findAccessibilityNodeInfosByViewId("com.android.chrome:id/url_bar");
|
||||
url = urlFromAddressFields(urlFields, url);
|
||||
|
||||
}
|
||||
else if (packageName == "com.sec.android.app.sbrowser")
|
||||
{
|
||||
List<AccessibilityNodeInfo> urlFields = root.findAccessibilityNodeInfosByViewId("com.sec.android.app.sbrowser:id/location_bar_edit_text");
|
||||
url = urlFromAddressFields(urlFields, url);
|
||||
}
|
||||
else if ("com.android.browser".equals(root.getPackageName()))
|
||||
{
|
||||
List<AccessibilityNodeInfo> urlFields = root.findAccessibilityNodeInfosByViewId("com.android.browser:id/url");
|
||||
url = urlFromAddressFields(urlFields, url);
|
||||
}
|
||||
|
||||
android.util.Log.d(_logTag, "URL=" + url);
|
||||
|
||||
if (ExistsNodeOrChildren(root, new PasswordFieldCondition()))
|
||||
{
|
||||
if ((getLastReceivedCredentialsUser() != null) &&
|
||||
(!_hasUsedData) &&
|
||||
(Objects.equals(url, _lastSearchUrl)
|
||||
|| isSame(getCredentialsField("URL"), url)))
|
||||
{
|
||||
android.util.Log.d(_logTag, "Filling credentials for " + url);
|
||||
|
||||
List<AccessibilityNodeInfo> emptyPasswordFields = new ArrayList<>();
|
||||
GetNodeOrChildren(root, new PasswordFieldCondition(), emptyPasswordFields);
|
||||
|
||||
List<AccessibilityNodeInfo> allEditTexts = new ArrayList<>();
|
||||
GetNodeOrChildren(root, new EditTextCondition(), allEditTexts);
|
||||
|
||||
AccessibilityNodeInfo usernameEdit = null;
|
||||
for (int i=0;i<allEditTexts.size();i++)
|
||||
{
|
||||
if (allEditTexts.get(i).isPassword() == false)
|
||||
{
|
||||
usernameEdit = allEditTexts.get(i);
|
||||
android.util.Log.d(_logTag, "setting usernameEdit = " + usernameEdit.getText() + " ");
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
FillPassword(url, usernameEdit, emptyPasswordFields);
|
||||
}
|
||||
else
|
||||
{
|
||||
android.util.Log.d (_logTag, "Notif for " + url );
|
||||
AskFillPassword(url);
|
||||
cancelNotification = false;
|
||||
}
|
||||
|
||||
}
|
||||
if (cancelNotification)
|
||||
{
|
||||
((NotificationManager)getSystemService(NOTIFICATION_SERVICE)).cancel(autoFillNotificationId);
|
||||
android.util.Log.d (_logTag,"Cancel notif");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
android.util.Log.e(_logTag, (e.toString() == null) ? "(null)" : e.toString() );
|
||||
|
||||
/*Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("message/rfc822");
|
||||
String to = "crocoapps@gmail.com";
|
||||
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{to});
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, "Error report 7d+");
|
||||
intent.putExtra(Intent.EXTRA_TEXT,
|
||||
"Please send the following text as an error report to crocoapps@gmail.com. You may also add additional information about the workflow you tried to perform. This will help me improve the app. Thanks! \n"+e.toString() );
|
||||
|
||||
|
||||
Notification.Builder builder = new Notification.Builder(this);
|
||||
builder.setSmallIcon(keepass2android.softkeyboard.R.drawable.ic_notify_autofill)
|
||||
.setContentText(e.toString())
|
||||
.setContentTitle("error information")
|
||||
.setWhen(java.lang.System.currentTimeMillis())
|
||||
.setContentIntent(PendingIntent.getActivity(this, 0, Intent.createChooser(intent, "Send error report"), PendingIntent.FLAG_CANCEL_CURRENT));
|
||||
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
notificationManager.notify(autoFillNotificationId+1, builder.build());*/
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
private void AskFillPassword(String url)
|
||||
{
|
||||
android.util.Log.d("KP2AAF", "asking for password for " + url);
|
||||
|
||||
Intent startKp2aIntent = new Intent();
|
||||
startKp2aIntent.setComponent(new ComponentName(this, "md58dca69cf5ce118dfdacac1ed5b2bbacf.LookupCredentialsActivity"));
|
||||
if (startKp2aIntent != null)
|
||||
{
|
||||
startKp2aIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startKp2aIntent.putExtra("UrlToSearch", url);
|
||||
}
|
||||
|
||||
|
||||
PendingIntent pending = PendingIntent.getActivity(this, 0, startKp2aIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
String targetName = url;
|
||||
|
||||
if (url.startsWith(androidAppPrefix))
|
||||
{
|
||||
String packageName = url.substring(androidAppPrefix.length());
|
||||
try
|
||||
{
|
||||
ApplicationInfo appInfo = getPackageManager().getApplicationInfo(packageName, 0);
|
||||
targetName = (String) (appInfo != null ? getPackageManager().getApplicationLabel(appInfo) : packageName);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
android.util.Log.d(_logTag, (e.toString() == null) ? "(null)" : e.toString());
|
||||
targetName = packageName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
targetName = getHost(url);
|
||||
}
|
||||
|
||||
|
||||
Notification.Builder builder = new Notification.Builder(this);
|
||||
//TODO icon
|
||||
//TODO plugin icon
|
||||
builder.setSmallIcon(keepass2android.softkeyboard.R.drawable.ic_notify_autofill)
|
||||
.setContentText(getString(keepass2android.softkeyboard.R.string.NotificationContentText, new Object[]{targetName}))
|
||||
.setContentTitle(getString(keepass2android.softkeyboard.R.string.NotificationTitle))
|
||||
.setWhen(java.lang.System.currentTimeMillis())
|
||||
.setVisibility(Notification.VISIBILITY_SECRET)
|
||||
.setContentIntent(pending);
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
notificationManager.notify(autoFillNotificationId, builder.build());
|
||||
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
private void FillPassword(String url, AccessibilityNodeInfo usernameEdit, List<AccessibilityNodeInfo> passwordFields)
|
||||
{
|
||||
Log.d(_logTag, "_hasUsedData = " + _hasUsedData);
|
||||
if ((keepass2android.kbbridge.KeyboardData.hasData()) && (_hasUsedData == false))
|
||||
{
|
||||
fillDataInTextField(usernameEdit, getLastReceivedCredentialsUser());
|
||||
for (int i=0;i<passwordFields.size();i++)
|
||||
{
|
||||
fillDataInTextField(passwordFields.get(i), getLastReceivedCredentialsPassword());
|
||||
}
|
||||
_hasUsedData = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
private void fillDataInTextField(AccessibilityNodeInfo edit, String value) {
|
||||
if ((value == null) || (edit == null))
|
||||
return;
|
||||
Bundle b = new Bundle();
|
||||
b.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, value);
|
||||
edit.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, b);
|
||||
}
|
||||
|
||||
|
||||
private boolean isSame(String url1, String url2) {
|
||||
if (url1 == null)
|
||||
return (url2 == null);
|
||||
if (url2 == null)
|
||||
return (url1 == null);
|
||||
|
||||
if (url1.startsWith("androidapp://"))
|
||||
return url1.equals(url2);
|
||||
|
||||
return getHost(url1).equals(getHost(url2));
|
||||
}
|
||||
|
||||
private String getHost(String url)
|
||||
{
|
||||
URI uri = null;
|
||||
try {
|
||||
uri = new URI(url);
|
||||
String domain = uri.getHost();
|
||||
if (domain == null)
|
||||
return url;
|
||||
return domain.startsWith("www.") ? domain.substring(4) : domain;
|
||||
} catch (URISyntaxException e) {
|
||||
android.util.Log.d(_logTag, "error parsing url: "+ url + e.toString());
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private String getLastReceivedCredentialsUser() {
|
||||
return getCredentialsField("UserName");
|
||||
}
|
||||
private String getLastReceivedCredentialsPassword() {
|
||||
return getCredentialsField("Password");
|
||||
}
|
||||
|
||||
private String getCredentialsField(String key) {
|
||||
for (int i=0;i<KeyboardData.availableFields.size();i++)
|
||||
{
|
||||
if (key.equals(KeyboardData.availableFields.get(i).key))
|
||||
{
|
||||
if (KeyboardData.availableFields.get(i).value != null)
|
||||
return KeyboardData.availableFields.get(i).value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void GetNodeOrChildren(AccessibilityNodeInfo n, NodeCondition condition, List<AccessibilityNodeInfo> result) {
|
||||
if (n != null)
|
||||
{
|
||||
if (condition.check(n))
|
||||
result.add(n);
|
||||
for (int i = 0; i < n.getChildCount(); i++)
|
||||
{
|
||||
GetNodeOrChildren(n.getChild(i), condition, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean ExistsNodeOrChildren(AccessibilityNodeInfo n, NodeCondition condition) {
|
||||
if (n == null) return false;
|
||||
if (condition.check(n))
|
||||
return true;
|
||||
for (int i = 0; i < n.getChildCount(); i++)
|
||||
{
|
||||
if (ExistsNodeOrChildren(n.getChild(i), condition))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String urlFromAddressFields(List<AccessibilityNodeInfo> urlFields, String url) {
|
||||
if (!urlFields.isEmpty())
|
||||
{
|
||||
AccessibilityNodeInfo addressField = urlFields.get(0);
|
||||
CharSequence text = addressField.getText();
|
||||
if (text != null)
|
||||
{
|
||||
url = text.toString();
|
||||
if (!url.contains("://"))
|
||||
url = "http://" + url;
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterrupt() {
|
||||
|
||||
}
|
||||
|
||||
public static void NotifyNewData(String searchUrl)
|
||||
{
|
||||
_hasUsedData = false;
|
||||
_lastSearchUrl = searchUrl;
|
||||
android.util.Log.d(_logTag, "Notify new data: " + searchUrl);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
package keepass2android.kbbridge;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import android.text.TextUtils;
|
||||
public class KeyboardData
|
||||
{
|
||||
public static List<StringForTyping> availableFields = new ArrayList<StringForTyping>();
|
||||
public static String entryName;
|
||||
public static String entryId;
|
||||
|
||||
public static boolean hasData()
|
||||
{
|
||||
return !TextUtils.isEmpty(entryId);
|
||||
}
|
||||
|
||||
public static void clear()
|
||||
{
|
||||
availableFields.clear();
|
||||
entryName = entryId = "";
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package keepass2android.kbbridge;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
public class KeyboardDataBuilder {
|
||||
private ArrayList<StringForTyping> availableFields = new ArrayList<StringForTyping>();
|
||||
|
||||
public void addString(String key, String displayName, String valueToType)
|
||||
{
|
||||
StringForTyping stringToType = new StringForTyping();
|
||||
stringToType.key = key;
|
||||
stringToType.displayName = displayName;
|
||||
stringToType.value = valueToType;
|
||||
availableFields.add(stringToType);
|
||||
}
|
||||
|
||||
public void commit()
|
||||
{
|
||||
KeyboardData.availableFields = this.availableFields;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package keepass2android.kbbridge;
|
||||
|
||||
public class StringForTyping {
|
||||
public String key; //internal identifier (PwEntry string field key)
|
||||
public String displayName; //display name for displaying the key (might be translated)
|
||||
public String value;
|
||||
|
||||
@Override
|
||||
public StringForTyping clone(){
|
||||
|
||||
StringForTyping theClone = new StringForTyping();
|
||||
theClone.key = key;
|
||||
theClone.displayName = displayName;
|
||||
theClone.value = value;
|
||||
|
||||
return theClone;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="AutoFillServiceDescription">Monitors apps and websites for password fields. Offers to look up credentials from Keepass2Android and auto-fill them into the forms.</string>
|
||||
|
||||
<string name="LookupTitle">Look up credentials</string>
|
||||
<string name="ApplicationName">KP2A AutoFillPlugin</string>
|
||||
<string name="NotificationTitle">Keepass2Android AutoFill</string>
|
||||
<string name="NotificationContentText">AutoFill form for %1$s</string>
|
||||
|
||||
</resources>
|
||||
@@ -1,15 +0,0 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.2.3'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
org.gradle.jvmargs=-Xmx1024m
|
||||
164
src/java/Kp2aAccServiceLib/gradlew
vendored
164
src/java/Kp2aAccServiceLib/gradlew
vendored
@@ -1,164 +0,0 @@
|
||||
#!/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
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# 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\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
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"`
|
||||
|
||||
# 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 "$@"
|
||||
90
src/java/Kp2aAccServiceLib/gradlew.bat
vendored
90
src/java/Kp2aAccServiceLib/gradlew.bat
vendored
@@ -1,90 +0,0 @@
|
||||
@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
|
||||
@@ -1,2 +0,0 @@
|
||||
include ':app'
|
||||
|
||||
Reference in New Issue
Block a user