Commit Graph

189 Commits

Author SHA1 Message Date
Allan Odgaard
b96bfad7b2 Files with .mm.rl extension are now built as Objective-C++
Previously all .rl files would be built as C++.
2020-06-03 21:21:46 +07:00
Allan Odgaard
4f8a3e3aa4 Use longest suffix match when more than one build rule can build a file
For example we may specify a transform for ‘.rl → .cc’ and another for ‘.mm.rl → .mm’. For a file named ‘fsm.mm.rl’ the build system would use the first rule seen, now it will always pick the latter, as it matches more of the suffix.
2020-06-03 21:21:46 +07:00
Allan Odgaard
a36bc310d0 Usage text for the process_plist script was using a wrong program name 2020-05-30 08:55:22 +07:00
Allan Odgaard
b663d0b520 Support passing arguments to ragel via RAGEL_FLAGS
The default for ragel is to generate compact and flexible code, not an issue for our current use case (parsing only comments and strings in ASCII property lists) but in the future we may need to tweak the output as ragel will be used for other things.
2020-05-30 08:55:22 +07:00
Allan Odgaard
c41804c267 Let ninja run tests in the console pool
I think it will prevent multiple tests from being run in parallel, but when writing tests, we may produce a lot of output, that should not be buffered by ninja.

A future improvement could be to only use the console pool for the tests of the current target, but that will require two different rules to run tests.
2020-05-30 08:55:22 +07:00
Allan Odgaard
6d045e2fd7 Update URL schemes (mainly in comments) to use https 2020-05-22 21:48:09 +07:00
Allan Odgaard
fe6cc872f3 Ensure build directory exists 2020-04-30 19:44:09 +07:00
Allan Odgaard
c297fd4bbc Remove upload helper script as it was using a deprecated GitHub API
As a replacement we can use `hub release create --attach …`.
2020-04-18 15:22:13 +07:00
Allan Odgaard
4f43bf497c Use the ‘console’ pool to run executables
This avoids output buffering so is necessary for executables that produce output without immediately terminating.
2020-04-14 12:58:10 +07:00
Allan Odgaard
3d4b72c0ff Add own framework header paths to include path before third party
This is because third party framework headers are likely to be installed in directories with many other headers that can clash with some of our custom frameworks.

Closes #1441.
2020-02-28 12:54:02 +07:00
Allan Odgaard
aeec0874b3 Fix warning about invalid ERB trim mode
We don’t care about the trim mode as nobody is reading the generated HTML, but we have to supply something, previously we enabled everything, which is now giving an error despite the documentation saying that trim mode can be “one or more of the following modifiers”:

	%  enables Ruby code processing for lines beginning with %
	<> omit newline for lines starting with <% and ending in %>
	>  omit newline for lines ending in %>
	-  omit blank lines ending in -%>

It would seem that ‘<>’ is mutually exclusive with ‘-’ so now we pass ‘%-’ for trim mode.
2019-12-26 23:20:48 +07:00
Allan Odgaard
504a42307e Passing ‘-deep’ to code sign should no longer be necessary
This is because we ensure that each target copied to another target, gets signed before we copy it.

We initially used ‘-deep’ but that actually never worked fully, as it didn’t find all executables in our bundle, presumably only embedded bundles like frameworks and plug-ins were found and signed.
2019-11-01 08:46:20 +01:00
Allan Odgaard
07e9e1c65e Make signing depend on the (potential) entitlements file 2019-10-06 11:06:57 +02:00
Allan Odgaard
d5d017ea88 Use git’s ‘--reverse’ option instead of ‘tail -r’
This avoids an extra process but also removes a dependency on BSD’s tail command, as support for ‘-r’ is not a POSIX requirement.
2019-09-15 16:20:40 +02:00
Allan Odgaard
360af637e2 Call /bin/cp directly instead of going via PATH
This is because we rely on `-X` (skip extended attributes / resource forks) which is only available with Apple’s version of `cp`, and it is not unlikely that the user has GNU’s version of `cp` available via PATH.
2019-09-12 17:40:51 +02:00
Allan Odgaard
a6ac1b9bf7 Make commands used during build relative to __FILE__ 2019-08-25 14:13:16 +02:00
Allan Odgaard
16c4239393 Do not pass builddir/ninja_required_version as variables to generator
This is to avoid redundancy as ninja_required_version is hardcoded in the generator script and builddir is already passed via the --build-directory/-C option (and explicitly exported as a variable in the generator script).
2019-08-01 10:49:55 +02:00
Allan Odgaard
328c5bdca7 Revert "No need to explicitly set builddir as it’s already among our variables"
There may be situations in which the user already have (generated) ninja build files which do not match our assertions.

