Skip to content

Commit

Permalink
Merge branch 'release/3.6.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
jcangas committed Dec 22, 2015
2 parents 9801b09 + 7cd348d commit a2d7983
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 26 deletions.
23 changes: 21 additions & 2 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,31 @@

== v3.6.0

== vendor:import
== Nueva opción prj:reset

Borra el out del proyecto

== Nueva opción vendor:tree MAX_LEVEL

Muestra el árbol de dependencias solo hasta un nivel máximo de profundidad.

Copia todo el contenido del .zip al directorio vendor, inlcuido el out si el zip lo contiene.
Util para revisar las dependencias directas (MAX_LEVEL = 0) o depurar las dependencias en general

== vendor:import

* Copia todo el contenido del .zip al directorio vendor, inlcuido el out si el zip lo contiene.
Ahora solo se envia salida al prj out durante vendor:make o vendor:build.

* fetch: optimizado:
** En lugar de descargar el import entero a memoria y luego crear el fichero
local en disco, la descarga se produce en bloques, lo que permite descargar ficheros grandes
con menos consumo de memoria.

** optimizada la opción -f. Esta opción borra la copia local del import en el cache, par forzar una
descarga fresca. Si el import aparecia varias veces en el árbol, se borraba cada vez, ahora solo se
borra la primera vez que aparece en el árbol, las siguientes apariciones, reusan la copia recien
descargada.

=== "build_as_copy" feature para vendor:build/make

