Skip to content

Instantly share code, notes, and snippets.

View stepango's full-sized avatar
👁️
Making devs happier with Bazel

Stepan Goncharov stepango

👁️
Making devs happier with Bazel
View GitHub Profile
-- Layout Switch
ctrlPressed = false
keyPressed = false
eventTypes = hs.eventtap.event.types
events = { eventTypes.flagsChanged, eventTypes.keyUp }
function indexOf(table, value)
local index = -1
for i = 1, #table do
@stepango
stepango / build.gradle
Created October 14, 2019 01:05
KAPT options
subprojects {
afterEvaluate {
if (project.hasProperty('kapt')) kapt {
javacOptions {
option("-source", "8")
option("-target", "8")
}
}
}
}
@stepango
stepango / error.log
Created October 14, 2019 00:55
Java 11 KAPT error
> Task :app:compileDebugJavaWithJavac FAILED
/Users/stepango/AndroidStudioProjects/Java11/app/build/generated/source/kapt/debug/com/stepango/java11/di/DaggerRootComponent.java:4: error: package javax.annotation.processing does not exist
import javax.annotation.processing.Generated;
^
/Users/stepango/AndroidStudioProjects/Java11/app/build/generated/source/kapt/debug/com/stepango/java11/di/DaggerRootComponent.java:6: error: cannot find symbol
@Generated(
^
symbol: class Generated
2 errors
@stepango
stepango / RootComponent.kt
Created October 13, 2019 09:15
Simple Dagger Root Component
import dagger.Component
@Component
interface RootComponent {
fun inject(app: MainActivity)
}
@stepango
stepango / git_diff.sh
Created October 2, 2019 03:50
Git diff between master and current branch
git diff $(git merge-base master $(git rev-parse --abbrev-ref HEAD))
@stepango
stepango / rfinder.py
Created October 2, 2019 02:22
Find all empty R.java files
import os
path = os.path.dirname(os.path.realpath(__file__))
pattern = """public final class R {
private R() {}
}"""
# r=root, d=directories, f = files
@stepango
stepango / build.gradle
Created September 21, 2019 10:46
Call Bazel from Gradle
apply plugin: 'java'
buildDir = "gradleBuild"
def buildBazel = tasks.register("buildBazel", Exec) {
finalizedBy(tasks.named("compileJava"))
workingDir '../'
commandLine 'bazel', 'build', '//' + project.name + ":bali"
}
@stepango
stepango / rmbuild.sh
Created November 17, 2018 08:51
Remove all build folders
rm -rf `find . -type d -name build`
@stepango
stepango / ObservableFields.kt
Created July 19, 2018 08:43
Observable fields mapping
val nameText = ObservableBoolean(nameHint) { it.isEmpty() }
fun <T: Any> ObservableBoolean(o: ObservableField<T>, f:(T) -> Boolean): ObservableBoolean {
return ObservableBoolean()
.apply {
o.observe {
this.set(f(it!!))
}
}
}
@stepango
stepango / build.gradle
Last active June 23, 2018 08:15
Alternative build dir
// your_project_folder/build.gradle
allprojects {
if (new File("your_ram_disk_path").exists())
buildDir = "your_ram_disk_path/build/${rootProject.name}/${project.name}"
}