Skip to content

Commit

Permalink
Merge pull request #62 from StarChart-Labs/task/romeara/deprecate-plu…
Browse files Browse the repository at this point in the history
…gins

Update to deprecate BinTray and dependency constraint plug-ins
  • Loading branch information
romeara authored Aug 12, 2023
2 parents 6281da8 + 5f54a96 commit 5d3d739
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 83 deletions.
7 changes: 7 additions & 0 deletions CHANGE_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased
### Changed
- Removed `org.starchartlabs.flare.dependency-constraints` from multi-module library plug-in
- Removed `org.starchartlabs.flare.bintray-credentials` from multi-module library plug-in
- Deprecated `org.starchartlabs.flare.dependency-constraints` plug-in in favor of Gradle platform configuration
- Deprecated `org.starchartlabs.flare.bintray-credentials` as BinTray has been sunset

## [1.0.0]
### Added
- bintray-credentials plug-in to encapsulate the behavior of reading credentials for Bintray from the environment
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ The `multi-module-library` convention is intended for gradle projects which defi
Applying this convention has the following effects:

- Applies a task to the root project which will create a merged Jacoco XML report in `${rootProject.buildDir}/reports/jacoco/report.xml`
- Reads dependency versions from file `"${rootDir}/dependencies.properties"` and applies these as dependency constraints
- This file may have empty lines, lines starting with `#` which act as comments, or lines of the form `group:artifact:version[,configurations,...]`
- Add a reference to credentials read from environment variables `BINTRAY_USER` and `BINTRAY_API_KEY`. These variables must be defined if the credentials are used, otherwise they default to blank
- These credentials can be referenced by `${credentials.bintray.username}` and `${credentials.bintray.password}`
- Configures the `user` and `key` values of the `bintray` extension from the configured credentials
Expand All @@ -53,7 +51,6 @@ Applying this convention has the following effects:

Individual plug-ins used to apply these behaviors:

- org.starchartlabs.flare.dependency-constraints
- org.starchartlabs.flare.increased-test-logging
- org.starchartlabs.flare.managed-credentials
- org.starchartlabs.flare.bintray-credentials
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Application Versions
version=1.0.1-SNAPSHOT
version=2.0.0-SNAPSHOT

# Consumed Language/Build System Versions
sourceCompatibility=1.8
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ public void apply(Project project) {
project.getPluginManager().withPlugin("com.jfrog.bintray", bintrayPlugin -> {
setupManagedCredentials(project);
});

project.getLogger().warn("Flare BinTray plug-in is deprecated - BinTray no longer exists");
}

