This repository has been archived by the owner on Mar 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/0.5.5' * release/0.5.5: (42 commits) [version] bump to 0.5.5. targets: Update spec for searching for target files. spec: Correct order for checking au spec. ninja: Fix file loading for targets. au: Prevent loading of cmake.vim in diffmode. extension: give clang-tidy and clang-check proper args. target: Update spec. targets: Remove typo! commands: Remove typo. extension/gnumake: Remove unused variables. target: Patch up spec, more ambigious file detection. targets: Allow more files to be detected. targets: No need to inform about lack of files. commands: Prevent dups, cond execution. spec: Run rubocop. extension: Update specs. extension: add info + rubocop on syntastic. ctags: add TODO and run rubocop on spec. buffer: Add check for 'buftype', update spec. au: touch spec, drop check on 'buftype'. ...
- Loading branch information
Showing
40 changed files
with
486 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.1.3 | ||
2.1.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
require 'rspec/core/rake_task' | ||
|
||
RSpec::Core::RakeTask.new(:spec) do | t | | ||
RSpec::Core::RakeTask.new(:spec) do |t| | ||
t.pattern = 'spec/*spec.rb' | ||
end | ||
|
||
task :default => :spec | ||
task default: :spec | ||
|
||
desc 'Changes the version used in files so far.' | ||
task :bump_version do | ||
files = Dir.glob 'autoload/cmake/**.vim' | ||
files += [ 'plugin/cmake.vim', 'README.markdown', 'doc/cmake.txt', 'CONTRIBUTING.markdown'] | ||
files = Dir.glob 'autoload/cmake/**.vim' | ||
files += ['plugin/cmake.vim', 'doc/cmake.txt', '*.markdown'] | ||
|
||
files.each do | file | | ||
old_version = ENV['OLD_VERSION'] | ||
new_version = ENV['NEW_VERSION'] | ||
files.each do |_file| | ||
# old_version = ENV['OLD_VERSION'] | ||
# new_version = ENV['NEW_VERSION'] | ||
|
||
# TODO: Read in the data for the file. | ||
# TODO: Replace every occurance of OLD_VERSION with NEW_VERSION. | ||
# TODO: Write that information back to disk. | ||
end | ||
# TODO: Read in the data for the file. | ||
# TODO: Replace every occurance of OLD_VERSION with NEW_VERSION. | ||
# TODO: Write that information back to disk. | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
" Author: Jacky Alciné <[email protected]> | ||
" License: MIT | ||
" Website: https://jalcine.github.io/cmake.vim | ||
" Version: 0.5.4 | ||
" Version: 0.5.5 | ||
|
||
function s:add_specific_buffer_commands() | ||
augroup cmake.vim | ||
|
@@ -18,12 +18,15 @@ function! cmake#augroup#init() | |
augroup cmake.vim | ||
au! | ||
au VimEnter * call cmake#augroup#on_vim_enter() | ||
au FileReadPost * call cmake#augroup#on_file_read(fnamemodify("<afile>",":p")) | ||
au FileWritePost * call cmake#augroup#on_file_write() | ||
au FileType * call cmake#augroup#on_file_type("<amatch>") | ||
augroup END | ||
endfunction | ||
|
||
function! cmake#augroup#on_vim_enter() | ||
if &diff | ||
" We don't want cmake.vim doing any work in diff mode, it slows things down. | ||
endif | ||
" NOTE: This function should handle the initial loading of cmake.vim's | ||
" necessary data in order for it to operate properly. This includes the | ||
" following: | ||
|
@@ -37,46 +40,37 @@ function! cmake#augroup#on_vim_enter() | |
endfunction | ||
|
||
function! cmake#augroup#on_buf_enter() | ||
call cmake#util#echo_msg('Applying generic buffer options for this buffer...') | ||
call cmake#util#echo_msg('Refreshing local buffer variables & options...') | ||
call cmake#buffer#set_options() | ||
|
||
call cmake#util#echo_msg('Applying values for "&l:path"...') | ||
call cmake#path#refresh() | ||
|
||
call cmake#util#echo_msg('Applying values for "&l:makeprg"...') | ||
call cmake#makeprg#set_for_buffer() | ||
call cmake#util#echo_msg('Local buffer variables & options refreshed.') | ||
endfunction | ||
|
||
function! cmake#augroup#on_file_type(filetype) | ||
if !cmake#util#has_project() | ||
if !cmake#buffer#has_project() | ||
return | ||
endif | ||
|
||
call cmake#util#echo_msg('Applying generic buffer options for this buffer...') | ||
call cmake#buffer#set_options() | ||
|
||
if !exists('b:cmake_target') | ||
call cmake#util#echo_msg('No target found for this buffer.') | ||
return | ||
endif | ||
|
||
call cmake#util#echo_msg('Applying values for "&l:makeprg"...') | ||
call cmake#makeprg#set_for_buffer() | ||
|
||
call cmake#util#echo_msg('Applying values for "&path"...') | ||
call cmake#path#refresh() | ||
|
||
call cmake#util#echo_msg('Applying values for "&tags" (will generate if not existing)...') | ||
call cmake#ctags#refresh() | ||
|
||
call cmake#util#echo_msg('Applying values for "&flags"....') | ||
call cmake#flags#inject() | ||
if exists('b:cmake_target') | ||
call cmake#flags#inject() | ||
endif | ||
|
||
call s:add_specific_buffer_commands() | ||
doau BufEnter <abuf> | ||
redraw | ||
endfunction | ||
|
||
function! cmake#augroup#on_buf_write() | ||
call cmake#util#echo_msg('Applying values for "&tags" (will generate if not existing)...') | ||
call cmake#ctags#refresh() | ||
endfunction | ||
|
||
function! cmake#augroup#on_file_write() | ||
if exists('b:cmake_target') | ||
call cmake#targets#clear(b:cmake_target) | ||
endif | ||
|
||
call cmake#targets#cache() | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,27 +3,25 @@ | |
" Author: Jacky Alciné <[email protected]> | ||
" License: MIT | ||
" Website: https://jalcine.github.io/cmake.vim | ||
" Version: 0.5.4 | ||
|
||
" Public Function: cmake#buffer#has_project | ||
" Checks if the current buffer follows the following criteria: | ||
" - Has either the 'cpp' or 'c' formats applied. | ||
" - Does it exist in the file system. | ||
" - Check if this entire session has a CMake project associated with it. | ||
" Returns: '1' if this current buffer relates to a CMake project. '0' | ||
" otherwise. | ||
" Version: 0.5.5 | ||
|
||
" Public Function: cmake#buffer#has_project() | ||
" Checks if the current buffer lives under either the source or binary dir. | ||
" Returns: '1' if the current buffer exists under the CMake sources. | ||
" Returns: '0' if the current buffer does not exist under the CMake sources. | ||
func! cmake#buffer#has_project() | ||
if !empty(&buftype) | ||
return | ||
" Make sure this is a normal buffer. | ||
endif | ||
|
||
let l:current_file = expand('%:p') | ||
|
||
" Check if this file lives under the source or binary directory. | ||
let l:in_srcdir = (stridx(l:current_file, cmake#util#source_dir(), 0) == 0) | ||
let l:in_bindir = (stridx(l:current_file, cmake#util#binary_dir(), 0) == 0) | ||
|
||
if cmake#util#has_project() | ||
return l:in_bindir || l:in_srcdir | ||
endif | ||
|
||
return 0 | ||
return cmake#util#has_project() && (l:in_bindir || l:in_srcdir) | ||
endfunc | ||
|
||
" Public Function: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
" Author: Jacky Alciné <[email protected]> | ||
" License: MIT | ||
" Website: https://jalcine.github.io/cmake.vim | ||
" Version: 0.5.4 | ||
" Version: 0.5.5 | ||
|
||
function! cmake#cache#read_all() | ||
let l:vars_strings = readfile(cmake#util#binary_dir() . '/CMakeCache.txt') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
" Author: Jacky Alciné <[email protected]> | ||
" License: MIT | ||
" Website: https://jalcine.github.io/cmake.vim | ||
" Version: 0.5.4 | ||
" Version: 0.5.5 | ||
|
||
function! cmake#commands#build() | ||
call cmake#util#echo_msg('Building all targets...') | ||
|
@@ -25,7 +25,11 @@ function! cmake#commands#build_current() | |
if exists('b:cmake_target') | ||
call cmake#commands#invoke_target(b:cmake_target) | ||
else | ||
call cmake#util#echo_msg('No target recognized for this buffer.') | ||
if cmake#buffer#has_project() | ||
call cmake#commands#invoke_target('all') | ||
else | ||
call cmake#util#echo_msg('This buffer does not live in a CMake project.') | ||
end | ||
endif | ||
endfunc | ||
|
||
|
@@ -163,22 +167,24 @@ function s:cmake_clear_buffer_opts() | |
unlet b:cmake_binary_dir | ||
endif | ||
|
||
if exists('b:cmake_target')j | ||
if exists('b:cmake_target') | ||
unlet b:cmake_target | ||
endif | ||
endfunction | ||
|
||
function! s:cmake_print_info() | ||
if exists('b:cmake_target') | ||
let l:current_file = fnamemodify(expand('%'), ':p') | ||
let l:current_flags = filter(copy(b:cmake_flags), | ||
\ 'v:val =~ "-f" || v:val =~ "-W"') | ||
let l:current_flags = uniq(filter(copy(b:cmake_flags), | ||
\ 'v:val =~ "-f" || v:val =~ "-W"')) | ||
echo "CMake Info for '" . fnamemodify(l:current_file,':t') . "':\n" . | ||
\ "Target: " . b:cmake_target . "\n" . | ||
\ "Binary Directory: " . fnamemodify(b:cmake_binary_dir, ':p:.') . | ||
\ "\nSource Directory: " . fnamemodify(b:cmake_source_dir, ':p:.') . | ||
\ "\nFlags: " . join(l:current_flags, ', ') . "\n" . | ||
\ "Include Directories: " . join(b:cmake_include_dirs, ',') . "\n" | ||
\ "Libraries: " . join(b:cmake_libraries, ',') | ||
\ "Include Directories: " . join(uniq(copy(b:cmake_include_dirs)), ',') . "\n" | ||
\ "Libraries: " . join(uniq(copy(b:cmake_libraries)), ',') | ||
endif | ||
endfunction | ||
|
||
function! s:clean_then_build() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
" Author: Jacky Alciné <[email protected]> | ||
" License: MIT | ||
" Website: https://jalcine.github.io/cmake.vim | ||
" Version: 0.5.4 | ||
" Version: 0.5.5 | ||
|
||
func! s:get_tags() | ||
return &l:tags | ||
|
@@ -30,6 +30,7 @@ func! cmake#ctags#filename(target) | |
return simplify(cmake#ctags#cache_directory() . '/' . a:target . '.tags') | ||
endfunc | ||
|
||
" TODO: Allow user to add options for ctags. | ||
func! cmake#ctags#generate_for_target(target) | ||
let l:tag_file = cmake#ctags#filename(a:target) | ||
let l:files = cmake#targets#files(a:target) | ||
|
@@ -65,12 +66,12 @@ func! cmake#ctags#paths_for_target(target) | |
endfunc | ||
|
||
func! cmake#ctags#refresh() | ||
if exists('b:cmake_target') | ||
call s:set_tags(join(cmake#ctags#paths_for_target(b:cmake_target), ',')) | ||
endif | ||
for target in cmake#targets#list() | ||
call s:set_tags(join(cmake#ctags#paths_for_target(target), ',')) | ||
endfor | ||
endfunc | ||
|
||
func! cmake#ctags#wipe(target) | ||
let l:tag_file = cmake#ctags#filename(a:target) | ||
|
||
endfunc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
" Author: Jacky Alciné <[email protected]> | ||
" License: MIT | ||
" Website: https://jalcine.github.io/cmake.vim | ||
" Version: 0.5.4 | ||
" Version: 0.5.5 | ||
|
||
" A lot of magic happening here; that magic behind interpolation. | ||
func! s:get_default_ext(class, type) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
" Author: Jacky Alciné <[email protected]> | ||
" License: MIT | ||
" Website: https://jalcine.github.io/cmake.vim | ||
" Version: 0.5.4 | ||
" Version: 0.5.5 | ||
|
||
func! cmake#extension#dispatch#sync(command) | ||
execute 'Dispatch "' . a:command . '"<CR>' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,9 @@ | |
" Author: Jacky Alciné <[email protected]> | ||
" License: MIT | ||
" Website: https://jalcine.github.io/cmake.vim | ||
" Version: 0.5.4 | ||
" Version: 0.5.5 | ||
|
||
function! s:parse_target_depends(dependInfoCMakeFilePath, target) | ||
let l:bindir = cmake#targets#binary_dir(a:target) | ||
let l:srcdir = cmake#targets#source_dir(a:target) | ||
let l:dependContents = readfile(a:dependInfoCMakeFilePath) | ||
let l:objects = filter(l:dependContents, 'v:val =~ "\.o\"$"') | ||
|
||
|
@@ -22,9 +20,6 @@ function! s:parse_target_depends(dependInfoCMakeFilePath, target) | |
endfunc | ||
|
||
function! s:normalize_object_path(object_path, target) | ||
let l:bindir = cmake#targets#binary_dir(a:target) | ||
let l:srcdir = cmake#targets#source_dir(a:target) | ||
|
||
" TODO: Strip the surrounding whitespace. | ||
let l:object_path = substitute(a:object_path, ' "', '', '') | ||
let l:object_path = substitute(l:object_path, '"(\s+)$', '', '') | ||
|
Oops, something went wrong.