Re-land r29957 (add versions and constraints for packages and samples), with

SDK constraints bumped from 1.0.0 to 0.8.10+6 .

R=ricow@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org//62473002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29986 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
dgrove@google.com 2013-11-06 18:28:22 +00:00
parent f4ce20b2c0
commit 18ca7d0036
40 changed files with 259 additions and 222 deletions

View file

@ -1,11 +1,13 @@
name: analyzer
version: 0.10.0
version: 0.10.1
author: Dart Team <misc@dartlang.org>
description: Static analyzer for Dart.
homepage: http://www.dartlang.org
dependencies:
args: ">=0.8.9 <1.0.0"
logging: ">=0.8.9 <1.0.0"
path: ">=0.8.9 <1.0.0"
args: ">=0.9.0 <0.10.0"
logging: ">=0.9.0 <0.10.0"
path: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: ">=0.8.9 <1.0.0"
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: args
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
documentation: http://api.dartlang.org/docs/pkg/args
@ -7,6 +8,8 @@ description: >
a set of options and values using GNU and POSIX style options.
dependencies:
unmodifiable_collection: any
unmodifiable_collection: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: async_helper
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: >
@ -7,3 +8,5 @@ description: >
language tests.
Third parties are discouraged from using this, and should use
the facilities provided in the unittest library.
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: barback
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: >
@ -12,9 +13,11 @@ description: >
Runs transforms asynchronously and in parallel when possible to maximize
responsiveness.
dependencies:
path: any
source_maps: any
stack_trace: any
path: ">=0.9.0 <0.10.0"
source_maps: ">=0.9.0 <0.10.0"
stack_trace: ">=0.9.0 <0.10.0"
dev_dependencies:
scheduled_test: any
unittest: any
scheduled_test: ">=0.9.0 <0.10.0"
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,5 +1,8 @@
name: browser
version: 0.9.0
authors: ["Dart Team <misc@dartlang.org>"]
homepage: http://www.dartlang.org
description: >
The bootstrap dart.js script for Dart apps running in the browser.
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,6 +1,9 @@
name: collection_helpers
version: 0.9.0
author: '"Dart Team <misc@dartlang.org>"'
description: Utility functions and classes for working with collections.
homepage: http://www.dartlang.org
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,6 +1,9 @@
name: crypto
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
documentation: http://api.dartlang.org/docs/pkg/crypto
description: >
Library of cryptographic functions.
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,12 +1,15 @@
name: csslib
version: 0.9.0
author: "Web UI Team <web-ui-dev@dartlang.org>"
description: A library for parsing CSS.
homepage: https://www.dartlang.org
dependencies:
args: any
logging: any
path: any
source_maps: any
args: ">=0.9.0 <0.10.0"
logging: ">=0.9.0 <0.10.0"
path: ">=0.9.0 <0.10.0"
source_maps: ">=0.9.0 <0.10.0"
dev_dependencies:
browser: any
unittest: any
browser: ">=0.9.0 <0.10.0"
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: custom_element
version: 0.9.0
author: "Web UI Team <web-ui-dev@dartlang.org>"
homepage: http://www.dartlang.org/
description: >
@ -6,7 +7,8 @@ description: >
with custom tag names, and then use those custom tag names as they would any
standard tag.
dependencies:
meta: any
mutation_observer: any
mutation_observer: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,10 +1,15 @@
name: docgen
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: https://github.com/dart-lang/dartdoc-viewer
description: A documentation generator for the Dart repository.
dependencies:
args: any
logging: any
markdown: any
path: any
yaml: any
args: ">=0.9.0 <0.10.0"
logging: ">=0.9.0 <0.10.0"
markdown: ">=0.9.0 <0.10.0"
path: ">=0.9.0 <0.10.0"
yaml: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: expect
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: >
@ -7,3 +8,5 @@ description: >
Third parties are discouraged from using this, and should use
the expect() function in the unit test library instead for
test assertions.
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,6 +1,9 @@
name: fixnum
version: 0.9.0
author: Dart Team <misc@dartlang.org>
description: Library for 32- and 64-bit fixed size integers.
homepage: http://www.dartlang.org
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: html_import
version: 0.9.0
author: "Web UI Team <web-ui-dev@dartlang.org>"
homepage: https://github.com/Polymer/HTMLImports/tree/master
description: >
@ -6,3 +7,5 @@ description: >
documents. As <script> tags let authors include external code in their
pages, imports let authors load full HTML resources. In particular, imports
let authors include Custom Element definitions from external URLs.
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,8 +1,11 @@
name: http
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: A composable, Future-based API for making HTTP requests.
dependencies:
path: any
path: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,10 +1,13 @@
name: http_server
version: 0.9.0
author: Dart Team <misc@dartlang.org>
description: Library of HTTP server classes.
homepage: http://www.dartlang.org
documentation: http://api.dartlang.org/docs/pkg/http_server
dependencies:
mime: any
path: any
mime: ">=0.9.0 <0.10.0"
path: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,12 +1,14 @@
name: intl
version: 0.9.0
author: Dart Team <misc@dartlang.org>
description: Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues.
homepage: http://www.dartlang.org
documentation: http://api.dartlang.org/docs/pkg/intl
dependencies:
analyzer: any
meta: any
path: any
analyzer: ">=0.10.1 <0.11.0"
path: ">=0.9.0 <0.10.0"
dev_dependencies:
serialization: any
unittest: any
serialization: ">=0.9.0 <0.10.0"
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: json
version: 0.9.0
author: Dart Team <misc@dartlang.org>
description: >
A JSON library. Intended for advanced use where the built-in facilities are
@ -6,4 +7,6 @@ description: >
homepage: http://www.dartlang.org
documentation: http://api.dartlang.org/docs/pkg/json
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,10 +1,12 @@
name: logging
version: 0.9.0
author: Dart Team <misc@dartlang.org>
description: Provides APIs for debugging and error logging. This library introduces abstractions similar to those used in other languages, such as the Closure JS Logger and java.util.logging.Logger.
homepage: http://www.dartlang.org
documentation: http://api.dartlang.org/docs/pkg/logging
dependencies:
meta: any
unmodifiable_collection: any
unmodifiable_collection: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,6 +1,9 @@
name: mime
version: 0.9.0
author: Dart Team <misc@dartlang.org>
description: Helper-package for working with MIME.
homepage: http://www.dartlang.org
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,8 +1,11 @@
name: mutation_observer
version: 0.9.0
author: "Web UI Team <web-ui-dev@dartlang.org>"
homepage: https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/pkg/mutation_observer/
documentation: https://api.dartlang.org/docs/releases/latest/dart_html/MutationObserver.html
description: >
Mutation Observers provide a way to react to changes in the DOM.
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: oauth2
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: >
@ -6,6 +7,8 @@ description: >
behalf of a user, and making authorized HTTP requests with the user's
OAuth2 credentials.
dependencies:
http: any
http: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: observe
version: 0.9.0
author: Web UI Team <web-ui-dev@dartlang.org>
description: >
Observable properties and objects for use in Model-Driven-Views (MDV).
@ -8,10 +9,12 @@ description: >
immediately assigned to the model.
homepage: https://www.dartlang.org/polymer-dart/
dependencies:
analyzer: any
barback: any
logging: any
path: any
source_maps: any
analyzer: ">=0.10.1 <0.11.0"
barback: ">=0.9.0 <0.10.0"
logging: ">=0.9.0 <0.10.0"
path: ">=0.9.0 <0.10.0"
source_maps: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: path
version: 0.9.0
author: Dart Team <misc@dartlang.org>
description: >
A string-based path manipulation library. All of the path operations you know
@ -7,4 +8,6 @@ description: >
homepage: http://www.dartlang.org
documentation: http://api.dartlang.org/docs/pkg/path
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: polymer
version: 0.9.0
author: Polymer.dart Authors <web-ui-dev@dartlang.org>
description: >
Polymer.dart is a new type of library for the web, built on top of Web
@ -6,22 +7,23 @@ description: >
browsers.
homepage: https://www.dartlang.org/polymer-dart/
dependencies:
analyzer: any
args: any
barback: any
browser: any
csslib: any
custom_element: any
html5lib: any
html_import: any
logging: any
meta: any
observe: any
path: any
polymer_expressions: any
shadow_dom: any
source_maps: any
template_binding: any
yaml: any
analyzer: ">=0.10.1 <0.11.0"
args: ">=0.9.0 <0.10.0"
barback: ">=0.9.0 <0.10.0"
browser: ">=0.9.0 <0.10.0"
csslib: ">=0.9.0 <0.10.0"
custom_element: ">=0.9.0 <0.10.0"
html5lib: ">=0.9.0 <0.10.0"
html_import: ">=0.9.0 <0.10.0"
logging: ">=0.9.0 <0.10.0"
observe: ">=0.9.0 <0.10.0"
path: ">=0.9.0 <0.10.0"
polymer_expressions: ">=0.9.0 <0.10.0"
shadow_dom: ">=0.9.0 <0.10.0"
source_maps: ">=0.9.0 <0.10.0"
template_binding: ">=0.9.0 <0.10.0"
yaml: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,10 +1,13 @@
name: polymer_expressions
version: 0.9.0
author: Web UI Authors <html-dev@dartlang.org>
description: An expressive custom binding syntax for MDV templates
homepage: http://www.dartlang.org/polymer-dart/
dependencies:
browser: any
observe: any
template_binding: any
browser: ">=0.9.0 <0.10.0"
observe: ">=0.9.0 <0.10.0"
template_binding: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: scheduled_test
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: >
@ -9,7 +10,9 @@ description: >
read like synchronous, linear code, despite executing asynchronously.
dependencies:
http: ">=0.4.1 <1.0.0"
path: ">=0.3.2 <1.0.0"
stack_trace: ">=0.4.3 <1.0.0"
unittest: ">=0.4.3 <1.0.0"
http: ">=0.9.0 <0.10.0"
path: ">=0.9.0 <0.10.0"
stack_trace: ">=0.9.0 <0.10.0"
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: sequence_zip
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: >
@ -6,4 +7,6 @@ description: >
Combines multiple iterables into a single iterable of tuples of values,
and similar for Streams.
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,8 +1,11 @@
name: serialization
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
documentation: http://api.dartlang.org/docs/pkg/serialization
description: >
Provide a serialization facility for Dart objects.
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: shadow_dom
version: 0.9.0
author: "Web UI Team <web-ui-dev@dartlang.org>"
homepage: https://github.com/dart-lang/ShadowDOM/tree/conditional_shadowdom
description: >
@ -7,3 +8,5 @@ description: >
boundaries between DOM trees and how these trees interact with each other
within a document, thus enabling better functional encapsulation within the
DOM.
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,6 +1,9 @@
name: source_maps
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: Library to programmatically manipulate source map files.
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,11 +1,14 @@
name: stack_trace
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: >
A package for manipulating stack traces and printing them readably.
dependencies:
path: any
path: ">=0.9.0 <0.10.0"
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,13 +1,16 @@
name: template_binding
version: 0.9.0
author: Polymer.dart Team <web-ui-dev@dartlang.org>
description: >
Extends the capabilities of the HTML Template Element by enabling it to
create, manage, and remove instances of content bound to data defined in Dart.
homepage: https://www.dartlang.org/polymer-dart/
dependencies:
logging: any
mutation_observer: any
observe: any
logging: ">=0.9.0 <0.10.0"
mutation_observer: ">=0.9.0 <0.10.0"
observe: ">=0.9.0 <0.10.0"
dev_dependencies:
custom_element: any
unittest: any
custom_element: ">=0.9.0 <0.10.0"
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,11 +1,14 @@
name: html5lib
version: 0.9.0
author: Dart Team <misc@dartlang.org>
description: A library for working with HTML documents.
homepage: http://pub.dartlang.org/packages/html5lib
dependencies:
source_maps: any
utf: any
source_maps: ">=0.9.0 <0.10.0"
utf: ">=0.9.0 <0.10.0"
dev_dependencies:
browser: any
path: any
unittest: any
browser: ">=0.9.0 <0.10.0"
path: ">=0.9.0 <0.10.0"
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,8 +1,10 @@
name: unittest
version: 0.9.0
author: Dart Team <misc@dartlang.org>
description: A library for writing dart unit tests.
homepage: http://www.dartlang.org
documentation: http://api.dartlang.org/docs/pkg/unittest
dependencies:
meta: any
stack_trace: any
stack_trace: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,7 +1,10 @@
name: unmodifiable_collection
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: >
Unmodifiable wrappers for base collection types.
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: utf
version: 0.9.0
author: Dart Team <misc@dartlang.org>
description: >
A Unicode library. Intended for advanced use where the built-in facilities
@ -6,4 +7,6 @@ description: >
homepage: http://www.dartlang.org
documentation: http://api.dartlang.org/docs/pkg/utf
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,4 +1,5 @@
name: watcher
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: >
@ -6,8 +7,10 @@ description: >
of directories and notifies you when files have been added, removed, or
modified.
dependencies:
crypto: any
path: any
crypto: ">=0.9.0 <0.10.0"
path: ">=0.9.0 <0.10.0"
dev_dependencies:
scheduled_test: any
unittest: any
scheduled_test: ">=0.9.0 <0.10.0"
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -1,6 +1,9 @@
name: yaml
version: 0.9.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: A parser for YAML.
dev_dependencies:
unittest: any
unittest: ">=0.9.0 <0.10.0"
environment:
sdk: ">=0.8.10+6 <2.0.0"

