Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Material Design Icons to their own package #250

Merged
merged 1 commit into from
Jul 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ hooks = [
'pattern': '.',
'action': [
'python',
'src/sky/sdk/lib/download_material_design_icons',
'src/sky/tools/download_material_design_icons',
],
},
# Pull binutils for linux, enabled debug fission for faster linking /
Expand Down
2 changes: 1 addition & 1 deletion sky/build/skyx.gni
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ template("skyx") {
}

action("gen_${bundle_prefix}_bundle") {
asset_base = "$package_root/sky/assets/material-design-icons"
asset_base = "//sky/packages/material_design_icons/icons"

sources = [
"//sky/tools/skyx/bin/skyx.dart",
Expand Down
1 change: 1 addition & 0 deletions sky/packages/material_design_icons/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
icons
393 changes: 393 additions & 0 deletions sky/packages/material_design_icons/LICENSE

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions sky/packages/material_design_icons/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Material Design Icons
=====================

A set of icons designed under the
[material design guidelines](http://www.google.com/design/spec).

License
-------

We have made these icons available for you to incorporate them into your
products under the Creative Common Attribution 4.0 International License
(CC-BY 4.0). Feel free to remix and re-share these icons and documentation in
your products. We'd love attribution in your app's about screen, but it's not
required. The only thing we ask is that you not re-sell the icons themselves.
5 changes: 5 additions & 0 deletions sky/packages/material_design_icons/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: material_design_icons
version: 0.0.1
author: Chromium Authors <sky-dev@googlegroups.com>
description: Material Design Icons
homepage: https://github.com/google/material-design-icons
29 changes: 0 additions & 29 deletions sky/sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ dart_pkg("sky") {
"lib/animation/forces.dart",
"lib/animation/scroll_behavior.dart",
"lib/animation/timeline.dart",
"lib/assets/.gitignore",
"lib/assets/material-design-icons.sha1",
"lib/base/debug.dart",
"lib/base/hit_test.dart",
"lib/base/lerp.dart",
"lib/base/node.dart",
"lib/base/scheduler.dart",
"lib/download_material_design_icons",
"lib/editing/editable_string.dart",
"lib/editing/editable_text.dart",
"lib/editing/input.dart",
Expand Down Expand Up @@ -115,34 +112,8 @@ dart_pkg("sky") {
]
}

action("material_design_icons") {
source_file = "lib/assets/material-design-icons"
target_file = "$root_gen_dir/dart-pkg/sky/lib/assets/material-design-icons"
stamp = "$target_gen_dir/material_design_icons_linked"

sources = [
"lib/assets/material-design-icons.sha1",
]
outputs = [
stamp,
]

script = "//sky/build/symlink.py"
args = [
rebase_path(source_file, root_build_dir),
rebase_path(target_file, root_build_dir),
"--touch",
rebase_path(stamp, root_build_dir),
]

deps = [
":sky",
]
}

group("sdk") {
deps = [
":sky",
":material_design_icons",
]
}
1 change: 0 additions & 1 deletion sky/sdk/lib/assets/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion sky/sdk/lib/widgets/icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class IconTheme extends Inherited {
AssetBundle _initIconBundle() {
if (rootBundle != null)
return rootBundle;
const String _kAssetBase = '/packages/sky/assets/material-design-icons/';
const String _kAssetBase = '/packages/material_design_icons/icons/';
return new NetworkAssetBundle(Uri.base.resolve(_kAssetBase));
}

Expand Down
1 change: 1 addition & 0 deletions sky/sdk/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description: A framework for writing Sky applications
homepage: https://github.com/domokit/sky_engine/tree/master/sky/sdk
dependencies:
cassowary: ^0.1.7
material_design_icons: ^0.0.1
mojo_services: ^0.0.15
mojo: ^0.0.17
mojom: ^0.0.17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,32 @@ import subprocess
import sys
import urllib2

SRC_ROOT = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, os.pardir))
VERSION_FILE = '.version.sha1'

def main():
sky_lib_dir = os.path.dirname(os.path.abspath(__file__))
assets_dir = os.path.join(sky_lib_dir, 'assets')
icons_dir = os.path.join(assets_dir, 'material-design-icons')
existing_sha1_path = os.path.join(icons_dir, 'material-design-icons.sha1')
package_dir = os.path.join(SRC_ROOT, 'sky/packages/material_design_icons')
icons_dir = os.path.join(package_dir, 'icons')
existing_sha1_path = os.path.join(icons_dir, VERSION_FILE)

existing_sha1 = None
if os.path.isfile(existing_sha1_path):
with open(existing_sha1_path, 'r') as f:
existing_sha1 = f.read()

sha1_path = os.path.join(assets_dir, 'material-design-icons.sha1')
desired_sha1_path = os.path.join(package_dir, VERSION_FILE)

with open(sha1_path, 'r') as f:
sha1 = f.read()
with open(desired_sha1_path, 'r') as f:
desired_sha1 = f.read()

if existing_sha1 == sha1:
if existing_sha1 == desired_sha1:
return

print "Downloading missing material design icons"

tgz_path = os.path.join(assets_dir, 'material-design-icons.tgz')
tgz_path = os.path.join(package_dir, 'material-design-icons.tgz')
untar_path = os.path.join(package_dir, 'material-design-icons')

url = 'https://storage.googleapis.com/mojo/material-design-icons/%s' % sha1
response = urllib2.urlopen(url)

Expand All @@ -40,14 +43,9 @@ def main():

shutil.rmtree(icons_dir, ignore_errors=True)

output_path = os.path.join(assets_dir, tgz_path)
subprocess.call([
'tar', '-xzf', output_path, '-C', assets_dir
])

subprocess.call([
'cp', sha1_path, icons_dir
])
subprocess.call([ 'tar', '-xzf', tgz_path, '-C', package_dir ])
subprocess.call([ 'mv', untar_path, icons_dir ])
subprocess.call([ 'cp', sha1_path, icons_dir ])

os.unlink(tgz_path)

Expand Down