-
Notifications
You must be signed in to change notification settings - Fork 191
/
Copy pathimport-prism.sh
executable file
·59 lines (45 loc) · 1.37 KB
/
import-prism.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
set -x
set -e
PRISM=../../prism
function create_generated_files() {
pushd $PRISM
bundle
bundle exec rake clobber
bundle exec rake templates
popd
}
# Copy C files and Makefile
function copy_c_files_and_makefile() {
to="$1"
rm -rf "$to"
mkdir "$to"
cp -R $PRISM/{include,src} "$to"
cp $PRISM/{LICENSE.md,Makefile} "$to"
}
# 1. Copy Prism files for the TruffleRuby parser
export PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS=1
create_generated_files
copy_c_files_and_makefile src/main/c/yarp
# Copy .java files
rm -rf src/yarp/java
cp -R $PRISM/java src/yarp/java
# 2. Copy Prism files for the default gem
unset PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS
create_generated_files
copy_c_files_and_makefile src/main/c/prism-gem
# Copy .rb files
cp -R $PRISM/lib/* lib/mri
# Copy MRI tests (and override existing Prism's ones)
rm -rf test/mri/tests/prism
cp -R $PRISM/test/prism test/mri/tests/
# Create and copy default gem gemspec
pushd $PRISM
gem build prism.gemspec -o prism.gem
gem spec prism.gem --ruby > prism.generated.gemspec
VERSION=$(ruby -e 'puts File.read("prism.generated.gemspec")[/stub: prism ([\d\.]+)/, 1]')
popd
rm lib/gems/specifications/default/prism-*.gemspec # remove a gemspec of the previous version
cp $PRISM/prism.generated.gemspec "lib/gems/specifications/default/prism-$VERSION.gemspec"
rm $PRISM/prism.generated.gemspec
rm $PRISM/prism.gem