View file

@ -20,6 +20,8 @@ import sys
BLACK_LISTED_DIRECTORIES = ['.svn', 'async_helper', 'expect', 'third_party'];
def Main(argv):
pkgs_to_publish = []
for pkgdir in ['pkg', 'pkg/third_party']:
for name in os.listdir(pkgdir):
if os.path.isdir(os.path.join(pkgdir, name)):

View file

@ -19,122 +19,52 @@ import sys
import subprocess
import tempfile
def ReplaceInFiles(paths, subs):
'''Reads a series of files, applies a series of substitutions to each, and
saves them back out. subs should be a list of (pattern, replace) tuples.'''
for path in paths:
contents = open(path).read()
for pattern, replace in subs:
contents = re.sub(pattern, replace, contents)
dest = open(path, 'w')
dest.write(contents)
dest.close()
def ReadVersion(file, field):
for line in open(file).read().split('\n'):
[k, v] = re.split('\s+', line)
if field == k:
return int(v)
def Main(argv):
HOME = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
versionFile = os.path.join(HOME, 'tools', 'VERSION')
major = ReadVersion(versionFile, 'MAJOR')
minor = ReadVersion(versionFile, 'MINOR')
build = ReadVersion(versionFile, 'BUILD')
patch = ReadVersion(versionFile, 'PATCH')
# bleeding_edge has a fixed version number of 0.1.x.y . Don't allow users
# to publish packages from bleeding_edge.
if major == 0 and minor <= 1:
print 'Error: Do not run this script from a bleeding_edge checkout.'
return -1
if patch != 0:
version = '%d.%d.%d+%d' % (major, minor, build, patch)
else:
version = '%d.%d.%d' % (major, minor, build)
tmpDir = tempfile.mkdtemp()
pkgName = os.path.basename(os.path.normpath(argv[1]))
pubspec = os.path.join(tmpDir, pkgName, 'pubspec.yaml')
pubspec = os.path.join(HOME, argv[1], 'pubspec.yaml')
if not os.path.exists(pubspec):
print 'Error: did not find pubspec.yaml at ' + pubspec
return -1
replaceInDart = []
replaceInPubspec = []
with open(pubspec) as pubspecFile:
lines = pubspecFile.readlines()
if os.path.exists(os.path.join(HOME, argv[1], 'pubspec.yaml')):
#
# If pubspec.yaml exists, add the SDK's version number if
# no version number is present.
#
shutil.copytree(os.path.join(HOME, argv[1]),
os.path.join(tmpDir, pkgName))
with open(pubspec) as pubspecFile:
lines = pubspecFile.readlines()
with open(pubspec, 'w') as pubspecFile:
foundVersion = False
version = None
foundSdkContraint = False
inDependencies = False
for line in lines:
if line.startswith('dependencies:'):
inDependencies = True
elif line.startswith('environment:'):
foundSdkContraint = True
elif line[0].isalpha():
inDependencies = False
for line in lines:
if line.startswith('dependencies:'):
inDependencies = True
elif line[0].isalpha():
inDependencies = False
if line.startswith('version:'):
foundVersion = True
if inDependencies:
#
# Within dependencies, don't print line that start with " sdk:"
# and strip out "{ sdk: package_name }".
#
if not line.startswith(' sdk:'):
line = re.sub(r'{(\s*)sdk:(\s+)([a-z0-9_]+)(\s*)}', '', line)
pubspecFile.write(line)
else:
pubspecFile.write(line)
if not foundVersion:
pubspecFile.write('\nversion: ' + version + '\n')
pubspecFile.write('environment:\n')
pubspecFile.write(' sdk: ">=' + version + '"\n')
if line.startswith('version:'):
version = line[len('version:'):].strip()
if inDependencies:
if line.endswith(': any'):
print 'Error in %s: should not use "any" version constraint: %s' % (
pubspec, line)
return -1
else:
#
# If there's a lib/ directory in the package, copy the package.
# Otherwise, move the package's contents to lib/.
#
if os.path.exists(os.path.join(HOME, argv[1], 'lib')):
shutil.copytree(os.path.join(HOME, argv[1]),
os.path.join(tmpDir, pkgName))
else:
os.makedirs(os.path.join(tmpDir, pkgName))
shutil.copytree(os.path.join(HOME, argv[1]),
os.path.join(tmpDir, pkgName, 'lib'))
if not version:
print 'Error in %s: did not find package version.' % pubspec
return -1
# Create pubspec.yaml .
with open(pubspec, 'w') as pubspecFile:
pubspecFile.write('name: ' + pkgName + '_unsupported\n')
pubspecFile.write('author: None\n')
pubspecFile.write('homepage: http://None\n')
pubspecFile.write('version: ' + version + '\n')
pubspecFile.write("description: >\n")
pubspecFile.write(' A completely unsupported clone of Dart SDK library\n')
pubspecFile.write(' ' + argv[1] + ' . This package will change in\n')
pubspecFile.write(' unpredictable/incompatible ways without warning.\n')
pubspecFile.write('dependencies:\n')
pubspecFile.write('environment:\n')
pubspecFile.write(' sdk: ">=' + version + '"\n')
if not foundSdkContraint:
print 'Error in %s: did not find SDK version constraint.' % pubspec
return -1
libpath = os.path.join(HOME, argv[1], '../libraries.dart')
if os.path.exists(libpath):
# Copy libraries.dart into the package source code
shutil.copy(libpath, os.path.join(tmpDir, pkgName, 'lib/libraries.dart'))
tmpDir = tempfile.mkdtemp()
# Replace '../../libraries.dart' with '../libraries.dart'
replaceInDart.append(
(r'(import|part)(\s+)(\'|")\.\./(\.\./)*libraries.dart',
r'\1\2\3\4libraries.dart'))
#
# If pubspec.yaml exists, check that the SDK's version constraint is valid
#
shutil.copytree(os.path.join(HOME, argv[1]),
os.path.join(tmpDir, pkgName))
if not os.path.exists(os.path.join(tmpDir, pkgName, 'LICENSE')):
with open(os.path.join(tmpDir, pkgName, 'LICENSE'), 'w') as licenseFile:
@ -167,21 +97,16 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
''');
replaceInDart.append(
(r'(import|part)(\s+)(\'|")(\.\./)+pkg/([^/]+/)lib/', r'\1\2\3package:\5'))
# Replace '../*/pkg' imports and parts.
for root, dirs, files in os.walk(os.path.join(tmpDir, pkgName)):
# TODO(dgrove): Remove this when dartbug.com/7487 is fixed.
if '.svn' in dirs:
shutil.rmtree(os.path.join(root, '.svn'))
for name in files:
if name.endswith('.dart'):
ReplaceInFiles([os.path.join(root, name)], replaceInDart)
elif name == 'pubspec.yaml':
ReplaceInFiles([os.path.join(root, name)], replaceInPubspec)
print 'publishing version ' + version + ' of ' + argv[1] + ' to pub.\n'
# TODO(jmesserly): this code puts things in the pub cache. Useful for testing
# without actually uploading.
#cacheDir = os.path.join(
# os.path.expanduser('~/.pub-cache/hosted/pub.dartlang.org'),
# pkgName + '-' + version)
#print 'Moving to ' + cacheDir
#shutil.move(os.path.join(tmpDir, pkgName), cacheDir)
subprocess.call(['pub', 'publish'], cwd=os.path.join(tmpDir, pkgName))
shutil.rmtree(tmpDir)