This reverts commit b42cbb1f7e.
2019-08-01 10:46:05 +02:00
Allan Odgaard
e155e6810a Re-add target to (build and) run non-bundled executables 2019-08-01 10:02:55 +02:00
Allan Odgaard
75be599e48 Do not set any targets as default in the generated build file 2019-07-19 16:45:18 +02:00
Allan Odgaard
9c51080d15 Add «target»/tests to run all tests for «target» or its dependencies 2019-07-19 16:42:44 +02:00
Allan Odgaard
af91d39be5 Generate build rules for tests but do not depend on the tests passing 2019-07-16 20:27:21 +02:00
Allan Odgaard
2bc982dfd8 Refactor bin/gen_build 2019-07-16 20:24:07 +02:00
Allan Odgaard
b42cbb1f7e No need to explicitly set builddir as it’s already among our variables 2019-07-16 19:42:29 +02:00
Allan Odgaard
4e6e765e5f Update CxxTest 2019-07-16 19:42:29 +02:00
Allan Odgaard
c920035f99 Variables from ./configure are now in the “local” (bootstrap) build file
This seems like a logical separation, as the build directory now contains things 100% generated, whereas the “local” build file has variables that came from the original ./configure step and may be edited.
2019-07-16 12:05:11 +02:00
Allan Odgaard
608c53a423 Refactor bin/gen_build 2019-07-16 12:02:16 +02:00
Allan Odgaard
d8fcf27cb5 Fix test for whether or not we have default targets 2019-07-16 11:53:48 +02:00
Allan Odgaard
72bf77c2e5 Handle a failing ‘xcrun altool --notarization-info’ gracefully
We now write the captured output to stderr and retry after 10 seconds.
2019-07-16 09:18:43 +02:00
Allan Odgaard
72f4b7447e Do not hardcode code signing flags in bin/gen_build 2019-07-13 08:49:45 +02:00
Allan Odgaard
ba60e7091d Use flat_map instead of map { … }.flatten 2019-07-10 20:32:40 +02:00
Allan Odgaard
116e5e9a6c Check that build files do not reference unknown targets 2019-07-07 20:52:50 +02:00
Allan Odgaard
f7aef9b2b0 Fix syntax error in (ninja) relaunch app build rule 2019-07-06 17:28:40 +02:00
Allan Odgaard
0d18d5b88f Bump modification date of files copied to build directory
This is required because copying an executable to the build directory now depends on its signature, but the signature’s date is always newer (or same) as the executable being copied, which leads to the target being considered out-of-date and thus rebuilt (copied again).
2019-07-04 10:58:54 +02:00
Allan Odgaard
d5cae62621 Rework small part of build script to be less redundant
It’s the same number of lines, but it feels better to me, as the logic/processing is not repeated for each type of compiler argument.
2019-07-04 10:58:01 +02:00
Allan Odgaard
bb772913c9 Variables from target file take precedence over command arguments (-D)
This may seem non-standard but since presence of a variable in our target file will drop a potential -D when, it does not make sense to have -D take precedence over what is in the target file.
2019-06-30 10:32:45 +02:00
Allan Odgaard
91b67f36c1 Skip passing variables to gen_build that are declared in our target file
This is to automatically drop variables that are moved from ./configure to our main target, e.g. APP_MIN_OS.
2019-06-30 10:32:45 +02:00
Allan Odgaard
68ec5e42a1 Cycles in our build dependencies could result in an incorrect build file 2019-06-29 16:36:25 +02:00
Allan Odgaard
260fad0c3f Make all variables in root target file available to ninja commands
Ideally we would have a section with “public” variables, but that will require making the format more complex, so for now, everything gets declared as a variable in the ninja build file, even though for now, we really just need to export APP_MIN_OS.
2019-06-29 15:05:48 +02:00
Allan Odgaard
6a8eb992fc Add to_h method to Context
This converts the context object to a hash with all (merged) values.
2019-06-29 15:01:20 +02:00
Allan Odgaard
9511926afc Use $args instead of $FLAGS in ninja commands
This is to avoid confusion with the compiler $FLAGS variable.
2019-06-29 15:00:05 +02:00
Allan Odgaard
27a7dd8815 Add some optional build rules for notarization/release notes
These can be included from a potential $USER.ninja file.
2019-06-29 14:12:29 +02:00
Allan Odgaard
e92d6aaac2 Broaden regex to match version strings in release notes 2019-06-29 07:24:21 +02:00
Allan Odgaard
224554f6a2 Let built bundles be phony targets in build file
The signature step takes the bundle as input and therefore depends on this, but if the bundle does not already exist, ninja will (correctly) complain that there is no rule to create it.

