222 Commits

Author SHA1 Message Date
Allan Odgaard
f89c042519 Remove CAPNP_BIN and assert that capnp can be found via PATH 2021-05-26 14:27:41 +02:00
Allan Odgaard
659254d2d1 Rave: Add ability to expand variables in files used as build arguments
Some build steps take input files that are not built per se, for example ‘codesign’ takes an entitlement property list, and the linker may take a text file to embed in the linked executable.

It is now possible to have these files go through variable expansion via the ‘expand’ command, for example:

    expand CS_ENTITLEMENTS "${dir}/Entitlements.plist"

This will run ‘Entitlements.plist’ through ‘bin/expand_variables’ and set ‘CS_ENTITLEMENTS’ to the resulting file.
2021-03-28 10:49:06 +02:00
Allan Odgaard
d4bb02981b Rave: More robust relaunch of the application built 2021-03-27 12:22:17 +01:00
Allan Odgaard
2624e59e2c Rave: Simplify code 2021-03-17 08:05:59 +01:00
Allan Odgaard
2b960ea97c Rave: Fix typo in variable name 2021-03-17 08:05:04 +01:00
Allan Odgaard
8adf0b3c92 Rave: Link rules are now dependent on files referenced in LN_FLAGS
For example if we link an executable with an embedded property list, then the linking step can be made dependent on the source property list by using a “${plist}” variable in LN_FLAGS set to “${dir}/info.plist” or similar.
2021-03-16 21:01:06 +01:00
Allan Odgaard
36e1d85c41 Rave: Fix issue with generated headers and universal builds
Generated Ragel and Cap’n Proto sources are required by both Intel and Arm targets, but as the output is the same, we cache and re-use the result from these transformations.

This however meant that our heuristic to find generated headers, and add these to the include path, would fail when we are receiving cached results (as we skip the intermediate, identical, steps).

We now return the intermediate steps from the cache, but mark them as duplicates, so that they can be stripped when generating the build file.

Not an ideal solution, but the real issue is really identifying generated headers, and getting these added to the include path.
2021-03-07 11:27:36 +01:00
Allan Odgaard
be513fc506 Rave: Support notarizing single executables
Executables can be notarized, although not stapled.

One can check the status of an executable using:

    spctl -a -vvv -t install /path/to/executable
2021-03-05 16:27:23 +01:00
Allan Odgaard
5784028ff3 Rave: Defines can now reference defines declared later in the file 2021-03-04 13:42:14 +01:00
Allan Odgaard
d769cee110 Rave: Make variable match regexp a global constant 2021-03-04 13:36:49 +01:00
Allan Odgaard
7e9426c57d Rave: Treat all values with a ‘${dir}/’ or ‘${HOME}/’ prefix as files
Previously we used a heuristic and if the value looked like a path, checked that it actually existed.

The new approach makes the rules simpler, avoids a file system check, and also ensures that non-existing files *will* become dependencies.

The latter is useful if they are generated by local.ninja, typos, or actually unmet dependencies.
2021-03-03 10:00:55 +01:00
Allan Odgaard
9075087fc7 Rave: Slightly more generalized handling of Cap’n Proto headers 2021-03-03 10:00:50 +01:00
Allan Odgaard
70d267158e Let bin/gen_build call ./configure to switch to new build file generator 2021-02-15 16:55:45 +01:00
Allan Odgaard
83d63659a6 Add script to extract single section from release notes 2021-02-15 16:01:50 +01:00
Allan Odgaard
5acdb25dc7 Update release notes script to no longer take new version as argument
Instead we just add one to the last number of last version.

With the new build system, the version of the build is extracted from the release notes, so this is the only source for the version number.
2021-02-15 16:01:50 +01:00
Allan Odgaard
e921af4e50 Add new build system 2021-02-15 16:01:50 +01:00
Allan Odgaard
0e27430e24 Remove “GetoptLong” usage comment in ruby scripts
This was used by GetoptLong but we switched to OptionParser in 2df7620b8d.

Also remove setting $KCODE (for ruby 1.8 compatibility).
2021-02-04 09:35:27 +01:00
Allan Odgaard
ba1c99f7bc build: Introduce CP_InfoPlist and move Info.plist files out of resources
Previously we would automatically pick up an Info.plist file copied using any of the CP_* keys, and both move it to the correct location (when belonging to target built) or ignore it, if we were copying it from an imported target.

