From 3348f10813d6b32d29694a3fbf31797350416b1f Mon Sep 17 00:00:00 2001 From: halx99 Date: Sun, 2 May 2021 17:23:39 +0800 Subject: [PATCH] Make tests could build at external location [ci build] --- .../cpp-empty-test/proj.android/settings.gradle | 17 ++++++++++++++++- tests/cpp-tests/proj.android/settings.gradle | 17 ++++++++++++++++- .../fairygui-tests/proj.android/settings.gradle | 17 ++++++++++++++++- .../project/proj.android/settings.gradle | 17 ++++++++++++++++- .../project/proj.android/settings.gradle | 17 ++++++++++++++++- .../proj.android/settings.gradle | 17 ++++++++++++++++- 6 files changed, 96 insertions(+), 6 deletions(-) diff --git a/tests/cpp-empty-test/proj.android/settings.gradle b/tests/cpp-empty-test/proj.android/settings.gradle index 9b2b1a1b72b0..ead6bd4dc14b 100644 --- a/tests/cpp-empty-test/proj.android/settings.gradle +++ b/tests/cpp-empty-test/proj.android/settings.gradle @@ -1,5 +1,20 @@ +import java.nio.file.Paths +import java.nio.file.Files + +def ENGINE_ROOT=Paths.get("${System.env.ENGINEX_ROOT}") +if(Files.exists(ENGINE_ROOT)) { + println("Determine ENGINE_JAVA_LIBPATH with system env var ENGINEX_ROOT") + ENGINE_ROOT = ENGINE_ROOT.toAbsolutePath().toString() +} +else { + println("Determine ENGINE_JAVA_LIBPATH with relative to settingsDir") + ENGINE_ROOT = settingsDir.getPath() + "/../../.." +} + +def ENGINE_JAVA_LIBPATH = ENGINE_ROOT + '/cocos/platform/android/libcocos2dx'; + include ':libcocos2dx' -project(':libcocos2dx').projectDir = new File(settingsDir, '../../../cocos/platform/android/libcocos2dx') +project(':libcocos2dx').projectDir = new File(ENGINE_JAVA_LIBPATH) include ':CppEmptyTest' project(':CppEmptyTest').projectDir = new File(settingsDir, 'app') rootProject.name = "cpp-empty-test" \ No newline at end of file diff --git a/tests/cpp-tests/proj.android/settings.gradle b/tests/cpp-tests/proj.android/settings.gradle index 72c6f3a475f8..149d5539a8f7 100644 --- a/tests/cpp-tests/proj.android/settings.gradle +++ b/tests/cpp-tests/proj.android/settings.gradle @@ -1,5 +1,20 @@ +import java.nio.file.Paths +import java.nio.file.Files + +def ENGINE_ROOT=Paths.get("${System.env.ENGINEX_ROOT}") +if(Files.exists(ENGINE_ROOT)) { + println("Determine ENGINE_JAVA_LIBPATH with system env var ENGINEX_ROOT") + ENGINE_ROOT = ENGINE_ROOT.toAbsolutePath().toString() +} +else { + println("Determine ENGINE_JAVA_LIBPATH with relative to settingsDir") + ENGINE_ROOT = settingsDir.getPath() + "/../../.." +} + +def ENGINE_JAVA_LIBPATH = ENGINE_ROOT + '/cocos/platform/android/libcocos2dx'; + include ':libcocos2dx' -project(':libcocos2dx').projectDir = new File(settingsDir, '../../../cocos/platform/android/libcocos2dx') +project(':libcocos2dx').projectDir = new File(ENGINE_JAVA_LIBPATH) include ':CppTests' project(':CppTests').projectDir = new File(settingsDir, 'app') rootProject.name = "cpp-tests" diff --git a/tests/fairygui-tests/proj.android/settings.gradle b/tests/fairygui-tests/proj.android/settings.gradle index 75dcea57b815..a24c937caa76 100644 --- a/tests/fairygui-tests/proj.android/settings.gradle +++ b/tests/fairygui-tests/proj.android/settings.gradle @@ -1,5 +1,20 @@ +import java.nio.file.Paths +import java.nio.file.Files + +def ENGINE_ROOT=Paths.get("${System.env.ENGINEX_ROOT}") +if(Files.exists(ENGINE_ROOT)) { + println("Determine ENGINE_JAVA_LIBPATH with system env var ENGINEX_ROOT") + ENGINE_ROOT = ENGINE_ROOT.toAbsolutePath().toString() +} +else { + println("Determine ENGINE_JAVA_LIBPATH with relative to settingsDir") + ENGINE_ROOT = settingsDir.getPath() + "/../../.." +} + +def ENGINE_JAVA_LIBPATH = ENGINE_ROOT + '/cocos/platform/android/libcocos2dx'; + include ':libcocos2dx' -project(':libcocos2dx').projectDir = new File(settingsDir, '../../../cocos/platform/android/libcocos2dx') +project(':libcocos2dx').projectDir = new File(ENGINE_JAVA_LIBPATH) include ':FairyGUITests' project(':FairyGUITests').projectDir = new File(settingsDir, 'app') rootProject.name = "fairygui-tests" \ No newline at end of file diff --git a/tests/lua-empty-test/project/proj.android/settings.gradle b/tests/lua-empty-test/project/proj.android/settings.gradle index e45551612e07..a67fdba7bdd9 100644 --- a/tests/lua-empty-test/project/proj.android/settings.gradle +++ b/tests/lua-empty-test/project/proj.android/settings.gradle @@ -1,5 +1,20 @@ +import java.nio.file.Paths +import java.nio.file.Files + +def ENGINE_ROOT=Paths.get("${System.env.ENGINEX_ROOT}") +if(Files.exists(ENGINE_ROOT)) { + println("Determine ENGINE_JAVA_LIBPATH with system env var ENGINEX_ROOT") + ENGINE_ROOT = ENGINE_ROOT.toAbsolutePath().toString() +} +else { + println("Determine ENGINE_JAVA_LIBPATH with relative to settingsDir") + ENGINE_ROOT = settingsDir.getPath() + "/../../.." +} + +def ENGINE_JAVA_LIBPATH = ENGINE_ROOT + '/cocos/platform/android/libcocos2dx'; + include ':libcocos2dx' -project(':libcocos2dx').projectDir = new File(settingsDir, '../../../../cocos/platform/android/libcocos2dx') +project(':libcocos2dx').projectDir = new File(ENGINE_JAVA_LIBPATH) include ':LuaEmptyTest' project(':LuaEmptyTest').projectDir = new File(settingsDir, 'app') rootProject.name = "lua-empty-test" \ No newline at end of file diff --git a/tests/lua-tests/project/proj.android/settings.gradle b/tests/lua-tests/project/proj.android/settings.gradle index 05c3a5eb7971..01dc3df09378 100644 --- a/tests/lua-tests/project/proj.android/settings.gradle +++ b/tests/lua-tests/project/proj.android/settings.gradle @@ -1,5 +1,20 @@ +import java.nio.file.Paths +import java.nio.file.Files + +def ENGINE_ROOT=Paths.get("${System.env.ENGINEX_ROOT}") +if(Files.exists(ENGINE_ROOT)) { + println("Determine ENGINE_JAVA_LIBPATH with system env var ENGINEX_ROOT") + ENGINE_ROOT = ENGINE_ROOT.toAbsolutePath().toString() +} +else { + println("Determine ENGINE_JAVA_LIBPATH with relative to settingsDir") + ENGINE_ROOT = settingsDir.getPath() + "/../../.." +} + +def ENGINE_JAVA_LIBPATH = ENGINE_ROOT + '/cocos/platform/android/libcocos2dx'; + include ':libcocos2dx' -project(':libcocos2dx').projectDir = new File(settingsDir, '../../../../cocos/platform/android/libcocos2dx') +project(':libcocos2dx').projectDir = new File(ENGINE_JAVA_LIBPATH) include ':LuaTests' project(':LuaTests').projectDir = new File(settingsDir, 'app') rootProject.name = "lua-tests" diff --git a/tests/performance-tests/proj.android/settings.gradle b/tests/performance-tests/proj.android/settings.gradle index 01cf7ba1af9a..8937f8b81ddb 100644 --- a/tests/performance-tests/proj.android/settings.gradle +++ b/tests/performance-tests/proj.android/settings.gradle @@ -1,5 +1,20 @@ +import java.nio.file.Paths +import java.nio.file.Files + +def ENGINE_ROOT=Paths.get("${System.env.ENGINEX_ROOT}") +if(Files.exists(ENGINE_ROOT)) { + println("Determine ENGINE_JAVA_LIBPATH with system env var ENGINEX_ROOT") + ENGINE_ROOT = ENGINE_ROOT.toAbsolutePath().toString() +} +else { + println("Determine ENGINE_JAVA_LIBPATH with relative to settingsDir") + ENGINE_ROOT = settingsDir.getPath() + "/../../.." +} + +def ENGINE_JAVA_LIBPATH = ENGINE_ROOT + '/cocos/platform/android/libcocos2dx'; + include ':libcocos2dx' -project(':libcocos2dx').projectDir = new File(settingsDir, '../../../cocos/platform/android/libcocos2dx') +project(':libcocos2dx').projectDir = new File(ENGINE_JAVA_LIBPATH) include ':performance-tests' project(':performance-tests').projectDir = new File(settingsDir, 'app') rootProject.name = "performance-tests"