Update NOTICE in libphutil

Summary: See D9730.

Test Plan: reading

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9732
Add classes to Remarkup lists and headers

Summary:
Ref T5497. We have some Remarkup CSS rules like `.remarkup ul`, which are bleeding into ObjectLists inside `{Wxxx}` and similar.

Add explicit classes to headers and lists so we can scope the Remarkup rules more tightly.

Test Plan: This stuff is covered by a million billion unit tests.

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T5497

Differential Revision: https://secure.phabricator.com/D9756
Support BitBucket as an auth provider

Summary: Ref T4251. See D9760, which fixes the root issue. See D9202 for discussion.

Test Plan: Authenticated with BitBucket.

Reviewers: btrahan, asherkin

Reviewed By: asherkin

Subscribers: epriestley

Maniphest Tasks: T4251

Differential Revision: https://secure.phabricator.com/D9761
Test cases should extend from `PhutilTestCase`

Summary: Currently, a few test cases in rPHU extend from `ArcanistPhutilTestCase` instead of `PhutilTestCase`.

Test Plan: This is a really minor change, but the unit tests still pass of course.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9787
Various minor improvements to the `xsprintf` functions

Summary:
- Renamed `Phutil*sprintfTestCase` classes to use proper camel case.
- Added some type hints for function parameters, where appropriate.
- Use more specific (SPL) `Exception` types, where appropriate.
- Change `##` to `\`` in comments.
- Wrap functions in `@{function:...}` when they appear in comments.

Test Plan: `arc unit` still works.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9788
Allow Remarkup rules to assert that attributes do not contain tokens

Summary: Remarkup rules can not safely use arbitrary text in attributes, as it
may be replaced with tags during text restoration. Resolve this in two ways:
first, allow rules to assert that variables contain only flat text. The next
patch also adjusts rule priorities so that embed rules fire before link rules.

Auditors: btrahan
Add isFlatText() for performing remarkup flat text tests

Summary: Add a method which lets rules check if text is flat.

Auditors: btrahan
Alphabetize `.arclint` linters

Summary: I'm a bit OCD with this, but I find the `.arclint` file easier to read if the keys are in alphabetical order.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9802
Add a `PhutilAWSS3Future` class

Summary: Ref T5155. This doesn't do anything currently, but should allow us to perform S3 operations without the [[http://undesigned.org.za/2007/10/22/amazon-s3-php-class/ | Amazon S3 PHP Class]].

Test Plan: I'm not really sure how to test this... if you have any ideas then please let me know.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5155

Differential Revision: https://secure.phabricator.com/D9781
Rebuild library map

Summary: Rebuild library map after D9787.

Test Plan: I forgot to run `arc liberate` as a part of D9787.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9814
Move `PhutilLibraryMapBuilder` to `libphutil`

Summary: Move `scripts/phutil_rebuild_map.php` and the `PhutilLibraryMapBuilder` class from rARC to rPHU. The intention here is to create a stronger `ArcanistInfrastructureTestCase` acceptance test (and the corresponding acceptance tests for rP and rPHU) by regenerating the library map file (to a temporary output) and comparing it to the existing library map file. This will be able to catch the case in which a new class/function has been added to a library, but `arc liberate` has not been executed.

Test Plan:
```
> ./scripts/phutil_rebuild_map.php src
Finding source files...
Found 344 files.
Loading symbol cache...
Found 344 files in cache.
Building library map...
Writing map...
Done.
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9813
Move `PhutilBootloader` into the standard directory structure

Summary: Move `PhutilBootloader` and other related classes/functions into the standard directory structure. Whilst there is no compelling reason that we have to do this, it does make the code in `libphutil/src/__phutil_library_init__.php` a bit cleaner.

Test Plan: Verfied that `arc liberate` and `arc unit` still worked.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9818
Add an `appendPath` method to `PhutilURI`

Summary: This method would primarily be useful when you have a `PhutilURI` (which may or may not have a path) and you would like to define a path relative to the existing URI.

Test Plan: Wrote and executed unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9823
Add an `externals/includes` directory

Summary: Add an `externals/includes` directory that will be included as a part of PHP's `include_path`. Arcanist already has similar functionality. Without this, it is hard to invoke the `scripts/update_compat_info.php` script, which was moved from rARC to rPHU in D9813.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9821
Move `PhutilLibraryMapBuilder` into the standard directory structure

Summary: See D9818.

Test Plan: Made sure `arc liberate` still works.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9822
Improve the `PhutilInfrastructureTestCase` unit tests

Summary:
Improve the `PhutilInfrastructureTestCase` unit tests such that they will fail if any of the following conditions are satisfied:

- A symbol referenced in the `__phutil_library_map__.php` file no longer exists.
- A symbol exists in the library but is not referenced within the `__phutil_library_map__.php` file.
- A symbol extends from a different parent symbol than that declared in the `__phutil_library_map.php` file.

Test Plan: Added a new function. Ran `arc unit` and observed the test failure.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9824
Add a `phutil_get_current_library_name` function

Summary: See https://secure.phabricator.com/D9827?id=23585#inline-37952

Test Plan: Called the function from within `arcanist` and verified that `'arcanist'` was returned.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9828
Disregard `src/extensions/` when running library map unit tests

Summary:
The runtime map will include anything loaded via `src/extensions/`, which means the test will always fail if you have anything in that directory.

Instead, allow the base (no extensions) map to be retrieved, and use that for comparisions.

Test Plan:
  - Ran unit tests with stuff in extensions.
  - Verified stuff in extensions still works fine.

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9834
Minor change to `PhutilInfrastructureTestCase::testLibraryMap`

Summary: Modify `PhutilInfrastructureTestCase::testLibraryMap` to use `phutil_get_current_library_name()` instead of hard-coding the library name.

Test Plan: Ran `arc unit`, tests passed. Added a new function without running `arc liberate`, tests failed.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9844
Minor modification to `PhutilJSONParser` documentation

Summary: The `PhutilJSONParser` class is reasonably stable, we no longer need to advise against using it.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9853