To simplify the logic in the build system, it is however better to be explicit about this, also because we could actually want an Info.plist file among our copied files.
2021-01-24 10:38:54 +01:00
Allan Odgaard
edec8f1c67 Merge Info.plist and InfoPlist.strings variable expansion build rules 2021-01-24 09:33:57 +01:00
Allan Odgaard
5d77c2ad6a Call expand_variables with -o instead of redirecting stdout
The advantage is that using -o we do not need to write to a temporary file and then only if expand_variables exits successfully, overwrite output with temporary file.

This is only possible because we know that expand_variables does not touch the output file unless it succeeds. Updating the output file and failing would cause a rebuild to continue, as if the output had been successfully built.
2021-01-24 09:33:57 +01:00
Allan Odgaard
a482cd71af Add -o,--output option to bin/expand_variables 2021-01-24 09:33:57 +01:00
Allan Odgaard
bf19be721d fixup! Rename process_plist as it makes no assumption about input format 2021-01-24 09:33:57 +01:00
Allan Odgaard
6d188e41e5 build: Bump file date after copying file to build directory
Using /bin/cp with -p (preserve) appears to round down the modification date, so we can end up with a file in the build directory that appears older than the source.

We also remove -R since this command is never used with directories.
2021-01-17 14:06:36 +01:00
Allan Odgaard
978c5a32a2 build: Expand variables in InfoPlist.strings files
We previously did this for InfoPlist.vstrings files, but the changed extension was only a temporary workaround for not allowing multiple filters to run on a build input.
2021-01-17 14:06:36 +01:00
Allan Odgaard
918c4f3bb2 Make bin/expand_variables work with UTF-8/16BE/16LE
This is because we may want to use it with strings files, which must be in UTF-16 encoding.
2021-01-17 14:06:36 +01:00
Allan Odgaard
22918c50ef build: Do not disable filters after first “generator”
Previously we would only allow a filter when going from source to build directory, since the output base name is unchanged for a filter’s output, and would thus cause multiple targets with same output name.

Since we now add the generator’s name to the output path, this is no longer a problem.
2021-01-17 14:06:36 +01:00
Allan Odgaard
a8a84d394a build: Add “generator” name to output path when extension is unchanged
For example we have a “generator” that ensures our *.strings files are UTF-16, if this is applied to files already in the build directory, the output will now include the generator’s class name, to ensure we do not create a target with identical input and output paths.
2021-01-17 14:06:36 +01:00
Allan Odgaard
a55e557ae1 build: Catch exception raised when failing to delete old target
This can happen if the target is a directory, which should only be possible with the “tbz.bl” generator.
2021-01-17 14:06:36 +01:00
Allan Odgaard
4606fdefff Create default bundles archive in ninja file and store in build dir
Previously we would download and archive the default bundles as part of ./configure and place the result in our source directory, this however both pollutes the source directory with generated files, but also had the ./configure step actually do a partial build, since we need to build the ‘bl’ executable to download bundles.
2021-01-16 19:14:22 +01:00
Allan Odgaard
05ab01e857 Add build rule that expands variables in InfoPlist.vstrings files
The extension is converted to from ‘vstrings’ to ‘strings’ and it is saved as UTF-16. Ideally this would not introduce a new extension (and rely on the existing ‘strings’ filter to convert to UTF-16), but see previous commit for the technical limitation preventing this.

TARGET_NAME and YEAR are predefined variables.
2021-01-12 10:43:53 +01:00
Allan Odgaard
ae9bdf5d7b Rename process_plist as it makes no assumption about input format 2021-01-12 10:43:53 +01:00
Allan Odgaard
2c6a825a95 Fix usage summary for process_plist
Old text looks like copy/paste from somewhere else.
2021-01-12 10:43:53 +01:00
Allan Odgaard
4e922dde99 Disable transformations with unchanged paths for assets in build dir
This relates to the build system: Transformations that does not change file name are called filters, this could e.g. be converting UTF-8 to UTF-16 or converting a property list to binary representation (without changing extension).

This currently works when the filter is applied to a file in the source directory, as we write the result to the build directory, but if the input is already in the build directory, we would create a new output with the same path, which would result in a malformed build file (multiple targets generate the same file and/or cycles in the dependency graph).

As a workaround, we only allow filters to be applied to files in the source directory. But it would be nice to lift this limitation.
2021-01-12 10:43:53 +01:00
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