forked from dropbox/AffectedModuleDetector
-
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 maven and gradle plugins for publishing (dropbox#5)
* Add gradle plugin * Add releasing notes * Refactor sample app to allow for publishing the correct binaries * Add maven publish plugin * Add gradle portal plugin * Remove unused dependency * Add in detector from gradle portal plugin
- Loading branch information
1 parent
b603ce9
commit 36f204b
Showing
65 changed files
with
551 additions
and
75 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ | |
.cxx | ||
local.properties | ||
buildSrc/build | ||
buildSrc/.idea/ | ||
affected_module_detector.log |
File renamed without changes.
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,84 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'kotlin' | ||
id 'java-gradle-plugin' | ||
id 'maven-publish' | ||
id "com.gradle.plugin-publish" version "0.12.0" | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_7 | ||
targetCompatibility = JavaVersion.VERSION_1_7 | ||
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
testImplementation("junit:junit:4.13.1") | ||
testImplementation("com.nhaarman:mockito-kotlin:1.5.0") | ||
testImplementation("com.google.truth:truth:1.0.1") | ||
} | ||
|
||
ext { | ||
DESCRIPTION = "A Gradle Plugin and library to determine which modules were affected in a commit." | ||
VERSION = "0.1.0-SNAPSHOT" | ||
GIT_URL = 'https://github.com/Dropbox/AffectedModuleDetector' | ||
GROUP_ID = "com.dropbox.affectedmoduledetector" | ||
} | ||
|
||
group = GROUP_ID | ||
version = VERSION | ||
description = DESCRIPTION | ||
|
||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
pom { | ||
name = 'Affected Module Detector' | ||
description = 'A concise description of my library' | ||
url = GIT_URL | ||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = 'mplat-dbx' | ||
name = 'Dropbox' | ||
} | ||
} | ||
scm { | ||
connection = 'scm:git:git://github.com:dropbox/AffectedModuleDetector.git' | ||
developerConnection = 'scm:git:ssh://github.com:dropbox/AffectedModuleDetector.git' | ||
url = GIT_URL | ||
} | ||
} | ||
|
||
from components.java | ||
} | ||
} | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
affectedModuleDetectorPlugin { | ||
id = GROUP_ID | ||
implementationClass = "com.dropbox.affectedmoduledetector.AffectedModuleDetectorPlugin" | ||
} | ||
} | ||
} | ||
|
||
pluginBundle { | ||
website = GIT_URL | ||
vcsUrl = GIT_URL | ||
description = "A Gradle Plugin to determine which modules were affected in a commit." | ||
tags = ["module", "git", "detector", "dependency"] | ||
|
||
plugins { | ||
affectedModuleDetectorPlugin { | ||
// id is captured from java-gradle-plugin configuration | ||
displayName = "Affected Module Detector" | ||
} | ||
} | ||
} |
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
File renamed without changes.
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
1 change: 1 addition & 0 deletions
1
.../src/main/resources/META-INF/gradle-plugins/com.dropbox.affectedmoduledetector.properties
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 @@ | ||
implementation-class=com.dropbox.affectedmoduledetector.AffectedModuleDetectorPlugin |
5 changes: 3 additions & 2 deletions
5
...etector/AffectedModuleDetectorImplTest.kt → ...etector/AffectedModuleDetectorImplTest.kt
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
2 changes: 1 addition & 1 deletion
2
...om/dropbox/detector/AttachLogsTestRule.kt → ...ectedmoduledetector/AttachLogsTestRule.kt
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
2 changes: 1 addition & 1 deletion
2
.../com/dropbox/detector/ProjectGraphTest.kt → ...ffectedmoduledetector/ProjectGraphTest.kt
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
1 change: 0 additions & 1 deletion
1
.../resources/META-INF/gradle-plugins/com.dropbox.detector.AffectedModuleDetector.properties
This file was deleted.
Oops, something went wrong.
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,57 @@ | ||
# Releasing | ||
|
||
* Create a local release branch from `main` | ||
```bash | ||
git checkout main | ||
git pull | ||
git checkout -b release_0.1.0 | ||
``` | ||
|
||
* Update `version` in `buildSrc/build.gradle.kts` (remove `-SNAPSHOT`) | ||
```kotlin | ||
version = 0.1.0" | ||
``` | ||
* Commit all local changes | ||
``` | ||
git commit -am "Prepare 0.1.0 release" | ||
``` | ||
* Create a tag and push it | ||
```bash | ||
git tag v0.1.0 | ||
git push origin v0.1.0 | ||
``` | ||
* Upload to Maven Central | ||
```bash | ||
./gradlew publishAllPublicationsToMavenRepository | ||
``` | ||
* Upload to Gradle Plugin Portal | ||
```bash | ||
./gradlew login | ||
./gradlew publishPlugins | ||
``` | ||
* Merge the release branch to master | ||
``` | ||
git checkout master | ||
git pull | ||
git merge --no-ff release_0.1.0 | ||
``` | ||
* Update `version` in `buildSrc/build.gradle.kts` (increase version and add `-SNAPSHOT`) | ||
```kotlin | ||
version = "REPLACE_WITH_NEXT_VERSION_NUMBER-SNAPSHOT" | ||
``` | ||
* Commit your changes | ||
``` | ||
git commit -am "Prepare for next development iteration" | ||
``` | ||
* Push your changes | ||
``` | ||
git push | ||
``` |
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 |
---|---|---|
@@ -1 +1,18 @@ | ||
/build | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties | ||
buildSrc/build | ||
buildSrc/.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 |
---|---|---|
@@ -1,57 +1,33 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'kotlin-android' | ||
} | ||
|
||
android { | ||
compileSdkVersion 30 | ||
buildToolsVersion "30.0.2" | ||
|
||
defaultConfig { | ||
applicationId "com.dropbox.detector.sample" | ||
minSdkVersion 23 | ||
targetSdkVersion 30 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
buildscript { | ||
ext.kotlin_version = "1.3.72" | ||
repositories { | ||
google() | ||
jcenter() | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
mavenLocal() | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
dependencies { | ||
classpath "com.android.tools.build:gradle:4.1.0" | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
classpath("org.jlleitschuh.gradle:ktlint-gradle:9.1.1") | ||
} | ||
} | ||
|
||
affectedModuleDetector { | ||
baseDir = "${project.rootDir}" | ||
pathsAffectingAllModules = [ | ||
"buildSrc/" | ||
] | ||
apply plugin: "org.jlleitschuh.gradle.ktlint" | ||
apply plugin: "com.dropbox.affectedmoduledetector" | ||
|
||
logFolder = "${project.rootDir}" | ||
allprojects { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation project(":sample-core") | ||
implementation project(":sample-util") | ||
|
||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
implementation 'androidx.core:core-ktx:1.2.0' | ||
implementation 'androidx.appcompat:appcompat:1.1.0' | ||
implementation 'com.google.android.material:material:1.1.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | ||
testImplementation 'junit:junit:4.+' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.1' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | ||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} |
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
4 changes: 2 additions & 2 deletions
4
...n/com/dropbox/test/AffectedTestsPlugin.kt → ...com/dropbox/sample/AffectedTestsPlugin.kt
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
File renamed without changes.
Oops, something went wrong.