Skip to content

Commit 7630597

Browse files
author
Kareem Zidane
authored
Merge pull request #23 from cs50/develop
v2.0.1
2 parents 7fd7d81 + eb2ea19 commit 7630597

13 files changed

Lines changed: 138 additions & 87 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
!.travis.yml
44
build/
55
docs/
6+
debian/changelog
7+
debian/*.log

.travis.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
language: java
2-
script: make build
2+
dist: trusty
3+
sudo: required
4+
before_install: sudo apt-get install build-essential debhelper devscripts dh-make lintian
5+
install: true
6+
before_script: echo -e $GPG_SECRET | gpg --import
7+
script: make deb
38
before_deploy: make docs
49
deploy:
5-
provider: pages
10+
- provider: script
11+
script: 'curl --fail --data "{ \"tag_name\": \"v$(make version)\",
12+
\"target_commitish\": \"$TRAVIS_COMMIT\", \"name\": \"v$(make version)\"
13+
}" --user bot50:$GITHUB_TOKEN https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases'
14+
on:
15+
branch: master
16+
- provider: script
17+
script: dput ppa:cs50/ppa build/deb/*.changes
18+
skip_cleanup: true
19+
on:
20+
branch: master
21+
- provider: pages
622
local_dir: docs
723
name: bot50
824
email: bot@cs50.harvard.edu

Makefile

Lines changed: 29 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,41 @@
1-
DESCRIPTION = CS50 Library for Java
2-
MAINTAINER = CS50 <sysadmins@cs50.harvard.edu>
3-
OLD_NAME = lib50-java
4-
NAME = libcs50-java
5-
VERSION = 2.0.0
6-
7-
BUILD_DIR = build
8-
DEB_DIR = $(BUILD_DIR)/deb
9-
DOCS_DIR = docs
10-
JAR_DIR = $(BUILD_DIR)/usr/java/packages/lib/ext
11-
PACMAN_DIR = $(BUILD_DIR)/pacman
12-
RPM_DIR = $(BUILD_DIR)/rpm
13-
14-
.PHONY: all
15-
all: clean deb pacman rpm
16-
17-
.PHONY: bash
18-
bash:
19-
docker run -i --rm -t -v "$(PWD):/root" cs50/cli
1+
DESTDIR ?= /usr/local/share/java
2+
VERSION = 2.0.1
203

214
.PHONY: build
225
build: clean Makefile src/edu/harvard/CS50.java
23-
mkdir -p "$(JAR_DIR)"
24-
javac -d "$(BUILD_DIR)" src/edu/harvard/CS50.java
25-
jar cvf "$(JAR_DIR)/cs50.jar" -C "$(BUILD_DIR)" .
26-
find "$(BUILD_DIR)" -type d -exec chmod 0755 {} +
27-
find "$(BUILD_DIR)" -type f -exec chmod 0644 {} +
6+
mkdir -p build/usr/share/java
7+
javac -d build src/edu/harvard/CS50.java
8+
cp src/edu/harvard/CS50.java build/edu/harvard
9+
jar cvf build/usr/share/java/cs50.jar -C build .
2810

2911
.PHONY: clean
3012
clean:
31-
rm -rf "$(BUILD_DIR)"
13+
rm -rf build libcs50-java* libcs50-java_*
3214

3315
.PHONY: deb
3416
deb: build
35-
mkdir -p "$(DEB_DIR)"
36-
fpm \
37-
-C "$(BUILD_DIR)" \
38-
-m "$(MAINTAINER)" \
39-
-n "$(NAME)" \
40-
-p "$(DEB_DIR)" \
41-
-s dir \
42-
-t deb \
43-
-v "$(VERSION)" \
44-
--conflicts $(OLD_NAME) \
45-
--provides $(OLD_NAME) \
46-
--replaces $(OLD_NAME) \
47-
--deb-no-default-config-files \
48-
--depends java7-runtime \
49-
--description "$(DESCRIPTION)" \
50-
usr
17+
@echo "libcs50-java ($(VERSION)-0ubuntu1) trusty; urgency=low" > debian/changelog
18+
@echo " * v$(VERSION)" >> debian/changelog
19+
@echo " -- CS50 Sysadmins <sysadmins@cs50.harvard.edu> $$(date --rfc-2822)" >> debian/changelog
20+
mkdir -p libcs50-java-$(VERSION)
21+
rsync -a build/usr libcs50-java-$(VERSION)
22+
tar -cvzf libcs50-java_$(VERSION).orig.tar.gz libcs50-java-$(VERSION)
23+
cp -r debian libcs50-java-$(VERSION)
24+
cd libcs50-java-$(VERSION) && debuild -S -sa --lintian-opts --display-info --info --show-overrides
25+
mkdir -p build/deb
26+
mv libcs50-java* build/deb
5127

5228
.PHONY: docs
5329
docs:
54-
rm -rf $(DOCS_DIR)
55-
javadoc -d "$(DOCS_DIR)" -linkoffline https://docs.oracle.com/javase/8/docs/api/ https://docs.oracle.com/javase/8/docs/api/ -sourcepath src edu.harvard
56-
57-
# TODO: add dependencies
58-
.PHONY: pacman
59-
pacman: build
60-
mkdir -p "$(PACMAN_DIR)"
61-
fpm \
62-
-C "$(BUILD_DIR)" \
63-
-m "$(MAINTAINER)" \
64-
-n "$(NAME)" \
65-
-p "$(PACMAN_DIR)" \
66-
-s dir \
67-
-t pacman \
68-
-v "$(VERSION)" \
69-
--description "$(DESCRIPTION)" \
70-
usr
71-
72-
# TODO: add dependencies
73-
.PHONY: rpm
74-
rpm: build
75-
mkdir -p "$(RPM_DIR)"
76-
fpm \
77-
-C "$(BUILD_DIR)" \
78-
-m "$(MAINTAINER)" \
79-
-n "$(NAME)" \
80-
-p "$(RPM_DIR)" \
81-
-s dir \
82-
-t rpm \
83-
-v "$(VERSION)" \
84-
--description "$(DESCRIPTION)" \
85-
usr
30+
rm -rf docs
31+
javadoc -d docs -linkoffline https://docs.oracle.com/javase/8/docs/api/ \
32+
https://docs.oracle.com/javase/8/docs/api/ -sourcepath src edu.harvard
33+
34+
.PHONY: install
35+
install: build
36+
mkdir -p $(DESTDIR)
37+
cp -r build/usr/share/java/cs50.jar $(DESTDIR)
38+
39+
.PHONY: version
40+
version:
41+
@echo $(VERSION)

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@ http://cs50.github.io/libcs50-java/edu/harvard/CS50.html
66

77
## Development
88

9-
Requires [Docker Toolbox](https://www.docker.com/products/docker-toolbox).
10-
11-
make bash # runs CS50 CLI
12-
make all # builds all
13-
make build # builds class and JAR file in build/edu/harvard/ and build/usr/java/packages/lib/ext
14-
make docs # builds documentation in build/docs/
15-
make deb # builds deb package in build/deb/
16-
make pacman # builds pacman package in build/pacman/
17-
make rpm # builds rpm package in build/rpm/
9+
```
10+
make build # builds class and JAR file
11+
make docs # builds documentation
12+
make deb # builds source deb package
13+
```
1814

1915
## Usage
2016

debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9

debian/control

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Source: libcs50-java
2+
Priority: optional
3+
Maintainer: CS50 Sysadmins <sysadmins@cs50.harvard.edu>
4+
Build-Depends: debhelper (>= 9)
5+
Standards-Version: 3.9.5
6+
Section: java
7+
Vcs-Git: https://github.com/cs50/libcs50-java.git
8+
9+
Package: libcs50-java
10+
Architecture: any
11+
Conflicts: lib50-java
12+
Depends: ${shlibs:Depends}, ${misc:Depends}
13+
Provides: lib50-java, libcs50-java
14+
Replaces: lib50-java, libcs50-java
15+
Description: CS50 library for Java
16+
makes it easier to write programs that prompt the users for input

debian/copyright

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: libcs50-java
3+
Source: http://github.com/cs50/libcs50-java/releases
4+
5+
Files: *
6+
Copyright: 2017 David J. Malan <malan@harvard.edu>
7+
2017 Kareem Zidane <kzidane@cs50.harvard.edu>
8+
License: BSD-3-Clause
9+
10+
Files: debian/*
11+
Copyright: 2017 CS50 Sysadmins <sysadmins@cs50.harvard.edu>
12+
License: BSD-3-Clause
13+
14+
License: BSD-3-Clause
15+
Redistribution and use in source and binary forms, with or without
16+
modification, are permitted provided that the following conditions
17+
are met:
18+
1. Redistributions of source code must retain the above copyright
19+
notice, this list of conditions and the following disclaimer.
20+
2. Redistributions in binary form must reproduce the above copyright
21+
notice, this list of conditions and the following disclaimer in the
22+
documentation and/or other materials provided with the distribution.
23+
3. Neither the name of the University nor the names of its contributors
24+
may be used to endorse or promote products derived from this software
25+
without specific prior written permission.
26+
.
27+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28+
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HOLDERS OR
31+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

debian/libcs50-java.dirs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/usr/share/java

debian/libcs50-java.install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/usr/share/java/*

debian/rules

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/make -f
2+
# -*- makefile -*-
3+
4+
# Uncomment this to turn on verbose mode.
5+
#export DH_VERBOSE=1
6+
7+
%:
8+
dh $@

0 commit comments

Comments
 (0)