Skip to content

Commit

Permalink
Cleanup project and dependencies (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
kageiit authored Nov 13, 2016
1 parent 66a56a3 commit 2c5cb28
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 43 deletions.
7 changes: 4 additions & 3 deletions .buckconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
android_sdk_type = AndroidSDK
jdk_name = 1.8
jdk_type = JavaSDK
default_android_manifest_path = src/main/AndroidManifest.xml

[tools]
proguard = tools/proguard.jar

[log]
max_traces = 5
compress_traces = true

[tools]
proguard = tools/proguard.jar
2 changes: 1 addition & 1 deletion .buckjavaargs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-Xms1g -Xmx8g -Xss4m
-Xmx4g
51 changes: 35 additions & 16 deletions .bucklogging.properties
Original file line number Diff line number Diff line change
@@ -1,24 +1,43 @@
# Enable the console logging handler and the file handler to
# write rotating log files under buck-out/log/buck-*.log in the
# project(s) being used.
handlers=com.facebook.buck.cli.bootstrapper.ConsoleHandler,com.facebook.buck.cli.bootstrapper.CompressingFileHandler
.level=FINE

# Log to buck-out/log/buck-*log.gz
com.facebook.buck.log.CompressingFileHandler.pattern=buck-out/log/buck-%g.log.gz
# Enable console logging handler and file handler to write rotating log files under
# buck-out/log/buck-*.log in the project(s) being used.
handlers=com.facebook.buck.cli.bootstrapper.ConsoleHandler,com.facebook.buck.cli.bootstrapper.LogFileHandler,com.facebook.buck.cli.bootstrapper.MemoryHandler,java.util.logging.FileHandler

# Write to disk all log messages not otherwise filtered by the top-level ".level"
# property.
com.facebook.buck.log.CompressingFileHandler.level=ALL
# We handle console events via the event bus, so disable console logging by default.
com.facebook.buck.log.ConsoleHandler.level=SEVERE

# Ignore the environment and always write UTF-8 to files.
com.facebook.buck.log.CompressingFileHandler.encoding=UTF-8
# http client is way too chatty at FINER level.
httpclient.wire.content.level=SEVERE
httpclient.wire.header.level=SEVERE

# Replace the default fugly multiline log formatter with a custom one.
com.facebook.buck.log.CompressingFileHandler.formatter=com.facebook.buck.cli.bootstrapper.LogFormatter
# Log to buck-out/log/buck-*.log.
java.util.logging.FileHandler.pattern=buck-out/log/buck-%g.log

# Write to disk all log messages not otherwise filtered by the top-level ".level" property.
java.util.logging.FileHandler.level=ALL

# Rotate up to this many log files, then start deleting the oldest one.
com.facebook.buck.log.CompressingFileHandler.count=5
java.util.logging.FileHandler.count=5

# Replace the default fugly multiline log formatter with a custom one.
java.util.logging.FileHandler.formatter=com.facebook.buck.cli.bootstrapper.LogFormatter

# Ignore the environment and always write UTF-8 to files.
java.util.logging.FileHandler.encoding=UTF-8

# Use a circular buffer to store high granularity logging in memory, only interesting if we hit
# an error.
com.facebook.buck.log.memory.MemoryHandler.level=ALL

# Define the buffer size.
com.facebook.buck.log.memory.MemoryHandler.size=100

# Define the push level.
com.facebook.buck.log.memory.MemoryHandler.push=SEVERE

# Max size in bytes all logs will take.
com.facebook.buck.log.LogFileHandler.max_size_bytes=100000

# This limits the log directories
# Max number of logs preserved in disk.
com.facebook.buck.log.LogFileHandler.count=5
com.facebook.buck.log.LogFileHandler.max_size_bytes=1000000
2 changes: 1 addition & 1 deletion .buckversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ec12e586dfcd9bbd4be7343b4b179bf119025f81
0ba2b70d8eca58c704db10332306a29fd1dfddd4
14 changes: 5 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,17 @@ android:
- google-gdk-license-.+

before_script:
- export PATH=$PATH:$HOME/.gradle/caches/okbuck/buck/bin
- export SKIP_OKBUCK=true
- echo no | android create avd --force -n test -t android-18 --abi armeabi-v7a
- emulator -avd test -no-audio -no-window &

script:
- ./buckw --version
- export OKBUCK_PROJECT_ROOT=`pwd`
- mv buildSrc notBuildSrc
- buck query "kind('android_binary', '//...')" | xargs buck build
- buck test --include unit
- buck query "filter('lint_*', kind('genrule', '//...'))" | xargs buck build
- SKIP_OKBUCK= ./buckw --version
- ./buckw targets --type android_binary java_test robolectric_test genrule | xargs ./buckw build
- ./buckw test --include unit
- android-wait-for-emulator
- adb shell input keyevent 82
- buck test //app:instrumentation_demoDebug_test
- mv notBuildSrc buildSrc
- ./buckw test //app:instrumentation_demoDebug_test

notifications:
email: false
Expand Down
10 changes: 7 additions & 3 deletions buckw
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
##
## Buck wrapper script to invoke okbuck when needed, before running buck
##
## Created by OkBuck Gradle Plugin on : Sat Nov 12 23:17:14 PST 2016
## Created by OkBuck Gradle Plugin on : Sat Nov 12 23:41:18 PST 2016
##
#########################################################################

Expand Down Expand Up @@ -189,7 +189,11 @@ setupBuckBinary ( ) {
# Run tasks before buck command
setupBuckRun ( ) {
if [[ ! -f "$OKBUCK_SUCCESS" ]] || [[ ! -d "$OKBUCK_DIR" ]]; then
if [[ ! -z "$SKIP_OKBUCK" ]]; then
:
elif [[ ! -z "$FORCE_OKBUCK" ]]; then
runOkBuck
elif [[ ! -f "$OKBUCK_SUCCESS" ]] || [[ ! -d "$OKBUCK_DIR" ]]; then
warn "NO PREVIOUS SUCCESSFUL OKBUCK RUN"
if [[ ! -z "$INSTALLED_WATCHMAN" ]]; then
getChanges # Prevent watchman from running after this run, since changes would already be accounted for
Expand All @@ -211,4 +215,4 @@ setupBuckRun ( ) {
setupBuckRun
# Invoke buck binary with arguments
exec env OKBUCK_PROJECT_ROOT="$WORKING_DIR" "$BUCK_BINARY" "$@"
exec "$BUCK_BINARY" "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class OkBuckGradlePlugin implements Plugin<Project> {
okBuckClean.setDescription("Delete configuration files generated by OkBuck")

okBuck.dependsOn(okBuckClean)
okBuck << {
okBuck.doLast {
generate(project)
}

Expand All @@ -83,7 +83,7 @@ class OkBuckGradlePlugin implements Plugin<Project> {
fetchRobolectricRuntimeDeps.mustRunAfter(okBuckClean)
fetchRobolectricRuntimeDeps.setDescription("Fetches runtime dependencies for robolectric")

fetchRobolectricRuntimeDeps << {
fetchRobolectricRuntimeDeps.doLast {
RobolectricUtil.download(project)
}
}
Expand All @@ -106,7 +106,7 @@ class OkBuckGradlePlugin implements Plugin<Project> {
Task fetchLintDeps = project.task('fetchLintDeps')
okBuck.dependsOn(fetchLintDeps)
fetchLintDeps.mustRunAfter(okBuckClean)
fetchLintDeps << {
fetchLintDeps.doLast {
LintUtil.fetchLintDeps(project, lint.version)
}
}
Expand All @@ -115,7 +115,7 @@ class OkBuckGradlePlugin implements Plugin<Project> {
Task fetchRetrolambdaDeps = project.task('fetchRetrolambdaDeps')
okBuck.dependsOn(fetchRetrolambdaDeps)
fetchRetrolambdaDeps.mustRunAfter(okBuckClean)
fetchRetrolambdaDeps << {
fetchRetrolambdaDeps.doLast {
RetrolambdaUtil.fetchRetrolambdaDeps(project, retrolambda)
okbuck.buckProjects.each { Project buckProject ->
RetrolambdaUtil.createRetrolambdac(buckProject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class LintUtil {

static final String LINT_DEPS_CONFIG = "${OkBuckGradlePlugin.BUCK_LINT}_deps"
static final String LINT_DEPS_CACHE = "${OkBuckGradlePlugin.DEFAULT_CACHE_PATH}/lint"
static final String LINT_VERSION_FILE = "${LINT_DEPS_CACHE}/.lintVersion"
static final String LINT_DEPS_RULE = "//${LINT_DEPS_CACHE}:okbuck_lint"
static final String LINT_DEPS_BUCK_FILE = "lint/BUCK_FILE"

Expand All @@ -42,6 +43,14 @@ class LintUtil {
throw new IllegalStateException("Invalid lint jar version: ${version}")
}

// Invalidate lint deps when versions change
File lintVersionFile = project.file(LINT_VERSION_FILE)
if (!lintVersionFile.exists() || lintVersionFile.text != version) {
FileUtils.deleteDirectory(lintVersionFile.parentFile)
lintVersionFile.parentFile.mkdirs()
lintVersionFile.text = version
}

project.configurations.maybeCreate(LINT_DEPS_CONFIG)
project.dependencies {
"${LINT_DEPS_CONFIG}" "${LINT_GROUP}:${LINT_MODULE}:${version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ setupBuckBinary ( ) {
# Run tasks before buck command
setupBuckRun ( ) {
if [[ ! -f "$OKBUCK_SUCCESS" ]] || [[ ! -d "$OKBUCK_DIR" ]]; then
if [[ ! -z "$SKIP_OKBUCK" ]]; then
:
elif [[ ! -z "$FORCE_OKBUCK" ]]; then
runOkBuck
elif [[ ! -f "$OKBUCK_SUCCESS" ]] || [[ ! -d "$OKBUCK_DIR" ]]; then
warn "NO PREVIOUS SUCCESSFUL OKBUCK RUN"
if [[ ! -z "$INSTALLED_WATCHMAN" ]]; then
getChanges # Prevent watchman from running after this run, since changes would already be accounted for
Expand All @@ -204,4 +208,4 @@ setupBuckRun ( ) {
setupBuckRun
# Invoke buck binary with arguments
exec env OKBUCK_PROJECT_ROOT="$WORKING_DIR" "$BUCK_BINARY" "$@"
exec "$BUCK_BINARY" "$@"
8 changes: 4 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def versions = [
butterKnifeVersion: '8.4.0',
daggerVersion : '2.7',
leakCanaryVersion : '1.4',
leakCanaryVersion : '1.5',
supportVersion : '24.1.1',
]

Expand All @@ -21,8 +21,8 @@ def buildConfig = [
]

def apt = [
autoValue : 'com.google.auto.value:auto-value:1.3-rc2',
autoValueGson : 'com.ryanharter.auto.value:auto-value-gson:0.4.2',
autoValue : 'com.google.auto.value:auto-value:1.4-rc1',
autoValueGson : 'com.ryanharter.auto.value:auto-value-gson:0.4.4',
butterKnifeCompiler: "com.jakewharton:butterknife-compiler:${versions.butterKnifeVersion}",
daggerCompiler : "com.google.dagger:dagger-compiler:${versions.daggerVersion}",
javax : 'org.glassfish:javax.annotation:10.0-b28',
Expand All @@ -31,7 +31,7 @@ def apt = [
def external = [
butterKnife : "com.jakewharton:butterknife:${versions.butterKnifeVersion}",
dagger : "com.google.dagger:dagger:${versions.daggerVersion}",
gson : 'com.google.code.gson:gson:2.7',
gson : 'com.google.code.gson:gson:2.8.0',
leakCanary : "com.squareup.leakcanary:leakcanary-android:${versions.leakCanaryVersion}",
rxandroid : 'io.reactivex:rxandroid:1.2.1',
rxjava : 'io.reactivex:rxjava:1.1.8',
Expand Down
Binary file modified tools/proguard.jar
Binary file not shown.

0 comments on commit 2c5cb28

Please sign in to comment.