crosspack 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/exe/crossbuild DELETED
@@ -1,76 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'optparse'
5
-
6
- begin
7
- require 'crossbuild'
8
- rescue LoadError
9
- require_relative '../lib/crossbuild'
10
- end
11
-
12
- def abort_with(message)
13
- warn message
14
- exit 1
15
- end
16
-
17
- options = { file: 'build.yaml', root: Dir.pwd, target: nil, version: nil, output_base: nil }
18
- parser = OptionParser.new do |opts|
19
- opts.banner = "crossbuild #{Crossbuild::VERSION} — cross-platform build orchestrator\n" \
20
- "Usage: crossbuild <command> [options]\n" \
21
- 'Commands: validate, matrix, version, build, targets'
22
-
23
- opts.on('-f', '--file PATH', 'path to build.yaml (default: ./build.yaml)') { |v| options[:file] = v }
24
- opts.on('--target ID', 'matrix entry to build, e.g. linux/amd64 (default: every host-buildable entry)') { |v| options[:target] = v }
25
- opts.on('--version VERSION', 'override the version scheme for build') { |v| options[:version] = v }
26
- opts.on('--root PATH', 'project root for relative paths (default: .)') { |v| options[:root] = v }
27
- opts.on('--output-base DIR', 'output directory (default: the manifest output, builds)') { |v| options[:output_base] = v }
28
- opts.on('-h', '--help', 'show help') do
29
- puts opts
30
- exit
31
- end
32
- end
33
- parser.parse!
34
-
35
- command = ARGV.shift
36
- abort_with 'No command given. See: crossbuild --help' if command.nil?
37
-
38
- # Positional file path: crossbuild validate path/to/build.yaml
39
- options[:file] = ARGV.shift if ARGV.first && !ARGV.first.start_with?('-')
40
-
41
- file = File.expand_path(options[:file], options[:root])
42
- begin
43
- manifest = Crossbuild::BuildManifest.load(file)
44
- rescue Crossbuild::InvalidManifestError => e
45
- abort_with e.message
46
- end
47
-
48
- case command
49
- when 'validate'
50
- puts manifest.error_report
51
- exit(manifest.valid? ? 0 : 1)
52
- when 'matrix'
53
- abort_with 'Schema is invalid — the matrix cannot be rendered. Run: crossbuild validate' unless manifest.valid?
54
- puts Crossbuild::Matrix.new(manifest).render
55
- when 'version'
56
- abort_with 'Schema is invalid. Run: crossbuild validate' unless manifest.valid?
57
- begin
58
- puts Crossbuild::VersionScheme.new(manifest.version).compute(root: options[:root])
59
- rescue Crossbuild::VersionScheme::Error => e
60
- abort_with e.message
61
- end
62
- when 'build'
63
- begin
64
- result = Crossbuild::Builder.new(manifest, root: options[:root], output_base: options[:output_base],
65
- version: options[:version]).run(entry_id: options[:target])
66
- rescue Crossbuild::Error, Crosspack::InvalidManifestError => e
67
- abort_with e.message
68
- end
69
- puts "\n📦 #{result.entries.size} entr#{result.entries.size == 1 ? 'y' : 'ies'} built, version #{result.version}"
70
- puts 'Pack with: crosspack pack --target <target> --version ' + result.version
71
- when 'targets'
72
- base = options[:output_base] || manifest.output
73
- puts Crosspack::Builds.report(File.expand_path(base, options[:root]))
74
- else
75
- abort_with "Unknown command #{command.inspect}. Available: validate, matrix, version, build, targets"
76
- end