-
-
Save asciimike/1f0799e38d1e96a993319da4645fa0b4 to your computer and use it in GitHub Desktop.
ios_app( | |
name = "App", | |
hdrs = ["src/*.h"], | |
srcs = ["src/*.m"], | |
deps = [ | |
"@SDWebImage//:latest_library", | |
], | |
) | |
ios_test( | |
name = "Test", | |
hdrs = ["test/*.h"], | |
srcs = ["test/*.m"], | |
deps = [ | |
"@SDWebImage//:latest_library", | |
], | |
xctest = 1, | |
) | |
objc_xcodeproj( | |
name = "Project", | |
deps = [ | |
":App", | |
":Tests", | |
], | |
) | |
# bazel build :Project builds the app and unit tests |
# Based on https://github.com/rs/SDWebImage/blob/master/SDWebImage.podspec | |
new_git_repository( | |
name = "SDWebImage", | |
remote = "https://github.com/rs/SDWebImage.git", | |
build_file_content = """ | |
objc_library( | |
name = "latest_library", | |
hdrs = glob( | |
["SDWebImage/{NS,SD,UI}*.h"], | |
exclude = ["SDWebImage/UIImage+WebP.h"], | |
), | |
srcs = glob( | |
["SDWebImage/{NS,SD,UI}*.m"], | |
exclude = ["SDWebImage/UIImage+WebP.m"], | |
), | |
sdk_frameworks = "ImageIO", | |
visibility = ["//visibility:public"], | |
)""", | |
) |
{ | |
"name": "SDWebImage", | |
"version": "3.7.1", | |
"platforms": { | |
"ios": "5.0" | |
}, | |
"license": "MIT", | |
"summary": "Asynchronous image downloader with cache support with an UIImageView category.", | |
"homepage": "https://github.com/rs/SDWebImage", | |
"authors": { | |
"Olivier Poitrey": "[email protected]" | |
}, | |
"source": { | |
"git": "https://github.com/rs/SDWebImage.git", | |
"tag": "3.7.1" | |
}, | |
"description": "This library provides a category for UIImageView with support for remote images coming from the web. It provides an UIImageView category adding web image and cache management to the Cocoa Touch framework, an asynchronous image downloader, an asynchronous memory + disk image caching with automatic cache expiration handling, a guarantee that the same URL won't be downloaded several times, a guarantee that bogus URLs won't be retried again and again, and performances!", | |
"requires_arc": true, | |
"frameworks": "ImageIO", | |
"default_subspecs": "Core", | |
"subspecs": [ | |
{ | |
"name": "Core", | |
"source_files": "SDWebImage/{NS,SD,UI}*.{h,m}", | |
"exclude_files": "SDWebImage/UIImage+WebP.{h,m}" | |
}, | |
{ | |
"name": "MapKit", | |
"source_files": "SDWebImage/MKAnnotationView+WebCache.*", | |
"frameworks": "MapKit", | |
"dependencies": { | |
"SDWebImage/Core": [ | |
] | |
} | |
}, | |
{ | |
"name": "WebP", | |
"source_files": "SDWebImage/UIImage+WebP.{h,m}", | |
"xcconfig": { | |
"GCC_PREPROCESSOR_DEFINITIONS": "$(inherited) SD_WEBP=1" | |
}, | |
"dependencies": { | |
"SDWebImage/Core": [ | |
], | |
"libwebp": [ | |
] | |
} | |
} | |
] | |
} |
No clue either.
Thread for reference: bazelbuild/bazel#1813 (comment)
I think it was just a comparison between the podspec and the BUILD file for reference of how you may convert them
Correct, this doesn't (to my knowledge) actually exist, it's purely a "I wish the world worked like this."
Ah FWIW this works:
objc_library(
name = "SDWebImage",
srcs = glob(
["SDWebImage/*.m"],
exclude = [
"SDWebImage/UIImage+WebP.m",
"SDWebImage/SDWebImageWebPCoder.m",
],
),
hdrs = glob(
["SDWebImage/*.h"],
exclude = [
"SDWebImage/UIImage+WebP.h",
"SDWebImage/SDWebImageWebPCoder.h",
],
),
module_name = "SDWebImage",
sdk_frameworks = [
"ImageIO",
"MobileCoreServices",
],
visibility = ["//visibility:public"],
)
Sure, provided you download the SDWebImage source, yeah? I was hoping to jam that into Bazel so it could do some of the package management as well (even though that's not really what it's meant for).
EDIT: I guess if you do the git repo thing you can avoid that?
Yea we use this file with http_archive
but git_repository
would work just as well
For anyone who stumbles upon this again (hi Mike 👋) here's an updated BUILD file for the latest SDWebImage library
objc_library(
name = "SDWebImage",
srcs = glob(
[
"SDWebImage/Core/*.m",
"SDWebImage/Private/*.m",
"SDWebImage/Private/*.h",
],
exclude = [],
),
hdrs = glob(
[
"SDWebImage/Core/*.h",
],
exclude = [],
),
module_name = "SDWebImage",
sdk_frameworks = [
"ImageIO",
],
includes = [
"SDWebImage/Core",
"SDWebImage/Private",
],
visibility = ["//visibility:public"],
)
What is sdwebimage.podspec.json for and how to use it in bazel?