206 Commits

Author SHA1 Message Date
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
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