passenger 5.2.3 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG +13 -0
- data/CONTRIBUTORS +5 -1
- data/build/agent.rb +22 -2
- data/build/cxx_tests.rb +41 -5
- data/build/misc.rb +4 -1
- data/build/support/cxx_dependency_map.rb +1746 -908
- data/build/support/vendor/cxx_hinted_parser/CxxHintedParser.sublime-project +8 -0
- data/build/support/vendor/cxx_hinted_parser/Gemfile +5 -0
- data/build/support/vendor/cxx_hinted_parser/Gemfile.lock +30 -0
- data/{src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core → build/support/vendor/cxx_hinted_parser}/LICENSE.md +1 -1
- data/build/support/vendor/cxx_hinted_parser/README.md +95 -0
- data/build/support/vendor/cxx_hinted_parser/Rakefile +4 -0
- data/{src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/initialize.rb → build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser.rb} +2 -9
- data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser/parser.rb +239 -0
- data/dev/ci/README.md +15 -2
- data/dev/ci/lib/set-container-envvars.sh +6 -0
- data/dev/ci/lib/setup-container.sh +4 -1
- data/dev/ci/scripts/debug-console-wrapper.sh +3 -1
- data/dev/ci/setup-host +5 -0
- data/dev/ci/tests/binaries/Jenkinsfile +105 -0
- data/dev/ci/tests/binaries/build-linux +38 -0
- data/dev/ci/tests/binaries/build-macos +40 -0
- data/dev/ci/tests/binaries/prepare-macos +38 -0
- data/dev/ci/tests/binaries/test-linux +45 -0
- data/dev/ci/tests/binaries/test-macos +38 -0
- data/dev/ci/tests/debian/Jenkinsfile +2 -2
- data/dev/ci/tests/rpm/Jenkinsfile +1 -1
- data/dev/configkit-schemas/index.json +3 -24
- data/dev/vagrant/nginx_rakefile +0 -1
- data/package.json +15 -5
- data/resources/templates/error_renderer/.editorconfig +19 -0
- data/resources/templates/error_renderer/with_details/README.md +9 -0
- data/resources/templates/error_renderer/with_details/dist/bundle.js +33 -0
- data/resources/templates/error_renderer/with_details/dist/styles.css +17 -0
- data/resources/templates/error_renderer/with_details/src/DetailsView.jsx +52 -0
- data/resources/templates/error_renderer/with_details/src/GetHelpView.jsx +61 -0
- data/resources/templates/error_renderer/with_details/src/JourneyView.css +50 -0
- data/resources/templates/error_renderer/with_details/src/JourneyView.jsx +621 -0
- data/resources/templates/error_renderer/with_details/src/PageMain.css +114 -0
- data/resources/templates/error_renderer/with_details/src/PageMain.jsx +136 -0
- data/resources/templates/error_renderer/with_details/src/ProblemDescriptionView.jsx +14 -0
- data/resources/templates/error_renderer/with_details/src/ProcessDetailsView.jsx +56 -0
- data/resources/templates/error_renderer/with_details/src/SolutionDescriptionView.css +5 -0
- data/resources/templates/error_renderer/with_details/src/SolutionDescriptionView.jsx +15 -0
- data/resources/templates/error_renderer/with_details/src/SummaryView.jsx +35 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentView.css +34 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentView.jsx +168 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentsView.css +13 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentsView.jsx +116 -0
- data/resources/templates/error_renderer/with_details/src/Tab.jsx +12 -0
- data/resources/templates/error_renderer/with_details/src/Tabs.jsx +104 -0
- data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.css +3446 -0
- data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.js +293 -0
- data/resources/templates/error_renderer/with_details/src/bootstrap/config.json +401 -0
- data/resources/templates/error_renderer/with_details/src/index.html.template +22 -0
- data/resources/templates/error_renderer/with_details/src/index.jsx +23 -0
- data/resources/templates/error_renderer/with_details/webpack.config.js +47 -0
- data/resources/templates/error_renderer/without_details/dist/bundle.js +1 -0
- data/resources/templates/error_renderer/without_details/dist/styles.css +1 -0
- data/resources/templates/{undisclosed_error.html.template → error_renderer/without_details/src/index.html.template} +7 -11
- data/resources/templates/error_renderer/without_details/src/index.js +1 -0
- data/resources/templates/{error_layout.css → error_renderer/without_details/src/main.css} +5 -2
- data/resources/templates/error_renderer/without_details/webpack.config.js +42 -0
- data/src/agent/AgentMain.cpp +3 -3
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +13 -0
- data/src/agent/Core/ApplicationPool/Common.h +3 -4
- data/src/agent/Core/ApplicationPool/Context.h +27 -17
- data/src/agent/Core/ApplicationPool/Group.h +3 -1
- data/src/agent/Core/ApplicationPool/Group/InitializationAndShutdown.cpp +2 -12
- data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +55 -10
- data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/SpawningAndRestarting.cpp +13 -6
- data/src/agent/Core/ApplicationPool/Implementation.cpp +16 -100
- data/src/agent/Core/ApplicationPool/Options.h +8 -65
- data/src/agent/Core/ApplicationPool/Pool.h +4 -21
- data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +1 -60
- data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +10 -13
- data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +3 -8
- data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +2 -34
- data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Process.cpp +17 -12
- data/src/agent/Core/ApplicationPool/Process.h +146 -93
- data/src/agent/Core/ApplicationPool/Session.h +2 -2
- data/src/agent/Core/ApplicationPool/Socket.h +28 -27
- data/src/agent/Core/Config.h +1 -3
- data/src/agent/Core/ConfigChange.cpp +2 -4
- data/src/agent/Core/Controller.h +2 -8
- data/src/agent/Core/Controller/BufferBody.cpp +0 -2
- data/src/agent/Core/Controller/CheckoutSession.cpp +12 -24
- data/src/agent/Core/Controller/Config.h +1 -9
- data/src/agent/Core/Controller/ForwardResponse.cpp +0 -34
- data/src/agent/Core/Controller/Hooks.cpp +0 -7
- data/src/agent/Core/Controller/InitRequest.cpp +0 -43
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +0 -4
- data/src/agent/Core/Controller/Request.h +1 -35
- data/src/agent/Core/Controller/SendRequest.cpp +0 -32
- data/src/agent/Core/CoreMain.cpp +19 -32
- data/src/agent/Core/SpawningKit/Config.h +329 -55
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +369 -0
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h.cxxcodebuilder +307 -0
- data/src/agent/Core/SpawningKit/Context.h +211 -0
- data/src/agent/Core/SpawningKit/DirectSpawner.h +112 -122
- data/src/agent/Core/SpawningKit/DummySpawner.h +59 -20
- data/src/agent/Core/SpawningKit/ErrorRenderer.h +117 -0
- data/src/agent/Core/SpawningKit/Exceptions.h +1157 -0
- data/src/agent/Core/SpawningKit/Factory.h +24 -17
- data/src/agent/Core/SpawningKit/{BackgroundIOCapturer.h → Handshake/BackgroundIOCapturer.h} +48 -18
- data/src/agent/Core/SpawningKit/Handshake/Perform.h +1650 -0
- data/src/agent/Core/SpawningKit/Handshake/Prepare.h +582 -0
- data/src/agent/Core/SpawningKit/Handshake/Session.h +91 -0
- data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +100 -0
- data/src/agent/Core/SpawningKit/Journey.h +561 -0
- data/src/agent/Core/SpawningKit/PipeWatcher.h +41 -18
- data/src/agent/Core/SpawningKit/README.md +534 -0
- data/src/agent/Core/SpawningKit/Result.h +182 -7
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +69 -0
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h.cxxcodebuilder +110 -0
- data/src/agent/Core/SpawningKit/SmartSpawner.h +1027 -562
- data/src/agent/Core/SpawningKit/Spawner.h +70 -1134
- data/src/agent/Core/SpawningKit/UserSwitchingRules.h +3 -33
- data/src/agent/README.md +2 -3
- data/src/agent/Shared/ApiServerUtils.h +2 -3
- data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +932 -0
- data/src/agent/Watchdog/Config.h +1 -3
- data/src/agent/Watchdog/WatchdogMain.cpp +2 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +5 -0
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
- data/src/apache2_module/ConfigGeneral/ManifestGeneration.h +22 -13
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +5 -0
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +3 -0
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +13 -0
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +7 -0
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +13 -0
- data/src/cxx_supportlib/Constants.h +3 -1
- data/src/cxx_supportlib/Exceptions.h +0 -121
- data/src/cxx_supportlib/LoggingKit/Implementation.cpp +7 -6
- data/src/cxx_supportlib/LoggingKit/Logging.h +3 -1
- data/src/cxx_supportlib/Utils.cpp +42 -0
- data/src/cxx_supportlib/Utils.h +7 -0
- data/src/cxx_supportlib/Utils/IOUtils.cpp +58 -0
- data/src/cxx_supportlib/Utils/IOUtils.h +13 -0
- data/src/cxx_supportlib/Utils/JsonUtils.h +130 -23
- data/src/cxx_supportlib/Utils/ScopeGuard.h +9 -4
- data/src/cxx_supportlib/Utils/StrIntUtils.cpp +7 -0
- data/src/cxx_supportlib/Utils/StrIntUtils.h +1 -0
- data/src/cxx_supportlib/Utils/SystemTime.h +1 -1
- data/src/cxx_supportlib/Utils/Timer.h +1 -1
- data/src/cxx_supportlib/WebSocketCommandReverseServer.h +6 -4
- data/src/cxx_supportlib/vendor-copy/adhoc_lve.h +1 -0
- data/src/helper-scripts/node-loader.js +54 -59
- data/src/helper-scripts/rack-loader.rb +63 -60
- data/src/helper-scripts/rack-preloader.rb +125 -72
- data/src/helper-scripts/wsgi-loader.py +100 -43
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +120 -112
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +15 -8
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +142 -142
- data/src/nginx_module/ConfigGeneral/ManifestGeneration.c +26 -15
- data/src/nginx_module/ConfigGeneral/ManifestGeneration.h +3 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +76 -70
- data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +114 -99
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +170 -156
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +38 -35
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +5 -1
- data/src/ruby_supportlib/phusion_passenger.rb +5 -5
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +14 -1
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +8 -0
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +0 -3
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +0 -1
- data/src/ruby_supportlib/phusion_passenger/constants.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +646 -238
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +117 -95
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +0 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +5 -1
- data/src/ruby_supportlib/phusion_passenger/preloader_shared_helpers.rb +92 -69
- data/src/ruby_supportlib/phusion_passenger/public_api.rb +0 -17
- data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +0 -3
- data/src/ruby_supportlib/phusion_passenger/request_handler.rb +4 -5
- data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +0 -22
- metadata +64 -67
- data/resources/templates/error_layout.html.template +0 -86
- data/resources/templates/general_error.html.template +0 -1
- data/resources/templates/general_error_with_html.html.template +0 -1
- data/src/agent/Core/ApplicationPool/ErrorRenderer.h +0 -131
- data/src/agent/Core/SpawningKit/Options.h +0 -41
- data/src/agent/Core/UnionStation/Connection.h +0 -173
- data/src/agent/Core/UnionStation/Context.h +0 -536
- data/src/agent/Core/UnionStation/StopwatchLog.h +0 -147
- data/src/agent/Core/UnionStation/Transaction.h +0 -249
- data/src/agent/SpawnPreparer/SpawnPreparerMain.cpp +0 -208
- data/src/cxx_supportlib/UnionStationFilterSupport.cpp +0 -67
- data/src/cxx_supportlib/UnionStationFilterSupport.h +0 -1622
- data/src/nodejs_supportlib/phusion_passenger/log_express.js +0 -106
- data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +0 -202
- data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +0 -227
- data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +0 -448
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/CONFIG.md +0 -37
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Gemfile +0 -17
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Gemfile.lock +0 -59
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README-API.md +0 -5
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README.md +0 -117
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Rakefile +0 -115
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +0 -423
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +0 -238
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/connection.rb +0 -67
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +0 -281
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/lock.rb +0 -62
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/log.rb +0 -66
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/message_channel.rb +0 -157
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +0 -150
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/basics.rb +0 -199
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/controllers.rb +0 -187
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/misc.rb +0 -303
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/view_rendering.rb +0 -91
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +0 -396
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/spec_helper.rb +0 -279
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/time_point.rb +0 -39
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +0 -173
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +0 -177
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version.rb +0 -32
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +0 -44
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.example +0 -16
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +0 -20
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +0 -18
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/union_station_hooks_core.gemspec +0 -23
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile +0 -14
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile.lock +0 -45
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/LICENSE.md +0 -19
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/README.md +0 -104
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Rakefile +0 -160
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb +0 -200
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/action_controller_extension.rb +0 -45
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/action_view_subscriber.rb +0 -55
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_record_subscriber.rb +0 -41
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_benchmarkable_extension.rb +0 -47
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_cache_subscriber.rb +0 -79
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/exception_logger.rb +0 -57
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version.rb +0 -32
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version_data.rb +0 -44
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/union_station_hooks_rails.gemspec +0 -34
@@ -0,0 +1,30 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
awesome_print (1.6.1)
|
5
|
+
diff-lcs (1.2.5)
|
6
|
+
rake (11.1.2)
|
7
|
+
rspec (3.4.0)
|
8
|
+
rspec-core (~> 3.4.0)
|
9
|
+
rspec-expectations (~> 3.4.0)
|
10
|
+
rspec-mocks (~> 3.4.0)
|
11
|
+
rspec-core (3.4.4)
|
12
|
+
rspec-support (~> 3.4.0)
|
13
|
+
rspec-expectations (3.4.0)
|
14
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
15
|
+
rspec-support (~> 3.4.0)
|
16
|
+
rspec-mocks (3.4.1)
|
17
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
18
|
+
rspec-support (~> 3.4.0)
|
19
|
+
rspec-support (3.4.1)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
awesome_print
|
26
|
+
rake
|
27
|
+
rspec
|
28
|
+
|
29
|
+
BUNDLED WITH
|
30
|
+
1.11.2
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# Simple C++ parser utilizing comment hints
|
2
|
+
|
3
|
+
This is a simple library for extracting information from C++ source files:
|
4
|
+
|
5
|
+
* Class names.
|
6
|
+
* Containing fields names and their types.
|
7
|
+
|
8
|
+
C++ is hard to parse, so this library requires the developer insert hints into the C++ code in the form of comments.
|
9
|
+
|
10
|
+
The main use case for this library is to automatically generate source code for processing the fields in a class, e.g. code for serializing a class. Instead of manually writing code for serializing each field, use this library to analyze the class and to automatically generate such source code. For this kind of use case, inserting hints to aid parsing is an acceptable trade-off.
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
Insert hints into C++ source files as follows:
|
15
|
+
|
16
|
+
* Before each class, add a comment containing the text "- begin hinted parseable class -"
|
17
|
+
* After each class, add a comment containing the text "- end hinted parseable class -"
|
18
|
+
* Before each struct, add a comment containing the text "- begin hinted parseable struct -"
|
19
|
+
* After each struct, add a comment containing the text "- end hinted parseable struct -"
|
20
|
+
* Before each field, add a comment containing the text "@hinted_parseable"
|
21
|
+
|
22
|
+
Example:
|
23
|
+
|
24
|
+
~~~c++
|
25
|
+
// - begin hinted parseable class -
|
26
|
+
class Foo {
|
27
|
+
// @hinted_parseable
|
28
|
+
int field1;
|
29
|
+
|
30
|
+
// @hinted_parseable
|
31
|
+
int field2;
|
32
|
+
};
|
33
|
+
// - end hinted parseable class -
|
34
|
+
~~~
|
35
|
+
|
36
|
+
It doesn't matter whether the comment is multi-line or single-line. Both are supported. The comment may also contain any other arbitrary text; it won't interfere with parsing.
|
37
|
+
|
38
|
+
Parse the file with the following code:
|
39
|
+
|
40
|
+
~~~ruby
|
41
|
+
require 'cxx_hinted_parser'
|
42
|
+
|
43
|
+
parser = CxxHintedParser::Parser.load_file('file.cpp').parse
|
44
|
+
|
45
|
+
parser.structs.keys # => ['Foo']
|
46
|
+
parser.structs['Foo'].size # => 2
|
47
|
+
|
48
|
+
parser.structs['Foo'][0].type # => 'int'
|
49
|
+
parser.structs['Foo'][0].name # => 'field1'
|
50
|
+
|
51
|
+
parser.structs['Foo'][1].type # => 'int'
|
52
|
+
parser.structs['Foo'][1].name # => 'field2'
|
53
|
+
~~~~
|
54
|
+
|
55
|
+
### Error handling
|
56
|
+
|
57
|
+
The parser may encounter errors during parsing. Errors do not stop parsing; they are remembered so that you can handle them later. Access errors with the `#errors` method on the parser object.
|
58
|
+
|
59
|
+
Example:
|
60
|
+
|
61
|
+
~~~ruby
|
62
|
+
parser = CxxHintedParser::Parser.load_file('file_with_errors.cpp').parse
|
63
|
+
parser.has_errors? # => true
|
64
|
+
parser.errors.size # => 1
|
65
|
+
parser.errors[0].line # => 8
|
66
|
+
parser.errors[0].column # => 22
|
67
|
+
parser.errors[0].message # => "Unable to parse field name and type"
|
68
|
+
~~~
|
69
|
+
|
70
|
+
### Metadata
|
71
|
+
|
72
|
+
You can attach arbitrary metadata to a field by specifying them in the comments in the form of `@key value`. Metadata must appear *after* `@hinted_parseable`.
|
73
|
+
|
74
|
+
Example:
|
75
|
+
|
76
|
+
~~~c++
|
77
|
+
// - begin hinted parseable class -
|
78
|
+
class Foo {
|
79
|
+
// @hinted_parseable
|
80
|
+
// @author Joe
|
81
|
+
// @written_on 2016-05-22
|
82
|
+
// @serialize
|
83
|
+
int field1;
|
84
|
+
};
|
85
|
+
// - end hinted parseable class -
|
86
|
+
~~~
|
87
|
+
|
88
|
+
You can access the metadata in the parser through the `metadata` method:
|
89
|
+
|
90
|
+
~~~ruby
|
91
|
+
parser.structs['Foo'][0].metadata
|
92
|
+
# => { :author => "Joe",
|
93
|
+
# :written_on => "2016-05-22",
|
94
|
+
# :serialize => true }
|
95
|
+
~~~
|
@@ -1,5 +1,4 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2010-2015 Phusion Holding B.V.
|
1
|
+
# Copyright (c) 2016 Phusion Holding B.V.
|
3
2
|
#
|
4
3
|
# "Union Station" and "Passenger" are trademarks of Phusion Holding B.V.
|
5
4
|
#
|
@@ -21,10 +20,4 @@
|
|
21
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
21
|
# THE SOFTWARE.
|
23
22
|
|
24
|
-
|
25
|
-
if GC.respond_to?(:enable_stats)
|
26
|
-
GC.enable_stats
|
27
|
-
end
|
28
|
-
if defined?(GC::Profiler) && GC::Profiler.respond_to?(:enable)
|
29
|
-
GC::Profiler.enable
|
30
|
-
end
|
23
|
+
require File.expand_path(File.dirname(__FILE__) + '/cxx_hinted_parser/parser')
|
@@ -0,0 +1,239 @@
|
|
1
|
+
# encoding: binary
|
2
|
+
|
3
|
+
# Copyright (c) 2016 Phusion Holding B.V.
|
4
|
+
#
|
5
|
+
# "Union Station" and "Passenger" are trademarks of Phusion Holding B.V.
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
15
|
+
# all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
# THE SOFTWARE.
|
24
|
+
|
25
|
+
require 'strscan'
|
26
|
+
|
27
|
+
module CxxHintedParser
|
28
|
+
class Parser
|
29
|
+
STRUCT_BEGIN_HINT = /- ?begin hinted parseable (struct|class) ?-/
|
30
|
+
STRUCT_END_HINT = /- ?end hinted parseable (struct|class) ?-/
|
31
|
+
FIELD_HINT = /@hinted_parseable$/
|
32
|
+
ALL_HINTS = Regexp.union(STRUCT_BEGIN_HINT, STRUCT_END_HINT, FIELD_HINT)
|
33
|
+
|
34
|
+
attr_reader :structs
|
35
|
+
attr_reader :errors
|
36
|
+
|
37
|
+
def self.load_file(path)
|
38
|
+
File.open(path, 'rb') do |f|
|
39
|
+
Parser.new(f.read)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def initialize(str)
|
44
|
+
@str = str
|
45
|
+
@scanner = StringScanner.new(str)
|
46
|
+
@structs = {}
|
47
|
+
@errors = []
|
48
|
+
@newline_positions = [0]
|
49
|
+
end
|
50
|
+
|
51
|
+
def parse
|
52
|
+
index_line_endings
|
53
|
+
while !@scanner.eos?
|
54
|
+
matched = @scanner.skip_until(ALL_HINTS)
|
55
|
+
break if !matched
|
56
|
+
process_match
|
57
|
+
end
|
58
|
+
self
|
59
|
+
end
|
60
|
+
|
61
|
+
def has_errors?
|
62
|
+
!errors.empty?
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
Field = Struct.new(:type, :name, :metadata)
|
67
|
+
Error = Struct.new(:line, :column, :message)
|
68
|
+
|
69
|
+
def index_line_endings
|
70
|
+
pos = 0
|
71
|
+
@str.split("\n", -1).each do |line|
|
72
|
+
pos += line.size + 1
|
73
|
+
@newline_positions << pos
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def process_match
|
78
|
+
if @scanner.matched =~ STRUCT_BEGIN_HINT
|
79
|
+
process_struct_begin_hint
|
80
|
+
elsif @scanner.matched =~ STRUCT_END_HINT
|
81
|
+
process_struct_end_hint
|
82
|
+
else
|
83
|
+
process_field_hint
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def process_struct_begin_hint
|
88
|
+
if @current_struct
|
89
|
+
error 'Class/struct begin hint encountered, but previous class/struct begin hint was never ended'
|
90
|
+
end
|
91
|
+
|
92
|
+
process_until_end_of_comment
|
93
|
+
regex = /(class|struct)\s+(\w+)/m
|
94
|
+
if match = @scanner.scan_until(regex)
|
95
|
+
match =~ regex
|
96
|
+
@current_struct = $2
|
97
|
+
@structs[@current_struct] = []
|
98
|
+
else
|
99
|
+
error 'Unable to parse class/struct name'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def process_struct_end_hint
|
104
|
+
if @current_struct
|
105
|
+
@current_struct = nil
|
106
|
+
else
|
107
|
+
error 'Class/struct end hint encountered, but no corresponding class/struct begin hint was found'
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def process_field_hint
|
112
|
+
metadata = process_until_end_of_comment
|
113
|
+
@scanner.skip(/\s+/m)
|
114
|
+
begin_pos = @scanner.pos
|
115
|
+
|
116
|
+
regex = /(.+?)\s+(\**\w+(\[.*?\])*)(\s*:\s*\d+)?\s*;/m
|
117
|
+
if match = @scanner.scan(regex)
|
118
|
+
if match =~ /\//
|
119
|
+
# We skipped to the next comment, so something went wrong.
|
120
|
+
temporarily_set_pos(begin_pos) do
|
121
|
+
error 'Unable to parse field name and type'
|
122
|
+
end
|
123
|
+
else
|
124
|
+
match =~ regex
|
125
|
+
type = $1
|
126
|
+
name = $2
|
127
|
+
type, name = move_pointer_and_array_notations_to_type(type, name)
|
128
|
+
type = strip_attribute(type)
|
129
|
+
|
130
|
+
if @current_struct
|
131
|
+
@structs[@current_struct] << Field.new(type, name, metadata)
|
132
|
+
else
|
133
|
+
temporarily_set_pos(begin_pos) do
|
134
|
+
error 'Field hint encountered, but no corresponding class/struct begin hint was found'
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
else
|
139
|
+
error 'Unable to parse field name and type'
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def process_until_end_of_comment
|
144
|
+
begin_pos = @scanner.pos
|
145
|
+
|
146
|
+
# Skip until end of comment
|
147
|
+
@scanner.pre_match =~ /.*\n(.*)\Z/m
|
148
|
+
last_line = $1
|
149
|
+
if last_line =~ /^\s*\/\//
|
150
|
+
# Single-line comment
|
151
|
+
done = false
|
152
|
+
while !done
|
153
|
+
# Skip until next line
|
154
|
+
@scanner.skip_until(/\n/m)
|
155
|
+
# Is this also another comment? If so, continue looping
|
156
|
+
done = @scanner.post_match !~ /\A\s*\/\//
|
157
|
+
end
|
158
|
+
else
|
159
|
+
# Assume multi-line comment
|
160
|
+
@scanner.skip_until(/\*\//)
|
161
|
+
end
|
162
|
+
|
163
|
+
end_pos = @scanner.pos
|
164
|
+
|
165
|
+
# Extract all metadata from the location where
|
166
|
+
# we encountered `@hinted_parseable` until end
|
167
|
+
# of comment
|
168
|
+
metadata = {}
|
169
|
+
@str[begin_pos..end_pos].split("\n").each do |line|
|
170
|
+
if line =~ /^[\s\*\/]*@(\w+)(.*)$/
|
171
|
+
key = $1
|
172
|
+
value = $2.strip
|
173
|
+
if value.empty?
|
174
|
+
metadata[key.to_sym] = true
|
175
|
+
else
|
176
|
+
metadata[key.to_sym] = value
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
metadata
|
182
|
+
end
|
183
|
+
|
184
|
+
def strip_attribute(type)
|
185
|
+
type = type.gsub(/__attribute__\(.*?\)+/, '')
|
186
|
+
type.split(/\s+/).reject { |x| x.empty? }.join(' ')
|
187
|
+
end
|
188
|
+
|
189
|
+
def move_pointer_and_array_notations_to_type(type, name)
|
190
|
+
type = type.dup
|
191
|
+
name = name.dup
|
192
|
+
|
193
|
+
if name =~ /^(\*+)/
|
194
|
+
type << " #{$1}"
|
195
|
+
name.gsub!(/^\*+/, '')
|
196
|
+
end
|
197
|
+
if name =~ /(\[.*?\]+)$/
|
198
|
+
type << " #{$1}"
|
199
|
+
name.gsub!(/\[.*?\]+$/, '')
|
200
|
+
end
|
201
|
+
|
202
|
+
[type, name]
|
203
|
+
end
|
204
|
+
|
205
|
+
def temporarily_set_pos(pos)
|
206
|
+
current_pos = @scanner.pos
|
207
|
+
@scanner.pos = pos
|
208
|
+
begin
|
209
|
+
yield
|
210
|
+
ensure
|
211
|
+
@scanner.pos = current_pos
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def line_and_column(pos = @scanner.pos)
|
216
|
+
low = 0
|
217
|
+
high = @newline_positions.size - 1
|
218
|
+
while low <= high
|
219
|
+
mid = (low + high) / 2
|
220
|
+
if @newline_positions[mid] >= pos
|
221
|
+
high = mid - 1
|
222
|
+
else
|
223
|
+
low = mid + 1
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
if @newline_positions[low] == pos
|
228
|
+
[low + 1, pos - @newline_positions[low] + 1]
|
229
|
+
else
|
230
|
+
[high + 1, pos - @newline_positions[high] + 1]
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
def error(message)
|
235
|
+
line, column = line_and_column
|
236
|
+
@errors << Error.new(line, column, message)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
data/dev/ci/README.md
CHANGED
@@ -14,6 +14,8 @@ Invoke: dev/ci/setup-host
|
|
14
14
|
| +-- Relax file permissions (if in Jenkins)
|
15
15
|
| |
|
16
16
|
| +-- Create cache directories
|
17
|
+
| |
|
18
|
+
| +-- Create buildout directory
|
17
19
|
|
|
18
20
|
Invoke: dev/ci/run-tests-with-docker <test name>
|
19
21
|
|
|
@@ -40,6 +42,9 @@ Invoke: dev/ci/run-tests-with-docker <test name>
|
|
40
42
|
| |
|
41
43
|
| +-- Load: dev/ci/tests/<test name>/run
|
42
44
|
|
|
45
|
+
+-- (if docker-entrypoint-stage2.sh exited with an error)
|
46
|
+
| Populate buildout/testlogs
|
47
|
+
|
|
43
48
|
+-- (if docker-entrypoint-stage2.sh exited with an error,
|
44
49
|
| and DEBUG_CONSOLE is set to 0)
|
45
50
|
| Print error message and exit
|
@@ -63,6 +68,8 @@ Invoke: dev/ci/setup-host <test name>
|
|
63
68
|
| |
|
64
69
|
| +-- Create cache directories
|
65
70
|
| |
|
71
|
+
| +-- Create buildout directory
|
72
|
+
| |
|
66
73
|
| +-- Exec: dev/ci/scripts/debug-console-wrapper.sh dev/ci/scripts/setup-host-natively.sh <test name>
|
67
74
|
| |
|
68
75
|
| +-- Invoke: dev/ci/scripts/setup-host-natively.sh
|
@@ -81,11 +88,14 @@ Invoke: dev/ci/setup-host <test name>
|
|
81
88
|
| | |
|
82
89
|
| | +-- Load: dev/ci/tests/<test name>/setup
|
83
90
|
| |
|
84
|
-
| +-- (if setup-host exited with an error
|
91
|
+
| +-- (if setup-host-natively.sh exited with an error)
|
92
|
+
| | Populate buildout/testlogs
|
93
|
+
| |
|
94
|
+
| +-- (if setup-host-natively.sh exited with an error,
|
85
95
|
| | and DEBUG_CONSOLE is set to 0)
|
86
96
|
| | Print error message and exit
|
87
97
|
| |
|
88
|
-
| +-- (if setup-host exited with an error,
|
98
|
+
| +-- (if setup-host-natively.sh exited with an error,
|
89
99
|
| and DEBUG_CONSOLE is set to 1)
|
90
100
|
| |
|
91
101
|
| +-- Load: dev/ci/lib/set-container-envvars.sh
|
@@ -106,6 +116,9 @@ Invoke: dev/ci/run-tests-natively <test name>
|
|
106
116
|
| |
|
107
117
|
| +-- Load: dev/ci/tests/<test name>/run
|
108
118
|
|
|
119
|
+
+-- (if run-tests-natively-stage2.sh exited with an error)
|
120
|
+
| Populate buildout/testlogs
|
121
|
+
|
|
109
122
|
+-- (if run-tests-natively-stage2.sh exited with an error,
|
110
123
|
| and DEBUG_CONSOLE is set to 0)
|
111
124
|
| Print error message and exit
|