Skip to content

Commit 02ff388

Browse files
Vendor lib/molinillo (#663)
Commits the dependency code into this repository, as suggested in crystal-lang/crystal#15344 (comment). We're already doing the same in https://github.com/crystal-lang/crystal. This simplifies the build process. All code required for building shards is contained in this repository (except for Crystal stdlib). There's no need to bootstrap the initial installation of the molinillo dependency anymore.
1 parent cccd47a commit 02ff388

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2785
-35
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/.crystal
22
/.shards
3-
/lib
43
/bin/shards
54
/bin/shards.dwarf
65
/bin/shards.exe

Makefile

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ BINDIR ?= $(PREFIX)/bin
4646
MANDIR ?= $(PREFIX)/share/man
4747
INSTALL ?= /usr/bin/install
4848

49-
MOLINILLO_VERSION = $(shell $(CRYSTAL) eval 'require "yaml"; puts YAML.parse(File.read("shard.lock"))["shards"]["molinillo"]["version"]')
50-
MOLINILLO_URL = "https://github.com/crystal-lang/crystal-molinillo/archive/v$(MOLINILLO_VERSION).tar.gz"
51-
5249
# MSYS2 support (native Windows should use `Makefile.win` instead)
5350
ifeq ($(OS),Windows_NT)
5451
EXE := .exe
@@ -71,7 +68,7 @@ clean: ## Remove build artifacts
7168
clean: clean_docs
7269
rm -f bin/shards$(EXE)
7370

74-
bin/shards$(EXE): $(SOURCES) $(TEMPLATES) lib
71+
bin/shards$(EXE): $(SOURCES) $(TEMPLATES)
7572
@mkdir -p bin
7673
$(EXPORTS) $(CRYSTAL) build $(FLAGS) src/shards.cr -o "$@"
7774

@@ -103,21 +100,14 @@ test: test_unit test_integration
103100

104101
.PHONY: test_unit
105102
test_unit: ## Run unit tests
106-
test_unit: lib
103+
test_unit:
107104
$(CRYSTAL) spec ./spec/unit/ $(if $(skip_fossil),--tag ~fossil) $(if $(skip_git),--tag ~git) $(if $(skip_hg),--tag ~hg)
108105

109106
.PHONY: test_integration
110107
test_integration: ## Run integration tests
111108
test_integration: bin/shards$(EXE)
112109
$(CRYSTAL) spec ./spec/integration/
113110

114-
lib: shard.lock
115-
mkdir -p lib/molinillo
116-
$(SHARDS) install || (curl -L $(MOLINILLO_URL) | tar -xzf - -C lib/molinillo --strip-components=1)
117-
118-
shard.lock: shard.yml
119-
([ $(SHARDS) = false ] && touch $@) || $(SHARDS) update
120-
121111
man/%.gz: man/%
122112
gzip -c -9 $< > $@
123113

Makefile.win

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ SHARDS_CONFIG_BUILD_COMMIT := $(shell git rev-parse --short HEAD)
4848
SOURCE_DATE_EPOCH := $(shell git show -s --format=%ct HEAD)
4949
export_vars = $(eval export SHARDS_CONFIG_BUILD_COMMIT SOURCE_DATE_EPOCH)
5050

51-
MOLINILLO_VERSION = $(shell $(CRYSTAL) eval 'require "yaml"; puts YAML.parse(File.read("shard.lock"))["shards"]["molinillo"]["version"]')
52-
MOLINILLO_URL = "https://github.com/crystal-lang/crystal-molinillo/archive/v$(MOLINILLO_VERSION).tar.gz"
53-
5451
prefix ?= $(or $(ProgramW6432),$(ProgramFiles))\crystal## Install path prefix
5552
BINDIR ?= $(prefix)
5653

@@ -65,7 +62,7 @@ clean: ## Remove build artifacts
6562
clean:
6663
$(call RM,"bin\shards.exe")
6764

68-
bin\shards.exe: $(SOURCES) $(TEMPLATES) lib
65+
bin\shards.exe: $(SOURCES) $(TEMPLATES)
6966
@$(call MKDIR,"bin")
7067
$(call export_vars)
7168
$(CRYSTAL) build $(FLAGS) -o bin\shards.exe src\shards.cr
@@ -89,21 +86,13 @@ test: test_unit test_integration
8986

9087
.PHONY: test_unit
9188
test_unit: ## Run unit tests
92-
test_unit: lib
9389
$(CRYSTAL) spec $(if $(skip_fossil),--tag ~fossil )$(if $(skip_git),--tag ~git )$(if $(skip_hg),--tag ~hg ).\spec\unit
9490

9591
.PHONY: test_integration
9692
test_integration: ## Run integration tests
9793
test_integration: bin\shards.exe
9894
$(CRYSTAL) spec .\spec\integration
9995

100-
lib: shard.lock
101-
$(call MKDIR,"lib\molinillo")
102-
$(SHARDS) install || (curl -L $(MOLINILLO_URL) | tar -xzf - -C lib\molinillo --strip-components=1)
103-
104-
shard.lock: shard.yml
105-
if not "$(SHARDS)" == "false" $(SHARDS) update
106-
10796
.PHONY: help
10897
help: ## Show this help
10998
@setlocal EnableDelayedExpansion &\

README.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,6 @@ These requirements are only necessary for compiling Shards.
6767
Please refer to <https://crystal-lang.org/install/> for
6868
instructions for your operating system.
6969

70-
* `molinillo`
71-
72-
The shard `molinillo` needs to be in the Crystal path.
73-
It is available at <https://github.com/crystal-lang/crystal-molinillo>
74-
You can install it either with a pre-existing `shards` binary (running `shards install`)
75-
or just check out the repository at `lib/crystal-molinillo` (`make lib`).
76-
7770
* libyaml
7871

7972
On Debian/Ubuntu Linux you may install the `libyaml-dev` package.
@@ -90,9 +83,7 @@ These requirements are only necessary for compiling Shards.
9083
### Getting started
9184

9285
It is strongly recommended to use `make` for building shards and developing it.
93-
The [`Makefile`](./Makefile) contains recipes for compiling and testing. Building
94-
with `make` also ensures the source dependency `molinillo` is installed. You don't
95-
need to take care of this yourself.
86+
The [`Makefile`](./Makefile) contains recipes for compiling and testing.
9687

9788
Run `make bin/shards` to build the binary.
9889
* `release=1` for a release build (applies optimizations)

lib/.shards.info

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
version: 1.0
3+
shards:
4+
molinillo:
5+
git: https://github.com/crystal-lang/crystal-molinillo.git
6+
version: 0.2.0

lib/molinillo/.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*.cr]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 2
9+
trim_trailing_whitespace = true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Crystal CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
container:
11+
image: crystallang/crystal
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Install dependencies
16+
run: shards install
17+
- name: Run tests
18+
run: crystal spec

lib/molinillo/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/docs/
2+
/lib/
3+
/bin/
4+
/.shards/
5+
*.dwarf
6+
7+
# Libraries don't need dependency lock
8+
# Dependencies will be locked in applications that use them
9+
/shard.lock

lib/molinillo/.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "spec/fixture"]
2+
path = spec/fixture
3+
url = https://github.com/CocoaPods/Resolver-Integration-Specs

lib/molinillo/.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: crystal
2+
3+
# Uncomment the following if you'd like Travis to run specs and check code formatting
4+
# script:
5+
# - crystal spec
6+
# - crystal tool format --check

0 commit comments

Comments
 (0)