Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 16 deletions.
26 changes: 20 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,39 @@ jdk:

env:
global:
- NDK_VERSION=r11c
# - ANDROID_API_LEVEL=26
# - ANDROID_EMU_API_LEVEL=24
# - ANDROID_BUILD_TOOLS_VERSION=26.0.1
# - ANDROID_ABI=armeabi-v7a
- ANDROID_API_LEVEL=26
- ANDROID_BUILD_TOOLS_VERSION=26.0.1
- ANDROID_ABI=armeabi-v7a
- NDK_VERSION=r18b
- ANDROID_NDK_HOME=$HOME/android-ndk-$NDK_VERSION
- QEMU_AUDIO_DRV=none # Remove audio
cache:
directories:
- $HOME/.m2/repository
- $HOME/.sbt
- $HOME/.ivy2
android:
components:
- sys-img-armeabi-v7a-android-24
- tools # to get the new `repository-11.xml`
- platform-tools
- build-tools-26.0.1
- android-24
- tools
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
# - android-$ANDROID_API_LEVEL
# - android-$ANDROID_EMU_API_LEVEL
# - sys-img-$ANDROID_ABI-android-$ANDROID_API_LEVEL
# - sys-img-$ANDROID_ABI-android-$ANDROID_EMU_API_LEVEL
- android-25
- sys-img-armeabi-v7a-google_apis-25
- extra
before_script:
# Emulator Management: Create, Start and Wait
- echo no | android create avd --force -n test -t android-24 --abi armeabi-v7a
- emulator -avd test -no-audio -no-window &
# - echo no | android create avd --force -n test -t android-$ANDROID_EMU_API_LEVEL --abi $ANDROID_ABI
- echo no | android create avd --force -n test -t android-25 --abi google_apis/armeabi-v7a
- emulator -avd test -no-window &
# install & cache NDK
- curl https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-linux-x86_64.zip -z ${ANDROID_NDK_HOME}/ndk-build -o $HOME/ndk-${NDK_VERSION}.zip
- (unzip -q $HOME/ndk-$NDK_VERSION.zip -d $HOME; true)
Expand Down
25 changes: 19 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@ val pluginVersion = "1.8.0-SNAPSHOT"
val gradleBuildVersion = "1.4.0-SNAPSHOT"

val androidToolsVersion = "2.3.0"
val gradleToolingApi = "2.6"

resolvers ++= Seq(
"Google's Maven repository" at "https://dl.google.com/dl/android/maven2/"
)

// gradle-plugin and gradle-model projects
val model = project.in(file("gradle-model")).settings(
name := "gradle-discovery-model",
organization := "com.hanhuy.gradle",
resolvers += Resolver.jcenterRepo,
resolvers ++= Seq(
"Google's Maven repository" at "https://dl.google.com/dl/android/maven2/",
"Gradle Releases Repository" at "https://repo.gradle.org/gradle/libs-releases-local/"
),
javacOptions ++= "-source" :: "1.6" :: "-target" :: "1.6" :: Nil,
autoScalaLibrary := false,
crossPaths := false,
libraryDependencies ++=
"com.android.tools.build" % "builder-model" % androidToolsVersion ::
"org.gradle" % "gradle-tooling-api" % "2.6" % "provided" :: Nil
"org.gradle" % "gradle-tooling-api" % gradleToolingApi % "provided" :: Nil
)