private CredentialSet setupManagedCredentials(Project project) {
project.getPluginManager().apply("org.starchartlabs.flare.managed-credentials");

@SuppressWarnings("unchecked")
NamedDomainObjectContainer<CredentialSet> credentials = (NamedDomainObjectContainer<CredentialSet>) project
.getExtensions().getByName("credentials");
.getExtensions().getByName("credentials");

// Setup reading BinTray credentials from the environment, with defaults of blank to allow non-publishing
// tasks to be run in environments where the environment variables are not set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class DependencyConstraintsPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
project.getExtensions().add(CONSTRAINTS_DSL_EXTENSION, new DependencyConstraints(project));

project.getLogger()
.warn("Flare dependency management plug-in is deprecated - use Gradle platform constraints instead");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.starchartlabs.flare.plugins.model.DependencyConstraints;
import org.starchartlabs.flare.plugins.model.ProjectMetaData;

/**
Expand All @@ -27,28 +26,17 @@ public void apply(Project project) {
project.getPluginManager().apply("org.starchartlabs.flare.merge-coverage-reports");

project.allprojects(p -> {
p.getPluginManager().apply("org.starchartlabs.flare.dependency-constraints");
p.getPluginManager().apply("org.starchartlabs.flare.managed-credentials");
p.getPluginManager().apply("org.starchartlabs.flare.increased-test-logging");
p.getPluginManager().apply("org.starchartlabs.flare.source-jars");
p.getPluginManager().apply("org.starchartlabs.flare.metadata-base");
p.getPluginManager().apply("org.starchartlabs.flare.metadata-pom");

p.getPluginManager().withPlugin("com.jfrog.bintray", bintrayPlugin -> {
p.getPluginManager().apply("org.starchartlabs.flare.bintray-credentials");
});

DependencyConstraints dependencyConstraints = p.getExtensions().getByType(DependencyConstraints.class);
ProjectMetaData projectMetaData = p.getExtensions().getByType(ProjectMetaData.class);

File dependenciesFile = project.file(project.getProjectDir().toPath().resolve("dependencies.properties"));
File developersFile = project.file(project.getProjectDir().toPath().resolve("developers.properties"));
File contributorsFile = project.file(project.getProjectDir().toPath().resolve("contributors.properties"));

if (dependenciesFile.exists()) {
dependencyConstraints.file(dependenciesFile);
}

if (developersFile.exists()) {
projectMetaData.github(gh -> gh.developers(developersFile));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public class MultiModuleLibraryPluginIntegrationTest {

private static final Path SUB_PROJECT_BUILD_FILE = BUILD_FILE_DIRECTORY.resolve("subProjectBuild.gradle");

private static final Path DEPENDENCIES_FILE = BUILD_FILE_DIRECTORY.resolve("dependencies.properties");

private static final Path DEVELOPERS_FILE = BUILD_FILE_DIRECTORY.resolve("developers.properties");

private static final Path CONTRIBUTORS_FILE = BUILD_FILE_DIRECTORY.resolve("contributors.properties");
Expand All @@ -76,20 +74,17 @@ public void setupProjects() throws Exception {
.addJavaFile("org.starchartlabs.flare.merge.coverage.reports", "Main")
.addTestFile("org.starchartlabs.flare.test.merge.coverage.reports", "MainTest",
"org.starchartlabs.flare.merge.coverage.reports.Main")
.addFile(DEPENDENCIES_FILE, Paths.get("dependencies.properties"))
.build()
.getProjectDirectory();

singleProjectNoExternalPath = TestGradleProject.builder(SINGLE_PROJECT_NO_EXTERNAL_BUILD_FILE)
.addJavaFile("org.starchartlabs.flare.merge.coverage.reports", "Main")
.addTestFile("org.starchartlabs.flare.test.merge.coverage.reports", "MainTest",
"org.starchartlabs.flare.merge.coverage.reports.Main")
.addFile(DEPENDENCIES_FILE, Paths.get("dependencies.properties"))
.build()
.getProjectDirectory();

multiModuleProjectPath = TestGradleProject.builder(ROOT_PROJECT_BUILD_FILE)
.addFile(DEPENDENCIES_FILE, Paths.get("dependencies.properties"))
.addFile(DEVELOPERS_FILE, Paths.get("developers.properties"))
.addFile(CONTRIBUTORS_FILE, Paths.get("contributors.properties"))
.subProject("one", SUB_PROJECT_BUILD_FILE)
Expand Down Expand Up @@ -151,22 +146,6 @@ public void singleProjectMergeCoverageReports() throws Exception {
Assert.assertTrue(coveredMainFile, "Coverage report missing line for expected source file");
}

@Test(dependsOnMethods = { "singleProjectBuildSuccessful" })
public void singleProjectDependencyConstraints() throws Exception {
String expectedLine = "Applied configuration ':compile' dependency constraint: org.testng:testng:6.14.3";

Assert.assertTrue(singleProjectBuildResult.getOutput().contains(expectedLine),
Strings.format("Did not find expected line '%s'", expectedLine));
}

@Test(dependsOnMethods = { "singleProjectBuildSuccessful" })
public void singleProjectBintrayCredentials() throws Exception {
String expectedLine = "Credentials configured: bintray";

Assert.assertTrue(singleProjectBuildResult.getOutput().contains(expectedLine),
Strings.format("Did not find expected line '%s'", expectedLine));
}

@Test(dependsOnMethods = { "singleProjectBuildSuccessful" })
public void singleProjectIncreasedTestLogging() throws Exception {
List<String> expectedLines = new ArrayList<>();
Expand Down Expand Up @@ -277,22 +256,6 @@ public void singleProjectNoExternalMergeCoverageReports() throws Exception {
Assert.assertTrue(coveredMainFile, "Coverage report missing line for expected source file");
}

@Test(dependsOnMethods = { "singleProjectNoExternalBuildSuccessful" })
public void singleProjectNoExternalDependencyConstraints() throws Exception {
String expectedLine = "Applied configuration ':compile' dependency constraint: org.testng:testng:6.14.3";

Assert.assertTrue(singleProjectNoExternalBuildResult.getOutput().contains(expectedLine),
Strings.format("Did not find expected line '%s'", expectedLine));
}

@Test(dependsOnMethods = { "singleProjectNoExternalBuildSuccessful" })
public void singleProjecNoExternaltBintrayCredentials() throws Exception {
String expectedLine = "Credentials configured: bintray";

Assert.assertFalse(singleProjectNoExternalBuildResult.getOutput().contains(expectedLine),
Strings.format("Found unexpected line '%s'", expectedLine));
}

@Test(dependsOnMethods = { "singleProjectNoExternalBuildSuccessful" })
public void singleProjectNoExternalIncreasedTestLogging() throws Exception {
List<String> expectedLines = new ArrayList<>();
Expand Down Expand Up @@ -407,27 +370,6 @@ public void multiModuleProjectMergeCoverageReports() throws Exception {
Assert.assertTrue(coveredMainTwoFile, "Coverage report missing line for expected source file Maintwo");
}

@Test(dependsOnMethods = { "multiModuleProjectBuildSuccessful" })
public void multiModuleProjectDependencyContraints() throws Exception {
List<String> expectedLines = new ArrayList<>();

expectedLines.add("Applied configuration ':one:compile' dependency constraint: org.testng:testng:6.14.3");
expectedLines.add("Applied configuration ':two:compile' dependency constraint: org.testng:testng:6.14.3");

for (String expectedLine : expectedLines) {
Assert.assertTrue(multiModuleProjectBuildResult.getOutput().contains(expectedLine),
Strings.format("Did not find expected line '%s'", expectedLine));
}
}

@Test(dependsOnMethods = { "multiModuleProjectBuildSuccessful" })
public void multiModuleProjectBintrayCredentials() throws Exception {
String expectedLine = "Credentials configured: bintray";

Assert.assertTrue(multiModuleProjectBuildResult.getOutput().contains(expectedLine),
Strings.format("Did not find expected line '%s'", expectedLine));
}

@Test(dependsOnMethods = { "multiModuleProjectBuildSuccessful" })
public void multiModuleProjectIncreasedTestLogging() throws Exception {
List<String> expectedLines = new ArrayList<>();
Expand Down Expand Up @@ -481,7 +423,7 @@ public void multiModuleProjectMetaDataBase() throws Exception {
expectedLines.add("scm.developerConnection: scm:git:ssh://github.com/owner/" + subProjectName + ".git");

expectedLines
.add("developer: dev-file-usernameonly:dev-file-usernameonly:https://github.com/dev-file-usernameonly");
.add("developer: dev-file-usernameonly:dev-file-usernameonly:https://github.com/dev-file-usernameonly");
expectedLines.add("developer: dev-file-username:dev-file-name:https://github.com/dev-file-username");

expectedLines.add("contributor: contrib-file-usernameonly:https://github.com/contrib-file-usernameonly");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id 'org.starchartlabs.flare.multi-module-library'
id 'com.jfrog.bintray' version '1.8.4'
}

allprojects{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ plugins {
id 'java'
id 'jacoco'
id 'maven-publish'
id 'com.jfrog.bintray' version '1.8.4'
}

description = "description"
Expand Down Expand Up @@ -38,7 +37,7 @@ repositories {
}

dependencies {
testCompile 'org.testng:testng'
testCompile 'org.testng:testng:6.14.3'
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repositories {
}

dependencies {
testCompile 'org.testng:testng'
testCompile 'org.testng:testng:6.14.3'
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ projectMetaData{
}

dependencies {
testCompile 'org.testng:testng'
testCompile 'org.testng:testng:6.14.3'
}

test {
Expand Down

0 comments on commit 5d3d739

Please sign in to comment.