First commit

pull/5/head v0.0.1
Gerben Droogers 7 years ago
commit 3bf00e3ed3

1
app/.gitignore vendored

@ -0,0 +1 @@
/build

@ -0,0 +1,43 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "eu.droogers.smsmatrix"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dir 'libs'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile(name: 'matrix-sdk', ext: 'aar')
compile(name: 'olm-sdk', ext: 'aar')
compile 'com.squareup.retrofit:retrofit:1.6.1'
compile 'com.google.code.gson:gson:2.3'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
}

Binary file not shown.

Binary file not shown.

@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/gerben/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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

@ -0,0 +1,26 @@
package eu.droogers.smsmatrix;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("eu.droogers.smsmatrix", appContext.getPackageName());
}
}

@ -0,0 +1,36 @@
<?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="eu.droogers.smsmatrix">
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
tools:replace="allowBackup,label"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="eu.droogers.smsmatrix.SmsListener">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<service android:name="eu.droogers.smsmatrix.MatrixService" />
</application>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

@ -0,0 +1,157 @@
package eu.droogers.smsmatrix;
import android.util.Log;
import org.matrix.androidsdk.data.MyUser;
import org.matrix.androidsdk.data.RoomState;
import org.matrix.androidsdk.listeners.IMXEventListener;
import org.matrix.androidsdk.rest.model.Event;
import org.matrix.androidsdk.rest.model.User;
import org.matrix.androidsdk.rest.model.bingrules.BingRule;
import java.util.List;
/**
* Created by gerben on 8-10-17.
*/
public class EventListener implements IMXEventListener {
private static final String TAG = "EventListener";
private boolean loaded = false;
private Matrix mx;
public EventListener (Matrix mx) {
this.mx = mx;
}
@Override
public void onStoreReady() {
}
@Override
public void onPresenceUpdate(Event event, User user) {
}
@Override
public void onAccountInfoUpdate(MyUser myUser) {
}
@Override
public void onIgnoredUsersListUpdate() {
}
@Override
public void onDirectMessageChatRoomsListUpdate() {
}
@Override
public void onLiveEvent(Event event, RoomState roomState) {
if (loaded == true) {
// mx.getUnreadEvents();
mx.sendEvent(event);
}
Log.e(TAG, "onLiveEvent: " + event + " " + event.getSender() + " : " + event.getContent());
}
@Override
public void onLiveEventsChunkProcessed(String s, String s1) {
}
@Override
public void onBingEvent(Event event, RoomState roomState, BingRule bingRule) {
}
@Override
public void onEventEncrypted(Event event) {
}
@Override
public void onEventDecrypted(Event event) {
}
@Override
public void onEventSent(Event event, String s) {
}
@Override
public void onFailedSendingEvent(Event event) {
}
@Override
public void onBingRulesUpdate() {
}
@Override
public void onInitialSyncComplete(String s) {
loaded = true;
mx.onEventStreamLoaded();
mx.getUnreadEvents();
}
@Override
public void onCryptoSyncComplete() {
}
@Override
public void onNewRoom(String s) {
}
@Override
public void onJoinRoom(String s) {
}
@Override
public void onRoomFlush(String s) {
}
@Override
public void onRoomInitialSyncComplete(String s) {
}
@Override
public void onRoomInternalUpdate(String s) {
}
@Override
public void onLeaveRoom(String s) {
}
@Override
public void onReceiptEvent(String s, List<String> list) {
}
@Override
public void onRoomTagEvent(String s) {
}
@Override
public void onReadMarkerEvent(String s) {
}
@Override
public void onToDeviceEvent(Event event) {
}
}

