我试图验证在执行部署命令时源路径和目标路径是否正确设置。
请看下面的例子:
(复制自: http://eppz.eu/blog/unity-android-plugin-tutorial-2/)
android.libraryVariants.all { variant ->
// Task names.
String variantName = "${variant.name.capitalize()}"; // Like 'Debug'
String deployTaskGroup = "plugin";
String deployTaskName = "deploy${variantName}PluginArchive"; // Like 'deployDebugPluginArchive'
String dependencyTaskName = "assemble${variantName}"; // Like 'assembleDebug'
// Source.
String sourceAARFolder = "${buildDir.getPath()}/outputs/aar/";
String sourceAARName = "${project.name}-${variant.name}.aar";
// Target.
String targetAssetFolder = "Assets/Plugins/My Plugin";
String targetAARFolder = "${rootDir.getPath()}/../../${targetAssetFolder}"; // Navigate into 'Assets'
String targetAARName = "My Plugin Android.aar"; // The form you ship your plugin
String targetProjDir = System.env.UNITY_PROJECT; // <-- Need to confirm this line!
//Log.i(targetProjDir); //??????????? something like this?
// Create task.
task(deployTaskName, dependsOn: dependencyTaskName, type: Copy) {
from(sourceAARFolder)
into(targetAARFolder)
include(sourceAARName)
rename(sourceAARName, targetAARName)
}.group = deployTaskGroup;
}
有没有什么方法可以将上面的 targetProjDir
字符串变量显示到某种控制台或 Android Studio 中的事件日志(假设它是控制台的名称) ?