From 3d25a08c6c15c149a55c1d0a5c5a36853907ee07 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Sun, 18 Jan 2015 17:41:37 +1100 Subject: [PATCH] src: introduce process.release object --- Makefile | 63 ++++++++++++++++++++++++++++++++-------------- configure | 30 ++++++++++++++++++++++ node.gyp | 15 +++++++++++ src/node.cc | 24 ++++++++++++++++++ src/node_version.h | 2 +- vcbuild.bat | 7 +++++- 6 files changed, 120 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index ffaed7b0338ebd..26df181ca0f4c8 100644 --- a/Makefile +++ b/Makefile @@ -134,16 +134,16 @@ test-npm: $(NODE_EXE) rm -rf npm-cache npm-tmp npm-prefix mkdir npm-cache npm-tmp npm-prefix cd deps/npm ; npm_config_cache="$(shell pwd)/npm-cache" \ - npm_config_prefix="$(shell pwd)/npm-prefix" \ - npm_config_tmp="$(shell pwd)/npm-tmp" \ - ../../$(NODE_EXE) cli.js install --ignore-scripts + npm_config_prefix="$(shell pwd)/npm-prefix" \ + npm_config_tmp="$(shell pwd)/npm-tmp" \ + ../../$(NODE_EXE) cli.js install --ignore-scripts cd deps/npm ; npm_config_cache="$(shell pwd)/npm-cache" \ - npm_config_prefix="$(shell pwd)/npm-prefix" \ - npm_config_tmp="$(shell pwd)/npm-tmp" \ - ../../$(NODE_EXE) cli.js run-script test-all && \ - ../../$(NODE_EXE) cli.js prune --prod && \ - cd ../.. && \ - rm -rf npm-cache npm-tmp npm-prefix + npm_config_prefix="$(shell pwd)/npm-prefix" \ + npm_config_tmp="$(shell pwd)/npm-tmp" \ + ../../$(NODE_EXE) cli.js run-script test-all && \ + ../../$(NODE_EXE) cli.js prune --prod && \ + cd ../.. && \ + rm -rf npm-cache npm-tmp npm-prefix test-npm-publish: $(NODE_EXE) npm_package_config_publishtest=true ./$(NODE_EXE) deps/npm/test/run.js @@ -160,7 +160,7 @@ test-timers-clean: apidoc_sources = $(wildcard doc/api/*.markdown) apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \ - $(addprefix out/,$(apidoc_sources:.markdown=.json)) + $(addprefix out/,$(apidoc_sources:.markdown=.json)) apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets @@ -244,7 +244,7 @@ release-only: @if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \ exit 0 ; \ else \ - echo "" >&2 ; \ + echo "" >&2 ; \ echo "The git repository is not clean." >&2 ; \ echo "Please commit changes before building release tarball." >&2 ; \ echo "" >&2 ; \ @@ -255,10 +255,26 @@ release-only: @if [ "$(NIGHTLY)" != "" -o "$(RELEASE)" = "1" ]; then \ exit 0; \ else \ - echo "" >&2 ; \ + echo "" >&2 ; \ echo "#NODE_VERSION_IS_RELEASE is set to $(RELEASE)." >&2 ; \ - echo "Did you remember to update src/node_version.cc?" >&2 ; \ - echo "" >&2 ; \ + echo "Did you remember to update src/node_version.h?" >&2 ; \ + echo "" >&2 ; \ + exit 1 ; \ + fi + @if [ "$(RELEASE_SOURCE_URL)" != "" ]; then \ + exit 0; \ + else \ + echo "" >&2 ; \ + echo "#RELEASE_SOURCE_URL is not set." >&2 ; \ + echo "" >&2 ; \ + exit 1 ; \ + fi + @if [ "$(RELEASE_HEADERS_URL)" != "" ]; then \ + exit 0; \ + else \ + echo "" >&2 ; \ + echo "#RELEASE_HEADERS_URL is not set." >&2 ; \ + echo "" >&2 ; \ exit 1 ; \ fi @@ -267,10 +283,14 @@ pkg: $(PKG) $(PKG): release-only rm -rf $(PKGDIR) rm -rf out/deps out/Release - $(PYTHON) ./configure --dest-cpu=ia32 --tag=$(TAG) + $(PYTHON) ./configure --dest-cpu=ia32 --tag=$(TAG) \ + --release-source-url=$(RELEASE_SOURCE_URL) \ + --release-headers-url=$(RELEASE_HEADERS_URL) $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)/32 rm -rf out/deps out/Release - $(PYTHON) ./configure --dest-cpu=x64 --tag=$(TAG) + $(PYTHON) ./configure --dest-cpu=x64 --tag=$(TAG) \ + --release-source-url=$(RELEASE_SOURCE_URL) \ + --release-headers-url=$(RELEASE_HEADERS_URL) $(MAKE) install V=$(V) DESTDIR=$(PKGDIR) SIGN="$(APP_SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh lipo $(PKGDIR)/32/usr/local/bin/iojs \ @@ -308,7 +328,10 @@ tar: $(TARBALL) $(BINARYTAR): release-only rm -rf $(BINARYNAME) rm -rf out/deps out/Release - $(PYTHON) ./configure --prefix=/ --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS) + $(PYTHON) ./configure --prefix=/ --dest-cpu=$(DESTCPU) \ + --tag=$(TAG) \ + --release-source-url=$(RELEASE_SOURCE_URL) \ + --release-headers-url=$(RELEASE_HEADERS_URL) $(CONFIG_FLAGS) $(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1 cp README.md $(BINARYNAME) cp LICENSE $(BINARYNAME) @@ -326,7 +349,9 @@ binary: $(BINARYTAR) $(PKGSRC): release-only rm -rf dist out $(PYTHON) configure --prefix=/ \ - --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS) + --dest-cpu=$(DESTCPU) --tag=$(TAG) \ + --release-source-url=$(RELEASE_SOURCE_URL) \ + --release-headers-url=$(RELEASE_HEADERS_URL) $(CONFIG_FLAGS) $(MAKE) install DESTDIR=dist (cd dist; find * -type f | sort) > packlist pkg_info -X pkg_install | \ @@ -380,7 +405,7 @@ bench-all: bench bench-misc bench-array bench-buffer bench-url bench-events bench: bench-net bench-http bench-fs bench-tls bench-http-simple: - benchmark/http_simple_bench.sh + benchmark/http_simple_bench.sh bench-idle: ./$(NODE_EXE) benchmark/idle_server.js & diff --git a/configure b/configure index e85621e9cb4af0..e28d5509eab9e9 100755 --- a/configure +++ b/configure @@ -197,6 +197,21 @@ parser.add_option('--tag', dest='tag', help='custom build tag') +parser.add_option('--release-source-url', + action='store', + dest='release_source_url', + help='custom url for process.release.sourceUrl') + +parser.add_option('--release-headers-url', + action='store', + dest='release_headers_url', + help='custom url for process.release.headersUrl') + +parser.add_option('--release-lib-url', + action='store', + dest='release_lib_url', + help='custom url for process.release.libUrl. Only valid on Windows.') + parser.add_option('--v8-options', action='store', dest='v8_options', @@ -555,6 +570,21 @@ def configure_node(o): else: o['variables']['node_tag'] = '' + if options.release_source_url: + o['variables']['node_release_source_url'] = options.release_source_url + else: + o['variables']['node_release_source_url'] = '' + + if options.release_headers_url: + o['variables']['node_release_headers_url'] = options.release_headers_url + else: + o['variables']['node_release_headers_url'] = '' + + if options.release_lib_url: + o['variables']['node_release_lib_url'] = '-' + options.release_lib_url + else: + o['variables']['node_release_lib_url'] = '' + if options.v8_options: o['variables']['node_v8_options'] = options.v8_options.replace('"', '\\"') diff --git a/node.gyp b/node.gyp index d58ec25dcb3c7c..272f60da5d99c9 100644 --- a/node.gyp +++ b/node.gyp @@ -172,6 +172,21 @@ ], 'conditions': [ + [ 'node_release_source_url!=""', { + 'defines': [ + 'NODE_RELEASE_SOURCE_URL="<(node_release_source_url)"', + ] + }], + [ 'node_release_headers_url!=""', { + 'defines': [ + 'NODE_RELEASE_HEADERS_URL="<(node_release_headers_url)"', + ] + }], + [ 'node_release_lib_url!=""', { + 'defines': [ + 'NODE_RELEASE_LIB_URL="<(node_release_lib_url)"', + ] + }], [ 'v8_enable_i18n_support==1', { 'defines': [ 'NODE_HAVE_I18N_SUPPORT=1' ], 'dependencies': [ diff --git a/src/node.cc b/src/node.cc index 72ddbe178e37b9..587fa3cdb2fafa 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2613,6 +2613,30 @@ void SetupProcessObject(Environment* env, "platform", OneByteString(env->isolate(), NODE_PLATFORM)); + // process.release + Local release = Object::New(env->isolate()); + READONLY_PROPERTY(process, "release", release); + + READONLY_PROPERTY(release, "name", OneByteString(env->isolate(), "iojs")); + +#if defined(NODE_RELEASE_SOURCE_URL) + READONLY_PROPERTY(release, + "sourceUrl", + OneByteString(env->isolate(), NODE_RELEASE_SOURCE_URL)); +#endif + +#if defined(NODE_RELEASE_HEADERS_URL) + READONLY_PROPERTY(release, + "headersUrl", + OneByteString(env->isolate(), NODE_RELEASE_HEADERS_URL)); +#endif + +#if defined(NODE_RELEASE_LIB_URL) + READONLY_PROPERTY(release, + "libUrl", + OneByteString(env->isolate(), NODE_RELEASE_LIB_URL)); +#endif + // process.argv Local arguments = Array::New(env->isolate(), argc); for (int i = 0; i < argc; ++i) { diff --git a/src/node_version.h b/src/node_version.h index 9571c8344f9fdf..7c185c9a48a73e 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -5,7 +5,7 @@ #define NODE_MINOR_VERSION 0 #define NODE_PATCH_VERSION 5 -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) diff --git a/vcbuild.bat b/vcbuild.bat index 606ebf262a46d8..6c17fc4426d15f 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -36,6 +36,7 @@ set noperfctr_arg= set noperfctr_msi_arg= set i18n_arg= set download_arg= +set release_urls_arg= :next-arg if "%1"=="" goto args-done @@ -87,6 +88,10 @@ if "%i18n_arg%"=="full-icu" set i18n_arg=--with-intl=full-icu if "%i18n_arg%"=="small-icu" set i18n_arg=--with-intl=small-icu if "%i18n_arg%"=="intl-none" set i18n_arg=--with-intl=none +if defined RELEASE_SOURCE_URL set release_urls_arg=--release-source-url=%RELEASE_SOURCE_URL% +if defined RELEASE_HEADERS_URL set release_urls_arg=%release_urls_arg% --release-headers-url=%RELEASE_HEADERS_URL% +if defined RELEASE_LIB_URL set release_urls_arg=%release_urls_arg% --release-lib-url=%RELEASE_LIB_URL% + :project-gen @rem Skip project generation if requested. if defined noprojgen goto msbuild @@ -96,7 +101,7 @@ if defined NIGHTLY set TAG=nightly-%NIGHTLY% @rem Generate the VS project. SETLOCAL if defined VS100COMNTOOLS call "%VS100COMNTOOLS%\VCVarsQueryRegistry.bat" - python configure %download_arg% %i18n_arg% %debug_arg% %snapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG% + python configure %download_arg% %i18n_arg% %debug_arg% %snapshot_arg% %noetw_arg% %noperfctr_arg% %release_urls% --dest-cpu=%target_arch% --tag=%TAG% if errorlevel 1 goto create-msvs-files-failed if not exist node.sln goto create-msvs-files-failed echo Project files generated.