val gradle = project.in(file("gradle-plugin")).settings(
Expand All @@ -24,7 +32,10 @@ val gradle = project.in(file("gradle-plugin")).settings(
bintrayRepository in bintray := "maven",
organization := "com.hanhuy.gradle",
bintrayOrganization in bintray := None,
resolvers += Resolver.jcenterRepo,
resolvers ++= Seq(
"Google's Maven repository" at "https://dl.google.com/dl/android/maven2/",
"Gradle Releases Repository" at "https://repo.gradle.org/gradle/libs-releases-local/"
),
publishMavenStyle := true,
autoScalaLibrary := false,
crossPaths := false,
Expand All @@ -41,14 +52,16 @@ val gradle = project.in(file("gradle-plugin")).settings(
"org.codehaus.groovy" % "groovy" % "2.4.4" % "provided" ::
"com.android.tools.build" % "gradle" % androidToolsVersion ::
"com.android.tools.build" % "builder-model" % androidToolsVersion ::
"org.gradle" % "gradle-tooling-api" % "2.6" % "provided" ::
"org.gradle" % "gradle-tooling-api" % gradleToolingApi % "provided" ::
"javax.inject" % "javax.inject" % "1" % "provided" ::
Nil
).dependsOn(model % "compile-internal")

val gradlebuild = project.in(file("gradle-build")).enablePlugins(BuildInfoPlugin).settings(
version := gradleBuildVersion,
resolvers += Resolver.jcenterRepo,
resolvers ++= Seq(
"Gradle Releases Repository" at "https://repo.gradle.org/gradle/libs-releases-local/"
),
mappings in (Compile, packageBin) ++=
(mappings in (Compile, packageBin) in model).value,
name := "sbt-android-gradle",
Expand All @@ -57,7 +70,7 @@ val gradlebuild = project.in(file("gradle-build")).enablePlugins(BuildInfoPlugin
libraryDependencies ++= Seq(
"com.hanhuy.sbt" %% "bintray-update-checker" % "0.2",
"com.google.code.findbugs" % "jsr305" % "3.0.1" % "compile-internal",
"org.gradle" % "gradle-tooling-api" % "2.6" % "provided",
"org.gradle" % "gradle-tooling-api" % gradleToolingApi % "provided",
"org.slf4j" % "slf4j-api" % "1.7.10" // required by gradle-tooling-api
),
// embed gradle-tooling-api jar in plugin since they don't publish on central
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.hanhuy.gradle.discovery;

import com.android.build.gradle.BaseExtension;
import com.android.builder.model.AndroidProject;
import com.android.builder.model.PackagingOptions;
import org.gradle.api.Plugin;
Expand All @@ -14,7 +13,6 @@

import javax.inject.Inject;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
import java.util.ArrayList;
Expand Down Expand Up @@ -121,20 +119,23 @@ public static class PO implements PackagingOptions, Serializable {
private final Set<String> excludes;
private final Set<String> firsts;
private final Set<String> merges;
private final Set<String> nostrip;
@SuppressWarnings("unchecked")
public PO(Object extension) {
Set<String> e = Collections.EMPTY_SET, f = Collections.EMPTY_SET, m = Collections.EMPTY_SET;
Set<String> e = Collections.EMPTY_SET, f = Collections.EMPTY_SET, m = Collections.EMPTY_SET, ns = Collections.EMPTY_SET;
try {
Object po = findMethod(extension, "getPackagingOptions").invoke(extension);
e = (Set<String>) findMethod(po, "getExcludes").invoke(po);
f = (Set<String>) findMethod(po, "getPickFirsts").invoke(po);
m = (Set<String>) findMethod(po, "getMerges").invoke(po);
ns = (Set<String>) findMethod(po, "getDoNotStrip").invoke(po);
} catch (Exception x) {
// noop
}
excludes = e;
firsts = f;
merges = m;
nostrip = ns;

}
@Override
Expand All @@ -151,6 +152,11 @@ public Set<String> getPickFirsts() {
public Set<String> getMerges() {
return merges;
}

@Override
public Set<String> getDoNotStrip() {
return nostrip;
}
}
public static class AndroidDiscovery implements Serializable, AndroidDiscoveryModel {
public final boolean hasApplicationPlugin;
Expand Down
2 changes: 1 addition & 1 deletion resources/tr.scala.template
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object TR {

trait TypedFindView extends Any {
protected %6$s
final def findView[A](tr: TypedResource[A]): A = %11$s
final def findView[A <: View](tr: TypedResource[A]): A = %11$s
}

object TypedResource {
Expand Down

0 comments on commit 5b1f703

Please sign in to comment.