Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit a9195f0

Browse files
committed
build(build-logic): modularize :build-logic composite build
1 parent 8ae87d7 commit a9195f0

File tree

86 files changed

+364
-135
lines changed

Some content is hidden

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

86 files changed

+364
-135
lines changed

.idea/compiler.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actions/build.gradle.kts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* This file is part of AndroidIDE.
3+
*
4+
* AndroidIDE is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* AndroidIDE is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
import com.itsaky.androidide.build.config.BuildConfig
19+
120
plugins{
221
id("com.android.library")
322
id("kotlin-android")

annotation-processors-ksp/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2-
31
/*
42
* This file is part of AndroidIDE.
53
*
@@ -17,6 +15,9 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1715
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
1816
*/
1917

18+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
19+
import com.itsaky.androidide.build.config.BuildConfig
20+
2021
plugins {
2122
kotlin("jvm")
2223
}

annotation-processors/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2-
31
/*
42
* This file is part of AndroidIDE.
53
*
@@ -17,6 +15,9 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1715
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
1816
*/
1917

18+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
19+
import com.itsaky.androidide.build.config.BuildConfig
20+
2021
plugins {
2122
kotlin("jvm")
2223
}

app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@file:Suppress("UnstableApiUsage")
22

33
import com.itsaky.androidide.plugins.AndroidIDEAssetsPlugin
4+
import com.itsaky.androidide.build.config.BuildConfig
45

56
plugins {
67
id("com.android.application")

build-info/build.gradle.kts

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.jetbrains.kotlin.incremental.createDirectory
2-
31
/*
42
* This file is part of AndroidIDE.
53
*
@@ -17,14 +15,28 @@ import org.jetbrains.kotlin.incremental.createDirectory
1715
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
1816
*/
1917

18+
import com.itsaky.androidide.build.config.AGP_VERSION_MINIMUM
19+
import com.itsaky.androidide.build.config.BuildConfig
20+
import com.itsaky.androidide.build.config.CI
21+
import com.itsaky.androidide.build.config.FDroidConfig
22+
import com.itsaky.androidide.build.config.ProjectConfig
23+
import com.itsaky.androidide.build.config.VersionUtils
24+
import com.itsaky.androidide.build.config.downloadVersion
25+
import com.itsaky.androidide.build.config.publishingVersion
26+
import com.itsaky.androidide.build.config.replaceContents
27+
import com.itsaky.androidide.build.config.simpleVersionName
28+
import org.jetbrains.kotlin.incremental.createDirectory
29+
2030
plugins {
31+
//noinspection JavaPluginLanguageLevel
2132
id("java-library")
2233
id("com.vanniktech.maven.publish.base")
2334
}
2435

2536
description = "Information about the AndroidIDE build"
2637

27-
val buildInfoGenDir: Provider<Directory> = project.layout.buildDirectory.dir("generated/buildInfo").also { it.get().asFile.createDirectory() }
38+
val buildInfoGenDir: Provider<Directory> = project.layout.buildDirectory.dir("generated/buildInfo")
39+
.also { it.get().asFile.createDirectory() }
2840

2941
sourceSets { getByName("main").java.srcDir(buildInfoGenDir) }
3042

@@ -38,34 +50,34 @@ tasks.create("generateBuildInfo") {
3850
dest = buildInfo.asFile,
3951
comment = "//",
4052
candidates =
41-
arrayOf(
42-
"PACKAGE_NAME" to BuildConfig.packageName,
43-
"MVN_GROUP_ID" to BuildConfig.packageName,
53+
arrayOf(
54+
"PACKAGE_NAME" to BuildConfig.packageName,
55+
"MVN_GROUP_ID" to BuildConfig.packageName,
4456

45-
"VERSION_NAME" to rootProject.version.toString(),
46-
"VERSION_NAME_SIMPLE" to rootProject.simpleVersionName,
47-
"VERSION_NAME_PUBLISHING" to rootProject.publishingVersion,
48-
"VERSION_NAME_DOWNLOAD" to rootProject.downloadVersion,
57+
"VERSION_NAME" to rootProject.version.toString(),
58+
"VERSION_NAME_SIMPLE" to rootProject.simpleVersionName,
59+
"VERSION_NAME_PUBLISHING" to rootProject.publishingVersion,
60+
"VERSION_NAME_DOWNLOAD" to rootProject.downloadVersion,
4961

50-
"FDROID_BUILD" to FDroidConfig.isFDroidBuild.toString(),
51-
"FDROID_BUILD_VERSION_NAME" to (FDroidConfig.fDroidVersionName ?: "null"),
52-
"FDROID_BUILD_VERSION_CODE" to (FDroidConfig.fDroidVersionCode ?: -1).toString(),
62+
"FDROID_BUILD" to FDroidConfig.isFDroidBuild.toString(),
63+
"FDROID_BUILD_VERSION_NAME" to (FDroidConfig.fDroidVersionName ?: "null"),
64+
"FDROID_BUILD_VERSION_CODE" to (FDroidConfig.fDroidVersionCode ?: -1).toString(),
5365

54-
"CI_BUILD" to CI.isCiBuild.toString(),
55-
"CI_GIT_BRANCH" to CI.branchName,
56-
"CI_COMMIT_HASH" to CI.commitHash,
66+
"CI_BUILD" to CI.isCiBuild.toString(),
67+
"CI_GIT_BRANCH" to CI.branchName,
68+
"CI_COMMIT_HASH" to CI.commitHash,
5769

58-
"REPO_HOST" to ProjectConfig.REPO_HOST,
59-
"REPO_OWNER" to ProjectConfig.REPO_OWNER,
60-
"REPO_NAME" to ProjectConfig.REPO_NAME,
61-
"PROJECT_SITE" to ProjectConfig.PROJECT_SITE,
70+
"REPO_HOST" to ProjectConfig.REPO_HOST,
71+
"REPO_OWNER" to ProjectConfig.REPO_OWNER,
72+
"REPO_NAME" to ProjectConfig.REPO_NAME,
73+
"PROJECT_SITE" to ProjectConfig.PROJECT_SITE,
6274

63-
"AGP_VERSION_MININUM" to AGP_VERSION_MINIMUM,
64-
"AGP_VERSION_LATEST" to libs.versions.agp.tooling.get(),
75+
"AGP_VERSION_MININUM" to AGP_VERSION_MINIMUM,
76+
"AGP_VERSION_LATEST" to libs.versions.agp.tooling.get(),
6577

66-
"SNAPSHOTS_REPOSITORY" to VersionUtils.SONATYPE_SNAPSHOTS_REPO,
67-
"PUBLIC_REPOSITORY" to VersionUtils.SONATYPE_PUBLIC_REPO,
68-
)
78+
"SNAPSHOTS_REPOSITORY" to VersionUtils.SONATYPE_SNAPSHOTS_REPO,
79+
"PUBLIC_REPOSITORY" to VersionUtils.SONATYPE_PUBLIC_REPO,
80+
)
6981
)
7082
}
7183
}

