102 lines
3.7 KiB
Groovy
102 lines
3.7 KiB
Groovy
apply plugin: 'com.android.library'
|
|
|
|
|
|
dependencies {
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
implementation(name: 'IngameDebugConsole', ext:'aar')
|
|
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion 30
|
|
buildToolsVersion '30.0.2'
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
defaultConfig {
|
|
minSdkVersion 22
|
|
targetSdkVersion 30
|
|
ndk {
|
|
abiFilters 'armeabi-v7a'
|
|
}
|
|
versionCode 1
|
|
versionName '0.1'
|
|
consumerProguardFiles 'proguard-unity.txt'
|
|
}
|
|
|
|
lintOptions {
|
|
abortOnError false
|
|
}
|
|
|
|
aaptOptions {
|
|
noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] + unityStreamingAssets.tokenize(', ')
|
|
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
|
|
}
|
|
|
|
packagingOptions {
|
|
doNotStrip '*/armeabi-v7a/*.so'
|
|
}
|
|
}
|
|
|
|
def getSdkDir() {
|
|
Properties local = new Properties()
|
|
local.load(new FileInputStream("${rootDir}/local.properties"))
|
|
return local.getProperty('sdk.dir')
|
|
}
|
|
|
|
def BuildIl2Cpp(String workingDir, String configuration, String architecture, String abi, String[] staticLibraries) {
|
|
def commandLineArgs = []
|
|
commandLineArgs.add("--compile-cpp")
|
|
commandLineArgs.add("--platform=Android")
|
|
commandLineArgs.add("--architecture=" + architecture)
|
|
commandLineArgs.add("--outputpath=" + workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.so")
|
|
commandLineArgs.add("--libil2cpp-static")
|
|
commandLineArgs.add("--baselib-directory=" + workingDir + "/src/main/jniStaticLibs/" + abi)
|
|
commandLineArgs.add("--configuration=" + configuration)
|
|
commandLineArgs.add("--dotnetprofile=unityaot-linux")
|
|
commandLineArgs.add("--profiler-report")
|
|
commandLineArgs.add("--profiler-output-file=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_conv.traceevents")
|
|
commandLineArgs.add("--print-command-line")
|
|
commandLineArgs.add("--generatedcppdir=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput")
|
|
commandLineArgs.add("--cachedirectory=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_cache")
|
|
commandLineArgs.add("--tool-chain-path=" + android.ndkDirectory)
|
|
staticLibraries.eachWithIndex {fileName, i->
|
|
commandLineArgs.add("--additional-libraries=" + workingDir + "/src/main/jniStaticLibs/" + abi + "/" + fileName)
|
|
}
|
|
def executableExtension = ""
|
|
if (org.gradle.internal.os.OperatingSystem.current().isWindows())
|
|
executableExtension = ".exe"
|
|
exec {
|
|
executable workingDir + "/src/main/Il2CppOutputProject/IL2CPP/build/deploy/il2cpp" + executableExtension
|
|
args commandLineArgs
|
|
environment "ANDROID_SDK_ROOT", getSdkDir()
|
|
}
|
|
delete workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.sym.so"
|
|
ant.move(file: workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.dbg.so", tofile: workingDir + "/symbols/" + abi + "/libil2cpp.so")
|
|
}
|
|
|
|
android {
|
|
task BuildIl2CppTask {
|
|
doLast {
|
|
BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), 'Release', 'armv7', 'armeabi-v7a', [ ] as String[]);
|
|
}
|
|
}
|
|
afterEvaluate {
|
|
if (project(':unityLibrary').tasks.findByName('mergeDebugJniLibFolders'))
|
|
project(':unityLibrary').mergeDebugJniLibFolders.dependsOn BuildIl2CppTask
|
|
if (project(':unityLibrary').tasks.findByName('mergeReleaseJniLibFolders'))
|
|
project(':unityLibrary').mergeReleaseJniLibFolders.dependsOn BuildIl2CppTask
|
|
}
|
|
sourceSets {
|
|
main {
|
|
jni.srcDirs = ["src/main/Il2CppOutputProject"]
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|