-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgradle-init-project.sh
More file actions
executable file
·55 lines (51 loc) · 1.74 KB
/
gradle-init-project.sh
File metadata and controls
executable file
·55 lines (51 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# Generate barebones groovy/gradle project
# Author: Pawel Slusarz @pslusarz
# License: MIT
if [ -n "$1" ]
then
project_name=$1
else
project_name="new-project" # Default, if not specified on command-line.
fi
language="groovy"
mkdir -p "$project_name/src/main/$language/org/sw7d"
mkdir -p "$project_name/src/test/$language/org/sw7d"
main_file="$project_name/src/main/$language/org/sw7d/Main.$language"
echo "package org.sw7d" >> $main_file
echo "class Main {" >> $main_file
echo " static void main(args) {" >> $main_file
echo " println 'hello barebones groovy'" >> $main_file
echo " }" >> $main_file
echo "}" >> $main_file
build_file="$project_name/build.gradle"
echo "apply plugin: '$language'" >> $build_file
echo "apply plugin: 'idea'" >> $build_file
echo "apply plugin: 'eclipse'" >> $build_file
echo "apply plugin: 'application'" >> $build_file
echo "" >> $build_file
echo "mainClassName = 'org.sw7d.Main'" >> $build_file
echo "" >> $build_file
echo "repositories {" >> $build_file
echo " mavenCentral()" >> $build_file
echo "}" >> $build_file
echo "" >> $build_file
echo "dependencies {" >> $build_file
echo " compile 'org.codehaus.groovy:groovy-all:2.4.11'" >> $build_file
echo "}" >> $build_file
echo "task wrapper(type: Wrapper) {" >> $build_file
echo " gradleVersion = '4.0.1'" >> $build_file
echo "}" >> $build_file
gitignore_file="$project_name/.gitignore"
echo ".gradle/" >> $gitignore_file
echo "build/" >> $gitignore_file
#idea project files
echo "*.iml" >> $gitignore_file
echo "*.ipr" >> $gitignore_file
echo "*.iws" >> $gitignore_file
echo ".idea/" >> $gitignore_file
echo "classes/" >> $gitignore_file
#eclipse project files
echo ".settings/" >> $gitignore_file
echo ".classpath" >> $gitignore_file
echo ".project" >> $gitignore_file