Skip to content

Commit

Permalink
build: reorganize gradle project structure as hierarchical with multi…
Browse files Browse the repository at this point in the history
…ple tools
  • Loading branch information
akirakw committed Dec 19, 2023
1 parent 2c17812 commit 3d8648b
Show file tree
Hide file tree
Showing 146 changed files with 44 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Assemble
run: |
./gradlew -i tanzawa-core:showTsubakuroManifest clean assemble
./gradlew -i tgsql:core:showTsubakuroManifest clean assemble
- name: Check
run: |
Expand Down
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Gradle
.gradle/
/build
/modules/*/build
/modules/**/build
/buildSrc/build

# Eclipse
/bin
/.project
/.classpath
/.settings
/modules/*/bin
/modules/*/.project
/modules/*/.classpath
/modules/*/.settings
/modules/**/bin
/modules/**/.project
/modules/**/.classpath
/modules/**/.settings

# IDEA
/.idea
/modules/*/out
/modules/**/out

# VSCode
/.vscode
Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Tanzawa: Tsurugi SQL console
# Tanzawa: Tsurugi command line tools written in Java

Tsurugi SQL console (Tanzawa) is a text based SQL client program.
## Available Tools

- [tgsql](./modules/tgsql/cli) - Text based SQL client program.

## Requirements

Expand All @@ -12,6 +14,20 @@ Tsurugi SQL console (Tanzawa) is a text based SQL client program.
./gradlew assemble
```

### for Eclipse Buildship users

If you work with [Eclipse Buildship](https://github.com/eclipse/buildship), the following [Gradle initialization script](https://docs.gradle.org/current/userguide/init_scripts.html) avoids the conflict of each project name on the Eclipse workspace.

```gradle
allprojects { project ->
if (project != project.rootProject) {
project.tasks.matching { it.name == 'eclipseProject' }.each { task ->
task.projectModel.name = (project.rootProject.name + project.path).replace(':', '-')
}
}
}
```

## How to test

```sh
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

dependencies {
// dependent projects
implementation project(':tanzawa-core')
implementation project(':tgsql:core')
runtimeOnly "com.tsurugidb.tsubakuro:tsubakuro-ipc:${tsubakuroVersion}"
runtimeOnly "com.tsurugidb.tsubakuro:tsubakuro-stream:${tsubakuroVersion}"

Expand Down
2 changes: 1 addition & 1 deletion modules/core/README.md → modules/tgsql/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ see [grammar-rule.md](../../docs/grammar-rule.md).

```sh
# cd /path/to/tanzawa
./gradlew :tanzawa-core:test \
./gradlew :tgsql:core:test \
-Ptanzawa.dot=/path/to/dot \
-Ptest.logLevel=debug
```
File renamed without changes.
23 changes: 17 additions & 6 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
rootProject.name = 'tanzawa'

include 'tanzawa-core'
include 'tanzawa-cli'
include 'tgsql:core'
include 'tgsql:cli'

rootProject.children.each { project ->
var dirName = project.name.substring('tanzawa-'.length());
project.projectDir = new File(settingsDir, "modules/${dirName}")
assert project.projectDir.isDirectory()
def setProjectDir(ProjectDescriptor project) {
if (project.parent == null) {
// root project
} else if (project.parent.parent == null) {
// first-level subprojects
var baseDir = new File(settingsDir, "modules")
project.projectDir = new File(baseDir, project.name)
} else {
// nested subprojects
var baseDir = project.parent.projectDir
project.projectDir = new File(baseDir, project.name)
}
project.children.each { it -> setProjectDir(it) }
}

setProjectDir(rootProject)

0 comments on commit 3d8648b

Please sign in to comment.