@ -0,0 +1,66 @@
package eu.droogers.smsmatrix;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import static android.content.ContentValues.TAG;
public class MainActivity extends Activity {
static Matrix mx;
private SharedPreferences sp;
private EditText botUsername;
private EditText botPassword;
private EditText username;
private EditText device;
private EditText hsUrl;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sp = getSharedPreferences("settings", Context.MODE_PRIVATE);
botUsername = (EditText) findViewById(R.id.editText_botUsername);
botPassword = (EditText) findViewById(R.id.editText_botpassword);
username = (EditText) findViewById(R.id.editText_username);
device = (EditText) findViewById(R.id.editText_device);
hsUrl = (EditText) findViewById(R.id.editText_hsUrl);
botUsername.setText(sp.getString("botUsername", ""));
botPassword.setText(sp.getString("botPassword", ""));
username.setText(sp.getString("username", ""));
device.setText(sp.getString("device", ""));
hsUrl.setText(sp.getString("hsUrl", ""));
Button saveButton = (Button) findViewById(R.id.button_save);
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sp.edit();
editor.putString("botUsername", botUsername.getText().toString());
editor.putString("botPassword", botPassword.getText().toString());
editor.putString("username", username.getText().toString());
editor.putString("device", device.getText().toString());
editor.putString("hsUrl", hsUrl.getText().toString());
editor.apply();
Log.e(TAG, "onClick: " + botUsername.getText().toString() );
startService();
}
});
startService();
}
private void startService() {
Intent intent = new Intent(this, MatrixService.class);
startService(intent);
}
}

