Skip to content

Commit

Permalink
Merge branch 'hotfix/0.1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelRocks committed Apr 24, 2017
2 parents 04a7fc1 + a80735d commit 4a4eb0f
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buildscript {
}
dependencies {
classpath 'io.michaelrocks:paranoid-gradle-plugin:0.1.3'
classpath 'io.michaelrocks:paranoid-gradle-plugin:0.1.4'
}
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Jan 21 21:16:53 MSK 2017
#Mon Apr 24 20:52:24 MSK 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
22 changes: 15 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

##############################################################################
##
Expand Down Expand Up @@ -154,11 +154,19 @@ if $cygwin ; then
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save ( ) {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
6 changes: 0 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ goto fail
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
Expand All @@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ class Generator(private val stringRegistry: StringRegistry) {
logger.error(
"Compilation error: {}:{}:{}: {}", it.source.name, it.lineNumber, it.columnNumber, it.getMessage(null))
}

val message = diagnostics.diagnostics.joinToString(separator = "\n", prefix = "Compilation error:\n") {
"%s:%d:%d: %s".format(it.source.name, it.lineNumber, it.columnNumber, it.getMessage(null))
}
throw ParanoidException(message)
}
} catch (exception: Exception) {
logger.error("Compilation error", exception)
throw ParanoidException("Compilation error", exception)
}
}

Expand All @@ -87,7 +93,7 @@ class Generator(private val stringRegistry: StringRegistry) {
appendln()
appendln("public class $className {")
appendln(" private static final char[] chars = new char[] {")
indexesByChar.keys.joinTo(this, prefix = " ", postfix = "\n") { "'\\u%04x'".format(it.toShort()) }
indexesByChar.keys.joinTo(this, prefix = " ", postfix = "\n") { it.toLiteral() }
appendln(" };")
appendln(" private static final short[][] indexes = new short[][] {")
strings
Expand All @@ -109,4 +115,13 @@ class Generator(private val stringRegistry: StringRegistry) {
appendln("}")
}
}

// https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.10.4
private fun Char.toLiteral(): String {
return when (this) {
'\n' -> "'\\n'"
'\r' -> "'\\r'"
else -> "'\\u%04x'".format(toShort())
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2017 Michael Rozumyanskiy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.michaelrocks.paranoid.processor

class ParanoidException : Exception {
constructor() : super()
constructor(message: String?) : super(message)
constructor(message: String?, cause: Throwable?) : super(message, cause)
constructor(cause: Throwable?) : super(cause)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

@Obfuscate
public class MainActivity extends AppCompatActivity {
private static final String QUESTION = "Q: %s";
private static final String ANSWER = "A: %s";
private static final String QUESTION = "Q:\r\n%s";
private static final String ANSWER = "A:\r\n%s";

@Override
protected void onCreate(final Bundle savedInstanceState) {
Expand Down
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version.major=0
version.minor=1
version.patch=3
version.patch=4
version.snapshot=false

version.dryRun=false
Expand Down

0 comments on commit 4a4eb0f

Please sign in to comment.