Compare commits

..

22 Commits

Author SHA1 Message Date
r4sas 4ee4f94c18 2.41.0
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-02-20 14:49:02 +00:00
R4SAS b4fbfa782e [i2pd] update to trunk
Signed-off-by: R4SAS <r4sas@i2pmail.org>
2022-02-16 16:28:36 +03:00
R4SAS 328502fd19 add pre-2.41.0 changelog
Signed-off-by: R4SAS <r4sas@i2pmail.org>
2022-02-16 16:24:19 +03:00
R4SAS 45fd6b619c [i2pd] update to trunk
Signed-off-by: R4SAS <r4sas@i2pmail.org>
2022-02-16 16:24:19 +03:00
r4sas e8ca0c20c5 fix typo
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-02-08 19:47:55 +00:00
r4sas 245a8c09b2 readme: cmake 3.18.1
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-02-08 19:31:06 +00:00
r4sas 0191d6a228 update libraries, add binary build files
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-02-08 19:29:39 +00:00
R4SAS 1a686fe979 update to trunk, enable stack-protector
Signed-off-by: R4SAS <r4sas@i2pmail.org>
2022-02-07 23:05:22 +03:00
Poussinou 8fa3121a90 Update README.md (#35) 2022-02-03 22:39:56 +03:00
R4SAS 92324f84b0 [fastlane] fix typo
Signed-off-by: R4SAS <r4sas@i2pmail.org>
2022-02-02 21:38:57 +03:00
R4SAS d14589f944 test logo usage with mipmap and pre-rendered icon
Signed-off-by: R4SAS <r4sas@i2pmail.org>
2022-01-30 02:40:31 +03:00
R4SAS 8938481432 test logo usage with mipmap and pre-rendered icon
Signed-off-by: R4SAS <r4sas@i2pmail.org>
2022-01-30 01:54:44 +03:00
R4SAS 140161d453 Update README.md 2022-01-29 17:51:20 +03:00
r4sas 24f9be058a switch i2pd to trunk
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-01-28 12:28:50 +00:00
r4sas 98f3cae415 forward openssl build log to file
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-01-28 11:40:39 +00:00
r4sas cb8095f939 suppress deprecation warnings
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-01-28 11:10:34 +00:00
r4sas ec003b9971 revert target to 29
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-01-28 11:02:34 +00:00
r4sas 3513053d37 update gradlew, gh action
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-01-28 10:41:57 +00:00
r4sas 5b2d7f39ae modify build flags to reduce output
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-01-28 10:08:54 +00:00
r4sas 8b91fc0198 [gha] switch to r23b
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-01-28 09:37:54 +00:00
r4sas d6bfbc954d switch target to 31, boost to 1.78.0
Signed-off-by: r4sas <r4sas@i2pmail.org>
2022-01-28 09:26:31 +00:00
R4SAS 292a67d1be [fastlane] add russian description
Signed-off-by: R4SAS <r4sas@i2pmail.org>
2022-01-28 05:13:28 +03:00
36 changed files with 630 additions and 267 deletions
+6 -5
View File
@@ -12,7 +12,7 @@ jobs:
- name: Install rename tool
run: |
sudo apt-get update
sudo apt-get install rename
sudo apt-get install -y g++ rename
- name: Setup JDK 1.8
uses: actions/setup-java@v1
with:
@@ -21,15 +21,16 @@ jobs:
uses: maxim-lobanov/setup-android-tools@v1
with:
packages: |
build-tools;29.0.3
platforms;android-29
ndk;21.4.7075529
build-tools;31.0.0
platforms;android-31
ndk;23.1.7779620
cache: true
- name: Build required modules
run: |
export ANDROID_SDK_ROOT=$ANDROID_HOME
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/21.4.7075529
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/23.1.7779620
pushd app/jni
sed -i -e 's/d+2/d+0/' boost/build-android.sh
./build_boost.sh
./build_openssl.sh
./build_miniupnpc.sh
+48 -8
View File
@@ -1,19 +1,59 @@
[![GitHub release](https://img.shields.io/github/release/PurpleI2P/i2pd-android.svg?label=latest%20release)](https://github.com/PurpleI2P/i2pd-android/releases/latest)
[![License](https://img.shields.io/github/license/PurpleI2P/i2pd-android.svg)](https://github.com/PurpleI2P/i2pd-android/blob/openssl/LICENSE)
[![Android CI](https://github.com/PurpleI2P/i2pd-android/actions/workflows/android.yml/badge.svg)](https://github.com/PurpleI2P/i2pd-android/actions/workflows/android.yml)
# i2pd android
### Install OpenJDK, gradle 5.1+ (6.8.3 has been tested and is working ok), download Android SDK and NDK r21e
https://gradle.org/install/
This repository contains Android application sources of i2pd
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/packages/org.purplei2p.i2pd/)
## How to build
### Install OpenJDK, g++, rename (used for building modules), gradle 5.1+, download Android SDK
```bash
sudo apt-get install g++ rename gradle
```
Android SDK Available here:
https://developer.android.com/studio#downloads
https://developer.android.com/ndk/
If your system provides gradle with version < 5.1, download it from gradle homepage:
https://gradle.org/install/
### Prepare Android SDK for building
Download Android SDK, unpack it to any directory (`/opt/anrdoid-sdk` for example) and install required packages
```bash
mkdir /opt/android-sdk
cd /opt/android-sdk
wget https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip
unzip commandlinetools-linux-8092744_latest.zip
# install required tools
./cmdline-tools/bin/sdkmanager --sdk_root=/opt/android-sdk "build-tools;29.0.3" "cmake;3.18.1" "ndk;23.1.7779620"
```
### Clone repository with submodules
git clone --recurse-submodules https://github.com/PurpleI2P/i2pd-android.git
```bash
git clone --recurse-submodules https://github.com/PurpleI2P/i2pd-android.git
```
### Compile application
export ANDROID_SDK_ROOT=/opt/android-sdk
export ANDROID_NDK_HOME=/opt/android-ndk-r21e
gradle clean assembleDebug
```bash
export ANDROID_SDK_ROOT=/opt/android-sdk
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/23.1.7779620
pushd app/jni
./build_boost.sh
./build_openssl.sh
./build_miniupnpc.sh
popd
gradle clean assembleDebug
```
You will find APKs in `app/build/outputs/apk`
+2 -2
View File
@@ -14,8 +14,8 @@ android {
applicationId "org.purplei2p.i2pd"
targetSdkVersion 29
minSdkVersion 16
versionCode 24000
versionName "2.40.0"
versionCode 24100
versionName "2.41.0"
setProperty("archivesBaseName", archivesBaseName + "-" + versionName)
ndk {
+2 -1
View File
@@ -16,7 +16,8 @@ LOCAL_LDLIBS := -lz
LOCAL_SRC_FILES := \
DaemonAndroid.cpp \
i2pd_android.cpp \
$(IFADDRS_PATH)/ifaddrs.c \
$(IFADDRS_PATH)/ifaddrs.cpp \
$(IFADDRS_PATH)/bionic_netlink.cpp \
$(wildcard $(LIB_SRC_PATH)/*.cpp) \
$(wildcard $(LIB_CLIENT_SRC_PATH)/*.cpp) \
$(wildcard $(LANG_SRC_PATH)/*.cpp) \
+1 -1
View File
@@ -4,7 +4,7 @@ APP_STL := c++_static
# Enable c++17 extensions in source code
APP_CPPFLAGS += -std=c++17 -fexceptions -frtti
APP_CPPFLAGS += -DANDROID -D__ANDROID__ -DUSE_UPNP
APP_CPPFLAGS += -DANDROID -D__ANDROID__ -DUSE_UPNP -Wno-deprecated-declarations -fstack-protector
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
APP_CPPFLAGS += -DANDROID_ARM7A
endif
+2 -2
View File
@@ -2,8 +2,8 @@
set -e
BOOST_VERSION=1.74.0
BOOST_VERSION_SUFFIX=1_74
BOOST_VERSION=1.78.0
BOOST_VERSION_SUFFIX=1_78
BOOST_LIBS=date_time,filesystem,program_options,system
REMOVE_BOOST_LIBS_SUFFIX_x86_64=-clang-mt-x64-${BOOST_VERSION_SUFFIX}
+19 -15
View File
@@ -2,28 +2,32 @@
set -e
CMAKE_VERSION=3.18.1
function build_one {
mkdir -p out/${CPU}
cd out/${CPU}
cmake \
-DANDROID_NATIVE_API_LEVEL=${API} \
-DANDROID_ABI=${CPU} \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_NDK=${ANDROID_NDK_HOME} \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
../..
cmake \
-DUPNPC_BUILD_SHARED=False \
-DUPNPC_BUILD_TESTS=False \
-DUPNPC_BUILD_SAMPLE=False \
-DANDROID_NATIVE_API_LEVEL=${API} \
-DANDROID_ABI=${CPU} \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_NDK=${ANDROID_NDK_HOME} \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
../..
echo "Building..."
cmake --build . -- libminiupnpc-static
echo "Building..."
cmake --build . -- libminiupnpc-static
cd ../..
cd ../..
if [[ -n 'out/include' ]]; then
mkdir -p out/include/miniupnpc
cp include/* out/include/miniupnpc
fi
if [[ -n 'out/include' ]]; then
mkdir -p out/include/miniupnpc
cp include/* out/include/miniupnpc
fi
}
function checkPreRequisites {
@@ -51,7 +55,7 @@ cd miniupnp/miniupnpc
rm -rf out
# add cmake from Android SDK to PATH
PATH=$ANDROID_SDK_ROOT/cmake/3.10.2.4988404/bin:$PATH
PATH=$ANDROID_SDK_ROOT/cmake/${CMAKE_VERSION}/bin:$PATH
function build {
for arg in "$@"; do
+15 -12
View File
@@ -2,26 +2,24 @@
set -e
function build_one {
mkdir -p out/${CPU}
mkdir output
echo "Configuring..."
echo "Configuring OpenSSL for ${CPU}..."
./Configure \
--prefix="$PWD/output" \
${TARGET} \
no-shared \
no-ssl3 \
no-comp \
no-hw \
no-engine \
no-tests \
--prefix="$PWD/output" \
-D__ANDROID_API__=${API}
-D__ANDROID_API__=${API} \
-Wno-macro-redefined
echo "Building..."
make -j $(nproc)
echo "Building OpenSSL for ${CPU}..."
make -j $(nproc) > output/build.log
make install_sw
echo "Installing to temporary directory..."
make install_sw >> output/build.log
cp output/lib/*.a out/${CPU}
@@ -51,7 +49,12 @@ function checkPreRequisites {
checkPreRequisites
cd openssl
rm -rf out
rm -rf out output
if [[ -f 'Makefile' ]]; then
make clean
fi
PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
+1 -1
View File
@@ -15,7 +15,7 @@
<application
android:allowBackup="true"
android:icon="@drawable/ic_logo"
android:icon="@mipmap/logo"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:theme="@android:style/Theme.Holo.Light.DarkActionBar"
@@ -54,7 +54,7 @@ public class SettingsActivity extends Activity {
}
List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (list.size() > 0) {
if (list.size() > 0) {
startActivity(intent);
}
} catch (Exception e) {
@@ -82,27 +82,29 @@ public class SettingsActivity extends Activity {
cacheDir = getApplicationContext().getCacheDir();
setContentView(R.layout.activity_settings);
Switch autostart_switch = findViewById(R.id.autostart_enable);
File onBoot= new File( cacheDir.getAbsolutePath()+onBootFileName);
File onBoot = new File(cacheDir.getAbsolutePath() + onBootFileName);
autostart_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// do something, the isChecked will be
// true if the switch is in the On position
if(isChecked){
if( !onBoot.exists() ) {
if (isChecked) {
if (!onBoot.exists()) {
requestPermission();
addAutoStartupswitch();
try {
if( !onBoot.createNewFile()) Log.d(TAG, "Cant create new wile on: "+onBoot.getAbsolutePath());
if (!onBoot.createNewFile())
Log.d(TAG, "Cant create new wile on: "+onBoot.getAbsolutePath());
} catch (Exception e) {
Log.d(TAG, "error: " + e.toString());
}
}
}else{
if( onBoot.exists() )
} else {
if (onBoot.exists())
onBoot.delete();
}
}
});
if(onBoot.exists()) autostart_switch.setChecked(true);
if(onBoot.exists())
autostart_switch.setChecked(true);
}
}
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

+79
View File
@@ -0,0 +1,79 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := i2pd
LOCAL_CPP_FEATURES := rtti exceptions
LOCAL_C_INCLUDES += $(IFADDRS_PATH) $(LIB_SRC_PATH) $(LIB_CLIENT_SRC_PATH) $(LANG_SRC_PATH) $(DAEMON_SRC_PATH)
LOCAL_STATIC_LIBRARIES := \
boost_system \
boost_date_time \
boost_filesystem \
boost_program_options \
crypto \
ssl \
miniupnpc
LOCAL_LDLIBS := -lz
LOCAL_SRC_FILES := \
$(IFADDRS_PATH)/ifaddrs.cpp \
$(IFADDRS_PATH)/bionic_netlink.cpp \
$(wildcard $(LIB_SRC_PATH)/*.cpp) \
$(wildcard $(LIB_CLIENT_SRC_PATH)/*.cpp) \
$(wildcard $(LANG_SRC_PATH)/*.cpp) \
$(DAEMON_SRC_PATH)/UnixDaemon.cpp \
$(DAEMON_SRC_PATH)/Daemon.cpp \
$(DAEMON_SRC_PATH)/UPnP.cpp \
$(DAEMON_SRC_PATH)/HTTPServer.cpp \
$(DAEMON_SRC_PATH)/I2PControl.cpp \
$(DAEMON_SRC_PATH)/i2pd.cpp \
include $(BUILD_EXECUTABLE)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := boost_system
LOCAL_SRC_FILES := $(BOOST_PATH)/out/$(TARGET_ARCH_ABI)/libboost_system.a
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/out/include
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := boost_date_time
LOCAL_SRC_FILES := $(BOOST_PATH)/out/$(TARGET_ARCH_ABI)/libboost_date_time.a
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/out/include
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := boost_filesystem
LOCAL_SRC_FILES := $(BOOST_PATH)/out/$(TARGET_ARCH_ABI)/libboost_filesystem.a
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/out/include
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := boost_program_options
LOCAL_SRC_FILES := $(BOOST_PATH)/out/$(TARGET_ARCH_ABI)/libboost_program_options.a
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/out/include
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := crypto
LOCAL_SRC_FILES := $(OPENSSL_PATH)/out/$(TARGET_ARCH_ABI)/libcrypto.a
LOCAL_EXPORT_C_INCLUDES := $(OPENSSL_PATH)/out/include
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ssl
LOCAL_SRC_FILES := $(OPENSSL_PATH)/out/$(TARGET_ARCH_ABI)/libssl.a
LOCAL_EXPORT_C_INCLUDES := $(OPENSSL_PATH)/out/include
LOCAL_STATIC_LIBRARIES := crypto
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := miniupnpc
LOCAL_SRC_FILES := $(MINIUPNP_PATH)/miniupnpc/out/$(TARGET_ARCH_ABI)/libminiupnpc.a
LOCAL_EXPORT_C_INCLUDES := $(MINIUPNP_PATH)/miniupnpc/out/include
include $(PREBUILT_STATIC_LIBRARY)
+34
View File
@@ -0,0 +1,34 @@
APP_ABI += all
#APP_ABI += arm64-v8a
#APP_ABI += armeabi-v7a
#APP_ABI += x86_64
#APP_ABI += x86
APP_PLATFORM := android-16
#APP_PLATFORM := android-21
NDK_TOOLCHAIN_VERSION := clang
APP_STL := c++_static
# Enable c++17 extensions in source code
APP_CPPFLAGS += -std=c++17 -fexceptions -frtti
APP_CPPFLAGS += -DANDROID_BINARY -DANDROID -D__ANDROID__ -DUSE_UPNP -Wno-deprecated-declarations
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
APP_CPPFLAGS += -DANDROID_ARM7A
endif
APP_LDFLAGS += -fPIE
IFADDRS_PATH = $(NDK_MODULE_PATH)/android-ifaddrs
BOOST_PATH = $(NDK_MODULE_PATH)/boost
MINIUPNP_PATH = $(NDK_MODULE_PATH)/miniupnp
OPENSSL_PATH = $(NDK_MODULE_PATH)/openssl
# don't change me
I2PD_SRC_PATH = $(NDK_MODULE_PATH)/i2pd
LIB_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd
LIB_CLIENT_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd_client
LANG_SRC_PATH = $(I2PD_SRC_PATH)/i18n
DAEMON_SRC_PATH = $(I2PD_SRC_PATH)/daemon
+1
View File
@@ -0,0 +1 @@
../../app/jni/android-ifaddrs
+1
View File
@@ -0,0 +1 @@
../../app/jni/boost
+1
View File
@@ -0,0 +1 @@
../../app/jni/build_boost.sh
+1
View File
@@ -0,0 +1 @@
../../app/jni/build_miniupnpc.sh
+1
View File
@@ -0,0 +1 @@
../../app/jni/build_openssl.sh
+1
View File
@@ -0,0 +1 @@
../../app/jni/i2pd
+1
View File
@@ -0,0 +1 @@
../../app/jni/miniupnp
+1
View File
@@ -0,0 +1 @@
../../app/jni/openssl
@@ -0,0 +1,6 @@
* Updated codebase to 2.41.0
* Switch to minSdkVersion 16, ndk 23.1.7779620, gradlew 6.9.2
* Build required modules from source instead of using prebuilt
* Add mipmap icon for compatability with old Android
* Fix crash on start when ifaddrs was called (with meshnets.yggdrasil=true for example)
* Use TCP/IP socket for I2CP instead unix socket
@@ -1,13 +1,9 @@
<b>I2P</b> (Invisible Internet Protocol) is a universal anonymous network layer.
All communications over I2P are anonymous and end-to-end encrypted, participants
don't reveal their real IP addresses.
All communications over I2P are anonymous and end-to-end encrypted, participants don't reveal their real IP addresses.
<b>I2P client</b> is a software used for building and using anonymous I2P
networks. Such networks are commonly used for anonymous peer-to-peer
applications (filesharing, cryptocurrencies) and anonymous client-server
applications (websites, instant messengers, chat-servers).
<b>I2P client</b> is a software used for building and using anonymous I2P networks.
Such networks are commonly used for anonymous peer-to-peer applications (filesharing, cryptocurrencies) and anonymous client-server applications (websites, instant messengers, chat-servers).
<b>I2P</b> allows people from all around the world to communicate and share information
without restrictions.
<b>I2P</b> allows people from all around the world to communicate and share information without restrictions.
For more information about <b>I2P</b>, you can read <a href="https://en.m.wikipedia.org/wiki/I2P">article on Wikipedia</a>.
@@ -0,0 +1,9 @@
<b>I2P</b> (Invisible Internet Protocol) является универсальным анонимным сетевым уровнем.
Все коммуникации по I2P анонимны и защищены сквозным шифрованием, участники не раскрывают своих реальных IP адресов.
<b>I2P клиент</b> является программным обеспечением, используемым для подключения и использования анонимной сети I2P.
Эта сеть обычно используется для анонимных peer-to-peer приложений (файлообмен, криптовалюты) и анонимных клиент-серверных приложений (веб-сайтов, служб мгновенных сообщений, чат-серверов).
<b>I2P</b> позволяет людям со всего мира общаться и обмениваться информацией без ограничений.
Для получения дополнительной информации о <b>I2P</b>, вы можете прочитать статью <a href="https://en.m.wikipedia.org/wiki/I2P">в Википедии</a>.
@@ -0,0 +1 @@
Полнофункциональная реализация I2P клиента на С++
Binary file not shown.
+6 -6
View File
@@ -1,6 +1,6 @@
#Thu Oct 15 17:35:03 MSK 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=8b356fd8702d5ffa2e066ed0be45a023a779bba4dd1a68fd11bc2a6bdc981e8f
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+174 -112
View File
@@ -1,78 +1,129 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed 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
#
# https://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.
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# 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
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
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"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
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
@@ -89,84 +140,95 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "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" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+89 -84
View File
@@ -1,84 +1,89 @@
@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
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@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=
@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 Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_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=%*
: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
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@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
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@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="-Xmx64m" "-Xms64m"
@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 execute
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 execute
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
: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 %*
: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