10. WHAT WE DID
Analyzed the config of an
existing job
Divided it into snippets
Created Puppet template for
each
Assembled and filled in
snippets through classes
27. AN ERROR!?
Error:Could not HEAD
'http://repo1.maven.org/maven2/org/robolectr
ic/robolectric-gradle-
plugin/0.12.0/robolectric-gradle-plugin-
0.12.0.jar'. Received status code 407 from
server: AuthorizedOnly
32. Y U ROBOLECTRIC?
“Robolectric downloads a version of Android at runtime
that's built specifically for running tests. Each API level is
~40mb, so producing a single jar file that includes everything
would be prohibitive. All of the artifacts are available on
maven central under the coordinates:
org.robolectric:android-all. You can grab the API levels from
maven central and use them with offline mode.”
https://groups.google.com/forum/#!topic/robolectric/nJgHt
dbkpi8
33. Y U ROBOLECTRIC?
Uses a custom class loader
Either:
• Download dependencies
beforehand
• Override method
• Pass through proxy
34. YOUR OWN TEST RUNNER
@Override
protected DependencyResolver getJarResolver() {
if (this.dependencyResolver == null) {
if (Boolean.getBoolean("robolectric.offline")) {
String cacheDir = System.getProperty(
"robolectric.dependency.dir", ".");
this.dependencyResolver =
new LocalDependencyResolver(
new File(cacheDir));
} else {
this.dependencyResolver = new MyResolver();
}
}
return this.dependencyResolver;
}
35. YOUR OWN RESOLVER
public class MyResolver
extends MavenDependencyResolver {
@Override
protected void configureMaven(
DependenciesTask task) {
RemoteRepository remoteRepository =
new RemoteRepository();
remoteRepository.setId("My Maven repo");
remoteRepository.setUrl(BuildConfig.NEXUS_URL);
task.addConfiguredRemoteRepository(
remoteRepository);
}
}
40. ANDROID SDK --HELP
Action "update sdk":
Updates the SDK by suggesting new platforms to install if available.
Options:
-f --force : Forces replacement of a package or its parts, even if
something has been modified.
-n --dry-mode : Simulates the update but does not download or install
anything.
--proxy-host: HTTP/HTTPS proxy host (overrides settings if defined)
-s --no-https : Uses HTTP instead of HTTPS (the default) for downloads.
-t --filter : A filter that limits the update to the specified types of
packages in the form of a comma-separated list of
[platform, system-image, tool, platform-tool, doc, sample,
source]. This also accepts the identifiers returned by
'list sdk --extended'.
-u --no-ui : Updates from command-line (does not display the GUI)
--proxy-port: HTTP/HTTPS proxy port (overrides settings if defined)
-p --obsolete : Deprecated. Please use --all instead.
-a --all : Includes all packages (such as obsolete and non-dependent
ones.)