Si el zip contiene un out, en lugar de invocar MSBuild, se copia la versión ya compilada en vendor al
Expand Down
2 changes: 1 addition & 1 deletion installer/delphivm.iss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# define VERSION "3.5.6"
# define VERSION "3.6.1"
[Setup]
AppName=DelphiVM
AppVersion={#VERSION}
Expand Down
54 changes: 41 additions & 13 deletions lib/delphivm/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def level

protected

def tree
foreach_do :tree, true
def tree(max_level)
foreach_do :tree, max_level, true
end

def proccess
Expand All @@ -78,13 +78,24 @@ def collect_dependences
@imports = sorted_imports
end

def foreach_do(method, owned = false)
def foreach_do(method, args = [], owned = false)
return unless method
imports.values.each do |importdef|
next if owned && importdef.script != self
importdef.send method
importdef.send method, *args
end
end

def satisfied(lib_tag)
lib_tag = lib_tag.to_sym
result = false
parent_result = false
result = true if @imports.has_key?(lib_tag) && @imports[lib_tag].satisfied?
parent_result = true if required_by && required_by.script.satisfied(lib_tag)
result ||= parent_result
#say "check #{level} satisfied #{lib_tag} = #{result};"
result
end
end

# Each import statement
Expand Down Expand Up @@ -114,6 +125,7 @@ def initialize(script, libname, libver, liboptions = {}, &block)
@source_uri = libopts[:uri] || Pathname(source) + lib_file
@ide_pkgs = []
@dependences_scriptname = Pathname(PRJ_IMPORTS + lib_tag + 'imports.dvm')
@satisfied = false
instance_eval(&block) if block
end

Expand All @@ -140,6 +152,10 @@ def dependences_script
@dependences_script
end

def satisfied?
@satisfied
end

private

def ide_install(*packages)
Expand Down Expand Up @@ -181,7 +197,8 @@ def proccess
destination = DVM_IMPORTS + idever
cache_folder = destination + lib_tag
exist = cache_folder.exist?
if exist && script.options.force?
already_in_tree = script.send(:satisfied, lib_tag)
if exist && script.options.force? && !already_in_tree
exist = false
FileUtils.remove_dir(cache_folder.win, true)
end
Expand All @@ -191,9 +208,11 @@ def proccess
say_status status, "#{destination.win}", :green

zip_file = download(source_uri, lib_file) unless exist
exist ||= zip_file
exist ? @satisfied = true : @satisfied = false
return if defined? Ocra

unzip(zip_file, destination) if zip_file
exist ||= zip_file
return unless exist
vendorize
ensure_dependences_script
Expand All @@ -207,7 +226,6 @@ def show_ide_install_report(report)
say_status :IDE, 'missing packages:', :red
say report[:fail].join("\n")
end
#say "[#{script.level}] Import #{lib_file} done!", [:blue, :bold]
end

def get_vendor_files
Expand Down Expand Up @@ -244,7 +262,7 @@ def install_vendor(link, target)
end
end

def tree
def tree(max_level)
if script.level == 0
indent = ''
else
Expand All @@ -263,7 +281,7 @@ def tree
say "#{idever} ", [ide_color, :bold]
end
say
dependences_script.send :tree
dependences_script.send(:tree, max_level) if (max_level > script.level)
end

def register(idever, pkg)
Expand All @@ -275,11 +293,21 @@ def download(source_uri, file_name)
to_here = DVM_TEMP + file_name
to_here.delete if to_here.exist?
pb = nil
start = lambda { |length| pb = ProgressBar.create(total: length, title: ' %9s ->' % 'download', format: '%t %J%% %E %B')}
progress = lambda { |s| pb.progress = s; pb.refresh }
start = lambda do |length|
pb = ProgressBar.create(total: length, title: ' %9s ->' % 'download', format: '%t %J%% %E %B')
end
progress = lambda do |s|
pb.progress = s
#pb.refresh
end
begin
content = open(source_uri, 'rb', content_length_proc: start, progress_proc: progress).read
File.open(to_here, 'wb') { |wfile| wfile.write(content)} unless defined? Ocra
open(source_uri, 'rb', content_length_proc: start, progress_proc: progress) do |reader|
File.open(to_here, 'wb') do |wfile|
while chunk = reader.read(1024)
wfile.write(chunk) unless defined? Ocra
end
end
end
rescue Exception => e
say_status :ERROR, e, :red
return nil
Expand Down
2 changes: 1 addition & 1 deletion lib/delphivm/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Delphivm
include VersionInfo
self.VERSION = "3.5.6"
self.VERSION = "3.6.1"
self.VERSION.file_name = __FILE__
end
9 changes: 9 additions & 0 deletions lib/dvm/project.thor
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@ class Project < BuildTarget
method_option :group, type: :string, aliases: '-g', default: self.configuration.build_args, desc: "Use BuildGroup", for: :make
method_option :group, type: :string, aliases: '-g', default: self.configuration.build_args, desc: "Use BuildGroup", for: :build

desc 'reset', 'erase prj out'
def reset
do_reset
end

protected

def do_reset
remove_dir(root_out_path)
end

def do_clean(idetag, cfg)
do_build_action(idetag, cfg, 'Clean')
end
Expand Down
16 changes: 9 additions & 7 deletions lib/dvm/vendor.thor
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@
prepare
end

desc 'tree', 'show dependencs tree. Use after import'
def tree
desc 'tree MAX_LEVEL', 'show dependencs tree. defaul MAX_LEVEL = 100'
def tree(max_level = 100)
silence_warnings do
DSL.load_dvm_script(PRJ_IMPORTS_FILE).send :tree
DSL.load_dvm_script(PRJ_IMPORTS_FILE).send(:tree, max_level.to_i)
end
end

Expand Down Expand Up @@ -149,17 +149,19 @@

def build_as_copy(lib_tag, ide_tag, action)
import_out_path = PRJ_IMPORTS + lib_tag + 'out' + ide_tag
return unless import_out_path.exist?
say_status(:WARN, "#{action} using #{import_out_path.relative_path_from PRJ_IMPORTS}", :yellow)
return false unless import_out_path.exist?
say_status(action.to_sym, "using imported #{import_out_path.relative_path_from PRJ_IMPORTS}", :yellow)
Pathname(import_out_path).glob('**/*.*').each do |file|
rel_route = file.relative_path_from(import_out_path)
dest_route = PRJ_ROOT + 'out' + ide_tag + rel_route
if action == 'Clean'
remove_file(dest_route, verbose: false)
elsif action == 'Make'
copy_file(file, dest_route, verbose: false, force: true)
else
copy_file(file, dest_route, verbose: false)
copy_file(file, dest_route, verbose: false, force: true)
end
end
true
return true
end
end
2 changes: 0 additions & 2 deletions spec/testPrj/imports.dvm
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ uses 'D210' do
import 'Summer', '1.2.1', uri: 'https://github.com/jcangas/SummerFW4D/releases/download/v1.2.1/Summer-1.2.1-D210.zip'
import "Dido", "0.9.4"
import "Lord", "0.9.4"
# using uri fails for security issues
import 'ics', '3.2.0', uri: 'http://git-lab.rido.es/infomedvendors/ics/repository/archive.zip?ref=v3.2.0'
end

uses 'D200' do
Expand Down

0 comments on commit a2d7983

Please sign in to comment.