Skip to content

Commit

Permalink
添加管理桥接代码的项目; 忽略gradle不必要的文件
Browse files Browse the repository at this point in the history
  • Loading branch information
U-UZ\litl authored and U-UZ\litl committed Jun 13, 2017
1 parent 2fb9761 commit 57876b5
Show file tree
Hide file tree
Showing 26 changed files with 868 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Expand Up @@ -34,3 +34,16 @@ sysinfo.txt

# we need unitypackage
#*.unitypackage

# Android-Unity-Bridge
*.iml
.gradle
.idea
gradle
build
captures
.DS_Store
local.properties
.externalNativeBuild


9 changes: 9 additions & 0 deletions Android-Unity-Bridge/MobLink/.classpath
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions Android-Unity-Bridge/MobLink/.project
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MobLink</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions Android-Unity-Bridge/MobLink/AndroidManifest.xml
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mob.moblink"
android:versionCode="200"
android:versionName="2.0.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />

<application/>

</manifest>
108 changes: 108 additions & 0 deletions Android-Unity-Bridge/MobLink/build-mix.gradle
@@ -0,0 +1,108 @@
// define the common method for android configuration
//
ext.findBuildTools = {
def localProperties = new File(projectDir, "local.properties")
String buildTools = "25.0.2";
if (localProperties.exists()) {
def properties = new Properties()
localProperties.withInputStream {
instr->properties.load(instr)
}
def sdkDir = properties.getProperty('sdk.dir')
def buildToolsDir = new File(sdkDir, "build-tools")
if (buildToolsDir.exists()) {
def tools = buildToolsDir.list()
if (tools != null) {
Arrays.sort(tools)
buildTools = tools[tools.length - 1]
}
}
}
logForfind("findBuildTools:" + buildTools)
return buildTools
}

ext.findCompileSdkVersion = {
int cimpileSdkVersion = 19
def projProp = new File(projectDir, "project.properties")
if (projProp.exists()) {
def properties = new Properties()
projProp.withInputStream {
instr->properties.load(instr)
}
def target = properties.getProperty('target').trim()
def pref = "android-"
if (target != null && target.startsWith(pref)) {
cimpileSdkVersion = Integer.parseInt(target.substring(pref.length()))
}
}
logForfind("findCompileSdkVersion:" + cimpileSdkVersion);
return cimpileSdkVersion;
}

ext.findProguardFile = {
String proguardFile = null;
def srcDir = new File(projectDir, "src")
srcDir = srcDir.listFiles();
if (null != srcDir && srcDir.length > 0) {
def file = new File(projectDir, "proguard-project.txt")
proguardFile = file.getAbsolutePath()
}
logForfind("findProguardFile:" + proguardFile);
return proguardFile;
}

ext.findTargetSdk = {
int targetSdk = 8;
def manifest = findManifest()
String temp = manifest.getAt("uses-sdk").getProperty('@android:targetSdkVersion').toString();
if (null != temp && temp.length() > 0) {
targetSdk = Integer.parseInt(temp);
}
logForfind("findTargetSdk:" + targetSdk)
return targetSdk;
}

ext.findMinSdk = {
int minSdk = 8;
def manifest = findManifest()
String temp = manifest.getAt("uses-sdk").getProperty('@android:minSdkVersion').toString();
if (null != temp && temp.length() > 0) {
minSdk = Integer.parseInt(temp);
}
logForfind("findMinSdk:" + minSdk)
return minSdk
}

ext.findVersionName = {
def manifest = findManifest();
String versionName = manifest.getProperty('@android:versionName')
logForfind("findVersionName:" + versionName)
return versionName
}

ext.findVersionCode = {
def manifest = findManifest();
String temp = manifest.getProperty('@android:versionCode');
def versionCode = Integer.parseInt(temp)
logForfind("findVersionCode:" + versionCode)
return versionCode
}

ext.findApplicationId = {
def manifest = findManifest();
String pkg = manifest.getProperty('@package');
logForfind("findApplicationId:" + pkg)
return pkg;
}

ext.findManifest = {
def file = new File(projectDir, "AndroidManifest.xml")
def xml = new XmlSlurper()
def manifest = xml.parse(file)
return manifest;
}

ext.logForfind = { msg ->
println("ext.find:" + msg)
}
55 changes: 55 additions & 0 deletions Android-Unity-Bridge/MobLink/build.gradle
@@ -0,0 +1,55 @@
apply plugin: 'com.android.library'
apply from: 'build-mix.gradle'


android {

compileSdkVersion findCompileSdkVersion()
buildToolsVersion findBuildTools()

defaultConfig {
minSdkVersion findMinSdk()
targetSdkVersion findTargetSdk()
versionCode findVersionCode()
versionName findVersionName()
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
assets.srcDirs = ['assets']
java.srcDirs = ['src']
aidl.srcDirs = ['src']
res.srcDirs = ['res']
jniLibs.srcDirs = ['libs']
}
}

buildTypes {
release {
minifyEnabled false
def proguard = findProguardFile()
if (null != proguard) {
proguardFiles proguard
}
}

debug {
minifyEnabled false
}
}

lintOptions {
checkReleaseBuilds false
abortOnError false
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
}
Binary file added Android-Unity-Bridge/MobLink/libs/MobCommons.jar
Binary file not shown.
Binary file not shown.
Binary file added Android-Unity-Bridge/MobLink/libs/MobTools.jar
Binary file not shown.
71 changes: 71 additions & 0 deletions Android-Unity-Bridge/MobLink/proguard-project.txt
@@ -0,0 +1,71 @@
-dontoptimize
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-dontwarn
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keepattributes SourceFile,LineNumberTable,Exceptions,InnerClasses,Signature

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.app.View
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference

-keep class android.net.http.SslError
-keep class android.webkit.**{*;}
-keep class eclipse.local.sdk.**{*;}

-keepclasseswithmembernames class * {
native <methods>;
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

-keep class **.R$* {
*;
}

# 下面这些是MobLink sdk 需要保持的 class
-keep class com.mob.commons.MOBLINK {
*;
}

-keep class com.mob.moblink.MobLink {
*;
}

-keep class com.mob.moblink.ActionListener {
*;
}

-keep class com.mob.moblink.RestoreSceneListener {
*;
}

-keep class com.mob.moblink.AbstractRestoreSceneListener {
*;
}
15 changes: 15 additions & 0 deletions Android-Unity-Bridge/MobLink/project.properties
@@ -0,0 +1,15 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-19
android.library=true
9 changes: 9 additions & 0 deletions Android-Unity-Bridge/UnityBridge/.classpath
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions Android-Unity-Bridge/UnityBridge/.project
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MobLink</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions Android-Unity-Bridge/UnityBridge/AndroidManifest.xml
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mob.moblink"
android:versionCode="200"
android:versionName="2.0.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />

<application/>

</manifest>

0 comments on commit 57876b5

Please sign in to comment.