突っ走り書き

見せるほどのものでは..

GOOS本写経:WindowLicker を使えるようにする

GOOS本の第11章「最初のテストを通す」で使う WindowLicker を使えるようにする

参考文献

futurismo.biz

手順

git clone

$ git clone https://github.com/petercoulton/windowlicker.git windowlicker

ソースコードを修正

clone 後 ./build.sh すると以下のエラーが出る。

Buildfile: ./build.xml

clean:
   [delete] Deleting directory /Users/i/ghq/github.com/petercoulton/windowlicker/build

compile:
    [mkdir] Created dir: /Users/i/ghq/github.com/petercoulton/windowlicker/build/classes
    [mkdir] Created dir: /Users/i/ghq/github.com/petercoulton/windowlicker/build/jars
    [mkdir] Created dir: /Users/i/ghq/github.com/petercoulton/windowlicker/build/classes/windowlicker-core-DEV.jar
    [javac] Compiling 36 source files to /Users/i/ghq/github.com/petercoulton/windowlicker/build/classes/windowlicker-core-DEV.jar
    [javac] 警告:[options] ブートストラップ・クラスパスが-source 5と一緒に設定されていません
    [javac] エラー: ソース・オプション5は現在サポートされていません。7以降を使用してください。
    [javac] エラー: ターゲット・オプション5は現在サポートされていません。7以降を使用してください。

BUILD FAILED
/Users/i/ghq/github.com/petercoulton/windowlicker/build.xml:87: The following error occurred while executing this line:
/Users/i/ghq/github.com/petercoulton/windowlicker/build.xml:77: The following error occurred while executing this line:
/Users/i/ghq/github.com/petercoulton/windowlicker/build.xml:57: Compile failed; see the compiler error output for details.

Total time: 0 seconds

これを回避するため、以下のように書き換える:

diff --git a/build.xml b/build.xml
index e74a2a7..e62ac7a 100644
--- a/build.xml
+++ b/build.xml
@@ -54,7 +54,7 @@
        <sequential>
            <mkdir dir="@{classdir}" />
 
-          <javac srcdir="@{srcdir}" classpathref="@{classpathref}" destdir="@{classdir}" debug="true" source="1.5" target="1.5" fork="true" />
+           <javac srcdir="@{srcdir}" classpathref="@{classpathref}" destdir="@{classdir}" debug="true" source="1.7" target="1.7" fork="true" />
 
            <copy todir="@{classdir}">
                <fileset dir="@{srcdir}" excludes="**/*.java" />

jar をプロジェクト配下にコピーする

  • windowlicker-core-DEV.jar
  • windowlicker-swing-DEV.jar

gradle に依存関係を追加

dependencies {
    implementation files('../libs/windowlicker-core-DEV.jar')
    implementation files('../libs/windowlicker-swing-DEV.jar')
}