aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java
diff options
context:
space:
mode:
authorGravatar laszlocsomor <laszlocsomor@google.com>2017-08-04 12:56:42 +0200
committerGravatar Dmitry Lomov <dslomov@google.com>2017-08-04 17:19:09 +0200
commit025a7b0a33680c53d872d241fdb49f3ab578afd6 (patch)
treecfcca497c74f25361537a038a4c898b26a7af39e /src/test/java
parent8879b48fa1f8f5bdc39321e31b02323b9f9dd86a (diff)
Android BusyBox: deprecate --libraries flag
Deprecate the --libraries flag of the GENERATE_BINARY_R tool in favour of --library. The new flag is multi-value and uses "," as the pair-separator instead of ":". The value converter still supports ":"-separated pairs as well, but looks for "," first. Old format: --libraries=key1:value1,key2:value2,... New format: --library=key1,value1 --library=key2,value2 Motivation: - the ":"-separator prevents using absolute paths on Windows The old flag is still supported, but will be removed after 2018-02-28 (about 6 months from now). Also in this commit: - add a new method to CustomCommandLine.Builder to lazily construct the command line for the --library flag See https://github.com/bazelbuild/bazel/issues/3264 RELNOTES: none PiperOrigin-RevId: 164246506
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/google/devtools/build/android/ConvertersTest.java8
-rw-r--r--src/test/java/com/google/devtools/build/android/RClassGeneratorActionTest.java56
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java4
3 files changed, 27 insertions, 41 deletions
diff --git a/src/test/java/com/google/devtools/build/android/ConvertersTest.java b/src/test/java/com/google/devtools/build/android/ConvertersTest.java
index 937435da67..4e8f7058c1 100644
--- a/src/test/java/com/google/devtools/build/android/ConvertersTest.java
+++ b/src/test/java/com/google/devtools/build/android/ConvertersTest.java
@@ -21,10 +21,8 @@ import com.google.devtools.build.android.Converters.PathConverter;
import com.google.devtools.build.android.Converters.PathListConverter;
import com.google.devtools.build.android.Converters.StringDictionaryConverter;
import com.google.devtools.common.options.OptionsParsingException;
-import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.List;
import java.util.Map;
import org.junit.Rule;
import org.junit.Test;
@@ -39,8 +37,6 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public final class ConvertersTest {
- private static final String SEPARATOR = File.pathSeparator;
-
@Rule public final TemporaryFolder tmp = new TemporaryFolder();
@Rule
@@ -89,9 +85,7 @@ public final class ConvertersTest {
@Test
public void testPathListConverter() throws Exception {
PathListConverter converter = new PathListConverter();
- List<Path> result =
- converter.convert("foo" + SEPARATOR + "bar" + SEPARATOR + SEPARATOR + "baz" + SEPARATOR);
- assertThat(result)
+ assertThat(converter.convert("foo:bar::baz:"))
.containsAllOf(Paths.get("foo"), Paths.get("bar"), Paths.get("baz"))
.inOrder();
}
diff --git a/src/test/java/com/google/devtools/build/android/RClassGeneratorActionTest.java b/src/test/java/com/google/devtools/build/android/RClassGeneratorActionTest.java
index e18f466060..e03348cdaa 100644
--- a/src/test/java/com/google/devtools/build/android/RClassGeneratorActionTest.java
+++ b/src/test/java/com/google/devtools/build/android/RClassGeneratorActionTest.java
@@ -19,7 +19,6 @@ import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
-import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@@ -111,20 +110,16 @@ public class RClassGeneratorActionTest {
RClassGeneratorAction.main(
ImmutableList.<String>of(
- "--primaryRTxt",
- binarySymbols.toString(),
- "--primaryManifest",
- binaryManifest.toString(),
- "--libraries",
- libFooSymbols
- + File.pathSeparator
- + libFooManifest
- + ","
- + libBarSymbols
- + File.pathSeparator
- + libBarManifest,
- "--classJarOutput",
- jarPath.toString())
+ "--primaryRTxt",
+ binarySymbols.toString(),
+ "--primaryManifest",
+ binaryManifest.toString(),
+ "--library",
+ libFooSymbols + "," + libFooManifest,
+ "--library",
+ libBarSymbols + "," + libBarManifest,
+ "--classJarOutput",
+ jarPath.toString())
.toArray(new String[0]));
assertThat(Files.exists(jarPath)).isTrue();
@@ -171,14 +166,10 @@ public class RClassGeneratorActionTest {
RClassGeneratorAction.main(
ImmutableList.<String>of(
- "--libraries",
- libFooSymbols
- + File.pathSeparator
- + libFooManifest
- + ","
- + libBarSymbols
- + File.pathSeparator
- + libBarManifest,
+ "--library",
+ libFooSymbols + "," + libFooManifest,
+ "--library",
+ libBarSymbols + "," + libBarManifest,
"--classJarOutput",
jarPath.toString())
.toArray(new String[0]));
@@ -281,15 +272,16 @@ public class RClassGeneratorActionTest {
Path jarPath = tempDir.resolve("app_resources.jar");
RClassGeneratorAction.main(
ImmutableList.<String>of(
- "--primaryRTxt",
- binarySymbols.toString(),
- "--primaryManifest",
- binaryManifest.toString(),
- "--packageForR", "com.custom.er",
- "--libraries",
- libFooSymbols + File.pathSeparator + libFooManifest,
- "--classJarOutput",
- jarPath.toString())
+ "--primaryRTxt",
+ binarySymbols.toString(),
+ "--primaryManifest",
+ binaryManifest.toString(),
+ "--packageForR",
+ "com.custom.er",
+ "--library",
+ libFooSymbols + "," + libFooManifest,
+ "--classJarOutput",
+ jarPath.toString())
.toArray(new String[0]));
assertThat(Files.exists(jarPath)).isTrue();
diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java
index 62c5057d8e..f305c3efa1 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java
@@ -1810,7 +1810,7 @@ public class AndroidBinaryTest extends AndroidBuildViewTestCase {
assertThat(compilerAction.getMnemonic()).isEqualTo("RClassGenerator");
List<String> args = compilerAction.getArguments();
assertThat(args)
- .containsAllOf("--primaryRTxt", "--primaryManifest", "--libraries", "--classJarOutput");
+ .containsAllOf("--primaryRTxt", "--primaryManifest", "--library", "--classJarOutput");
}
@Test
@@ -1853,7 +1853,7 @@ public class AndroidBinaryTest extends AndroidBuildViewTestCase {
assertThat(compilerAction.getMnemonic()).isEqualTo("RClassGenerator");
List<String> args = compilerAction.getArguments();
assertThat(args)
- .containsAllOf("--primaryRTxt", "--primaryManifest", "--libraries", "--classJarOutput",
+ .containsAllOf("--primaryRTxt", "--primaryManifest", "--library", "--classJarOutput",
"--packageForR", "com.binary.custom");
}