build-logic/build.gradle.kts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* This file is part of AndroidIDE.
3+
*
4+
* AndroidIDE is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* AndroidIDE is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
subprojects {
19+
plugins.withId("java-library") {
20+
extensions.getByType(JavaPluginExtension::class.java).apply {
21+
sourceCompatibility = JavaVersion.VERSION_17
22+
targetCompatibility = JavaVersion.VERSION_17
23+
}
24+
}
25+
}

build-logic/common/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* This file is part of AndroidIDE.
3+
*
4+
* AndroidIDE is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* AndroidIDE is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
19+
20+
plugins {
21+
//noinspection JavaPluginLanguageLevel
22+
id("java-library")
23+
alias(libs.plugins.kotlin.jvm)
24+
}
25+
26+
tasks.withType<KotlinCompile> {
27+
kotlinOptions.jvmTarget = "17"
28+
}
29+
30+
dependencies {
31+
api(gradleApi())
32+
}

build-logic/ide/src/main/java/BuildConfig.kt renamed to build-logic/common/src/main/java/com/itsaky/androidide/build/config/BuildConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
package com.itsaky.androidide.build.config/*
22
* This file is part of AndroidIDE.
33
*
44
* AndroidIDE is free software: you can redistribute it and/or modify

0 commit comments

Comments
 (0)