@ -0,0 +1,216 @@
package eu.droogers.smsmatrix;
import android.content.Context;
import android.net.Uri;
import android.telephony.SmsManager;
import android.util.Log;
import com.google.gson.JsonElement;
import org.matrix.androidsdk.HomeServerConnectionConfig;
import org.matrix.androidsdk.MXDataHandler;
import org.matrix.androidsdk.MXSession;
import org.matrix.androidsdk.data.Room;
import org.matrix.androidsdk.data.store.IMXStore;
import org.matrix.androidsdk.data.store.IMXStoreListener;
import org.matrix.androidsdk.data.store.MXFileStore;
import org.matrix.androidsdk.data.store.MXMemoryStore;
import org.matrix.androidsdk.listeners.IMXEventListener;
import org.matrix.androidsdk.rest.callback.SimpleApiCallback;
import org.matrix.androidsdk.rest.client.LoginRestClient;
import org.matrix.androidsdk.rest.model.Event;
import org.matrix.androidsdk.rest.model.Message;
import org.matrix.androidsdk.rest.model.login.Credentials;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static android.content.ContentValues.TAG;
/**
* Created by gerben on 6-10-17.
*/
public class Matrix {
HomeServerConnectionConfig hsConfig;
Context context;
MXSession session;
int transaction;
private String tag = "Matrix";
private List<NotSendMesage> notSendMesages = new ArrayList<>();
MXDataHandler dh;
private IMXEventListener evLis;
IMXStore store;
String deviceName;
private String realUserid;
public Matrix (final Context context, String url, String botUsername, String botPassword, String username, String device) {
this.context = context;
hsConfig = new HomeServerConnectionConfig(Uri.parse(url));
realUserid = username;
deviceName = device;
login(botUsername, botPassword);
}
private void login(String username, String password) {
new LoginRestClient(hsConfig).loginWithUser(username, password, deviceName, new SimpleApiCallback<Credentials>() {
@Override
public void onSuccess(Credentials credentials) {
super.onSuccess(credentials);
onLogin(credentials);
}
});
}
private void onLogin(Credentials credentials) {
hsConfig.setCredentials(credentials);
startEventStream();
}
public void startEventStream() {
evLis = new EventListener(this);
if (false) {
store = new MXFileStore(hsConfig, context);
} else {
store = new MXMemoryStore(hsConfig.getCredentials(), context);
}
dh = new MXDataHandler(store, hsConfig.getCredentials());
// NetworkConnectivityReceiver nwMan = new NetworkConnectivityReceiver();
session = new MXSession(hsConfig, dh, context);
session.setSyncDelay(12000);
session.setSyncTimeout(30*60*1000);
Log.e(TAG, "onLogin:" + session.getSyncTimeout());
if (store.isReady()) {
session.getDataHandler().checkPermanentStorageData();
session.startEventStream(store.getEventStreamToken());
session.getDataHandler().addListener(evLis);
} else {
store.addMXStoreListener(new IMXStoreListener() {
@Override
public void postProcess(String s) {
}
@Override
public void onStoreReady(String s) {
session.getDataHandler().checkPermanentStorageData();
session.startEventStream(store.getEventStreamToken());
session.getDataHandler().addListener(evLis);
}
@Override
public void onStoreCorrupted(String s, String s1) {
Log.e(TAG, "onStoreCorrupted: " + s );
}
@Override
public void onStoreOOM(String s, String s1) {
}
@Override
public void onReadReceiptsLoaded(String s) {
}
});
}
}
public void sendMessage(final String phoneNumber, final String body) {
if (session != null && session.isAlive()) {
Room room = getRoomByPhonenumber(phoneNumber);
if (room == null) {
Log.e(TAG, "sendMessage: not found" );
session.createRoomDirectMessage(realUserid, new SimpleApiCallback<String>() {
@Override
public void onSuccess(String info) {
super.onSuccess(info);
session.getRoomsApiClient().updateTopic(info, phoneNumber, new SimpleApiCallback<Void>());
SendMesageToRoom(store.getRoom(info), body);
}
});
} else {
SendMesageToRoom(room, body);
}
} else {
Log.e(tag, "Error with sending message");
notSendMesages.add(new NotSendMesage(phoneNumber, body));
}
}
public void SendMesageToRoom(Room room, String body) {
Message msg = new Message();
msg.body = body;
msg.msgtype = "m.mesage";
session.getRoomsApiClient().sendMessage(String.valueOf(transaction), room.getRoomId(), msg, new SimpleApiCallback<Event>());
transaction++;
}
public void getUnreadEvents() {
List<String> types = new ArrayList<>();
types.add("m.room.message");
Collection<Room> rooms = store.getRooms();
for (Room room : rooms) {
List<Event> roomsDirect = store.unreadEvents(room.getRoomId(), types);
for (Event event : roomsDirect) {
sendEvent(event);
}
}
}
public void sendEvent(Event event) {
if (event.sender.equals(realUserid)) {
Room room = store.getRoom(event.roomId);
JsonElement json = event.getContent();
String body = json.getAsJsonObject().get("body").getAsString();
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(room.getTopic(), null, body, null, null);
room.markAllAsRead(new SimpleApiCallback<Void>());
}
}
public void onEventStreamLoaded() {
sendMessageList(notSendMesages);
notSendMesages.clear();
}
public void sendMessageList(List<NotSendMesage> messages) {
for (NotSendMesage ms : messages) {
sendMessage(ms.getPhone(), ms.getBody());
}
}
public Room getRoomByPhonenumber (String number) {
Collection<Room> rooms = store.getRooms();
Log.e(TAG, "getRoomByPhonenumber: " + number );
Log.e(TAG, "getRoomByPhonenumber: " + rooms.size() );
for (Room room : rooms) {
Log.e(TAG, "getRoomByPhonenumber: " + room.getTopic() );
if (room.getTopic() != null && room.getTopic().equals(number)) {
return room;
}
}
return null;
}
public void destroy() {
session.stopEventStream();
dh.removeListener(evLis);
store.close();
}
}

