diff options
author | 2015-07-17 09:14:58 +0000 | |
---|---|---|
committer | 2015-07-17 13:18:06 +0000 | |
commit | 582c162c17d8f7ddbb96eda87a8c19254a34dda8 (patch) | |
tree | 09c47d6b8c05bdee2a8c52af069030a57e3eb3b3 /src/main/java/com/google/devtools | |
parent | ee8fcd312eef51d2558c940f00d6381af0d52dff (diff) |
Make android_ndk_repository work on case-insensitive OS X file systems by not creating a BUILD file next to the build/ directory of the NDK.
Fixes #297.
Note that a directory called build/ or BUILD/ is not taken as the root of a package (it must be a file).
Also drive-by fix the fallout from the recent changes to how Jack/Jill is handled.
--
MOS_MIGRATED_REVID=98476274
Diffstat (limited to 'src/main/java/com/google/devtools')
8 files changed, 56 insertions, 33 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/NewLocalRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/NewLocalRepositoryFunction.java index 6cd887f954..be3b40bc39 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/NewLocalRepositoryFunction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/NewLocalRepositoryFunction.java @@ -47,7 +47,9 @@ public class NewLocalRepositoryFunction extends RepositoryFunction { // Link x/y/z to /some/path/to/y/z. if (!symlinkLocalRepositoryContents( - directoryValue, getOutputBase().getFileSystem().getPath(pathFragment), env)) { + directoryValue.realRootedPath().asPath(), + getOutputBase().getFileSystem().getPath(pathFragment), + env)) { return null; } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryFunction.java index 8aa0160813..bc4d523aed 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryFunction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryFunction.java @@ -203,12 +203,12 @@ public abstract class RepositoryFunction implements SkyFunction { * </pre> */ public static boolean symlinkLocalRepositoryContents( - FileValue repositoryDirectory, Path targetDirectory, Environment env) + Path repositoryDirectory, Path targetDirectory, Environment env) throws RepositoryFunctionException { try { for (Path target : targetDirectory.getDirectoryEntries()) { Path symlinkPath = - repositoryDirectory.realRootedPath().asPath().getRelative(target.getBaseName()); + repositoryDirectory.getRelative(target.getBaseName()); if (createSymbolicLink(symlinkPath, target, env) == null) { return false; } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidLocalToolsRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidLocalToolsRepositoryFunction.java index e0bc01c925..d595e28fc8 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidLocalToolsRepositoryFunction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidLocalToolsRepositoryFunction.java @@ -46,7 +46,9 @@ public class AndroidLocalToolsRepositoryFunction extends RepositoryFunction { PathFragment pathFragment = getTargetPath(rule); if (!symlinkLocalRepositoryContents( - directoryValue, getOutputBase().getFileSystem().getPath(pathFragment), env)) { + directoryValue.realRootedPath().asPath(), + getOutputBase().getFileSystem().getPath(pathFragment), + env)) { return null; } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java index 0d2dca14ea..0412608c44 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java @@ -23,8 +23,10 @@ import com.google.devtools.build.lib.packages.Rule; import com.google.devtools.build.lib.packages.Type; import com.google.devtools.build.lib.skyframe.FileValue; import com.google.devtools.build.lib.util.ResourceFileLoader; +import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.PathFragment; import com.google.devtools.build.skyframe.SkyFunctionException; +import com.google.devtools.build.skyframe.SkyFunctionException.Transience; import com.google.devtools.build.skyframe.SkyFunctionName; import com.google.devtools.build.skyframe.SkyKey; import com.google.devtools.build.skyframe.SkyValue; @@ -50,9 +52,15 @@ public class AndroidNdkRepositoryFunction extends RepositoryFunction { } PathFragment pathFragment = getTargetPath(rule); + Path ndkSymlinkTreeDirectory = directoryValue.realRootedPath().asPath().getRelative("ndk"); + try { + ndkSymlinkTreeDirectory.createDirectory(); + } catch (IOException e) { + throw new RepositoryFunctionException(e, Transience.TRANSIENT); + } if (!symlinkLocalRepositoryContents( - directoryValue, getOutputBase().getFileSystem().getPath(pathFragment), env)) { + ndkSymlinkTreeDirectory, getOutputBase().getFileSystem().getPath(pathFragment), env)) { return null; } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java index 1a3b98436c..9fdf90dec5 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java @@ -50,7 +50,9 @@ public class AndroidSdkRepositoryFunction extends RepositoryFunction { PathFragment pathFragment = getTargetPath(rule); if (!symlinkLocalRepositoryContents( - directoryValue, getOutputBase().getFileSystem().getPath(pathFragment), env)) { + directoryValue.realRootedPath().asPath(), + getOutputBase().getFileSystem().getPath(pathFragment), + env)) { return null; } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_ndk_cc_toolchain_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_ndk_cc_toolchain_template.txt index 5ee49671a2..64ebd7f182 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_ndk_cc_toolchain_template.txt +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_ndk_cc_toolchain_template.txt @@ -32,10 +32,10 @@ filegroup( name = "everything-%api_level%-%cpu%", srcs = glob( [ - "platforms/android-%api_level%/arch-%cpu%/usr/include/**/*.h", - "platforms/android-%api_level%/arch-%cpu%/usr/lib/**/*.a", - "platforms/android-%api_level%/arch-%cpu%/usr/lib/**/*.o", - "platforms/android-%api_level%/arch-%cpu%/usr/lib/**/*.so", + "ndk/platforms/android-%api_level%/arch-%cpu%/usr/include/**/*.h", + "ndk/platforms/android-%api_level%/arch-%cpu%/usr/lib/**/*.a", + "ndk/platforms/android-%api_level%/arch-%cpu%/usr/lib/**/*.o", + "ndk/platforms/android-%api_level%/arch-%cpu%/usr/lib/**/*.so", ], ), ) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_ndk_toolchain_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_ndk_toolchain_template.txt index d483cecac9..ea24824ea3 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_ndk_toolchain_template.txt +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_ndk_toolchain_template.txt @@ -26,37 +26,37 @@ toolchain { toolchain_identifier: "%cpu%-linux-androideabi-%compiler%" tool_path { name: "ar" - path: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-ar" + path: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-ar" } tool_path { name: "compat-ld" - path: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-ld" + path: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-ld" } tool_path { name: "cpp" - path: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-cpp" + path: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-cpp" } tool_path { name: "dwp" - path: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-dwp" + path: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-dwp" } tool_path { name: "gcc" - path: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-gcc" + path: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-gcc" } tool_path { name: "gcov" - path: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-gcov" + path: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-gcov" } tool_path { name: "ld" - path: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-ld" + path: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-ld" } tool_path { name: "nm" - path: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-nm" + path: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-nm" } tool_path { name: "objcopy" - path: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-objcopy" + path: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-objcopy" } tool_path { name: "strip" - path: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-strip" + path: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-strip" } tool_path { name: "objdump" - path: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-objdump" + path: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/bin/%cpu%-linux-androideabi-objdump" } objcopy_embed_flag: "-I" @@ -76,19 +76,19 @@ toolchain { cxx_flag: "-std=gnu++11" - cxx_builtin_include_directory: "external/%repository%/platforms/android-%api_level%/arch-%cpu%/usr/include" - cxx_builtin_include_directory: "external/%repository%/sources" - cxx_builtin_include_directory: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/lib/gcc/%cpu%-linux-androideabi/%compiler%/include" - cxx_builtin_include_directory: "external/%repository%/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/lib/gcc/%cpu%-linux-androideabi/%compiler%/include-fixed" + cxx_builtin_include_directory: "external/%repository%/ndk/platforms/android-%api_level%/arch-%cpu%/usr/include" + cxx_builtin_include_directory: "external/%repository%/ndk/sources" + cxx_builtin_include_directory: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/lib/gcc/%cpu%-linux-androideabi/%compiler%/include" + cxx_builtin_include_directory: "external/%repository%/ndk/toolchains/%cpu%-linux-androideabi-%compiler%/prebuilt/linux-x86_64/lib/gcc/%cpu%-linux-androideabi/%compiler%/include-fixed" - unfiltered_cxx_flag: "-isystemexternal/%repository%/platforms/android-%api_level%/arch-%cpu%/usr/include" - unfiltered_cxx_flag: "-isystemexternal/%repository%/sources/cxx-stl/gnu-libstdc++/%compiler%/include" - unfiltered_cxx_flag: "-isystemexternal/%repository%/sources/cxx-stl/gnu-libstdc++/%compiler%/libs/%abi%/include" + unfiltered_cxx_flag: "-isystemexternal/%repository%/ndk/platforms/android-%api_level%/arch-%cpu%/usr/include" + unfiltered_cxx_flag: "-isystemexternal/%repository%/ndk/sources/cxx-stl/gnu-libstdc++/%compiler%/include" + unfiltered_cxx_flag: "-isystemexternal/%repository%/ndk/sources/cxx-stl/gnu-libstdc++/%compiler%/libs/%abi%/include" unfiltered_cxx_flag: "-isystem" - unfiltered_cxx_flag: "external/%repository%/sources/cxx-stl/stlport/stlport" + unfiltered_cxx_flag: "external/%repository%/ndk/sources/cxx-stl/stlport/stlport" unfiltered_cxx_flag: "-isystem" - unfiltered_cxx_flag: "external/%repository%/sources/cxx-stl/gabi++/include" + unfiltered_cxx_flag: "external/%repository%/ndk/sources/cxx-stl/gabi++/include" linking_mode_flags { mode: FULLY_STATIC @@ -111,11 +111,11 @@ toolchain { compiler_flag: "-DANDROID" compiler_flag: "-g" - linker_flag: "--sysroot=external/%repository%/platforms/android-%api_level%/arch-%cpu%" + linker_flag: "--sysroot=external/%repository%/ndk/platforms/android-%api_level%/arch-%cpu%" linker_flag: "-fPIE" linker_flag: "-pie" - linker_flag: "-Lexternal/%repository%/sources/cxx-stl/gnu-libstdc++/%compiler%/libs/%abi%/" + linker_flag: "-Lexternal/%repository%/ndk/sources/cxx-stl/gnu-libstdc++/%compiler%/libs/%abi%/" linker_flag: "-lgnustl_static" linker_flag: "-lsupc++" linker_flag: "-lc" diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_sdk_repository_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_sdk_repository_template.txt index 51ea29a23c..06f8f650c8 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_sdk_repository_template.txt +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_sdk_repository_template.txt @@ -14,7 +14,16 @@ android_sdk( annotations_jar = "tools/support/annotations.jar", main_dex_classes = "build-tools/%build_tools_version%/mainDexClasses.rules", apkbuilder = ":apkbuilder", - zipalign = "build-tools/%build_tools_version%/zipalign") + zipalign = "build-tools/%build_tools_version%/zipalign", + android_jack = ":empty", + jack = ":fail", + jill = ":fail", + resource_extractor = ":fail" +) + +sh_binary( + name = "fail", + srcs = ["fail.sh"]) genrule( name = "main_dex_list_creator_source", |