diff --git a/.gitignore b/.gitignore index cd2e7068..2e8f3d8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,2 @@ -/target -**/*.rs.bk **/*.elc* **/.cask - -core/tsc-dyn.* -core/DYN-VERSION diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index 3c42c434..00000000 --- a/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[workspace] -members = [ - "core", -] - -[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" diff --git a/bin/build b/bin/build index a34bba86..135e5461 100755 --- a/bin/build +++ b/bin/build @@ -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 ) diff --git a/bin/build.ps1 b/bin/build.ps1 index c72efa30..7c32a88b 100644 --- a/bin/build.ps1 +++ b/bin/build.ps1 @@ -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 diff --git a/.cargo/config.toml b/core/.cargo/config.toml similarity index 100% rename from .cargo/config.toml rename to core/.cargo/config.toml diff --git a/core/.gitignore b/core/.gitignore new file mode 100644 index 00000000..7defa2c2 --- /dev/null +++ b/core/.gitignore @@ -0,0 +1,5 @@ +**/*.rs.bk + +tsc-dyn.* +DYN-VERSION +target/ diff --git a/Cargo.lock b/core/Cargo.lock similarity index 100% rename from Cargo.lock rename to core/Cargo.lock diff --git a/core/Cargo.toml b/core/Cargo.toml index f061f7e9..c613621b 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -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"