For bundles the sequence is now the following:

- Copy/run depends on signature
- Signature depends on bundle
- Bundle depends on linked executable and all resources
2019-06-27 11:20:48 +02:00
Allan Odgaard
412e6798ca Update build generator script
This changes a bunch of things:

1. Each framework now creates its own include directory for exported headers, and any target linking with this framework, gets that directory added to its include search path. This ensures deterministic behavior, unlike previously where a single shared directory was used, so even if target A did not explicitly link with target B, there was a reasonable chance that target B’s headers would be available when target A was built.

2. There is a new IMPORT keyword to indicate that a target depends on the headers of another framework but does not want to link with it. For example the `commit` shell command imports headers from the CommitWindow framework (related to their communications protocol) but linking with the CommitWindow framework would not be practical (as that would bring in all the resources of the CommitWindow).

3. All embedded targets are signed before being copied to their destination.

4. A new CS_ENTITLEMENTS keyword allows specifying `codesign` entitlements. Currently the hardened runtime is enabled, although this does make development problematic, as modifying files of a running instance (as done during rebuild) can cause TextMate to crash with EXC_BAD_ACCESS (Code Signature Invalid). Worse though, it seems the system has a cache of blacklisted executables indexed by inode. So if e.g. the embedded `mate` executable gets blacklisted, one has to manually remove and rebuild it, before it gets possible to use it again (by default, rebuilding causes the inode to be re-used, but I may change the build system to unlink before copy).

5. The build file no longer contains rules related to deployment. Instead variables are declared that a user build file can reference to extend the build with notarization/deployment rules (without having to hardcode build directory paths).

6. The code has been made modular with a Compiler super class that is subclassed to add support for file transformations (xib, ragel, asset catalogs, etc.) and a transformed file can have its own settings.

7. If target A links with target B, the linker flags of target B will now be included when linking target A.

8. Currently no indexing of help books. Unsure if this is actually useful.

9. Previously it was possible to have umbrella targets that would not generate any output, but just change settings for their sub-targets. This is no longer supported, as the implementation was arcane. I would like to introduce a different system for managing sectioned settings. Related to this; settings in target files are now always merged, regardless of whether using ‘=’ or ‘+=’.
2019-06-26 23:32:19 +02:00
Allan Odgaard
f92d36571a Use DISPATCH_APPLY_AUTO instead of explicit global queue
This is “strongly recommended” (according to `man dispatch_apply`) and should work on 10.9 and later (according to a WWDC session).
2018-11-12 19:15:12 +07:00
Ronald Wampler
62ee2f94be Add support for building Asset Catalogs
We compile all assets into one file that resides in the main app bundle so while we can have multiple asset catalogs (per Framework, etc.), individual assets should still be namespaced.
2018-10-28 12:12:04 +07:00
Allan Odgaard
8e186231fd Fix typo in bin/gen_build 2018-10-28 12:09:12 +07:00
Paul Collins
108b99149c Handle rate-limiting when using GitHub’s API to obtain author emails 2018-02-06 17:14:40 +07:00
Paul Collins
d00a5cd4a0 Create credits database file’s enclosing directory as necessary 2018-02-06 17:11:31 +07:00