mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
83ee2d23b3
Instead of finding and compiling all .coffee/.cson files in script/copy-files-to-bundle, we now tell gyp how to do this for us. It works like this: 1. Rakefile invokes the new script/generate-sources-gypi script to generate sources.gypi. This file lists all the .coffee/.cson files in the src, static, and vendor directories, as well as a new compiled_sources_dir variable that specifies where the compiled versions of the files should be placed. 2. atom.gyp includes sources.gypi. 3. atom.gyp has a new target, generated_sources, which contains all the .coffee/.cson files, and uses two rules to tell gyp how to compile them. The rules invoke the new script/compile-coffee and script/compile-cson files once for each file. 4. gyp generates one Makefile for each rule to actually perform the compilation. 5. script/copy-files-to-bundle now takes the compiled_sources_dir variable as an argument, and copies files both from there and from the repository into the Resources directory. By putting the compilation into a different target, we can do it in parallel with compiling/linking our binaries. And gyp automatically runs make using -j$(sysctl -n hw.ncpu), so compilation of .coffee/.cson files happens in parallel, too. These changes reduce clean build time on my MacBook Pro from 55 seconds to 46 seconds.
33 lines
523 B
Bash
Executable File
33 lines
523 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
cd "$(dirname $0)/.."
|
|
|
|
DIRS="src static vendor"
|
|
|
|
find_files() {
|
|
find ${DIRS} -type file -name ${1}
|
|
}
|
|
|
|
file_list() {
|
|
while read file; do
|
|
echo " '${file}',"
|
|
done
|
|
}
|
|
|
|
cat > sources.gypi <<EOF
|
|
{
|
|
'variables': {
|
|
'compiled_sources_dir': '<(INTERMEDIATE_DIR)/atom-resources',
|
|
'compiled_sources_dir_xcode': '\${INTERMEDIATE_DIR}/atom-resources',
|
|
'coffee_sources': [
|
|
$(find_files '*.coffee' | file_list)
|
|
],
|
|
'cson_sources': [
|
|
$(find_files '*.cson' | file_list)
|
|
],
|
|
},
|
|
}
|
|
EOF
|