Skip to content

Commit

Permalink
Move cargo files to core/
Browse files Browse the repository at this point in the history
  • Loading branch information
ubolonton committed Aug 25, 2021
1 parent c7a1c34 commit 8fef456
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 38 deletions.
5 changes: 0 additions & 5 deletions .gitignore
@@ -1,7 +1,2 @@
/target
**/*.rs.bk
**/*.elc*
**/.cask

core/tsc-dyn.*
core/DYN-VERSION
14 changes: 0 additions & 14 deletions Cargo.toml

This file was deleted.

36 changes: 21 additions & 15 deletions bin/build
Expand Up @@ -5,24 +5,30 @@ set -euo pipefail
here=$(cd "$(dirname "$BASH_SOURCE")"; pwd)
source "$here/env.bash"

core_root="$PROJECT_ROOT/core"

(
cd "$PROJECT_ROOT"
cd "$core_root"

target=${1:-debug}
if [[ $target == "release" ]]; then
cargo build --all --release
else
cargo build --all
fi

module_dir="$PROJECT_ROOT/target/$target"
(
cd core
cp -f "$module_dir/$MODULE_ORIGINAL" "$MODULE_RENAMED"
version=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "$version".1 | tr -d $'\n' > DYN-VERSION
cask build
)
case $target in
(release)
cargo build --all --release
;;
(debug)
cargo build --all
;;
(*)
echo "Unknown target $target"
exit 1
esac

cp -f target/"$target/$MODULE_ORIGINAL" "$MODULE_RENAMED"
version=$(cargo pkgid | cut -d'#' -f2 | cut -d: -f2)
echo "$version".1 | tr -d $'\n' > DYN-VERSION
cask build
)
(
cd "$PROJECT_ROOT"
cask build
)
8 changes: 4 additions & 4 deletions bin/build.ps1
Expand Up @@ -4,22 +4,22 @@ $module_name = "tsc_dyn"
$module_renamed = $module_name.replace("_", "-")
$core_root = "$project_root\core"

Push-Location $project_root
Push-Location $core_root
$target = $args[0]

if ($target -eq "release") {
cargo build --all --release
} else {
$target = "debug"
cargo build --all
}
$module_dir = "$project_root\target\$target"

Push-Location $core_root
Copy-Item $module_dir\$module_name.dll $core_root\$module_renamed.dll
Copy-Item "target\$target\${module_name}.dll" "${module_renamed}.dll"
$version = ((cargo pkgid) | Out-String).Trim().Split('#')[-1].Split(':')[-1]
Set-Content -Path "DYN-VERSION" -Value "${version}.1" -NoNewLine -Force
cask build
Pop-Location

Push-Location $project_root
cask build
Pop-Location
File renamed without changes.
5 changes: 5 additions & 0 deletions core/.gitignore
@@ -0,0 +1,5 @@
**/*.rs.bk

tsc-dyn.*
DYN-VERSION
target/
File renamed without changes.
10 changes: 10 additions & 0 deletions core/Cargo.toml
Expand Up @@ -15,3 +15,13 @@ emacs = "0.17"
libloading = "0.7.0"
tree-sitter = "0.19.4"
once_cell = "1.7.2"

[profile.release]
opt-level = 3
lto = "thin"

[profile.release.build-override]
opt-level = 0

[patch.crates-io.tree-sitter]
git = "https://github.com/tree-sitter/tree-sitter"

0 comments on commit 8fef456

Please sign in to comment.