Skip to content

Instantly share code, notes, and snippets.

Christian Williams xian

Block or report user

Report or block xian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@xian
xian / gist:730793
Created Dec 6, 2010
Android: include build number and date
View gist:730793
<property environment="env"/>
<condition property="build.number" value="${env.BUILD_NUMBER}" else="unknown">
<isset property="env.BUILD_NUMBER"/>
</condition>
<exec command="date" outputproperty="build.date"/>
<target name="update-buildinfo">
<echo>updating build number and date to ${build.number} and ${build.date}</echo>
<echo file="res/values/buildinfo.xml"
@xian
xian / 00_README.md
Last active Dec 14, 2015 — forked from JakeWharton/ActionBarSherlockRobolectric.java
Here's the magic to get ActionBarSherlock working with Robolectric 2.0-alpha-2!
View 00_README.md

You need to add the files below, and do this once in your base test runner:

ActionBarSherlock.registerImplementation(ActionBarSherlockRobolectric.class);
ActionBarSherlock.unregisterImplementation(ActionBarSherlockNative.class);
ActionBarSherlock.unregisterImplementation(ActionBarSherlockCompat.class);
View Capture Android log messages in tests with Robolectric
package com.pivotallabs;
import android.util.Log;
import com.xtremelabs.robolectric.Robolectric;
import com.xtremelabs.robolectric.RobolectricTestRunner;
import com.xtremelabs.robolectric.util.Implements;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(RobolectricTestRunner.class)
View gist:eaf2746737ecb7f213eb1f219d1158ef
[17:54:09] :integration_tests:androidx:lint (3s)
[17:54:12] [:integration_tests:androidx:lint]
[17:54:12] [:integration_tests:androidx:lint] FAILURE: Build failed with an exception.
[17:54:12] [:integration_tests:androidx:lint]
[17:54:12] [:integration_tests:androidx:lint] * What went wrong:
[17:54:12] [:integration_tests:androidx:lint] Execution failed for task ':integration_tests:androidx:lint'.
[17:54:12] [:integration_tests:androidx:lint] > Lint found errors in the project; aborting build.
[17:54:12]
[17:54:12] Fix the issues identified by lint, or add the following to your build script to proceed with errors:
[17:54:12] ...
View Robolectric_Build_437.log
[13:36:08] : [Step 1/1] :shadowapi:testClasses
[13:36:09] : [Step 1/1]
[13:36:09] : [Step 1/1] > Task :shadowapi:test
[13:36:09] : [Step 1/1] :shadowapi:test
[13:36:09] : [:shadowapi:test] Running tests with [-Drobolectric.enabledSdks=28]
[13:36:09] : [Step 1/1] org.robolectric.util.ReflectionHelpersTest
[13:36:09] : [org.robolectric.util.ReflectionHelpersTest] org.robolectric.util.ReflectionHelpersTest.getFieldReflectively_getsInheritedFields
[13:36:09] : [org.robolectric.util.ReflectionHelpersTest] org.robolectric.util.ReflectionHelpersTest.callStaticMethodReflectively_rethrowsUncheckedException
[13:36:09] : [org.robolectric.util.ReflectionHelpersTest] org.robolectric.util.ReflectionHelpersTest.callConstructorReflectively_rethrowsError
[13:36:09] : [org.robolectric.util.ReflectionHelpersTest] org.robolectric.util.ReflectionHelpersTest.setFieldReflectively_givesHelpfulExceptions
View Robolectric_Build_23.log
This file has been truncated, but you can view the full file.
Build 'Robolectric / Build' #23, branch 'fix-windows'
Started 2019-02-26 11:33:51 on 'Mobile-DevX-Lab-Windows' by 'Super user ()'
Finished 2019-02-26 11:42:25 with status FAILURE 'Tests passed: 4492, ignored: 31; gradle exception (new); exit code 1 (Step: Gradle)'
VCS revisions: 'git://github.com/robolectric/robolectric.git#refs/heads/master' (Git): 239a84240d9fd62c79d72d51f3d00ae1a0c46434 (branch 'refs/heads/fix-windows')
TeamCity URL http://dhcp-100-91-62-136.sfo.corp.google.com/viewLog.html?buildId=26&buildTypeId=Robolectric_Build
TeamCity server version is 2018.2.2 (build 61245), server timezone: PST (UTC-08:00)
[11:33:50]E: bt1 (8m:35s)
[11:33:50]i: TeamCity server version is 2018.2.2 (build 61245)
View Kevmo.kt
import kotlin.math.PI
// declarations
interface ThingWithMass {
fun weightInKilograms(): Double
}
// create a class
open class Animal(var age: Int)
View ShaderExample.kt
package baaahs.shaders
import org.joml.Matrix4f
import org.joml.Quaternionf
import org.lwjgl.BufferUtils
import org.lwjgl.glfw.GLFW.*
import org.lwjgl.glfw.GLFWErrorCallback
import org.lwjgl.glfw.GLFWFramebufferSizeCallback
import org.lwjgl.glfw.GLFWKeyCallback
import org.lwjgl.opengl.GL
View GlslBase.kt
package baaahs.glsl
import baaahs.*
import baaahs.geom.Vector2F
import baaahs.shows.GlslShow
import org.joml.Matrix4f
import org.lwjgl.BufferUtils
import org.lwjgl.glfw.GLFW.*
import org.lwjgl.glfw.GLFWErrorCallback
import org.lwjgl.glfw.GLFWFramebufferSizeCallback
View GlslBase.kt
package baaahs.glsl
import baaahs.*
import baaahs.geom.Vector2F
import baaahs.shows.GlslShow
import org.joml.Matrix4f
import org.lwjgl.BufferUtils
import org.lwjgl.glfw.GLFW.*
import org.lwjgl.glfw.GLFWErrorCallback
import org.lwjgl.glfw.GLFWFramebufferSizeCallback
You can’t perform that action at this time.