@ -0,0 +1,66 @@
package eu.droogers.smsmatrix;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.IBinder;
import android.util.Log;
import android.widget.Toast;
/**
* Created by gerben on 7-10-17.
*/
public class MatrixService extends Service {
private Matrix mx;
private final String TAG = "MatrixService";
private String botUsername;
private String botPassword;
private String username;
private String device;
private String hsUrl;
@Override
public void onCreate() {
super.onCreate();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
SharedPreferences sp = getSharedPreferences("settings", Context.MODE_PRIVATE);
botUsername = sp.getString("botUsername", "");
botPassword = sp.getString("botPassword", "");
username = sp.getString("username", "");
device = sp.getString("device", "");
hsUrl = sp.getString("hsUrl", "");
if (mx == null && !botUsername.isEmpty() && !botPassword.isEmpty() && !username.isEmpty() && !device.isEmpty() && !hsUrl.isEmpty()) {
mx = new Matrix(getApplication(), hsUrl, botUsername, botPassword, username, device);
Log.e(TAG, "onStartCommand222: " + hsUrl );
Toast.makeText(this, "service starting:", Toast.LENGTH_SHORT).show();
}
Log.e(TAG, "onStartCommand: Service");
String phone = intent.getStringExtra("SendSms_phone");
String body = intent.getStringExtra("SendSms_body");
if (phone != null) {
mx.sendMessage(phone, body);
}
return START_NOT_STICKY;
}
@Override
public void onDestroy() {
mx.destroy();
super.onDestroy();
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}

@ -0,0 +1,23 @@
package eu.droogers.smsmatrix;
/**
* Created by gerben on 9-10-17.
*/
class NotSendMesage {
private String phone;
private String body;
public NotSendMesage(String phone, String body) {
this.phone = phone;
this.body = body;
}
public String getPhone() {
return phone;
}
public String getBody() {
return body;
}
}

@ -0,0 +1,49 @@
package eu.droogers.smsmatrix;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.util.Log;
/**
* Created by gerben on 6-10-17.
*/
public class SmsListener extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")){
Bundle bundle = intent.getExtras(); //---get the SMS message passed in---
SmsMessage[] msgs = null;
String msg_from;
if (bundle != null){
//---retrieve the SMS message received---
try{
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for(int i=0; i<msgs.length; i++){
msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
msg_from = msgs[i].getOriginatingAddress();
String msgBody = msgs[i].getMessageBody();
System.out.println(msg_from + ": " + msgBody);
// Matrix mx = new Matrix(context, "https://matrix.org");
sendMatrix(context, msgBody, msg_from);
}
}catch(Exception e){
Log.d("Exception caught",e.getMessage());
}
}
}
}
private void sendMatrix(Context context, String body, String phone) {
Intent intent = new Intent(context, MatrixService.class);
intent.putExtra("SendSms_phone", phone);
intent.putExtra("SendSms_body", body);
context.startService(intent);
// MainActivity.mx.sendMessage( + ": " + );
}
}

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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"
tools:context="eu.droogers.smsmatrix.MainActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="0dp">
<TextView
android:id="@+id/textView_botUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Bot Username"
android:textStyle="bold" />
<EditText
android:id="@+id/editText_botUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="botSms"
android:inputType="textPersonName"
tools:layout_editor_absoluteX="-106dp"
tools:layout_editor_absoluteY="-16dp" />
<TextView
android:id="@+id/textView_botPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Bot Password"
android:textStyle="bold" />
<EditText
android:id="@+id/editText_botpassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Secret123"
android:inputType="textPassword" />
<TextView
android:id="@+id/textView_hsUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Homeserver url" />
<EditText
android:id="@+id/editText_hsUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="https://matrix.org"
android:inputType="textPersonName" />
<TextView
android:id="@+id/textView_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Your username"
android:textStyle="bold" />
<EditText
android:id="@+id/editText_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="\@user:matrix.org"
android:inputType="textPersonName" />
<TextView
android:id="@+id/textView_devicename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Devicename"
android:textStyle="bold" />
<EditText
android:id="@+id/editText_device"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Sms_mobiel"
android:inputType="textPersonName" />
<Button
android:id="@+id/button_save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Save" />
</LinearLayout>
</ScrollView>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

@ -0,0 +1,3 @@
<resources>
<string name="app_name">SmsMatrix</string>
</resources>

@ -0,0 +1,17 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name="Base.TextAppearance.AppCompat.Subhead"></style>
<style name="Base.TextAppearance.AppCompat"></style>
<style name="Base.TextAppearance"></style>
<style name="Base"></style>
</resources>

@ -0,0 +1,17 @@
package eu.droogers.smsmatrix;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

@ -0,0 +1,23 @@
// 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:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

@ -0,0 +1,17 @@
# 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

Binary file not shown.

@ -0,0 +1,6 @@
#Fri Oct 06 15:05:57 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

160
gradlew vendored

@ -0,0 +1,160 @@
#!/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 "$@"

90
gradlew.bat vendored

@ -0,0 +1,90 @@
@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

@ -0,0 +1 @@
include ':app'
Loading…
Cancel
Save