forked from Qihoo360/RePlugin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#plugin #gradle compat provider like 4b29af3
- Loading branch information
Showing
5 changed files
with
57 additions
and
8 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/compat/ScopeCompat.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.qihoo360.replugin.gradle.compat | ||
|
||
import com.android.sdklib.IAndroidTarget | ||
|
||
/** | ||
* @author hyongbai | ||
*/ | ||
class ScopeCompat { | ||
static def getAdbExecutable(def scope) { | ||
final MetaClass scopeClz = scope.metaClass | ||
if (scopeClz.hasProperty(scope, "androidBuilder")) { | ||
return scope.androidBuilder.sdkInfo.adb | ||
} | ||
if (scopeClz.hasProperty(scope, "sdkComponents")) { | ||
return scope.sdkComponents.adbExecutableProvider.get() | ||
} | ||
} | ||
|
||
// TODO: getBuilderTarget | ||
// static def getBuilderTarget(def scope, def target){ | ||
// final MetaClass scopeClz = scope.metaClass | ||
// | ||
// if (scopeClz.hasProperty(scope, "androidBuilder")) { | ||
// return scope.getAndroidBuilder().getTarget().getPath(target) //IAndroidTarget.ANDROID_JAR | ||
// } | ||
// | ||
// return globalScope.getAndroidBuilder().getTarget().getPath(IAndroidTarget.ANDROID_JAR) | ||
// } | ||
|
||
static def getAndroidJar(def scope){ | ||
final MetaClass scopeClz = scope.metaClass | ||
|
||
if (scopeClz.hasProperty(scope, "androidBuilder")) { | ||
return scope.getAndroidBuilder().getTarget().getPath(IAndroidTarget.ANDROID_JAR) | ||
} | ||
if (scopeClz.hasProperty(scope, "sdkComponents")) { | ||
return scope.sdkComponents.androidJarProvider.get().getAbsolutePath() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f43bbbe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已在多个 gradle 和 Android build 插件的组合测试通过
组合列表
关联
提交:
4b29af3
issue: