Skip to content

Commit 7d83bfb

Browse files
author
Tony Morris
committed
Moving from google code subversion
0 parents  commit 7d83bfb

File tree

235 files changed

+47723
-0
lines changed

Some content is hidden

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

235 files changed

+47723
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
build
2+
classes
3+
target
4+
*.iws
5+
.deps
6+

Build.hs

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
{-
2+
3+
Depends
4+
* The Haskell Platform http://hackage.haskell.org/platform/
5+
* Lastik http://hackage.haskell.org/package/Lastik
6+
7+
-}
8+
module Build where
9+
10+
import System.Build
11+
import qualified System.Build.Java.Javac as J
12+
import qualified System.Build.Java.Javadoc as D
13+
import System.Cmd
14+
import System.Directory
15+
import System.Exit
16+
import System.FilePath
17+
import Control.Arrow
18+
import Control.Monad
19+
import Codec.Archive.Zip
20+
21+
src :: [FilePath]
22+
src = ["src" </> "main", "src" </> "package-info"]
23+
24+
deps :: [FilePath]
25+
deps = ["src" </> "deps-test"]
26+
27+
test :: [FilePath]
28+
test = ["src" </> "test"]
29+
30+
build :: FilePath
31+
build = "build"
32+
33+
javaco :: FilePath
34+
javaco = build </> "classes" </> "javac"
35+
36+
depso :: FilePath
37+
depso = build </> "classes" </> "deps"
38+
39+
testo :: FilePath
40+
testo = build </> "classes" </> "test"
41+
42+
javadoco :: FilePath
43+
javadoco = build </> "javadoc"
44+
45+
scaladoco :: FilePath
46+
scaladoco = build </> "scaladoc"
47+
48+
jardir :: FilePath
49+
jardir = build </> "jar"
50+
51+
releasedir :: FilePath
52+
releasedir = build </> "release"
53+
54+
mavendir :: FilePath
55+
mavendir = build </> "maven"
56+
57+
etcdir :: FilePath
58+
etcdir = "etc"
59+
60+
resources :: FilePath
61+
resources = "resources"
62+
63+
cp :: String
64+
cp = "classpath" ~: [javaco, depso, testo, resources]
65+
66+
wt :: Version -> Maybe String
67+
wt v = Just ("Functional Java " ++ v)
68+
69+
dt :: Version -> Maybe String
70+
dt v = Just ("Functional Java " ++ v ++ " API Specification")
71+
72+
hd :: Maybe String
73+
hd = Just "<div><p><em>Copyright 2008 - 2010 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg</em></p>This software is released under an open source BSD licence.</div>"
74+
75+
ds :: String
76+
ds = ".deps"
77+
78+
repo :: String
79+
repo = "https://functionaljava.googlecode.com/svn/"
80+
81+
commitMessage :: String
82+
commitMessage = "\"Automated build\""
83+
84+
resolve :: IO ()
85+
resolve = do e <- doesDirectoryExist ds
86+
unless e $ do mkdir ds
87+
mapM_ (\d -> system ("wget -c --directory " ++ ds ++ ' ' : d)) k
88+
where
89+
k = map ("http://projects.tmorris.net/public/standards/artifacts/1.30/" ++) ["javadoc-style/javadoc-style.css", "scaladoc-style/script.js", "scaladoc-style/style.css"] ++ ["http://soft.tmorris.net/artifacts/package-list-j2se/1.5.0/package-list"]
90+
91+
type Version = String
92+
93+
readVersion :: IO Version
94+
readVersion = readFile "version"
95+
96+
clean :: IO ()
97+
clean = rmdir build
98+
99+
fullClean :: IO ()
100+
fullClean = rmdir ds >> clean
101+
102+
javac' :: FilePath -> J.Javac
103+
javac' d = J.javac {
104+
J.directory = Just d,
105+
J.deprecation = True,
106+
J.etc = Just "-Xlint:unchecked",
107+
J.source = Just "1.5",
108+
J.target = Just "1.5"
109+
}
110+
111+
j :: J.Javac
112+
j = javac' javaco
113+
114+
javac :: IO ExitCode
115+
javac = j ->- src
116+
117+
repl :: IO ExitCode
118+
repl = javac >-- system ("scala -i initrepl " ++ cp)
119+
120+
javadoc' :: Version -> D.Javadoc
121+
javadoc' v = D.javadoc {
122+
D.directory = Just javadoco,
123+
D.windowtitle = wt v,
124+
D.doctitle = dt v,
125+
D.header = hd,
126+
D.stylesheetfile = Just (ds </> "javadoc-style.css"),
127+
D.linkoffline = [("http://java.sun.com/j2se/1.5.0/docs/api", ds)],
128+
D.linksource = True
129+
}
130+
131+
javadoc :: Version -> IO ExitCode
132+
javadoc v = resolve >> javadoc' v ->- src
133+
134+
nosvn :: FilePather Bool
135+
nosvn = fileName /=? ".svn"
136+
137+
nosvnf :: FilterPredicate
138+
nosvnf = constant nosvn ?&&? isFile
139+
140+
archive :: IO ()
141+
archive = do javac
142+
mkdir jardir
143+
writeArchive ([javaco, resources] `zip` repeat ".")
144+
nosvn
145+
nosvnf
146+
[OptVerbose]
147+
(jardir </> "functionaljava.jar")
148+
149+
buildAll :: IO ExitCode
150+
buildAll = do v <- readVersion
151+
resolve
152+
archive
153+
javadoc v
154+
155+
maven :: IO ()
156+
maven = do buildAll
157+
mkdir mavendir
158+
v <- readVersion
159+
forM_ [("javadoc", [javadoco]), ("sources", src), ("tests", test)] (\(n, f) ->
160+
writeHashArchive (map (flip (,) ".") f) nosvn nosvnf [OptVerbose] (mavendir </> "fj-" ++ v ++ '-' : n ++ ".jar"))
161+
162+
svn :: String -> IO ExitCode
163+
svn k = print k >> system ("svn " ++ k)
164+
165+
svn' :: [String] -> IO ExitCode
166+
svn' = svn . join
167+
168+
release :: IO ExitCode
169+
release = let k = build </> "functionaljava"
170+
updateVersion z = let (a, b) = second (show . (+1) . read . drop 1) (break (== '.') z)
171+
in a ++ '.' : b
172+
in do buildAll
173+
mkdir k
174+
forM_ ([(1, javadoco), (2, jardir), (1, etcdir)] ++ map ((,) 0) src) (\(l, d) -> copyl nosvn nosvnf l d k)
175+
mkdir releasedir
176+
writeHashArchive [(build, "functionaljava")] always always' [OptVerbose] (releasedir </> "functionaljava.zip")
177+
v <- readVersion
178+
svn' ["import ", build </> "functionaljava", " ", repo, "/artifacts/", v, " -m ", commitMessage]
179+
svn' ["import ", releasedir, " ", repo, "/artifacts/", v, "/release", " -m ", commitMessage]
180+
svn' ["copy ", repo, "trunk", " ", repo, "/tags/", v, " -m ", commitMessage]
181+
length v `seq` writeFile "version" (updateVersion v)
182+
svn ("commit version -m " ++ commitMessage)

README

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
$LastChangedDate: 2009-12-04 20:30:21 +1000 (Fri, 04 Dec 2009) $
2+
$LastChangedRevision: 288 $
3+
$LastChangedBy: tomjadams $
4+
$URL: https://functionaljava.googlecode.com/svn/trunk/README $
5+
6+
Build Instructions
7+
------------------
8+
9+
1a) Install The Haskell Platform http://hackage.haskell.org/platform/
10+
1b) If The Haskell Platform is not available to you:
11+
1b.1) Install GHC http://haskell.org/ghc
12+
1b.2) Install cabal-install http://hackage.haskell.org/trac/hackage/wiki/CabalInstall
13+
1b.3) Install The Haskell Platform with the command 'cabal install haskell-platform'
14+
2) Cabal update with the command 'cabal update'
15+
3) Install Lastik with the command 'cabal install Lastik'
16+
http://hackage.haskell.org/package/Lastik
17+
18+
You are now ready to start playing with the build functionality.
19+
20+
To enter the GHC interpreter with the Build.hs source, type:
21+
> ghci Build.hs
22+
23+
You will find yourself at a prompt
24+
*Build>
25+
26+
This is a GHCi prompt and you have loaded the Functional Java build module.
27+
28+
The special GHCi commands are prefixed with a semi-colon (:).
29+
GHCi also has tab-completion so you may type : then hit TAB and you will see all GHCi special commands.
30+
31+
You can view all of the available Functional Java build functions and their type with the :browse command. The output will be a list of function name followed by :: followed by the type. You read the word :: out aloud as "is of type" so for example src :: [FilePath] would be read as "src is of type list of FilePath". You can get its value by typing src and hitting enter.
32+
33+
*Build> src
34+
["src/main","src/package-info"]
35+
36+
They are the Functional Java source directories. Functions that have the type "IO ()" or "IO ExitCode" will execute a command of some sort. You are probably most interested in these functions for doing compiling and so on. Tab-completion is also available for function names so don't forget to use it.
37+
38+
For example, suppose you want to compile and build a JAR file, then you would execute the "archive" function. At the *Build> prompt type "ar<TAB>". This will fill out the word "archive". Hit enter and the build of the JAR archive will commence. If the tab-completion is ambiguous, hit tab twice in quick succession to list your available options.
39+
40+
Want to know where the JAR file built to? There is a function called 'jardir' which is of the type FilePath. You'll have seen in your :browse. Just type jardir and hit ENTER.
41+
42+
*Build> jardir
43+
"build/jar"
44+
45+
That's where your JAR file will be.
46+
47+
Want to compile all outstanding source files then start a Scala Read-Eval-Print-Loop with all the compiled classes on the classpath? That would be the 'repl' function. You get the drift.
48+
49+
There is the full power of the Haskell programming language and tools to supplement your experience. No more piss-farting about with Apache Ant or Maven or Buildr or any of that nonsense, yay!
50+
51+
52+
But if you must have Maven...
53+
54+
To create a Maven release:
55+
56+
$ # Edit pom.xml in HEAD to point to correct version, 2.16 below.
57+
$ svn co https://functionaljava.googlecode.com/svn/tags/2.16 functionaljava-2.16
58+
$ cd functionaljava-2.16
59+
$ export ANT_OPTS=-Xmx1024m
60+
$ ant -Dbuild.number=2.16 -Dbuild.username=<SVN username> -Dbuild.password=<SVN password> maven-deploy
61+
$ # Post to list.
62+

archive.properties

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# $LastChangedRevision: 269 $
2+
# $LastChangedDate: 2009-07-28 12:05:29 +1000 (Tue, 28 Jul 2009) $
3+
# $LastChangedBy: runarorama $
4+
5+
6+
archive.file=functionaljava.jar
7+
release.file.dir.prefix=functionaljava
8+
release.file.name.prefix=functionaljava
9+
repository=https://functionaljava.googlecode.com/svn
10+
build.username=tonymorris
11+
scalacheck.version r332

bin/archive

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
ghc Build.hs -e 'archive'
3+

bin/b

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
ghci ./Build.hs

bin/clean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
ghc Build.hs -e 'clean'
3+

bin/compile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
ghc Build.hs -e 'javac'
3+

bin/doc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
ghc Build.hs -e "javadoc \"$1\""
3+

bin/maven

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
ghc Build.hs -e 'maven'
3+

0 commit comments

Comments
 (0)