Added support for Android Studio

This commit is contained in:
vladislav.khorev committed 2017-01-10 07:10:36 +03:00
1 parent e4a7822385
commit 99a6b3728d
45 files changed
+1834 -548

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
+3
View File
@@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\Android\Android Studio\gradle\gradle-2.14.1" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
+49
View File
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="SvnBranchConfigurationManager">
<option name="mySupportsUserInfoFilter" value="true" />
</component>
</project>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/SalmonEngineAndroid.iml" filepath="$PROJECT_DIR$/SalmonEngineAndroid.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../libs/jpeg-9" vcs="svn" />
<mapping directory="$PROJECT_DIR$/../../libs/julienr-libzip-android/jni" vcs="svn" />
<mapping directory="$PROJECT_DIR$/../../libs/libogg-1.3.0/src" vcs="svn" />
<mapping directory="$PROJECT_DIR$/../../libs/libpng_1.4.1_android" vcs="svn" />
<mapping directory="$PROJECT_DIR$/../../libs/libvorbis-1.3.2/lib" vcs="svn" />
</component>
</project>
+1
View File
@@ -0,0 +1 @@
/build
+372
View File
@@ -0,0 +1,372 @@
# Sets the minimum version of CMake required to build the native
# library. You should either keep the default value or only pass a
# value of 3.4.0 or lower.
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds it for you.
# Gradle automatically packages shared libraries with your APK.
#ENGINE_PATH = $(SalmonEnginePathCygwin)
#BOOST_PATH = $(LibsPathCygwin)/boost_1_52_0
#OGG_PATH = $(LibsPathCygwin)/libogg-1.3.0
#VORBIS_PATH = $(LibsPathCygwin)/libvorbis-1.3.2
#SQUIRREL_PATH = $(LibsPathCygwin)/sqplus
#LIBPNG_PATH = $(LibsPathCygwin)/libpng_1.4.1_android
#LIBJPEG_PATH = $(LibsPathCygwin)/jpeg-9
#ZIP_PATH = $(LibsPathCygwin)/julienr-libzip-android/jni
set(BOOST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../boost_1_63_0)
set(BOOST_GIL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/boost-gil-extension)
set(ZIP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/julienr-libzip-android/jni)
set(LIBPNG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/libpng_1.4.1_android)
set(LIBJPEG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/jpeg-9")
set(SQUIRREL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/sqplus)
set(OGG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/libogg-1.3.0)
set(VORBIS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/libvorbis-1.3.2)
#include_directories(ZIP_PATH)
add_library(zip
${ZIP_PATH}/zip_add.c
${ZIP_PATH}/zip_add_dir.c
${ZIP_PATH}/zip_close.c
${ZIP_PATH}/zip_delete.c
${ZIP_PATH}/zip_dirent.c
${ZIP_PATH}/zip_entry_free.c
${ZIP_PATH}/zip_entry_new.c
${ZIP_PATH}/zip_err_str.c
${ZIP_PATH}/zip_error.c
${ZIP_PATH}/zip_error_clear.c
${ZIP_PATH}/zip_error_get.c
${ZIP_PATH}/zip_error_get_sys_type.c
${ZIP_PATH}/zip_error_strerror.c
${ZIP_PATH}/zip_error_to_str.c
${ZIP_PATH}/zip_fclose.c
${ZIP_PATH}/zip_file_error_clear.c
${ZIP_PATH}/zip_file_error_get.c
${ZIP_PATH}/zip_file_get_offset.c
${ZIP_PATH}/zip_file_strerror.c
${ZIP_PATH}/zip_filerange_crc.c
${ZIP_PATH}/zip_fopen.c
${ZIP_PATH}/zip_fopen_index.c
${ZIP_PATH}/zip_fread.c
${ZIP_PATH}/zip_free.c
${ZIP_PATH}/zip_get_archive_comment.c
${ZIP_PATH}/zip_get_archive_flag.c
${ZIP_PATH}/zip_get_file_comment.c
${ZIP_PATH}/zip_get_num_files.c
${ZIP_PATH}/zip_get_name.c
${ZIP_PATH}/zip_memdup.c
${ZIP_PATH}/zip_name_locate.c
${ZIP_PATH}/zip_new.c
${ZIP_PATH}/zip_open.c
${ZIP_PATH}/zip_rename.c
${ZIP_PATH}/zip_replace.c
${ZIP_PATH}/zip_set_archive_comment.c
${ZIP_PATH}/zip_set_archive_flag.c
${ZIP_PATH}/zip_set_file_comment.c
${ZIP_PATH}/zip_source_buffer.c
${ZIP_PATH}/zip_source_file.c
${ZIP_PATH}/zip_source_filep.c
${ZIP_PATH}/zip_source_free.c
${ZIP_PATH}/zip_source_function.c
${ZIP_PATH}/zip_source_zip.c
${ZIP_PATH}/zip_set_name.c
${ZIP_PATH}/zip_stat.c
${ZIP_PATH}/zip_stat_index.c
${ZIP_PATH}/zip_stat_init.c
${ZIP_PATH}/zip_strerror.c
${ZIP_PATH}/zip_unchange.c
${ZIP_PATH}/zip_unchange_all.c
${ZIP_PATH}/zip_unchange_archive.c
${ZIP_PATH}/zip_unchange_data.c
)
#include_directories(LIBPNG_PATH)
add_library(png
${LIBPNG_PATH}/png.c
${LIBPNG_PATH}/pngerror.c
${LIBPNG_PATH}/pngget.c
${LIBPNG_PATH}/pngmem.c
${LIBPNG_PATH}/pngpread.c
${LIBPNG_PATH}/pngread.c
${LIBPNG_PATH}/pngrio.c
${LIBPNG_PATH}/pngrtran.c
${LIBPNG_PATH}/pngrutil.c
${LIBPNG_PATH}/pngset.c
${LIBPNG_PATH}/pngtrans.c
${LIBPNG_PATH}/pngwio.c
${LIBPNG_PATH}/pngwrite.c
${LIBPNG_PATH}/pngwtran.c
${LIBPNG_PATH}/pngwutil.c
)
include_directories(${LIBJPEG_PATH}/vc10)
add_library(jpeg
${LIBJPEG_PATH}/jaricom.c
${LIBJPEG_PATH}/jcapimin.c
${LIBJPEG_PATH}/jcapistd.c
${LIBJPEG_PATH}/jcarith.c
${LIBJPEG_PATH}/jccoefct.c
${LIBJPEG_PATH}/jccolor.c
${LIBJPEG_PATH}/jcdctmgr.c
${LIBJPEG_PATH}/jchuff.c
${LIBJPEG_PATH}/jcinit.c
${LIBJPEG_PATH}/jcmainct.c
${LIBJPEG_PATH}/jcmarker.c
${LIBJPEG_PATH}/jcmaster.c
${LIBJPEG_PATH}/jcomapi.c
${LIBJPEG_PATH}/jcparam.c
${LIBJPEG_PATH}/jcprepct.c
${LIBJPEG_PATH}/jcsample.c
${LIBJPEG_PATH}/jctrans.c
${LIBJPEG_PATH}/jdapimin.c
${LIBJPEG_PATH}/jdapistd.c
${LIBJPEG_PATH}/jdarith.c
${LIBJPEG_PATH}/jdatadst.c
${LIBJPEG_PATH}/jdatasrc.c
${LIBJPEG_PATH}/jdcoefct.c
${LIBJPEG_PATH}/jdcolor.c
${LIBJPEG_PATH}/jddctmgr.c
${LIBJPEG_PATH}/jdhuff.c
${LIBJPEG_PATH}/jdinput.c
${LIBJPEG_PATH}/jdmainct.c
${LIBJPEG_PATH}/jdmarker.c
${LIBJPEG_PATH}/jdmaster.c
${LIBJPEG_PATH}/jdmerge.c
${LIBJPEG_PATH}/jdpostct.c
${LIBJPEG_PATH}/jdsample.c
${LIBJPEG_PATH}/jdtrans.c
${LIBJPEG_PATH}/jerror.c
${LIBJPEG_PATH}/jfdctflt.c
${LIBJPEG_PATH}/jfdctfst.c
${LIBJPEG_PATH}/jfdctint.c
${LIBJPEG_PATH}/jidctflt.c
${LIBJPEG_PATH}/jidctfst.c
${LIBJPEG_PATH}/jidctint.c
${LIBJPEG_PATH}/jmemmgr.c
${LIBJPEG_PATH}/jmemnobs.c
${LIBJPEG_PATH}/jquant1.c
${LIBJPEG_PATH}/jquant2.c
${LIBJPEG_PATH}/jutils.c
)
#LOCAL_PATH := $(VORBIS_PATH)/lib
#LOCAL_C_INCLUDES := $(VORBIS_PATH)/include
#LOCAL_C_INCLUDES += $(VORBIS_PATH)/include/vorbis
#LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/src
#LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/books
#LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/modes
#LOCAL_C_INCLUDES += $(OGG_PATH)/include
#LOCAL_C_INCLUDES += $(OGG_PATH)/include/ogg
include_directories(${OGG_PATH}/include)
include_directories(${VORBIS_PATH}/include)
add_library(ogg
${OGG_PATH}/src/framing.c
${OGG_PATH}/src/bitwise.c
)
add_library(vorbis
${VORBIS_PATH}/lib/mdct.c
${VORBIS_PATH}/lib/smallft.c
${VORBIS_PATH}/lib/block.c
${VORBIS_PATH}/lib/envelope.c
${VORBIS_PATH}/lib/window.c
${VORBIS_PATH}/lib/lsp.c
${VORBIS_PATH}/lib/lpc.c
${VORBIS_PATH}/lib/analysis.c
${VORBIS_PATH}/lib/synthesis.c
${VORBIS_PATH}/lib/psy.c
${VORBIS_PATH}/lib/info.c
${VORBIS_PATH}/lib/floor1.c
${VORBIS_PATH}/lib/floor0.c
${VORBIS_PATH}/lib/res0.c
${VORBIS_PATH}/lib/mapping0.c
${VORBIS_PATH}/lib/registry.c
${VORBIS_PATH}/lib/codebook.c
${VORBIS_PATH}/lib/sharedbook.c
${VORBIS_PATH}/lib/lookup.c
${VORBIS_PATH}/lib/bitrate.c
${VORBIS_PATH}/lib/vorbisfile.c
)
include_directories(${BOOST_PATH})
add_library(boost
${BOOST_PATH}/libs/thread/src/pthread/thread.cpp
#thread
${BOOST_PATH}/libs/thread/src/pthread/thread.cpp
${BOOST_PATH}/libs/thread/src/pthread/once.cpp
#signals
${BOOST_PATH}/libs/signals/src/connection.cpp
${BOOST_PATH}/libs/signals/src/named_slot_map.cpp
${BOOST_PATH}/libs/signals/src/signal_base.cpp
${BOOST_PATH}/libs/signals/src/slot.cpp
${BOOST_PATH}/libs/signals/src/trackable.cpp
#system
${BOOST_PATH}/libs/system/src/error_code.cpp
#regex
${BOOST_PATH}/libs/regex/src/c_regex_traits.cpp
${BOOST_PATH}/libs/regex/src/cpp_regex_traits.cpp
${BOOST_PATH}/libs/regex/src/cregex.cpp
${BOOST_PATH}/libs/regex/src/fileiter.cpp
${BOOST_PATH}/libs/regex/src/icu.cpp
${BOOST_PATH}/libs/regex/src/instances.cpp
${BOOST_PATH}/libs/regex/src/posix_api.cpp
${BOOST_PATH}/libs/regex/src/regex.cpp
${BOOST_PATH}/libs/regex/src/regex_debug.cpp
${BOOST_PATH}/libs/regex/src/regex_raw_buffer.cpp
${BOOST_PATH}/libs/regex/src/regex_traits_defaults.cpp
${BOOST_PATH}/libs/regex/src/static_mutex.cpp
${BOOST_PATH}/libs/regex/src/usinstances.cpp
${BOOST_PATH}/libs/regex/src/w32_regex_traits.cpp
${BOOST_PATH}/libs/regex/src/wc_regex_traits.cpp
${BOOST_PATH}/libs/regex/src/wide_posix_api.cpp
${BOOST_PATH}/libs/regex/src/winstances.cpp
#date_time
${BOOST_PATH}/libs/date_time/src/gregorian/greg_month.cpp
${BOOST_PATH}/libs/date_time/src/gregorian/greg_weekday.cpp
${BOOST_PATH}/libs/date_time/src/gregorian/date_generators.cpp
)
find_library( # Sets the name of the path variable.
z-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
z )
find_library( # Sets the name of the path variable.
GLESv2-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
GLESv2 )
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../)
include_directories(${BOOST_PATH})
include_directories(${LIBPNG_PATH})
include_directories(${LIBJPEG_PATH})
include_directories(${ZIP_PATH})
include_directories(${BOOST_GIL_PATH})
add_definitions(-DTARGET_ANDROID)
add_library( # Sets the name of the library.
engine
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
# Associated headers in the same location as their source
# file are automatically included.
#testcpp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/DataTypes/DataTypes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/DataTypes/NewDataTypes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/FileUtils/FileUtils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/JniApi/JniApi.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/JniApi/JniApplication.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/Console/Console.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/SerializeInterface/SerializeInterface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/Network/Network.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/PngHelper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/JpegHelper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/TgaLoader.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/SimpleTimer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/ThreadUtils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/TextureManager/SalmonTexture.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/ShaderManager/ShaderManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/FrameManager/FrameManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/LightManager/LightManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SoundManager/SoundManagerAndroid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SoundManager/SoundManagerDataTypes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/FontManager/FontManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/ScriptManager/ScriptManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SmartValueManager/SmartValueManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/GUIManager/GUIManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/GUIManager/ButtonWidget.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/GUIManager/WidgetXmlParsers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/HalibutAnimation/HalibutAnimation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/ModelManager/ModelManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/ModelManager/NewModelManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SimpleLand/SimpleLand.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/PhysicsManager/PhysicsManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/RenderMisc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/RenderParams.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/SalmonRender/BackgroundCubemap.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/SalmonRender/SalmonRenderInterface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/SalmonRender/SalmonRenderGLES20.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/SalmonRender/SalmonRenderAndroid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/SalmonRender/Cameras.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Animation/SalmonAnimation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SalmonEngineAndroid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SalmonEngineInterface.cpp
)
target_link_libraries(engine
${z-lib}
${log-lib}
${GLESv2-lib}
png
zip
boost
jpeg
ogg
vorbis
)
+38
View File
@@ -0,0 +1,38 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -fexceptions -Wno-c++11-narrowing"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
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:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
}
+17
View File
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\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 *;
#}
@@ -0,0 +1,26 @@
package fishrungames.salmonengineandroid;
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("fishrungames.salmonengineandroid", appContext.getPackageName());
}
}
+17
View File
@@ -0,0 +1,17 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fishrungames.salmonengineandroid">
<application android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:screenOrientation="landscape"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true">
</application>
<uses-feature android:glEsVersion="0x00020000"/>
</manifest>
+3
View File
@@ -0,0 +1,3 @@
#include <jni.h>
#include <string>
@@ -0,0 +1,448 @@
package fishrungames.salmonengineandroid;
import java.io.IOException;
import java.io.InputStream;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.SoundPool;
import android.opengl.GLSurfaceView;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.GestureDetector.SimpleOnGestureListener;
//import android.net.Uri;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
public class EngineWrapper {
static class CustomGestureListener extends SimpleOnGestureListener
{
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY)
{
EngineWrapper.OnFling(velocityX, velocityY, e2.getEventTime());
return true;
}
}
static class JniDestroyRunnable implements Runnable
{
public void run()
{
EngineWrapper.Destroy();
}
}
static ContextWrapper Instance = null;
static Map<String, Integer> FileMap = new HashMap<String, Integer>();
static Map<String, Integer> SoundMap = new HashMap<String, Integer>();
static Context context;
static SoundPool soundPool;
static MediaPlayer mp;
static GLSurfaceView mView;
static GestureDetector customGestureDetector = new GestureDetector(new CustomGestureListener());
public static void SetActivityInstance(ContextWrapper inst)
{
Instance = inst;
context = Instance.getBaseContext();
soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
mp = new MediaPlayer();
}
public static void SetView(GLSurfaceView view)
{
mView = view;
}
public static String GetApplicationDir()
{
return Instance.getFilesDir().getPath();
}
public static void AddToFileMap(String s, Integer i)
{
FileMap.put(s, i);
}
public synchronized static int OpenFile(String fileName)
{
String newFileName;
int i = fileName.lastIndexOf(".");
if (i == -1)
{
newFileName = fileName;
}
else
{
newFileName = fileName.substring(0, i);
}
if (!FileMap.containsKey(newFileName))
{
return 0;
}
Integer id = FileMap.get(newFileName);
try
{
InputStream is = Instance.getResources().openRawResource(id);
byte[] buffer = new byte[256];
int bytesRead;
CreateFile(is.available());
while ((bytesRead = is.read(buffer, 0, 256)) != -1)
{
WriteToFile(buffer, bytesRead);
}
} catch (Throwable t) {
ConsoleOut("Exception in FileWrapper::OpenFile!\n");
return 0;
}
return 1;
}
public static native void SetupEnviroment();
public static native void SetupApkFilePath(String s);
public static native void ConsoleOut(String s);
public static native void CreateFile(int fileSize);
public static native void WriteToFile(byte [] buffer, int bufferSize);
public static void LoadSound(String soundFileName)
{
if (SoundMap.containsKey(soundFileName))
{
return;
}
/*
String newFileName;
int i = soundFileName.lastIndexOf(".");
if (i == -1)
{
newFileName = soundFileName;
}
else
{
newFileName = soundFileName.substring(0, i);
}*/
//int soundId = soundPool.load(context, FileMap.get(newFileName), 1);
AssetFileDescriptor afd = null;
try
{
afd = Instance.getAssets().openFd(soundFileName);
} catch (IOException e)
{
e.printStackTrace();
}
int soundId = soundPool.load(afd, 1);
SoundMap.put(soundFileName, soundId);
}
public static void ReleaseAllSoundsAndMusic()
{
mp.stop();
mp.reset();
//soundPool.autoPause();
Enumeration<Integer> i = Collections.enumeration(SoundMap.values());
while(i.hasMoreElements())
{
soundPool.stop(i.nextElement());
}
SoundMap.clear();
}
public static void PauseAllSoundsAndMusic()
{
//NIU right now
soundPool.autoPause();
mp.pause();
}
public static void ResumeAllSoundsAndMusic()
{
//NIU right now
soundPool.autoResume();
mp.start();
}
public static void StopMusic()
{
mp.stop();
mp.reset();
}
public static void PlayMusic(String musicFileName)
{
InnerPlayMusic(musicFileName, false);
}
public static void PlayMusicLooped(String musicFileName)
{
InnerPlayMusic(musicFileName, true);
}
private static void InnerPlayMusic(String musicFileName, boolean looped)
{
/*
String newFileName;
int i = musicFileName.lastIndexOf(".");
if (i == -1)
{
newFileName = musicFileName;
}
else
{
newFileName = musicFileName.substring(0, i);
}
*/
try
{
//Uri path = Uri.parse("android.resource://"+Instance.getPackageName()+"/assets/"+newFileName);
AssetFileDescriptor afd = null;
try
{
afd = Instance.getAssets().openFd(musicFileName);
} catch (IOException e)
{
e.printStackTrace();
}
//mp.setDataSource(context, path);
mp.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
mp.prepare();
mp.setLooping(looped);
mp.start();
} catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void PlaySound(String soundFileName)
{
if (!SoundMap.containsKey(soundFileName))
{
return;
}
int soundId = SoundMap.get(soundFileName);
soundPool.play(soundId, 1,1,1,0,1);
}
public static void LoadSalmonEngineLibrary()
{
System.loadLibrary("engine");
}
static
{
//System.loadLibrary("gnustl_shared");
}
//Application methods
public static native void Update(long dt);
public static native void Destroy();
public static native int IsInited();
public static native void OnTapDown(float x, float y, long time);
public static native void OnTapUp(float x, float y, long time);
public static native void OnTapUpAfterMove(float x, float y, long time);
public static native void OnTapMove(float x, float y, long time);
public static native void OnFling(float velocityX, float velocityY, long time);
public static native void OnScroll(float distanceX, float distanceY, long time);
public static native void OnKeyPress(int keyCode);
public static void CallDestroy()
{
mView.queueEvent(new JniDestroyRunnable());
}
public static void ProcessKeyDown(int keyCode, KeyEvent event)
{
int ascii_keycode = keyCode;
if (keyCode == KeyEvent.KEYCODE_DEL)
{
ascii_keycode = 8; //Hack - getUnicodeChar does not recognize backspace
}
else
{
ascii_keycode = event.getUnicodeChar();
}
OnKeyPress(ascii_keycode);
}
static boolean IsScrolling = false;
static float PrevMovePosX = 0;
static float PrevMovePosY = 0;
static boolean EnableFlingGesture = false;
public static void ProcessTouchEvent(MotionEvent event)
{
if (EnableFlingGesture)
{
if (customGestureDetector.onTouchEvent(event))
{
return;
}
}
if (event.getAction() == MotionEvent.ACTION_MOVE)
{
float x = event.getX();
float y = (float) mView.getHeight() - event.getY();
float oldX = PrevMovePosX;
float oldY = (float) mView.getHeight() - PrevMovePosY;
float shiftX = x - oldX;
float shiftY = y - oldY;
if (Math.abs(shiftX) > 0.001f || Math.abs(shiftY) > 0.001f)
{
OnScroll(-shiftX, -shiftY, event.getEventTime());
}
PrevMovePosX = event.getX();
PrevMovePosY = event.getY();
IsScrolling = true;
}
if (event.getAction() == MotionEvent.ACTION_UP)
{
float x = event.getX();
float y = (float) mView.getHeight() - event.getY();
if (IsScrolling)
{
IsScrolling = false;
OnTapUpAfterMove(x, y, event.getEventTime());
}
else
{
OnTapUp(x, y, event.getEventTime());
}
}
if (event.getAction() == MotionEvent.ACTION_DOWN)
{
float x = event.getX();
float y = (float) mView.getHeight() - event.getY();
PrevMovePosX = event.getX();
PrevMovePosY = event.getY();
OnTapDown(x, y, event.getEventTime());
}
}
}
@@ -0,0 +1,289 @@
package fishrungames.salmonengineandroid;
import android.content.Context;
import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;
import android.util.Log;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
/*
This is a OpenGL View template. Do not change this code - derive your own class instead!!
*/
public class GLViewAncestor extends GLSurfaceView
{
private static String TAG = "GL2JNIView";
private static final boolean DEBUG = false;
public GLViewAncestor(Context context)
{
super(context);
}
public void init(boolean translucent, int depth, int stencil)
{
/*
* By default, GLSurfaceView() creates a RGB_565 opaque surface. If we
* want a translucent one, we should change the surface's format here,
* using PixelFormat.TRANSLUCENT for GL Surfaces is interpreted as any
* 32-bit surface with alpha by SurfaceFlinger.
*/
if (translucent)
{
this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
}
/*
* Setup the context factory for 2.0 rendering. See ContextFactory class
* definition below
*/
setEGLContextFactory(new ContextFactory());
/*
* We need to choose an EGLConfig that matches the format of our surface
* exactly. This is going to be done in our custom config chooser. See
* ConfigChooser class definition below.
*/
setEGLConfigChooser(translucent ? new ConfigChooser(8, 8, 8, 8, depth,
stencil) : new ConfigChooser(5, 6, 5, 0, depth, stencil));
}
private static class ContextFactory implements
GLSurfaceView.EGLContextFactory
{
private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
@Override
public EGLContext createContext(EGL10 egl, EGLDisplay display,
EGLConfig eglConfig)
{
Log.w(TAG, "creating OpenGL ES 2.0 context");
checkEglError("Before eglCreateContext", egl);
int[] attrib_list =
{ EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
EGLContext context = egl.eglCreateContext(display, eglConfig,
EGL10.EGL_NO_CONTEXT, attrib_list);
checkEglError("After eglCreateContext", egl);
return context;
}
@Override
public void destroyContext(EGL10 egl, EGLDisplay display,
EGLContext context)
{
egl.eglDestroyContext(display, context);
}
}
private static void checkEglError(String prompt, EGL10 egl)
{
int error;
while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS)
{
Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error));
}
}
private static class ConfigChooser implements
GLSurfaceView.EGLConfigChooser
{
public ConfigChooser(int r, int g, int b, int a, int depth, int stencil)
{
mRedSize = r;
mGreenSize = g;
mBlueSize = b;
mAlphaSize = a;
mDepthSize = depth;
mStencilSize = stencil;
}
/*
* This EGL config specification is used to specify 2.0 rendering. We
* use a minimum size of 4 bits for red/green/blue, but will perform
* actual matching in chooseConfig() below.
*/
private static int EGL_OPENGL_ES2_BIT = 4;
private static int[] s_configAttribs2 =
{ EGL10.EGL_RED_SIZE, 4, EGL10.EGL_GREEN_SIZE, 4,
EGL10.EGL_BLUE_SIZE, 4, EGL10.EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES2_BIT, EGL10.EGL_NONE };
@Override
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display)
{
/*
* Get the number of minimally matching EGL configurations
*/
int[] num_config = new int[1];
egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config);
int numConfigs = num_config[0];
if (numConfigs <= 0)
{
throw new IllegalArgumentException(
"No configs match configSpec");
}
/*
* Allocate then read the array of minimally matching EGL configs
*/
EGLConfig[] configs = new EGLConfig[numConfigs];
egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs,
num_config);
if (DEBUG)
{
printConfigs(egl, display, configs);
}
/*
* Now return the "best" one
*/
return chooseConfig(egl, display, configs);
}
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
EGLConfig[] configs)
{
for (EGLConfig config : configs)
{
int d = findConfigAttrib(egl, display, config,
EGL10.EGL_DEPTH_SIZE, 0);
int s = findConfigAttrib(egl, display, config,
EGL10.EGL_STENCIL_SIZE, 0);
// We need at least mDepthSize and mStencilSize bits
if (d < mDepthSize || s < mStencilSize)
continue;
// We want an *exact* match for red/green/blue/alpha
int r = findConfigAttrib(egl, display, config,
EGL10.EGL_RED_SIZE, 0);
int g = findConfigAttrib(egl, display, config,
EGL10.EGL_GREEN_SIZE, 0);
int b = findConfigAttrib(egl, display, config,
EGL10.EGL_BLUE_SIZE, 0);
int a = findConfigAttrib(egl, display, config,
EGL10.EGL_ALPHA_SIZE, 0);
if (r == mRedSize && g == mGreenSize && b == mBlueSize
&& a == mAlphaSize)
return config;
}
return null;
}
private int findConfigAttrib(EGL10 egl, EGLDisplay display,
EGLConfig config, int attribute, int defaultValue)
{
if (egl.eglGetConfigAttrib(display, config, attribute, mValue))
{
return mValue[0];
}
return defaultValue;
}
private void printConfigs(EGL10 egl, EGLDisplay display,
EGLConfig[] configs)
{
int numConfigs = configs.length;
Log.w(TAG, String.format("%d configurations", numConfigs));
for (int i = 0; i < numConfigs; i++)
{
Log.w(TAG, String.format("Configuration %d:\n", i));
printConfig(egl, display, configs[i]);
}
}
private void printConfig(EGL10 egl, EGLDisplay display, EGLConfig config)
{
int[] attributes =
{
EGL10.EGL_BUFFER_SIZE,
EGL10.EGL_ALPHA_SIZE,
EGL10.EGL_BLUE_SIZE,
EGL10.EGL_GREEN_SIZE,
EGL10.EGL_RED_SIZE,
EGL10.EGL_DEPTH_SIZE,
EGL10.EGL_STENCIL_SIZE,
EGL10.EGL_CONFIG_CAVEAT,
EGL10.EGL_CONFIG_ID,
EGL10.EGL_LEVEL,
EGL10.EGL_MAX_PBUFFER_HEIGHT,
EGL10.EGL_MAX_PBUFFER_PIXELS,
EGL10.EGL_MAX_PBUFFER_WIDTH,
EGL10.EGL_NATIVE_RENDERABLE,
EGL10.EGL_NATIVE_VISUAL_ID,
EGL10.EGL_NATIVE_VISUAL_TYPE,
0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
EGL10.EGL_SAMPLES,
EGL10.EGL_SAMPLE_BUFFERS,
EGL10.EGL_SURFACE_TYPE,
EGL10.EGL_TRANSPARENT_TYPE,
EGL10.EGL_TRANSPARENT_RED_VALUE,
EGL10.EGL_TRANSPARENT_GREEN_VALUE,
EGL10.EGL_TRANSPARENT_BLUE_VALUE,
0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
EGL10.EGL_LUMINANCE_SIZE, EGL10.EGL_ALPHA_MASK_SIZE,
EGL10.EGL_COLOR_BUFFER_TYPE, EGL10.EGL_RENDERABLE_TYPE,
0x3042 // EGL10.EGL_CONFORMANT
};
String[] names =
{ "EGL_BUFFER_SIZE", "EGL_ALPHA_SIZE", "EGL_BLUE_SIZE",
"EGL_GREEN_SIZE", "EGL_RED_SIZE", "EGL_DEPTH_SIZE",
"EGL_STENCIL_SIZE", "EGL_CONFIG_CAVEAT",
"EGL_CONFIG_ID", "EGL_LEVEL", "EGL_MAX_PBUFFER_HEIGHT",
"EGL_MAX_PBUFFER_PIXELS", "EGL_MAX_PBUFFER_WIDTH",
"EGL_NATIVE_RENDERABLE", "EGL_NATIVE_VISUAL_ID",
"EGL_NATIVE_VISUAL_TYPE", "EGL_PRESERVED_RESOURCES",
"EGL_SAMPLES", "EGL_SAMPLE_BUFFERS",
"EGL_SURFACE_TYPE", "EGL_TRANSPARENT_TYPE",
"EGL_TRANSPARENT_RED_VALUE",
"EGL_TRANSPARENT_GREEN_VALUE",
"EGL_TRANSPARENT_BLUE_VALUE",
"EGL_BIND_TO_TEXTURE_RGB", "EGL_BIND_TO_TEXTURE_RGBA",
"EGL_MIN_SWAP_INTERVAL", "EGL_MAX_SWAP_INTERVAL",
"EGL_LUMINANCE_SIZE", "EGL_ALPHA_MASK_SIZE",
"EGL_COLOR_BUFFER_TYPE", "EGL_RENDERABLE_TYPE",
"EGL_CONFORMANT" };
int[] value = new int[1];
for (int i = 0; i < attributes.length; i++)
{
int attribute = attributes[i];
String name = names[i];
if (egl.eglGetConfigAttrib(display, config, attribute, value))
{
Log.w(TAG, String.format(" %s: %d\n", name, value[0]));
} else
{
// Log.w(TAG, String.format(" %s: failed\n", name));
while (egl.eglGetError() != EGL10.EGL_SUCCESS)
;
}
}
}
// Subclasses can adjust these values:
protected int mRedSize;
protected int mGreenSize;
protected int mBlueSize;
protected int mAlphaSize;
protected int mDepthSize;
protected int mStencilSize;
private int[] mValue = new int[1];
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

+6
View File
@@ -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>
+3
View File
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">SalmonEngineAndroid</string>
</resources>
+11
View File
@@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>
@@ -0,0 +1,17 @@
package fishrungames.salmonengineandroid;
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);
}
}
+23
View File
@@ -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.2.2'
// 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
}
+17
View File
@@ -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.
+6
View File
@@ -0,0 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
Vendored Executable
+160
View File
@@ -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
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
include ':app'