forked from buildfoundation/mainframer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Buck sample. (buildfoundation#111)
- Loading branch information
1 parent
f016b53
commit 5de51e2
Showing
12 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[java] | ||
src_roots = /src/main/java/ | ||
source_level = 6 | ||
target_level = 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
buck-out | ||
.buckd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
remote_machine=sample@remotebuildmachine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# .buckd folder contains machine specific loc and bin files, no need to sync it between machines. | ||
/.buckd | ||
|
||
# Synching .git or other VCS folders is very bad idea, they are usually very heavy and not required for the build. | ||
/.git | ||
|
||
# Synching IDE specific folders is really not needed for remote build. | ||
/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Usually you don't need to sync buck-out folder to remote machine since it will have one as result of build. | ||
/buck-out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Usually you don't need to sync sources back from remote to local machine. | ||
/sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## Sample Buck project | ||
|
||
Most interesting for you here is not the source code, but configs in [`.mainframer`](.mainframer) folder. | ||
|
||
This is a very common setup for basically any Buck project (including multimodule), but of course you might need to tune some ignore configs for your project. | ||
|
||
### How to build | ||
|
||
```bash | ||
$ bash mainframer.sh buck build sample | ||
``` | ||
|
||
Or any other Buck task you want, btw it integrates with IntelliJ pretty easily! TODO add link to docs. | ||
|
||
### Requirements | ||
|
||
* Buck installed on remote machine. | ||
* JDK 8+ installed on remote machine. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
java_binary( | ||
name = "sample", | ||
main_class = "com.gojuno.mainframer.Sample", | ||
deps = [":main"] | ||
) | ||
|
||
java_library( | ||
name = "main", | ||
srcs = glob(["src/main/java/**/*.java"]) | ||
) |
8 changes: 8 additions & 0 deletions
8
samples/buck/sample/src/main/java/com/gojuno/mainframer/Sample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.gojuno.mainframer; | ||
|
||
class Sample { | ||
|
||
public static void main(String[] args) { | ||
System.out.println("Build me on remote machine!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# You can run it from any directory. | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# Execute common pre-setup, include test functions. | ||
source "$DIR/common.sh" | ||
|
||
printTestStarted | ||
|
||
# Copy Buck sample to build dir. | ||
cp -a "$DIR/../samples/buck/." "$BUILD_DIR" | ||
|
||
# Overwrite config to work with test remote machine. | ||
setTestRemoteMachineInConfig | ||
|
||
# Run mainframer.sh that builds Buck project. | ||
bash "$REPO_DIR"/mainframer.sh 'buck clean && buck build sample' | ||
|
||
# Run jar to ensure that it was built fine. | ||
java -jar "$BUILD_DIR/buck-out/gen/sample/sample.jar" | ||
|
||
printTestEnded |